diff --git a/packages/multimedia/ffmpeg/patches/ffmpeg-0.10.4-901.04-xvba_correct_h.264_level_in_case_it_was_encoded_wrongly.patch b/packages/multimedia/ffmpeg/patches/ffmpeg-0.10.4-901.04-xvba_correct_h.264_level_in_case_it_was_encoded_wrongly.patch new file mode 100644 index 0000000000..b5b4193972 --- /dev/null +++ b/packages/multimedia/ffmpeg/patches/ffmpeg-0.10.4-901.04-xvba_correct_h.264_level_in_case_it_was_encoded_wrongly.patch @@ -0,0 +1,34 @@ +From adc34a12c7d8b778021ae75562ccedd98a43a602 Mon Sep 17 00:00:00 2001 +From: xbmc +Date: Thu, 28 Jun 2012 13:06:16 +0200 +Subject: [PATCH] xvba: correct h.264 level in case it was encoded wrongly, + thanks @fritsch for pointing this out + +--- + lib/ffmpeg/libavcodec/xvba_h264.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/libavcodec/xvba_h264.c b/libavcodec/xvba_h264.c +index 9be6ffb..a077442 100644 +--- a/libavcodec/xvba_h264.c ++++ b/libavcodec/xvba_h264.c +@@ -102,6 +102,16 @@ static int end_frame(AVCodecContext *avctx) + pic_descriptor->avc_num_ref_frames = h->sps.ref_frame_count; + pic_descriptor->avc_reserved_8bit = 0; + ++ /* Set correct level */ ++ if (pic_descriptor->level == 41) { ++ const unsigned int mbw = pic_descriptor->width_in_mb; ++ const unsigned int mbh = pic_descriptor->height_in_mb; ++ const unsigned int max_ref_frames = 12288 * 1024 / (mbw * mbh * 384); ++ const unsigned int num_ref_frames = pic_descriptor->avc_num_ref_frames; ++ if (max_ref_frames < num_ref_frames) ++ pic_descriptor->level = 51; ++ } ++ + pic_descriptor->avc_num_slice_groups_minus1 = h->pps.slice_group_count - 1; + pic_descriptor->avc_num_ref_idx_l0_active_minus1 = h->pps.ref_count[0] - 1; + pic_descriptor->avc_num_ref_idx_l1_active_minus1 = h->pps.ref_count[1] - 1; +-- +1.7.10 +