diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-06-11 18:43:11 +0200 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2011-06-19 19:18:33 +0200 |
commit | 44f669e7bc4f7f064e3f81d3596637a0e043b501 (patch) | |
tree | 36210b9886f202f885867abee1455838168a6c51 /cmdutils.c | |
parent | e89ba76a59ce31320083b74f41e26bf4f64df8dd (diff) | |
download | ffmpeg-44f669e7bc4f7f064e3f81d3596637a0e043b501.tar.gz |
lavfi: add vsink_buffer, and use it in ff* tools
Also add the public interface libavfilter/vsink_buffer.h.
Diffstat (limited to 'cmdutils.c')
-rw-r--r-- | cmdutils.c | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/cmdutils.c b/cmdutils.c index 3b9cfaa3d9..c3c5c0efa9 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -962,71 +962,3 @@ FILE *get_preset_file(char *filename, size_t filename_size, return f; } - -#if CONFIG_AVFILTER - -static int ffsink_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - FFSinkContext *priv = ctx->priv; - - if (!opaque) - return AVERROR(EINVAL); - *priv = *(FFSinkContext *)opaque; - - return 0; -} - -static void null_end_frame(AVFilterLink *inlink) { } - -static int ffsink_query_formats(AVFilterContext *ctx) -{ - FFSinkContext *priv = ctx->priv; - enum PixelFormat pix_fmts[] = { priv->pix_fmt, PIX_FMT_NONE }; - - avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); - return 0; -} - -AVFilter ffsink = { - .name = "ffsink", - .priv_size = sizeof(FFSinkContext), - .init = ffsink_init, - - .query_formats = ffsink_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .end_frame = null_end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; - -int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame, - AVFilterBufferRef **picref_ptr, AVRational *tb) -{ - int ret; - AVFilterBufferRef *picref; - *picref_ptr = NULL; - - if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0) - return ret; - if (!(picref = ctx->inputs[0]->cur_buf)) - return AVERROR(ENOENT); - *picref_ptr = picref; - ctx->inputs[0]->cur_buf = NULL; - *tb = ctx->inputs[0]->time_base; - - memcpy(frame->data, picref->data, sizeof(frame->data)); - memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize)); - frame->pkt_pos = picref->pos; - frame->interlaced_frame = picref->video->interlaced; - frame->top_field_first = picref->video->top_field_first; - frame->key_frame = picref->video->key_frame; - frame->pict_type = picref->video->pict_type; - frame->sample_aspect_ratio = picref->video->sample_aspect_ratio; - - return 1; -} - -#endif /* CONFIG_AVFILTER */ |