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
48 48
49 p->cbc->log_ctx = avctx;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 if (ret < 0) {52 if (ret < 0) {
53 av_log(avctx, AV_LOG_ERROR, "Failed to parse access unit.\n");53 av_log(avctx, AV_LOG_ERROR, "Failed to parse access unit.\n");
54 goto end;54 goto end;
libavcodec/av1_parser.c+1−1
@@ -82,7 +82,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx, · 81 unmodified lines
82 ff_cbs_fragment_reset(td);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 if (ret < 0) {86 if (ret < 0) {
87 av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n");87 av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n");
88 goto end;88 goto end;
libavcodec/cbs.c+3−2
@@ -261,7 +261,7 @@ static int cbs_fill_fragment_data(CodedBitstreamFragment *frag, · 260 unmodified lines
261 261
262static int cbs_read_data(CodedBitstreamContext *ctx,262static int cbs_read_data(CodedBitstreamContext *ctx,
263 CodedBitstreamFragment *frag,263 CodedBitstreamFragment *frag,
264 AVBufferRef *buf,264 const AVBufferRef *buf,
265 const uint8_t *data, size_t size,265 const uint8_t *data, size_t size,
266 int header)266 int header)
267{267{
@@ -329,9 +329,10 @@ int CBS_FUNC(read_packet_side_data)(CodedBitstreamContext *ctx, · 61 unmodified lines
329 329
330int CBS_FUNC(read)(CodedBitstreamContext *ctx,330int CBS_FUNC(read)(CodedBitstreamContext *ctx,
331 CodedBitstreamFragment *frag,331 CodedBitstreamFragment *frag,
332 const AVBufferRef *buf,
332 const uint8_t *data, size_t size)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 data, size, 0);336 data, size, 0);
336}337}
337#endif338#endif
libavcodec/cbs.h+1−0
@@ -379,6 +379,7 @@ int CBS_FUNC(read_packet)(CodedBitstreamContext *ctx, · 378 unmodified lines
379 */379 */
380int CBS_FUNC(read)(CodedBitstreamContext *ctx,380int CBS_FUNC(read)(CodedBitstreamContext *ctx,
381 CodedBitstreamFragment *frag,381 CodedBitstreamFragment *frag,
382 const AVBufferRef *buf,
382 const uint8_t *data, size_t size);383 const uint8_t *data, size_t size);
383 384
384 385
libavcodec/vulkan_encode_h264.c+1−1
@@ -1061,7 +1061,7 @@ static int parse_feedback_units(AVCodecContext *avctx, · 1060 unmodified lines
1061 if (err < 0)1061 if (err < 0)
1062 return err;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 if (err < 0) {1065 if (err < 0) {
1066 av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",1066 av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
1067 av_err2str(err));1067 av_err2str(err));
libavcodec/vulkan_encode_h265.c+1−1
@@ -1214,7 +1214,7 @@ static int parse_feedback_units(AVCodecContext *avctx, · 1213 unmodified lines
1214 if (err < 0)1214 if (err < 0)
1215 return err;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 if (err < 0) {1218 if (err < 0) {
1219 av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",1219 av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
1220 av_err2str(err));1220 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
357 return 1;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 av_log(avctx, AV_LOG_ERROR, "Failed to parse picture unit.\n");361 av_log(avctx, AV_LOG_ERROR, "Failed to parse picture unit.\n");
362 goto end;362 goto end;
363 }363 }

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