Browse code

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

Michael Niedermayer authored on 2011/04/27 01:16:48
Showing 2 changed files
... ...
@@ -1638,7 +1638,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
1638 1638
                     av_vsrc_buffer_add_frame2(ost->input_video_filter, &picture,
1639 1639
                                              ist->pts,
1640 1640
                                              sar, ist->st->codec->width, ist->st->codec->height,
1641
-                                             ist->st->codec->pix_fmt, "0:0"); //TODO user setable params
1641
+                                             ist->st->codec->pix_fmt, ""); //TODO user setable params
1642 1642
                 }
1643 1643
             }
1644 1644
         }
... ...
@@ -35,6 +35,7 @@ typedef struct {
35 35
     enum PixelFormat  pix_fmt;
36 36
     AVRational        time_base;     ///< time_base to set in the output link
37 37
     AVRational        pixel_aspect;
38
+    char              sws_param[256];
38 39
 } BufferSourceContext;
39 40
 
40 41
 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,
53 53
         //return -1;
54 54
     }
55 55
 
56
+    if(!c->sws_param[0]){
57
+        snprintf(c->sws_param, 255, "%d:%d:%s", c->w, c->h, sws_param);
58
+    }
59
+
56 60
     if(width != c->w || height != c->h || pix_fmt != c->pix_fmt){
57 61
         AVFilterContext *scale= buffer_filter->outputs[0]->dst;
58 62
         AVFilterLink *link;
... ...
@@ -67,7 +72,7 @@ int av_vsrc_buffer_add_frame2(AVFilterContext *buffer_filter, AVFrame *frame,
67 67
             if(avfilter_open(&scale, f, "Input equalizer") < 0)
68 68
                 return -1;
69 69
 
70
-            if((ret=avfilter_init_filter(scale, sws_param, NULL))<0){
70
+            if((ret=avfilter_init_filter(scale, c->sws_param, NULL))<0){
71 71
                 avfilter_free(scale);
72 72
                 return ret;
73 73
             }