diff mbox

[FFmpeg-devel,12/18] cbs: Expose the function to insert a new empty unit into a fragment

Message ID 20191002230453.6462-12-sw@jkqxz.net
State New
Headers show

Commit Message

Mark Thompson Oct. 2, 2019, 11:04 p.m. UTC
This will be helpful when adding new SEI to an existing access unit.
---
 libavcodec/cbs.c | 10 +++++-----
 libavcodec/cbs.h |  7 +++++++
 2 files changed, 12 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index f689221945..c9098b09b5 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -624,9 +624,9 @@  int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx,
     return 0;
 }
 
-static int cbs_insert_unit(CodedBitstreamContext *ctx,
-                           CodedBitstreamFragment *frag,
-                           int position)
+int ff_cbs_insert_unit(CodedBitstreamContext *ctx,
+                       CodedBitstreamFragment *frag,
+                       int position)
 {
     CodedBitstreamUnit *units;
 
@@ -686,7 +686,7 @@  int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
         content_ref = NULL;
     }
 
-    err = cbs_insert_unit(ctx, frag, position);
+    err = ff_cbs_insert_unit(ctx, frag, position);
     if (err < 0) {
         av_buffer_unref(&content_ref);
         return err;
@@ -722,7 +722,7 @@  int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx,
     if (!data_ref)
         return AVERROR(ENOMEM);
 
-    err = cbs_insert_unit(ctx, frag, position);
+    err = ff_cbs_insert_unit(ctx, frag, position);
     if (err < 0) {
         av_buffer_unref(&data_ref);
         return err;
diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h
index 1144b9f186..0770d6c7cb 100644
--- a/libavcodec/cbs.h
+++ b/libavcodec/cbs.h
@@ -363,6 +363,13 @@  int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx,
                            CodedBitstreamUnit *unit,
                            size_t size);
 
+/**
+ * Insert a new empty unit into a fragment.
+ */
+int ff_cbs_insert_unit(CodedBitstreamContext *ctx,
+                       CodedBitstreamFragment *frag,
+                       int position);
+
 /**
  * Insert a new unit into a fragment with the given content.
  *