Skip to content

Commit b8e9baf

Browse files
committed
lavfi: Keep frame-based metadata.
1 parent 3a5bcea commit b8e9baf

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

cmdutils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,7 @@ int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
10341034
frame->top_field_first = picref->video->top_field_first;
10351035
frame->key_frame = picref->video->key_frame;
10361036
frame->pict_type = picref->video->pict_type;
1037+
frame->metadata = picref->metadata;
10371038

10381039
return 1;
10391040
}

libavfilter/avfilter.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
6464
}
6565
*ret->audio = *ref->audio;
6666
}
67+
ret->metadata = NULL;
68+
av_dict_copy(&ret->metadata, ref->metadata, 0);
6769
ret->perms &= pmask;
6870
ret->buf->refcount ++;
6971
return ret;
@@ -77,6 +79,7 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref)
7779
ref->buf->free(ref->buf);
7880
av_free(ref->video);
7981
av_free(ref->audio);
82+
av_dict_free(&ref->metadata);
8083
av_free(ref);
8184
}
8285

libavfilter/avfilter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ typedef struct AVFilterBufferRef {
149149
enum AVMediaType type; ///< media type of buffer data
150150
AVFilterBufferRefVideoProps *video; ///< video buffer specific properties
151151
AVFilterBufferRefAudioProps *audio; ///< audio buffer specific properties
152+
AVDictionary *metadata;
152153
} AVFilterBufferRef;
153154

154155
/**

libavfilter/vsrc_buffer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
5656
c->frame.top_field_first = frame->top_field_first;
5757
c->frame.key_frame = frame->key_frame;
5858
c->frame.pict_type = frame->pict_type;
59+
c->frame.metadata = frame->metadata;
5960
c->pts = pts;
6061
c->pixel_aspect = pixel_aspect;
6162
c->has_frame = 1;
@@ -137,6 +138,8 @@ static int request_frame(AVFilterLink *link)
137138
picref->video->top_field_first = c->frame.top_field_first;
138139
picref->video->key_frame = c->frame.key_frame;
139140
picref->video->pict_type = c->frame.pict_type;
141+
picref->metadata = NULL;
142+
av_dict_copy(&picref->metadata, c->frame.metadata, 0);
140143
avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
141144
avfilter_draw_slice(link, 0, link->h, 1);
142145
avfilter_end_frame(link);

0 commit comments

Comments
 (0)