[FFmpeg-cvslog] vsrc_buffer: Set output size

Michael Niedermayer git at videolan.org
Tue Apr 26 18:22:47 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Apr 26 18:16:48 2011 +0200| [a38cdfde5285700fc8a4db3592f9cca287079265] | committer: Michael Niedermayer

vsrc_buffer: Set output size
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 ffmpeg.c                  |    2 +-
 libavfilter/vsrc_buffer.c |    7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 2c69608..bf0133e 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1638,7 +1638,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
                     av_vsrc_buffer_add_frame2(ost->input_video_filter, &picture,
                                              ist->pts,
                                              sar, ist->st->codec->width, ist->st->codec->height,
-                                             ist->st->codec->pix_fmt, "0:0"); //TODO user setable params
+                                             ist->st->codec->pix_fmt, ""); //TODO user setable params
                 }
             }
         }
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
index 3e7fe97..797cc98 100644
--- a/libavfilter/vsrc_buffer.c
+++ b/libavfilter/vsrc_buffer.c
@@ -35,6 +35,7 @@ typedef struct {
     enum PixelFormat  pix_fmt;
     AVRational        time_base;     ///< time_base to set in the output link
     AVRational        pixel_aspect;
+    char              sws_param[256];
 } BufferSourceContext;
 
 int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,
@@ -53,6 +54,10 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,
         //return -1;
     }
 
+    if(!c->sws_param[0]){
+        snprintf(c->sws_param, 255, "%d:%d:%s", c->w, c->h, sws_param);
+    }
+
     if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){
         AVFilterContext *scale= buffer_filter->outputs[0]->dst;
         AVFilterLink *link;
@@ -67,7 +72,7 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,
             if(avfilter_open(&scale, f, "Input equalizer") < 0)
                 return -1;
 
-            if((ret=avfilter_init_filter(scale, sws_param, NULL))<0){
+            if((ret=avfilter_init_filter(scale, c->sws_param, NULL))<0){
                 avfilter_free(scale);
                 return ret;
             }



More information about the ffmpeg-cvslog mailing list