* video field order filter, heavily influenced by vf_pad.c
*/
-/* #define DEBUG */
-
#include <stdio.h>
#include <string.h>
#include "internal.h"
#include "video.h"
-typedef struct
-{
+typedef struct FieldOrderContext {
const AVClass *class;
int dst_tff; ///< output bff/tff
int line_size[4]; ///< bytes of pixel data per line for each plane
/** accept any input pixel format that is not hardware accelerated, not
* a bitstream format, and does not have vertically sub-sampled chroma */
if (ctx->inputs[0]) {
+ const AVPixFmtDescriptor *desc = NULL;
formats = NULL;
- for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) {
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ while ((desc = av_pix_fmt_desc_next(desc))) {
+ pix_fmt = av_pix_fmt_desc_get_id(desc);
if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL ||
desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) &&
desc->nb_components && !desc->log2_chroma_h &&
static int config_input(AVFilterLink *inlink)
{
- AVFilterContext *ctx = inlink->dst;
- FieldOrderContext *fieldorder = ctx->priv;
+ AVFilterContext *ctx = inlink->dst;
+ FieldOrderContext *s = ctx->priv;
int plane;
/** full an array with the number of bytes that the video
* data occupies per line for each plane of the input video */
for (plane = 0; plane < 4; plane++) {
- fieldorder->line_size[plane] = av_image_get_linesize(
- inlink->format,
- inlink->w,
- plane);
+ s->line_size[plane] = av_image_get_linesize(inlink->format, inlink->w,
+ plane);
}
return 0;
}
-static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
-{
- AVFilterContext *ctx = inlink->dst;
- AVFilterLink *outlink = ctx->outputs[0];
-
- return ff_get_video_buffer(outlink, w, h);
-}
-
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
AVFilterContext *ctx = inlink->dst;
uint8_t *data;
if (!frame->interlaced_frame ||
- frame->top_field_first == s->dst_tff)
+ frame->top_field_first == s->dst_tff) {
+ av_log(ctx, AV_LOG_VERBOSE,
+ "Skipping %s.\n",
+ frame->interlaced_frame ?
+ "frame with same field order" : "progressive frame");
return ff_filter_frame(outlink, frame);
+ }
av_dlog(ctx,
"picture will move %s one line\n",
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_input,
- .get_video_buffer = get_video_buffer,
.filter_frame = filter_frame,
.needs_writable = 1,
},
{ NULL }
};
-AVFilter avfilter_vf_fieldorder = {
+AVFilter ff_vf_fieldorder = {
.name = "fieldorder",
.description = NULL_IF_CONFIG_SMALL("Set the field order."),
.priv_size = sizeof(FieldOrderContext),