[FFmpeg-cvslog] avcodec/cbs: add an AVBufferRef input argument to ff_cbs_read()
James Almer
git at videolan.org
Sun May 4 22:30:46 EEST 2025
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Apr 29 16:54:21 2025 -0300| [4bfe9c56632a3ccdcd5c1d0c415cda0111639bf1] | committer: James Almer
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 at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4bfe9c56632a3ccdcd5c1d0c415cda0111639bf1
---
libavcodec/apv_parser.c | 2 +-
libavcodec/av1_parser.c | 2 +-
libavcodec/cbs.c | 5 +++--
libavcodec/cbs.h | 1 +
libavcodec/vulkan_encode_h264.c | 2 +-
libavcodec/vulkan_encode_h265.c | 2 +-
libavcodec/vvc_parser.c | 2 +-
7 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/libavcodec/apv_parser.c b/libavcodec/apv_parser.c
index bd1894146c..daa58fd9d2 100644
--- a/libavcodec/apv_parser.c
+++ b/libavcodec/apv_parser.c
@@ -48,7 +48,7 @@ static int parse(AVCodecParserContext *s,
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) {
av_log(avctx, AV_LOG_ERROR, "Failed to parse access unit.\n");
goto end;
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index 2b79493bf8..1792e813f4 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -82,7 +82,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
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) {
av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n");
goto end;
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index c0f6c62d20..2b4445ddb8 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -261,7 +261,7 @@ static int cbs_fill_fragment_data(CodedBitstreamFragment *frag,
static int cbs_read_data(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag,
- AVBufferRef *buf,
+ const AVBufferRef *buf,
const uint8_t *data, size_t size,
int header)
{
@@ -329,9 +329,10 @@ int CBS_FUNC(read_packet_side_data)(CodedBitstreamContext *ctx,
int CBS_FUNC(read)(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag,
+ const AVBufferRef *buf,
const uint8_t *data, size_t size)
{
- return cbs_read_data(ctx, frag, NULL,
+ return cbs_read_data(ctx, frag, buf,
data, size, 0);
}
#endif
diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h
index 47818d5c12..67f2ec9e50 100644
--- a/libavcodec/cbs.h
+++ b/libavcodec/cbs.h
@@ -379,6 +379,7 @@ int CBS_FUNC(read_packet)(CodedBitstreamContext *ctx,
*/
int CBS_FUNC(read)(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag,
+ const AVBufferRef *buf,
const uint8_t *data, size_t size);
diff --git a/libavcodec/vulkan_encode_h264.c b/libavcodec/vulkan_encode_h264.c
index edfe680500..ecbb125420 100644
--- a/libavcodec/vulkan_encode_h264.c
+++ b/libavcodec/vulkan_encode_h264.c
@@ -1061,7 +1061,7 @@ static int parse_feedback_units(AVCodecContext *avctx,
if (err < 0)
return err;
- err = ff_cbs_read(cbs, &au, data, size);
+ err = ff_cbs_read(cbs, &au, NULL, data, size);
if (err < 0) {
av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
av_err2str(err));
diff --git a/libavcodec/vulkan_encode_h265.c b/libavcodec/vulkan_encode_h265.c
index 018aaee9af..a1f9528ac3 100644
--- a/libavcodec/vulkan_encode_h265.c
+++ b/libavcodec/vulkan_encode_h265.c
@@ -1214,7 +1214,7 @@ static int parse_feedback_units(AVCodecContext *avctx,
if (err < 0)
return err;
- err = ff_cbs_read(cbs, &au, data, size);
+ err = ff_cbs_read(cbs, &au, NULL, data, size);
if (err < 0) {
av_log(avctx, AV_LOG_ERROR, "Unable to parse feedback units, bad drivers: %s\n",
av_err2str(err));
diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index 8d32d66573..c9c3a3949f 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -357,7 +357,7 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
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");
goto end;
}
More information about the ffmpeg-cvslog
mailing list