diff options
author | James Almer <jamrial@gmail.com> | 2019-03-25 00:27:23 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-04-03 18:12:37 -0300 |
commit | ee16d14b0a29317f6118a209c4d0737b97b7f58f (patch) | |
tree | 76fbb893a512a871c48a9b0c7eb0ac5c02246d34 /libavcodec | |
parent | 1125277bc64ebef1a7a6bee7349c7a8fab7fdcc7 (diff) | |
download | ffmpeg-streaming-ee16d14b0a29317f6118a209c4d0737b97b7f58f.zip ffmpeg-streaming-ee16d14b0a29317f6118a209c4d0737b97b7f58f.tar.gz |
avcodec/av1_metadata: add an option to remove Padding OBUs
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/av1_metadata_bsf.c | 19 | ||||
-rw-r--r-- | libavcodec/version.h | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c index 2b74b69..fe208fe 100644 --- a/libavcodec/av1_metadata_bsf.c +++ b/libavcodec/av1_metadata_bsf.c @@ -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 } }; diff --git a/libavcodec/version.h b/libavcodec/version.h index d1cd356..02cb5c3 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -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, \ |