To allow taking a reference from an existing buffer outside of AVPackets.
Unified · Split
| @@ -48,7 +48,7 @@ static int parse(AVCodecParserContext *s, · 47 unmodified lines | ||
| 48 | 48 | |
| 49 | 49 | p->cbc->log_ctx = avctx; |
| 50 | 50 | |
| 51 | − ret = ff_cbs_read(p->cbc, au, buf, buf_size); | |
| 51 | + ret = ff_cbs_read(p->cbc, au, NULL, buf, buf_size); | |
| 52 | 52 | if (ret < 0) { |
| 53 | 53 | av_log(avctx, AV_LOG_ERROR, "Failed to parse access unit.\n"); |
| 54 | 54 | goto end; |
| @@ -82,7 +82,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx, · 81 unmodified lines | ||
| 82 | 82 | ff_cbs_fragment_reset(td); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | − ret = ff_cbs_read(s->cbc, td, data, size); | |
| 85 | + ret = ff_cbs_read(s->cbc, td, NULL, data, size); | |
| 86 | 86 | if (ret < 0) { |
| 87 | 87 | av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n"); |
| 88 | 88 | goto end; |
| @@ -261,7 +261,7 @@ static int cbs_fill_fragment_data(CodedBitstreamFragment *frag, · 260 unmodified lines | ||
| 261 | 261 | |
| 262 | 262 | static int cbs_read_data(CodedBitstreamContext *ctx, |
| 263 | 263 | CodedBitstreamFragment *frag, |
| 264 | − AVBufferRef *buf, | |
| 264 | + const AVBufferRef *buf, | |
| 265 | 265 | const uint8_t *data, size_t size, |
| 266 | 266 | int header) |
| 267 | 267 | { |
| @@ -329,9 +329,10 @@ int CBS_FUNC(read_packet_side_data)(CodedBitstreamContext *ctx, · 61 unmodified lines | ||
| 329 | 329 | |
| 330 | 330 | int CBS_FUNC(read)(CodedBitstreamContext *ctx, |
| 331 | 331 | CodedBitstreamFragment *frag, |
| 332 | + const AVBufferRef *buf, | |
| 332 | 333 | const uint8_t *data, size_t size) |
| 333 | 334 | { |
| 334 | − return cbs_read_data(ctx, frag, NULL, | |
| 335 | + return cbs_read_data(ctx, frag, buf, | |
| 335 | 336 | data, size, 0); |
| 336 | 337 | } |
| 337 | 338 | #endif |
| @@ -379,6 +379,7 @@ int CBS_FUNC(read_packet)(CodedBitstreamContext *ctx, · 378 unmodified lines | ||
| 379 | 379 | */ |
| 380 | 380 | int CBS_FUNC(read)(CodedBitstreamContext *ctx, |
| 381 | 381 | CodedBitstreamFragment *frag, |
| 382 | + const AVBufferRef *buf, | |
| 382 | 383 | const uint8_t *data, size_t size); |
| 383 | 384 | |
| 384 | 385 | |
| @@ -1061,7 +1061,7 @@ static int parse_feedback_units(AVCodecContext *avctx, · 1060 unmodified lines | ||
| 1061 | 1061 | if (err < 0) |
| 1062 | 1062 | return err; |
| 1063 | 1063 | |
| 1064 | − err = ff_cbs_read(cbs, &au, data, size); | |
| 1064 | + err = ff_cbs_read(cbs, &au, NULL, data, size); | |
| 1065 | 1065 | if (err < 0) { |
| 1066 | 1066 | av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n", |
| 1067 | 1067 | av_err2str(err)); |
| @@ -1214,7 +1214,7 @@ static int parse_feedback_units(AVCodecContext *avctx, · 1213 unmodified lines | ||
| 1214 | 1214 | if (err < 0) |
| 1215 | 1215 | return err; |
| 1216 | 1216 | |
| 1217 | − err = ff_cbs_read(cbs, &au, data, size); | |
| 1217 | + err = ff_cbs_read(cbs, &au, NULL, data, size); | |
| 1218 | 1218 | if (err < 0) { |
| 1219 | 1219 | av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n", |
| 1220 | 1220 | av_err2str(err)); |
| @@ -357,7 +357,7 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, · 356 unmodified lines | ||
| 357 | 357 | return 1; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | − if ((ret = ff_cbs_read(ctx->cbc, pu, buf, buf_size)) < 0) { | |
| 360 | + if ((ret = ff_cbs_read(ctx->cbc, pu, NULL, buf, buf_size)) < 0) { | |
| 361 | 361 | av_log(avctx, AV_LOG_ERROR, "Failed to parse picture unit.\n"); |
| 362 | 362 | goto end; |
| 363 | 363 | } |