From: Tim Walker Date: Sat, 17 Sep 2016 12:54:01 +0000 (+0200) Subject: encx265: flag all HEVC random access points as keyframes. X-Git-Tag: 1.0.0~213^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=843e327e0d62e730c0d36d5cbe1e43d9dd329308;p=handbrake encx265: flag all HEVC random access points as keyframes. --- diff --git a/libhb/encx265.c b/libhb/encx265.c index 9cb23bd08..fdfe7cf21 100644 --- a/libhb/encx265.c +++ b/libhb/encx265.c @@ -390,6 +390,11 @@ static hb_buffer_t* nal_encode(hb_work_object_t *w, // copy the bitstream data for (i = 0; i < nnal; i++) { + if (HB_HEVC_NALU_KEYFRAME(nal[i].type)) + { + buf->s.flags |= HB_FLAG_FRAMETYPE_REF; + buf->s.flags |= HB_FLAG_FRAMETYPE_KEY; + } memcpy(buf->data + buf->size, nal[i].payload, nal[i].sizeBytes); buf->size += nal[i].sizeBytes; } diff --git a/libhb/h265_common.h b/libhb/h265_common.h index 3a5edf111..3711d35cd 100644 --- a/libhb/h265_common.h +++ b/libhb/h265_common.h @@ -10,6 +10,10 @@ #ifndef HB_H265_COMMON_H #define HB_H265_COMMON_H +// inspired by libavcodec/hevc.h +// in HEVC, all "random access point" NAL units are keyframes +#define HB_HEVC_NALU_KEYFRAME(nal_unit_type) (((nal_unit_type) >= 16) && ((nal_unit_type) <= 23)) + static const char * const hb_h265_tier_names[] = { "auto", "main", "high", NULL, }; static const char * const hb_h265_profile_names_8bit[] = { "auto", "main", "mainstillpicture", NULL, }; static const char * const hb_h265_profile_names_10bit[] = { "auto", "main10", "main10-intra", NULL, };