Browse code

avfilter/vf_framepack: Check and update frame_rate

The frame_rate update was missing leaving the output frame rate
wrong.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2015/01/17 05:36:26
Showing 2 changed files
... ...
@@ -82,6 +82,7 @@ static int config_output(AVFilterLink *outlink)
82 82
     int width            = ctx->inputs[LEFT]->w;
83 83
     int height           = ctx->inputs[LEFT]->h;
84 84
     AVRational time_base = ctx->inputs[LEFT]->time_base;
85
+    AVRational frame_rate = ctx->inputs[LEFT]->frame_rate;
85 86
 
86 87
     // check size and fps match on the other input
87 88
     if (width  != ctx->inputs[RIGHT]->w ||
... ...
@@ -93,11 +94,18 @@ static int config_output(AVFilterLink *outlink)
93 93
         return AVERROR_INVALIDDATA;
94 94
     } else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
95 95
         av_log(ctx, AV_LOG_ERROR,
96
-               "Left and right framerates differ (%d/%d vs %d/%d).\n",
96
+               "Left and right time bases differ (%d/%d vs %d/%d).\n",
97 97
                time_base.num, time_base.den,
98 98
                ctx->inputs[RIGHT]->time_base.num,
99 99
                ctx->inputs[RIGHT]->time_base.den);
100 100
         return AVERROR_INVALIDDATA;
101
+    } else if (av_cmp_q(frame_rate, ctx->inputs[RIGHT]->frame_rate) != 0) {
102
+        av_log(ctx, AV_LOG_ERROR,
103
+               "Left and right framerates differ (%d/%d vs %d/%d).\n",
104
+               frame_rate.num, frame_rate.den,
105
+               ctx->inputs[RIGHT]->frame_rate.num,
106
+               ctx->inputs[RIGHT]->frame_rate.den);
107
+        return AVERROR_INVALIDDATA;
101 108
     }
102 109
 
103 110
     s->pix_desc = av_pix_fmt_desc_get(outlink->format);
... ...
@@ -108,6 +116,8 @@ static int config_output(AVFilterLink *outlink)
108 108
     switch (s->format) {
109 109
     case AV_STEREO3D_FRAMESEQUENCE:
110 110
         time_base.den *= 2;
111
+        frame_rate.num *= 2;
112
+
111 113
         s->double_pts = AV_NOPTS_VALUE;
112 114
         break;
113 115
     case AV_STEREO3D_COLUMNS:
... ...
@@ -126,6 +136,7 @@ static int config_output(AVFilterLink *outlink)
126 126
     outlink->w         = width;
127 127
     outlink->h         = height;
128 128
     outlink->time_base = time_base;
129
+    outlink->frame_rate= frame_rate;
129 130
 
130 131
     return 0;
131 132
 }
... ...
@@ -1,16 +1,16 @@
1
-#tb 0: 1/25
1
+#tb 0: 1/50
2 2
 0,          0,          0,        1,   152064, 0x05b789ef
3 3
 0,          1,          1,        1,   152064, 0x05b789ef
4 4
 0,          2,          2,        1,   152064, 0x4bb46551
5
-0,          3,          3,        1,   152064, 0x9dddf64a
6
-0,          4,          4,        1,   152064, 0x2a8380b0
7
-0,          5,          5,        1,   152064, 0x4de3b652
8
-0,          6,          6,        1,   152064, 0xedb5a8e6
9
-0,          7,          7,        1,   152064, 0xe20f7c23
10
-0,          8,          8,        1,   152064, 0x5ab58bac
11
-0,          9,          9,        1,   152064, 0x1f1b8026
12
-0,         10,         10,        1,   152064, 0x91373915
13
-0,         11,         11,        1,   152064, 0x02344760
14
-0,         12,         12,        1,   152064, 0x30f5fcd5
15
-0,         13,         13,        1,   152064, 0xc711ad61
16
-0,         14,         14,        1,   152064, 0x24eca223
5
+0,          3,          3,        1,   152064, 0x4bb46551
6
+0,          4,          4,        1,   152064, 0x9dddf64a
7
+0,          5,          5,        1,   152064, 0x9dddf64a
8
+0,          6,          6,        1,   152064, 0x2a8380b0
9
+0,          7,          7,        1,   152064, 0x2a8380b0
10
+0,          8,          8,        1,   152064, 0x4de3b652
11
+0,          9,          9,        1,   152064, 0x4de3b652
12
+0,         10,         10,        1,   152064, 0xedb5a8e6
13
+0,         11,         11,        1,   152064, 0xedb5a8e6
14
+0,         12,         12,        1,   152064, 0xe20f7c23
15
+0,         13,         13,        1,   152064, 0xe20f7c23
16
+0,         14,         14,        1,   152064, 0x5ab58bac