Commit d946424f authored by Marton Balint's avatar Marton Balint

lavfi/metadata: fix setting metadata values

Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent 4f8262e3
......@@ -280,13 +280,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
MetadataContext *s = ctx->priv;
AVDictionary *metadata = av_frame_get_metadata(frame);
AVDictionary **metadata = avpriv_frame_get_metadatap(frame);
AVDictionaryEntry *e;
if (!metadata)
if (!*metadata)
return ff_filter_frame(outlink, frame);
e = av_dict_get(metadata, !s->key ? "" : s->key, NULL,
e = av_dict_get(*metadata, !s->key ? "" : s->key, NULL,
!s->key ? AV_DICT_IGNORE_SUFFIX: 0);
switch (s->mode) {
......@@ -302,13 +302,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
if (e && e->value) {
;
} else {
av_dict_set(&metadata, s->key, s->value, 0);
av_dict_set(metadata, s->key, s->value, 0);
}
return ff_filter_frame(outlink, frame);
break;
case METADATA_MODIFY:
if (e && e->value) {
av_dict_set(&metadata, s->key, s->value, 0);
av_dict_set(metadata, s->key, s->value, 0);
}
return ff_filter_frame(outlink, frame);
break;
......@@ -317,7 +317,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%-7s\n",
inlink->frame_count, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base));
s->print(ctx, "%s=%s\n", e->key, e->value);
while ((e = av_dict_get(metadata, "", e, AV_DICT_IGNORE_SUFFIX)) != NULL) {
while ((e = av_dict_get(*metadata, "", e, AV_DICT_IGNORE_SUFFIX)) != NULL) {
s->print(ctx, "%s=%s\n", e->key, e->value);
}
} else if (e && e->value && (!s->value || (e->value && s->compare(s, e->value, s->value)))) {
......@@ -329,9 +329,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
break;
case METADATA_DELETE:
if (e && e->value && s->value && s->compare(s, e->value, s->value)) {
av_dict_set(&metadata, s->key, NULL, 0);
av_dict_set(metadata, s->key, NULL, 0);
} else if (e && e->value) {
av_dict_set(&metadata, s->key, NULL, 0);
av_dict_set(metadata, s->key, NULL, 0);
}
return ff_filter_frame(outlink, frame);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment