diff options
author | James Almer <jamrial@gmail.com> | 2021-08-05 11:59:55 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2021-08-14 23:06:38 -0300 |
commit | e680c5c344683d4a0d3a8b5c976ca56baf21b8bd (patch) | |
tree | 7851bb146102de271feed1470cf247ad6addb9ef /libavcodec/cbs.c | |
parent | 087fbfe5bc2272aa1cfd9f4c49438436b68a1ddc (diff) | |
download | ffmpeg-e680c5c344683d4a0d3a8b5c976ca56baf21b8bd.tar.gz |
avcodec/cbs: add a helper to read extradata within packet side data
Using ff_cbs_read() on the raw buffer will not parse it as extradata,
resulting in parsing errors for example when handling ISOBMFF avcC.
This helper works around that.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/cbs.c')
-rw-r--r-- | libavcodec/cbs.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index 8d50ea1432..f6e371ddef 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -294,6 +294,19 @@ int ff_cbs_read_packet(CodedBitstreamContext *ctx, pkt->data, pkt->size, 0); } +int ff_cbs_read_packet_side_data(CodedBitstreamContext *ctx, + CodedBitstreamFragment *frag, + const AVPacket *pkt) +{ + size_t side_data_size; + const uint8_t *side_data = + av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, + &side_data_size); + + return cbs_read_data(ctx, frag, NULL, + side_data, side_data_size, 1); +} + int ff_cbs_read(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const uint8_t *data, size_t size) |