[FFmpeg-devel] [PATCH] avcodec/h264: export ref_frame_count
Michael Niedermayer
michaelni at gmx.at
Mon Dec 29 03:49:24 CET 2014
Fixes Ticket3141
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavcodec/h264.c | 1 +
libavcodec/h264.h | 1 +
libavcodec/h264_ps.c | 3 +++
3 files changed, 5 insertions(+)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index f40449e..46ae1cc 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1978,6 +1978,7 @@ static const AVProfile profiles[] = {
static const AVOption h264_options[] = {
{"is_avc", "is avc", offsetof(H264Context, is_avc), FF_OPT_TYPE_INT, {.i64 = 0}, 0, 1, 0},
{"nal_length_size", "nal_length_size", offsetof(H264Context, nal_length_size), FF_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0},
+ {"ref_frame_count", "ref_frame_count", offsetof(H264Context, ref_frame_count_export), FF_OPT_TYPE_INT, {.i64 = 0}, 0, 16, 0},
{NULL}
};
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 74c1bbf..43a04b0 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -566,6 +566,7 @@ typedef struct H264Context {
int is_avc; ///< this flag is != 0 if codec is avc1
int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4)
int got_first; ///< this flag is != 0 if we've parsed a frame
+ int ref_frame_count_export;
int bit_depth_luma; ///< luma bit depth from sps to detect changes
int chroma_format_idc; ///< chroma format from sps to detect changes
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 4070490..26b705a 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -550,6 +550,9 @@ int ff_h264_decode_seq_parameter_set(H264Context *h)
av_free(h->sps_buffers[sps_id]);
h->sps_buffers[sps_id] = sps;
+ if (!h->ref_frame_count_export)
+ h->ref_frame_count_export = sps->ref_frame_count;
+
return 0;
fail:
--
1.7.9.5
More information about the ffmpeg-devel
mailing list