[FFmpeg-devel] [PATCH v6 13/22] cbs: Expose the function to insert a new empty unit into a fragment

Mark Thompson sw at jkqxz.net
Mon Jul 27 19:32:28 EEST 2020


This will be helpful when adding new SEI to an existing access unit.
---
 libavcodec/cbs.c | 8 ++++----
 libavcodec/cbs.h | 6 ++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index 7c1aa005c2..6677442d10 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -674,8 +674,8 @@ int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit,
     return 0;
 }
 
-static int cbs_insert_unit(CodedBitstreamFragment *frag,
-                           int position)
+int ff_cbs_insert_unit(CodedBitstreamFragment *frag,
+                       int position)
 {
     CodedBitstreamUnit *units;
 
@@ -734,7 +734,7 @@ int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag,
         content_ref = NULL;
     }
 
-    err = cbs_insert_unit(frag, position);
+    err = ff_cbs_insert_unit(frag, position);
     if (err < 0) {
         av_buffer_unref(&content_ref);
         return err;
@@ -772,7 +772,7 @@ int ff_cbs_insert_unit_data(CodedBitstreamFragment *frag,
         return AVERROR(ENOMEM);
     }
 
-    err = cbs_insert_unit(frag, position);
+    err = ff_cbs_insert_unit(frag, position);
     if (err < 0) {
         av_buffer_unref(&data_ref);
         return err;
diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h
index 3a054aa8f3..9152d655d2 100644
--- a/libavcodec/cbs.h
+++ b/libavcodec/cbs.h
@@ -366,6 +366,12 @@ int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx,
 int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit,
                            size_t size);
 
+/**
+ * Insert a new empty unit into a fragment.
+ */
+int ff_cbs_insert_unit(CodedBitstreamFragment *frag,
+                       int position);
+
 /**
  * Insert a new unit into a fragment with the given content.
  *
-- 
2.27.0



More information about the ffmpeg-devel mailing list