2014-01-09 19:50:19 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Vittorio Giovara
|
|
|
|
*
|
2014-01-10 02:53:15 +01:00
|
|
|
* This file is part of FFmpeg.
|
2014-01-09 19:50:19 +01:00
|
|
|
*
|
2014-01-10 02:53:15 +01:00
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2014-01-09 19:50:19 +01:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2014-01-10 02:53:15 +01:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2014-01-09 19:50:19 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2014-01-10 02:53:15 +01:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2014-01-09 19:50:19 +01:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Generate a frame packed video, by combining two views in a single surface.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2016-01-08 16:16:10 +01:00
|
|
|
#include "libavutil/common.h"
|
2014-01-09 19:50:19 +01:00
|
|
|
#include "libavutil/imgutils.h"
|
|
|
|
#include "libavutil/opt.h"
|
|
|
|
#include "libavutil/pixdesc.h"
|
|
|
|
#include "libavutil/rational.h"
|
|
|
|
#include "libavutil/stereo3d.h"
|
|
|
|
|
|
|
|
#include "avfilter.h"
|
2019-11-16 23:53:39 +01:00
|
|
|
#include "filters.h"
|
2014-01-09 19:50:19 +01:00
|
|
|
#include "formats.h"
|
|
|
|
#include "internal.h"
|
|
|
|
#include "video.h"
|
|
|
|
|
|
|
|
#define LEFT 0
|
|
|
|
#define RIGHT 1
|
|
|
|
|
|
|
|
typedef struct FramepackContext {
|
|
|
|
const AVClass *class;
|
|
|
|
|
|
|
|
const AVPixFmtDescriptor *pix_desc; ///< agreed pixel format
|
|
|
|
|
|
|
|
enum AVStereo3DType format; ///< frame pack type output
|
|
|
|
|
|
|
|
AVFrame *input_views[2]; ///< input frames
|
|
|
|
} FramepackContext;
|
|
|
|
|
|
|
|
static const enum AVPixelFormat formats_supported[] = {
|
|
|
|
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
|
|
|
|
AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVJ420P,
|
|
|
|
AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P,
|
|
|
|
AV_PIX_FMT_NONE
|
|
|
|
};
|
|
|
|
|
|
|
|
static int query_formats(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
// this will ensure that formats are the same on all pads
|
2015-04-03 19:55:18 +02:00
|
|
|
AVFilterFormats *fmts_list = ff_make_format_list(formats_supported);
|
|
|
|
if (!fmts_list)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
return ff_set_common_formats(ctx, fmts_list);
|
2014-01-09 19:50:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static av_cold void framepack_uninit(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
FramepackContext *s = ctx->priv;
|
|
|
|
|
|
|
|
// clean any leftover frame
|
|
|
|
av_frame_free(&s->input_views[LEFT]);
|
|
|
|
av_frame_free(&s->input_views[RIGHT]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int config_output(AVFilterLink *outlink)
|
|
|
|
{
|
2015-11-03 18:57:25 +01:00
|
|
|
AVFilterContext *ctx = outlink->src;
|
|
|
|
FramepackContext *s = outlink->src->priv;
|
2014-01-09 19:50:19 +01:00
|
|
|
|
2015-11-03 18:57:25 +01:00
|
|
|
int width = ctx->inputs[LEFT]->w;
|
|
|
|
int height = ctx->inputs[LEFT]->h;
|
|
|
|
AVRational time_base = ctx->inputs[LEFT]->time_base;
|
2015-01-16 21:36:26 +01:00
|
|
|
AVRational frame_rate = ctx->inputs[LEFT]->frame_rate;
|
2014-01-09 19:50:19 +01:00
|
|
|
|
|
|
|
// check size and fps match on the other input
|
|
|
|
if (width != ctx->inputs[RIGHT]->w ||
|
|
|
|
height != ctx->inputs[RIGHT]->h) {
|
|
|
|
av_log(ctx, AV_LOG_ERROR,
|
|
|
|
"Left and right sizes differ (%dx%d vs %dx%d).\n",
|
|
|
|
width, height,
|
|
|
|
ctx->inputs[RIGHT]->w, ctx->inputs[RIGHT]->h);
|
|
|
|
return AVERROR_INVALIDDATA;
|
|
|
|
} else if (av_cmp_q(time_base, ctx->inputs[RIGHT]->time_base) != 0) {
|
|
|
|
av_log(ctx, AV_LOG_ERROR,
|
2015-01-16 21:36:26 +01:00
|
|
|
"Left and right time bases differ (%d/%d vs %d/%d).\n",
|
2014-01-09 19:50:19 +01:00
|
|
|
time_base.num, time_base.den,
|
|
|
|
ctx->inputs[RIGHT]->time_base.num,
|
|
|
|
ctx->inputs[RIGHT]->time_base.den);
|
|
|
|
return AVERROR_INVALIDDATA;
|
2015-01-16 21:36:26 +01:00
|
|
|
} 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;
|
2014-01-09 19:50:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
s->pix_desc = av_pix_fmt_desc_get(outlink->format);
|
|
|
|
if (!s->pix_desc)
|
|
|
|
return AVERROR_BUG;
|
|
|
|
|
|
|
|
// modify output properties as needed
|
|
|
|
switch (s->format) {
|
|
|
|
case AV_STEREO3D_FRAMESEQUENCE:
|
2015-11-03 18:57:25 +01:00
|
|
|
time_base.den *= 2;
|
2015-01-16 21:36:26 +01:00
|
|
|
frame_rate.num *= 2;
|
2014-01-09 19:50:19 +01:00
|
|
|
break;
|
|
|
|
case AV_STEREO3D_COLUMNS:
|
|
|
|
case AV_STEREO3D_SIDEBYSIDE:
|
|
|
|
width *= 2;
|
|
|
|
break;
|
|
|
|
case AV_STEREO3D_LINES:
|
|
|
|
case AV_STEREO3D_TOPBOTTOM:
|
|
|
|
height *= 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
av_log(ctx, AV_LOG_ERROR, "Unknown packing mode.");
|
|
|
|
return AVERROR_INVALIDDATA;
|
|
|
|
}
|
|
|
|
|
2015-11-03 18:57:25 +01:00
|
|
|
outlink->w = width;
|
|
|
|
outlink->h = height;
|
|
|
|
outlink->time_base = time_base;
|
|
|
|
outlink->frame_rate = frame_rate;
|
2014-01-09 19:50:19 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-09-22 14:22:15 +02:00
|
|
|
static void horizontal_frame_pack(AVFilterLink *outlink,
|
|
|
|
AVFrame *out,
|
2014-01-09 19:50:19 +01:00
|
|
|
int interleaved)
|
|
|
|
{
|
2015-09-22 14:22:15 +02:00
|
|
|
AVFilterContext *ctx = outlink->src;
|
|
|
|
FramepackContext *s = ctx->priv;
|
|
|
|
int i, plane;
|
|
|
|
|
|
|
|
if (interleaved) {
|
|
|
|
const uint8_t *leftp = s->input_views[LEFT]->data[0];
|
|
|
|
const uint8_t *rightp = s->input_views[RIGHT]->data[0];
|
|
|
|
uint8_t *dstp = out->data[0];
|
|
|
|
int length = out->width / 2;
|
|
|
|
int lines = out->height;
|
|
|
|
|
|
|
|
for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
|
|
|
|
if (plane == 1 || plane == 2) {
|
2016-01-27 16:19:38 +01:00
|
|
|
length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
|
|
|
|
lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h);
|
2015-09-22 14:22:15 +02:00
|
|
|
}
|
2014-01-09 19:50:19 +01:00
|
|
|
for (i = 0; i < lines; i++) {
|
|
|
|
int j;
|
2015-09-22 14:22:15 +02:00
|
|
|
leftp = s->input_views[LEFT]->data[plane] +
|
|
|
|
s->input_views[LEFT]->linesize[plane] * i;
|
|
|
|
rightp = s->input_views[RIGHT]->data[plane] +
|
|
|
|
s->input_views[RIGHT]->linesize[plane] * i;
|
|
|
|
dstp = out->data[plane] + out->linesize[plane] * i;
|
2014-01-09 19:50:19 +01:00
|
|
|
for (j = 0; j < length; j++) {
|
2015-09-22 14:22:15 +02:00
|
|
|
// interpolate chroma as necessary
|
|
|
|
if ((s->pix_desc->log2_chroma_w ||
|
|
|
|
s->pix_desc->log2_chroma_h) &&
|
|
|
|
(plane == 1 || plane == 2)) {
|
|
|
|
*dstp++ = (*leftp + *rightp) / 2;
|
|
|
|
*dstp++ = (*leftp + *rightp) / 2;
|
|
|
|
} else {
|
|
|
|
*dstp++ = *leftp;
|
|
|
|
*dstp++ = *rightp;
|
|
|
|
}
|
|
|
|
leftp += 1;
|
|
|
|
rightp += 1;
|
2014-01-09 19:50:19 +01:00
|
|
|
}
|
|
|
|
}
|
2015-09-22 14:22:15 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
const uint8_t *src[4];
|
|
|
|
uint8_t *dst[4];
|
|
|
|
int sub_w = s->input_views[i]->width >> s->pix_desc->log2_chroma_w;
|
|
|
|
|
|
|
|
src[0] = s->input_views[i]->data[0];
|
|
|
|
src[1] = s->input_views[i]->data[1];
|
|
|
|
src[2] = s->input_views[i]->data[2];
|
|
|
|
|
|
|
|
dst[0] = out->data[0] + i * s->input_views[i]->width;
|
|
|
|
dst[1] = out->data[1] + i * sub_w;
|
|
|
|
dst[2] = out->data[2] + i * sub_w;
|
|
|
|
|
|
|
|
av_image_copy(dst, out->linesize, src, s->input_views[i]->linesize,
|
|
|
|
s->input_views[i]->format,
|
|
|
|
s->input_views[i]->width,
|
|
|
|
s->input_views[i]->height);
|
2014-01-09 19:50:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-22 14:22:15 +02:00
|
|
|
static void vertical_frame_pack(AVFilterLink *outlink,
|
|
|
|
AVFrame *out,
|
2014-01-09 19:50:19 +01:00
|
|
|
int interleaved)
|
|
|
|
{
|
2015-09-22 14:22:15 +02:00
|
|
|
AVFilterContext *ctx = outlink->src;
|
|
|
|
FramepackContext *s = ctx->priv;
|
|
|
|
int i;
|
2014-01-09 19:50:19 +01:00
|
|
|
|
2015-09-22 14:22:15 +02:00
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
const uint8_t *src[4];
|
|
|
|
uint8_t *dst[4];
|
|
|
|
int linesizes[4];
|
|
|
|
int sub_h = s->input_views[i]->height >> s->pix_desc->log2_chroma_h;
|
|
|
|
|
|
|
|
src[0] = s->input_views[i]->data[0];
|
|
|
|
src[1] = s->input_views[i]->data[1];
|
|
|
|
src[2] = s->input_views[i]->data[2];
|
|
|
|
|
|
|
|
dst[0] = out->data[0] + i * out->linesize[0] *
|
|
|
|
(interleaved + s->input_views[i]->height * (1 - interleaved));
|
|
|
|
dst[1] = out->data[1] + i * out->linesize[1] *
|
|
|
|
(interleaved + sub_h * (1 - interleaved));
|
|
|
|
dst[2] = out->data[2] + i * out->linesize[2] *
|
|
|
|
(interleaved + sub_h * (1 - interleaved));
|
|
|
|
|
|
|
|
linesizes[0] = out->linesize[0] +
|
|
|
|
interleaved * out->linesize[0];
|
|
|
|
linesizes[1] = out->linesize[1] +
|
|
|
|
interleaved * out->linesize[1];
|
|
|
|
linesizes[2] = out->linesize[2] +
|
|
|
|
interleaved * out->linesize[2];
|
|
|
|
|
|
|
|
av_image_copy(dst, linesizes, src, s->input_views[i]->linesize,
|
|
|
|
s->input_views[i]->format,
|
|
|
|
s->input_views[i]->width,
|
|
|
|
s->input_views[i]->height);
|
2014-01-09 19:50:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-22 14:22:15 +02:00
|
|
|
static av_always_inline void spatial_frame_pack(AVFilterLink *outlink,
|
|
|
|
AVFrame *dst)
|
2014-01-09 19:50:19 +01:00
|
|
|
{
|
2015-09-22 14:22:15 +02:00
|
|
|
AVFilterContext *ctx = outlink->src;
|
|
|
|
FramepackContext *s = ctx->priv;
|
2014-01-09 19:50:19 +01:00
|
|
|
switch (s->format) {
|
|
|
|
case AV_STEREO3D_SIDEBYSIDE:
|
2015-09-22 14:22:15 +02:00
|
|
|
horizontal_frame_pack(outlink, dst, 0);
|
2014-01-09 19:50:19 +01:00
|
|
|
break;
|
|
|
|
case AV_STEREO3D_COLUMNS:
|
2015-09-22 14:22:15 +02:00
|
|
|
horizontal_frame_pack(outlink, dst, 1);
|
2014-01-09 19:50:19 +01:00
|
|
|
break;
|
|
|
|
case AV_STEREO3D_TOPBOTTOM:
|
2015-09-22 14:22:15 +02:00
|
|
|
vertical_frame_pack(outlink, dst, 0);
|
2014-01-09 19:50:19 +01:00
|
|
|
break;
|
|
|
|
case AV_STEREO3D_LINES:
|
2015-09-22 14:22:15 +02:00
|
|
|
vertical_frame_pack(outlink, dst, 1);
|
2014-01-09 19:50:19 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-22 09:58:25 +02:00
|
|
|
static int try_push_frame(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
FramepackContext *s = ctx->priv;
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
|
|
|
AVStereo3D *stereo;
|
|
|
|
int ret, i;
|
2014-01-09 19:50:19 +01:00
|
|
|
|
2015-10-22 09:58:25 +02:00
|
|
|
if (!(s->input_views[0] && s->input_views[1]))
|
|
|
|
return 0;
|
2014-01-09 19:50:19 +01:00
|
|
|
if (s->format == AV_STEREO3D_FRAMESEQUENCE) {
|
2019-11-16 23:31:03 +01:00
|
|
|
int64_t pts = s->input_views[0]->pts;
|
2014-01-09 19:50:19 +01:00
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
// set correct timestamps
|
2019-11-16 23:31:03 +01:00
|
|
|
if (pts != AV_NOPTS_VALUE)
|
2019-11-17 00:21:18 +01:00
|
|
|
s->input_views[i]->pts = i == 0 ? pts * 2 : pts * 2 + av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
|
2014-01-09 19:50:19 +01:00
|
|
|
|
|
|
|
// set stereo3d side data
|
|
|
|
stereo = av_stereo3d_create_side_data(s->input_views[i]);
|
|
|
|
if (!stereo)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
stereo->type = s->format;
|
2017-09-25 15:09:21 +02:00
|
|
|
stereo->view = i == LEFT ? AV_STEREO3D_VIEW_LEFT
|
|
|
|
: AV_STEREO3D_VIEW_RIGHT;
|
2014-01-09 19:50:19 +01:00
|
|
|
|
|
|
|
// filter the frame and immediately relinquish its pointer
|
|
|
|
ret = ff_filter_frame(outlink, s->input_views[i]);
|
|
|
|
s->input_views[i] = NULL;
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
} else {
|
|
|
|
AVFrame *dst = ff_get_video_buffer(outlink, outlink->w, outlink->h);
|
|
|
|
if (!dst)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
|
2015-09-22 14:22:15 +02:00
|
|
|
spatial_frame_pack(outlink, dst);
|
2014-01-09 19:50:19 +01:00
|
|
|
|
|
|
|
// get any property from the original frame
|
|
|
|
ret = av_frame_copy_props(dst, s->input_views[LEFT]);
|
|
|
|
if (ret < 0) {
|
|
|
|
av_frame_free(&dst);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
av_frame_free(&s->input_views[i]);
|
|
|
|
|
|
|
|
// set stereo3d side data
|
|
|
|
stereo = av_stereo3d_create_side_data(dst);
|
|
|
|
if (!stereo) {
|
|
|
|
av_frame_free(&dst);
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
}
|
|
|
|
stereo->type = s->format;
|
|
|
|
|
|
|
|
return ff_filter_frame(outlink, dst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-16 23:53:39 +01:00
|
|
|
static int activate(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
|
|
|
FramepackContext *s = ctx->priv;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx);
|
|
|
|
|
|
|
|
if (!s->input_views[0]) {
|
|
|
|
ret = ff_inlink_consume_frame(ctx->inputs[0], &s->input_views[0]);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!s->input_views[1]) {
|
|
|
|
ret = ff_inlink_consume_frame(ctx->inputs[1], &s->input_views[1]);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->input_views[0] && s->input_views[1])
|
|
|
|
return try_push_frame(ctx);
|
|
|
|
|
|
|
|
FF_FILTER_FORWARD_STATUS(ctx->inputs[0], outlink);
|
|
|
|
FF_FILTER_FORWARD_STATUS(ctx->inputs[1], outlink);
|
|
|
|
|
|
|
|
if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
|
|
|
|
!ff_outlink_get_status(ctx->inputs[0]) &&
|
|
|
|
!s->input_views[0]) {
|
|
|
|
ff_inlink_request_frame(ctx->inputs[0]);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ff_outlink_frame_wanted(ctx->outputs[0]) &&
|
|
|
|
!ff_outlink_get_status(ctx->inputs[1]) &&
|
|
|
|
!s->input_views[1]) {
|
|
|
|
ff_inlink_request_frame(ctx->inputs[1]);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FFERROR_NOT_READY;
|
|
|
|
}
|
|
|
|
|
2014-01-09 19:50:19 +01:00
|
|
|
#define OFFSET(x) offsetof(FramepackContext, x)
|
2019-11-16 23:18:36 +01:00
|
|
|
#define VF AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
|
2015-07-02 11:49:26 +02:00
|
|
|
static const AVOption framepack_options[] = {
|
2014-01-09 19:50:19 +01:00
|
|
|
{ "format", "Frame pack output format", OFFSET(format), AV_OPT_TYPE_INT,
|
2019-11-16 23:18:36 +01:00
|
|
|
{ .i64 = AV_STEREO3D_SIDEBYSIDE }, 0, INT_MAX, .flags = VF, .unit = "format" },
|
2014-01-09 19:50:19 +01:00
|
|
|
{ "sbs", "Views are packed next to each other", 0, AV_OPT_TYPE_CONST,
|
2019-11-16 23:18:36 +01:00
|
|
|
{ .i64 = AV_STEREO3D_SIDEBYSIDE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
|
2014-01-09 19:50:19 +01:00
|
|
|
{ "tab", "Views are packed on top of each other", 0, AV_OPT_TYPE_CONST,
|
2019-11-16 23:18:36 +01:00
|
|
|
{ .i64 = AV_STEREO3D_TOPBOTTOM }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
|
2014-01-09 19:50:19 +01:00
|
|
|
{ "frameseq", "Views are one after the other", 0, AV_OPT_TYPE_CONST,
|
2019-11-16 23:18:36 +01:00
|
|
|
{ .i64 = AV_STEREO3D_FRAMESEQUENCE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
|
2014-01-09 19:50:19 +01:00
|
|
|
{ "lines", "Views are interleaved by lines", 0, AV_OPT_TYPE_CONST,
|
2019-11-16 23:18:36 +01:00
|
|
|
{ .i64 = AV_STEREO3D_LINES }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
|
2014-01-09 19:50:19 +01:00
|
|
|
{ "columns", "Views are interleaved by columns", 0, AV_OPT_TYPE_CONST,
|
2019-11-16 23:18:36 +01:00
|
|
|
{ .i64 = AV_STEREO3D_COLUMNS }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
|
2014-01-09 19:50:19 +01:00
|
|
|
{ NULL },
|
|
|
|
};
|
|
|
|
|
2015-07-02 11:49:26 +02:00
|
|
|
AVFILTER_DEFINE_CLASS(framepack);
|
2014-01-09 19:50:19 +01:00
|
|
|
|
|
|
|
static const AVFilterPad framepack_inputs[] = {
|
|
|
|
{
|
|
|
|
.name = "left",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "right",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
|
|
|
},
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVFilterPad framepack_outputs[] = {
|
|
|
|
{
|
|
|
|
.name = "packed",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
|
|
|
.config_props = config_output,
|
|
|
|
},
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
AVFilter ff_vf_framepack = {
|
|
|
|
.name = "framepack",
|
|
|
|
.description = NULL_IF_CONFIG_SMALL("Generate a frame packed stereoscopic video."),
|
|
|
|
.priv_size = sizeof(FramepackContext),
|
|
|
|
.priv_class = &framepack_class,
|
|
|
|
.query_formats = query_formats,
|
|
|
|
.inputs = framepack_inputs,
|
|
|
|
.outputs = framepack_outputs,
|
2019-11-16 23:53:39 +01:00
|
|
|
.activate = activate,
|
2014-01-09 19:50:19 +01:00
|
|
|
.uninit = framepack_uninit,
|
|
|
|
};
|