[FFmpeg-cvslog] lavfi: support audio in avfilter_copy_frame_props().

Anton Khirnov git at videolan.org
Mon May 7 23:06:25 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat May  5 13:11:53 2012 +0200| [0bbd874743538103c74f3c81df4f25b1bb3f1b2e] | committer: Anton Khirnov

lavfi: support audio in avfilter_copy_frame_props().

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0bbd874743538103c74f3c81df4f25b1bb3f1b2e
---

 libavfilter/avfilter.c |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index d426591..91eb7f97 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -684,19 +684,26 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
 
 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;
+    switch (dst->type) {
+    case AVMEDIA_TYPE_VIDEO:
+        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;
+        break;
+    case AVMEDIA_TYPE_AUDIO:
+        dst->audio->sample_rate         = src->sample_rate;
+        dst->audio->channel_layout      = src->channel_layout;
+        break;
+    default:
+        return AVERROR(EINVAL);
+    }
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list