buffersrc: use avfilter_get_buffer_ref_from_frame.
authorNicolas George <nicolas.george@normalesup.org>
Fri, 20 Jul 2012 22:48:23 +0000 (00:48 +0200)
committerNicolas George <nicolas.george@normalesup.org>
Mon, 23 Jul 2012 15:14:59 +0000 (17:14 +0200)
libavfilter/buffersrc.c

index 5186b09..153ab6c 100644 (file)
@@ -83,16 +83,8 @@ int av_buffersrc_add_frame(AVFilterContext *buffer_src,
     if (!frame) /* NULL for EOF */
         return av_buffersrc_add_ref(buffer_src, NULL, flags);
 
-    switch (buffer_src->outputs[0]->type) {
-    case AVMEDIA_TYPE_VIDEO:
-        picref = avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE);
-        break;
-    case AVMEDIA_TYPE_AUDIO:
-        picref = avfilter_get_audio_buffer_ref_from_frame(frame, AV_PERM_WRITE);
-        break;
-    default:
-        return AVERROR(ENOSYS);
-    }
+    picref = avfilter_get_buffer_ref_from_frame(buffer_src->outputs[0]->type,
+                                                frame, AV_PERM_WRITE);
     if (!picref)
         return AVERROR(ENOMEM);
     ret = av_buffersrc_add_ref(buffer_src, picref, flags);