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>
This commit is contained in:
parent
087fbfe5bc
commit
e680c5c344
@ -294,6 +294,19 @@ int ff_cbs_read_packet(CodedBitstreamContext *ctx,
|
|||||||
pkt->data, pkt->size, 0);
|
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,
|
int ff_cbs_read(CodedBitstreamContext *ctx,
|
||||||
CodedBitstreamFragment *frag,
|
CodedBitstreamFragment *frag,
|
||||||
const uint8_t *data, size_t size)
|
const uint8_t *data, size_t size)
|
||||||
|
@ -276,6 +276,10 @@ int ff_cbs_read_extradata_from_codec(CodedBitstreamContext *ctx,
|
|||||||
CodedBitstreamFragment *frag,
|
CodedBitstreamFragment *frag,
|
||||||
const struct AVCodecContext *avctx);
|
const struct AVCodecContext *avctx);
|
||||||
|
|
||||||
|
int ff_cbs_read_packet_side_data(CodedBitstreamContext *ctx,
|
||||||
|
CodedBitstreamFragment *frag,
|
||||||
|
const AVPacket *pkt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the data bitstream from a packet into a fragment, then
|
* Read the data bitstream from a packet into a fragment, then
|
||||||
* split into units and decompose.
|
* split into units and decompose.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user