aboutsummaryrefslogtreecommitdiff
path: root/cmdutils.c
diff options
context:
space:
mode:
authorAnton Khirnov2012-04-27 06:56:56 +0200
committerAnton Khirnov2012-05-09 08:59:37 +0200
commitac71230902af1a8ebc7abf85143139ffb49838eb (patch)
tree1b3b3b4c484a35e0be341eca4cafe80d8befd930 /cmdutils.c
parentab165047a6142ca0c8c333c36f4ebb96477622d7 (diff)
lavfi: add video buffer sink, and use it in avtools
Also add the public interface libavfilter/buffersink.h. Based on a commit by Stefano Sabatini.
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c68
1 files changed, 0 insertions, 68 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 6d2e97f694..3cd11ca241 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1021,74 +1021,6 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s,
return opts;
}
-#if CONFIG_AVFILTER
-
-static int sink_init(AVFilterContext *ctx, const char *args, void *opaque)
-{
- SinkContext *priv = ctx->priv;
-
- if (!opaque)
- return AVERROR(EINVAL);
- *priv = *(SinkContext *)opaque;
-
- return 0;
-}
-
-static void null_end_frame(AVFilterLink *inlink) { }
-
-static int sink_query_formats(AVFilterContext *ctx)
-{
- SinkContext *priv = ctx->priv;
-
- if (priv->pix_fmts)
- avfilter_set_common_formats(ctx, avfilter_make_format_list(priv->pix_fmts));
- else
- avfilter_default_query_formats(ctx);
- return 0;
-}
-
-AVFilter sink = {
- .name = "sink",
- .priv_size = sizeof(SinkContext),
- .init = sink_init,
-
- .query_formats = sink_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;
-
- 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->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->pixel_aspect;
-
- return 1;
-}
-
-#endif /* CONFIG_AVFILTER */
-
void *grow_array(void *array, int elem_size, int *size, int new_size)
{
if (new_size >= INT_MAX / elem_size) {