diff options
author | Marton Balint <cus@passwd.hu> | 2016-10-01 13:55:35 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2016-10-01 17:32:32 +0200 |
commit | 7ef3e5b593fb984b318d971421a7e687ca69d536 (patch) | |
tree | d3f670420efed463bf1c5384dd9660948c457ae0 /libavfilter/f_metadata.c | |
parent | d946424f193391e37c034ceb2c72203309904e30 (diff) | |
download | ffmpeg-7ef3e5b593fb984b318d971421a7e687ca69d536.tar.gz |
lavfi/metadata: allow deleting all metadata
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavfilter/f_metadata.c')
-rw-r--r-- | libavfilter/f_metadata.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c index 1fe713c34a..f4a929c1d5 100644 --- a/libavfilter/f_metadata.c +++ b/libavfilter/f_metadata.c @@ -194,7 +194,7 @@ static av_cold int init(AVFilterContext *ctx) MetadataContext *s = ctx->priv; int ret; - if (!s->key && s->mode != METADATA_PRINT) { + if (!s->key && s->mode != METADATA_PRINT && s->mode != METADATA_DELETE) { av_log(ctx, AV_LOG_WARNING, "Metadata key must be set\n"); return AVERROR(EINVAL); } @@ -328,7 +328,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) return ff_filter_frame(outlink, frame); break; case METADATA_DELETE: - if (e && e->value && s->value && s->compare(s, e->value, s->value)) { + if (!s->key) { + av_dict_free(metadata); + } else if (e && e->value && s->value && s->compare(s, e->value, s->value)) { av_dict_set(metadata, s->key, NULL, 0); } else if (e && e->value) { av_dict_set(metadata, s->key, NULL, 0); |