diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-05-01 14:47:05 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-12-25 16:18:57 +0100 |
commit | 1c9e340d35351858907f11c45b2691db708f3903 (patch) | |
tree | b707c4c421cf7fd6caa5186b405ee4662ef46ec2 /libavfilter/avfilter.c | |
parent | 8a4a5f6ff756fdba44254015c714f173b2db6f64 (diff) | |
download | ffmpeg-1c9e340d35351858907f11c45b2691db708f3903.tar.gz |
lavfi: add avfilter_copy_frame_props()
avfilter_copy_frame_props() avoids code duplication and increases
robustness.
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index b0304d64d5..d42659112a 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -25,6 +25,7 @@ #include "libavutil/rational.h" #include "libavutil/audioconvert.h" #include "libavutil/imgutils.h" +#include "libavcodec/avcodec.h" #include "avfilter.h" #include "internal.h" @@ -681,3 +682,21 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque return ret; } +int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) +{ + if (dst->type != AVMEDIA_TYPE_VIDEO) + return AVERROR(EINVAL); + + dst->pts = src->pts; + dst->format = src->format; + + dst->video->w = src->width; + dst->video->h = src->height; + dst->video->pixel_aspect = src->sample_aspect_ratio; + dst->video->interlaced = src->interlaced_frame; + dst->video->top_field_first = src->top_field_first; + dst->video->key_frame = src->key_frame; + dst->video->pict_type = src->pict_type; + + return 0; +} |