|
|
@ -76,12 +76,13 @@ static av_cold void framepack_uninit(AVFilterContext *ctx) |
|
|
|
|
|
|
|
|
|
|
|
static int config_output(AVFilterLink *outlink) |
|
|
|
static int config_output(AVFilterLink *outlink) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AVFilterContext *ctx = outlink->src; |
|
|
|
AVFilterContext *ctx = outlink->src; |
|
|
|
FramepackContext *s = outlink->src->priv; |
|
|
|
FramepackContext *s = outlink->src->priv; |
|
|
|
|
|
|
|
|
|
|
|
int width = ctx->inputs[LEFT]->w; |
|
|
|
int width = ctx->inputs[LEFT]->w; |
|
|
|
int height = ctx->inputs[LEFT]->h; |
|
|
|
int height = ctx->inputs[LEFT]->h; |
|
|
|
AVRational time_base = ctx->inputs[LEFT]->time_base; |
|
|
|
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
|
|
|
|
// check size and fps match on the other input
|
|
|
|
if (width != ctx->inputs[RIGHT]->w || |
|
|
|
if (width != ctx->inputs[RIGHT]->w || |
|
|
@ -93,11 +94,18 @@ static int config_output(AVFilterLink *outlink) |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) { |
|
|
|
} else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) { |
|
|
|
av_log(ctx, AV_LOG_ERROR, |
|
|
|
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, |
|
|
|
time_base.num, time_base.den, |
|
|
|
ctx->inputs[RIGHT]->time_base.num, |
|
|
|
ctx->inputs[RIGHT]->time_base.num, |
|
|
|
ctx->inputs[RIGHT]->time_base.den); |
|
|
|
ctx->inputs[RIGHT]->time_base.den); |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
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); |
|
|
|
s->pix_desc = av_pix_fmt_desc_get(outlink->format); |
|
|
@ -107,7 +115,9 @@ static int config_output(AVFilterLink *outlink) |
|
|
|
// modify output properties as needed
|
|
|
|
// modify output properties as needed
|
|
|
|
switch (s->format) { |
|
|
|
switch (s->format) { |
|
|
|
case AV_STEREO3D_FRAMESEQUENCE: |
|
|
|
case AV_STEREO3D_FRAMESEQUENCE: |
|
|
|
time_base.den *= 2; |
|
|
|
time_base.den *= 2; |
|
|
|
|
|
|
|
frame_rate.num *= 2; |
|
|
|
|
|
|
|
|
|
|
|
s->double_pts = AV_NOPTS_VALUE; |
|
|
|
s->double_pts = AV_NOPTS_VALUE; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case AV_STEREO3D_COLUMNS: |
|
|
|
case AV_STEREO3D_COLUMNS: |
|
|
@ -123,9 +133,10 @@ static int config_output(AVFilterLink *outlink) |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
outlink->w = width; |
|
|
|
outlink->w = width; |
|
|
|
outlink->h = height; |
|
|
|
outlink->h = height; |
|
|
|
outlink->time_base = time_base; |
|
|
|
outlink->time_base = time_base; |
|
|
|
|
|
|
|
outlink->frame_rate = frame_rate; |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|