]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/av1_metadata: add an option to remove Padding OBUs
authorJames Almer <jamrial@gmail.com>
Mon, 25 Mar 2019 03:27:23 +0000 (00:27 -0300)
committerJames Almer <jamrial@gmail.com>
Wed, 3 Apr 2019 21:12:37 +0000 (18:12 -0300)
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
doc/bitstream_filters.texi
libavcodec/av1_metadata_bsf.c
libavcodec/version.h

index 076b910e4053a467135efa9105ce6f8eae881545..25bbf8372b749e027ee913d9902d9faeeaaec303 100644 (file)
@@ -87,6 +87,9 @@ the timing info in the sequence header.
 Set the number of ticks in each picture, to indicate that the stream
 has a fixed framerate.  Ignored if @option{tick_rate} is not also set.
 
+@item delete_padding
+Deletes Padding OBUs.
+
 @end table
 
 @section chomp
index 2b74b697e41ad3f7f9496d7b95e8e2d2b0616fa2..fe208feaf5d200f24150118faced8f5502183ad6 100644 (file)
@@ -46,6 +46,8 @@ typedef struct AV1MetadataContext {
 
     AVRational tick_rate;
     int num_ticks_per_picture;
+
+    int delete_padding;
 } AV1MetadataContext;
 
 
@@ -158,6 +160,19 @@ static int av1_metadata_filter(AVBSFContext *bsf, AVPacket *out)
         }
     }
 
+    if (ctx->delete_padding) {
+        for (i = 0; i < frag->nb_units; i++) {
+            if (frag->units[i].type == AV1_OBU_PADDING) {
+                err = ff_cbs_delete_unit(ctx->cbc, frag, i);
+                if (err < 0) {
+                    av_log(bsf, AV_LOG_ERROR, "Failed to delete Padding OBU.\n");
+                    goto fail;
+                }
+                --i;
+            }
+        }
+    }
+
     err = ff_cbs_write_packet(ctx->cbc, out, frag);
     if (err < 0) {
         av_log(bsf, AV_LOG_ERROR, "Failed to write packet.\n");
@@ -275,6 +290,10 @@ static const AVOption av1_metadata_options[] = {
         OFFSET(num_ticks_per_picture), AV_OPT_TYPE_INT,
         { .i64 = -1 }, -1, INT_MAX, FLAGS },
 
+    { "delete_padding", "Delete all Padding OBUs",
+        OFFSET(delete_padding), AV_OPT_TYPE_BOOL,
+        { .i64 = 0 }, 0, 1, FLAGS},
+
     { NULL }
 };
 
index d1cd3565242d160e144f2ae80eff30ca95e0ca81..02cb5c3ec15073c76300a9a66eb7ce290d40b89d 100644 (file)
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  48
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \