History

avcodec/cbs: add an AVBufferRef input argument to ff_cbs_read()

To allow taking a reference from an existing buffer outside of AVPackets.

James Almer committed 1 year ago

Commit 4bfe9c51 parent fab691e7 files · +9 −7Browse files

Unified · Split

7 files
  1. libavcodec/apv_parser.c +1 −1
  2. libavcodec/av1_parser.c +1 −1
  3. libavcodec/cbs.c +3 −2
  4. libavcodec/cbs.h +1 −0
  5. libavcodec/vulkan_encode_h264.c +1 −1
  6. libavcodec/vulkan_encode_h265.c +1 −1
  7. libavcodec/vvc_parser.c +1 −1
libavcodec/apv_parser.c+1−1
@@ -48,7 +48,7 @@ static int parse(AVCodecParserContext *s, · 47 unmodified lines
4848
4949 p->cbc->log_ctx = avctx;
5050
51− ret = ff_cbs_read(p->cbc, au, buf, buf_size);
51+ ret = ff_cbs_read(p->cbc, au, NULL, buf, buf_size);
5252 if (ret < 0) {
5353 av_log(avctx, AV_LOG_ERROR, "Failed to parse access unit.\n");
5454 goto end;
libavcodec/av1_parser.c+1−1
@@ -82,7 +82,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx, · 81 unmodified lines
8282 ff_cbs_fragment_reset(td);
8383 }
8484
85− ret = ff_cbs_read(s->cbc, td, data, size);
85+ ret = ff_cbs_read(s->cbc, td, NULL, data, size);
8686 if (ret < 0) {
8787 av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n");
8888 goto end;
libavcodec/cbs.c+3−2
@@ -261,7 +261,7 @@ static int cbs_fill_fragment_data(CodedBitstreamFragment *frag, · 260 unmodified lines
261261
262262 static int cbs_read_data(CodedBitstreamContext *ctx,
263263 CodedBitstreamFragment *frag,
264− AVBufferRef *buf,
264+ const AVBufferRef *buf,
265265 const uint8_t *data, size_t size,
266266 int header)
267267 {
@@ -329,9 +329,10 @@ int CBS_FUNC(read_packet_side_data)(CodedBitstreamContext *ctx, · 61 unmodified lines
329329
330330 int CBS_FUNC(read)(CodedBitstreamContext *ctx,
331331 CodedBitstreamFragment *frag,
332+ const AVBufferRef *buf,
332333 const uint8_t *data, size_t size)
333334 {
334− return cbs_read_data(ctx, frag, NULL,
335+ return cbs_read_data(ctx, frag, buf,
335336 data, size, 0);
336337 }
337338 #endif
libavcodec/cbs.h+1−0
@@ -379,6 +379,7 @@ int CBS_FUNC(read_packet)(CodedBitstreamContext *ctx, · 378 unmodified lines
379379 */
380380 int CBS_FUNC(read)(CodedBitstreamContext *ctx,
381381 CodedBitstreamFragment *frag,
382+ const AVBufferRef *buf,
382383 const uint8_t *data, size_t size);
383384
384385
libavcodec/vulkan_encode_h264.c+1−1
@@ -1061,7 +1061,7 @@ static int parse_feedback_units(AVCodecContext *avctx, · 1060 unmodified lines
10611061 if (err < 0)
10621062 return err;
10631063
1064− err = ff_cbs_read(cbs, &au, data, size);
1064+ err = ff_cbs_read(cbs, &au, NULL, data, size);
10651065 if (err < 0) {
10661066 av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
10671067 av_err2str(err));
libavcodec/vulkan_encode_h265.c+1−1
@@ -1214,7 +1214,7 @@ static int parse_feedback_units(AVCodecContext *avctx, · 1213 unmodified lines
12141214 if (err < 0)
12151215 return err;
12161216
1217− err = ff_cbs_read(cbs, &au, data, size);
1217+ err = ff_cbs_read(cbs, &au, NULL, data, size);
12181218 if (err < 0) {
12191219 av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
12201220 av_err2str(err));
libavcodec/vvc_parser.c+1−1
@@ -357,7 +357,7 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, · 356 unmodified lines
357357 return 1;
358358 }
359359
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) {
361361 av_log(avctx, AV_LOG_ERROR, "Failed to parse picture unit.\n");
362362 goto end;
363363 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t