diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-10-12 18:40:26 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-10-12 18:40:26 +0000 |
commit | f7ead94c69bf7b7f8ef63fbe8c869982e2bb5048 (patch) | |
tree | 7a384b92352ab755e0531699d0232728669f2a51 /ffmpeg.c | |
parent | f5b05b951c81f23c8a79f1c19b2657f85d43f93a (diff) | |
download | ffmpeg-streaming-f7ead94c69bf7b7f8ef63fbe8c869982e2bb5048.zip ffmpeg-streaming-f7ead94c69bf7b7f8ef63fbe8c869982e2bb5048.tar.gz |
Factorize definition of the output_filter defined in both ffplay.c and
ffmpeg.c.
Replace it with a more generic definition which can be shared.
Originally committed as revision 25453 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 50 |
1 files changed, 3 insertions, 47 deletions
@@ -339,34 +339,6 @@ static struct termios oldtty; #endif #if CONFIG_AVFILTER -typedef struct { - int pix_fmt; -} FilterOutPriv; - - -static int output_init(AVFilterContext *ctx, const char *args, void *opaque) -{ - FilterOutPriv *priv = ctx->priv; - - if(!opaque) return -1; - - priv->pix_fmt = *((int *)opaque); - - return 0; -} - -static void output_end_frame(AVFilterLink *link) -{ -} - -static int output_query_formats(AVFilterContext *ctx) -{ - FilterOutPriv *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; -} static int get_filtered_video_pic(AVFilterContext *ctx, AVFilterBufferRef **picref, AVFrame *pic2, @@ -391,29 +363,13 @@ static int get_filtered_video_pic(AVFilterContext *ctx, return 1; } -static AVFilter output_filter = -{ - .name = "ffmpeg_output", - - .priv_size = sizeof(FilterOutPriv), - .init = output_init, - - .query_formats = output_query_formats, - - .inputs = (AVFilterPad[]) {{ .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .end_frame = output_end_frame, - .min_perms = AV_PERM_READ, }, - { .name = NULL }}, - .outputs = (AVFilterPad[]) {{ .name = NULL }}, -}; - static int configure_filters(AVInputStream *ist, AVOutputStream *ost) { AVFilterContext *last_filter, *filter; /** filter graph containing all filters including input & output */ AVCodecContext *codec = ost->st->codec; AVCodecContext *icodec = ist->st->codec; + FFSinkContext ffsink_ctx = { .pix_fmt = codec->pix_fmt }; char args[255]; int ret; @@ -421,7 +377,7 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost) if ((ret = avfilter_open(&ist->input_video_filter, avfilter_get_by_name("buffer"), "src")) < 0) return ret; - if ((ret = avfilter_open(&ist->output_video_filter, &output_filter, "out")) < 0) + if ((ret = avfilter_open(&ist->output_video_filter, &ffsink, "out")) < 0) return ret; snprintf(args, 255, "%d:%d:%d:%d:%d", ist->st->codec->width, @@ -429,7 +385,7 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost) ist->st->time_base.num, ist->st->time_base.den); if ((ret = avfilter_init_filter(ist->input_video_filter, args, NULL)) < 0) return ret; - if ((ret = avfilter_init_filter(ist->output_video_filter, NULL, &codec->pix_fmt)) < 0) + if ((ret = avfilter_init_filter(ist->output_video_filter, NULL, &ffsink_ctx)) < 0) return ret; /* add input and output filters to the overall graph */ |