You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/cbs: add an AVBufferRef input argument to ff_cbs_read()
To allow taking a reference from an existing buffer outside of AVPackets. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@ -48,7 +48,7 @@ static int parse(AVCodecParserContext *s,
|
|||||||
|
|
||||||
p->cbc->log_ctx = avctx;
|
p->cbc->log_ctx = avctx;
|
||||||
|
|
||||||
ret = ff_cbs_read(p->cbc, au, buf, buf_size);
|
ret = ff_cbs_read(p->cbc, au, NULL, buf, buf_size);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Failed to parse access unit.\n");
|
av_log(avctx, AV_LOG_ERROR, "Failed to parse access unit.\n");
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -82,7 +82,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
|
|||||||
ff_cbs_fragment_reset(td);
|
ff_cbs_fragment_reset(td);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ff_cbs_read(s->cbc, td, data, size);
|
ret = ff_cbs_read(s->cbc, td, NULL, data, size);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n");
|
av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n");
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -261,7 +261,7 @@ static int cbs_fill_fragment_data(CodedBitstreamFragment *frag,
|
|||||||
|
|
||||||
static int cbs_read_data(CodedBitstreamContext *ctx,
|
static int cbs_read_data(CodedBitstreamContext *ctx,
|
||||||
CodedBitstreamFragment *frag,
|
CodedBitstreamFragment *frag,
|
||||||
AVBufferRef *buf,
|
const AVBufferRef *buf,
|
||||||
const uint8_t *data, size_t size,
|
const uint8_t *data, size_t size,
|
||||||
int header)
|
int header)
|
||||||
{
|
{
|
||||||
@ -329,9 +329,10 @@ int CBS_FUNC(read_packet_side_data)(CodedBitstreamContext *ctx,
|
|||||||
|
|
||||||
int CBS_FUNC(read)(CodedBitstreamContext *ctx,
|
int CBS_FUNC(read)(CodedBitstreamContext *ctx,
|
||||||
CodedBitstreamFragment *frag,
|
CodedBitstreamFragment *frag,
|
||||||
|
const AVBufferRef *buf,
|
||||||
const uint8_t *data, size_t size)
|
const uint8_t *data, size_t size)
|
||||||
{
|
{
|
||||||
return cbs_read_data(ctx, frag, NULL,
|
return cbs_read_data(ctx, frag, buf,
|
||||||
data, size, 0);
|
data, size, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -379,6 +379,7 @@ int CBS_FUNC(read_packet)(CodedBitstreamContext *ctx,
|
|||||||
*/
|
*/
|
||||||
int CBS_FUNC(read)(CodedBitstreamContext *ctx,
|
int CBS_FUNC(read)(CodedBitstreamContext *ctx,
|
||||||
CodedBitstreamFragment *frag,
|
CodedBitstreamFragment *frag,
|
||||||
|
const AVBufferRef *buf,
|
||||||
const uint8_t *data, size_t size);
|
const uint8_t *data, size_t size);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1061,7 +1061,7 @@ static int parse_feedback_units(AVCodecContext *avctx,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = ff_cbs_read(cbs, &au, data, size);
|
err = ff_cbs_read(cbs, &au, NULL, data, size);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
|
av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
|
||||||
av_err2str(err));
|
av_err2str(err));
|
||||||
|
@ -1214,7 +1214,7 @@ static int parse_feedback_units(AVCodecContext *avctx,
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = ff_cbs_read(cbs, &au, data, size);
|
err = ff_cbs_read(cbs, &au, NULL, data, size);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
|
av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
|
||||||
av_err2str(err));
|
av_err2str(err));
|
||||||
|
@ -357,7 +357,7 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = ff_cbs_read(ctx->cbc, pu, buf, buf_size)) < 0) {
|
if ((ret = ff_cbs_read(ctx->cbc, pu, NULL, buf, buf_size)) < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Failed to parse picture unit.\n");
|
av_log(avctx, AV_LOG_ERROR, "Failed to parse picture unit.\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user