summaryrefslogtreecommitdiff
path: root/libavcodec/h264dec.c
diff options
context:
space:
mode:
authorOliver Woodman <ollywoodman@gmail.com>2020-05-08 03:09:29 +0100
committerJames Almer <jamrial@gmail.com>2020-07-06 13:52:34 -0300
commit73757577cb6dbc08aa0b12294863a3cc9d91b26f (patch)
tree2540328d0be65d2ef957921b79a71d5edff675a3 /libavcodec/h264dec.c
parent584f396132aa19d21bb1e38ad9a5d428869290cb (diff)
downloadffmpeg-73757577cb6dbc08aa0b12294863a3cc9d91b26f.tar.gz
avcodec/h264: support sps/pps AV_PKT_DATA_NEW_EXTRADATA
Commit 601c238854 added support for AV_PKT_DATA_NEW_EXTRADATA, but only for avcC extradata. This commit adds support for sps/pps extradata as well. This makes support consistent for passing new extradata consistent with the types of extradata that can be passed when initializing the decoder. Signed-off-by: Oliver Woodman <ollywoodman@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/h264dec.c')
-rw-r--r--libavcodec/h264dec.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 1e2ca68449..46495d586f 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -847,7 +847,7 @@ fail:
return ret;
}
-static int is_extra(const uint8_t *buf, int buf_size)
+static int is_avcc_extradata(const uint8_t *buf, int buf_size)
{
int cnt= buf[5]&0x1f;
const uint8_t *p= buf+6;
@@ -974,16 +974,15 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
if (buf_size == 0)
return send_next_delayed_frame(h, pict, got_frame, 0);
- if (h->is_avc && av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
+ if (av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
int side_size;
uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
- if (is_extra(side, side_size))
- ff_h264_decode_extradata(side, side_size,
- &h->ps, &h->is_avc, &h->nal_length_size,
- avctx->err_recognition, avctx);
+ ff_h264_decode_extradata(side, side_size,
+ &h->ps, &h->is_avc, &h->nal_length_size,
+ avctx->err_recognition, avctx);
}
if (h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC) {
- if (is_extra(buf, buf_size))
+ if (is_avcc_extradata(buf, buf_size))
return ff_h264_decode_extradata(buf, buf_size,
&h->ps, &h->is_avc, &h->nal_length_size,
avctx->err_recognition, avctx);