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>
(cherry picked from commit a46a23d30fea9c8a5570e07ec4d9c9b4eaa6eb4f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-01-16 21:36:26 +01:00
parent e3b6144e0c
commit 65074a5dae
2 changed files with 25 additions and 14 deletions

View File

@ -82,6 +82,7 @@ static int config_output(AVFilterLink *outlink)
int width = ctx->inputs[LEFT]->w;
int height = ctx->inputs[LEFT]->h;
AVRational time_base = ctx->inputs[LEFT]->time_base;
AVRational frame_rate = ctx->inputs[LEFT]->frame_rate;
// check size and fps match on the other input
if (width != ctx->inputs[RIGHT]->w ||
@ -93,11 +94,18 @@ static int config_output(AVFilterLink *outlink)
return AVERROR_INVALIDDATA;
} else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
av_log(ctx, AV_LOG_ERROR,
"Left and right framerates differ (%d/%d vs %d/%d).\n",
"Left and right time bases differ (%d/%d vs %d/%d).\n",
time_base.num, time_base.den,
ctx->inputs[RIGHT]->time_base.num,
ctx->inputs[RIGHT]->time_base.den);
return AVERROR_INVALIDDATA;
} else if (av_cmp_q(frame_rate, ctx->inputs[RIGHT]->frame_rate) != 0) {
av_log(ctx, AV_LOG_ERROR,
"Left and right framerates differ (%d/%d vs %d/%d).\n",
frame_rate.num, frame_rate.den,
ctx->inputs[RIGHT]->frame_rate.num,
ctx->inputs[RIGHT]->frame_rate.den);
return AVERROR_INVALIDDATA;
}
s->pix_desc = av_pix_fmt_desc_get(outlink->format);
@ -108,6 +116,8 @@ static int config_output(AVFilterLink *outlink)
switch (s->format) {
case AV_STEREO3D_FRAMESEQUENCE:
time_base.den *= 2;
frame_rate.num *= 2;
s->double_pts = AV_NOPTS_VALUE;
break;
case AV_STEREO3D_COLUMNS:
@ -126,6 +136,7 @@ static int config_output(AVFilterLink *outlink)
outlink->w = width;
outlink->h = height;
outlink->time_base = time_base;
outlink->frame_rate= frame_rate;
return 0;
}

View File

@ -1,16 +1,16 @@
#tb 0: 1/25
#tb 0: 1/50
0, 0, 0, 1, 152064, 0x05b789ef
0, 1, 1, 1, 152064, 0x05b789ef
0, 2, 2, 1, 152064, 0x4bb46551
0, 3, 3, 1, 152064, 0x9dddf64a
0, 4, 4, 1, 152064, 0x2a8380b0
0, 5, 5, 1, 152064, 0x4de3b652
0, 6, 6, 1, 152064, 0xedb5a8e6
0, 7, 7, 1, 152064, 0xe20f7c23
0, 8, 8, 1, 152064, 0x5ab58bac
0, 9, 9, 1, 152064, 0x1f1b8026
0, 10, 10, 1, 152064, 0x91373915
0, 11, 11, 1, 152064, 0x02344760
0, 12, 12, 1, 152064, 0x30f5fcd5
0, 13, 13, 1, 152064, 0xc711ad61
0, 14, 14, 1, 152064, 0x24eca223
0, 3, 3, 1, 152064, 0x4bb46551
0, 4, 4, 1, 152064, 0x9dddf64a
0, 5, 5, 1, 152064, 0x9dddf64a
0, 6, 6, 1, 152064, 0x2a8380b0
0, 7, 7, 1, 152064, 0x2a8380b0
0, 8, 8, 1, 152064, 0x4de3b652
0, 9, 9, 1, 152064, 0x4de3b652
0, 10, 10, 1, 152064, 0xedb5a8e6
0, 11, 11, 1, 152064, 0xedb5a8e6
0, 12, 12, 1, 152064, 0xe20f7c23
0, 13, 13, 1, 152064, 0xe20f7c23
0, 14, 14, 1, 152064, 0x5ab58bac