[FFmpeg-devel] [PATCH] lavfi test for 1-1 filters pixel format output

Michael Niedermayer michaelni
Thu Apr 1 01:36:08 CEST 2010


On Mon, Mar 22, 2010 at 11:52:12PM +0100, Stefano Sabatini wrote:
> Hi,
> 
> this test checks for the output of some selected filters with all the
> input pixel formats supported by each of the filters.
> 
> Only filters with exactly one input and one output are tested.
> 
> Note that many of the issued files *cannot be reproduced* y ffplay, as
> for many of them there is no support by nut.
> 
> While we'll find some way to extend nut for that, here it is the patch
> for the first review.
> 
> Regards.
> -- 
> FFmpeg = Fundamental & Fabulous Mortal Ponderous Exploitable Gadget

[...]
> +int main(int argc, char **argv)
> +{
> +    AVFilter *filter;
> +    AVFilterContext *filter_ctx;
> +    const char *filter_name;
> +    const char *filter_args = NULL;
> +    int i, j;
> +
> +    av_log_set_level(AV_LOG_DEBUG);
> +
> +    if (!argv[1]) {
> +        fprintf(stderr, "Missing filter name as argument\n");
> +        return 1;
> +    }
> +
> +    filter_name = argv[1];
> +    if (argv[2])
> +        filter_args = argv[2];
> +
> +    avfilter_register_all();
> +
> +    /* get a corresponding filter and open it */
> +    if (!(filter = avfilter_get_by_name(filter_name))) {
> +        fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name);
> +        return 1;
> +    }
> +
> +    if (!(filter_ctx = avfilter_open(filter, NULL))) {
> +        fprintf(stderr, "Inpossible to open filter with name '%s'\n", filter_name);
> +        return 1;
> +    }
> +    if (avfilter_init_filter(filter_ctx, filter_args, NULL) < 0) {
> +        fprintf(stderr, "Impossible to init filter '%s' with arguments '%s'\n", filter_name, filter_args);
> +        return 1;
> +    }
> +
> +    /* create a link for each of the input pads */
> +    for (i = 0; i < filter_ctx->input_count; i++) {
> +        AVFilterLink *link = av_malloc(sizeof(AVFilterLink));
> +        filter_ctx->inputs[i] = link;
> +    }
> +    for (i = 0; i < filter_ctx->output_count; i++) {
> +        AVFilterLink *link = av_malloc(sizeof(AVFilterLink));
> +        filter_ctx->outputs[i] = link;
> +    }
> +

> +    if (filter->query_formats)
> +        filter->query_formats(filter_ctx);
> +    else
> +        avfilter_default_query_formats(filter_ctx);

i wonder if this should be a function somewhere...

anyway most of this patch falls under the shell script posix area
so review left to mans

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100401/0ec4dc1b/attachment.pgp>



More information about the ffmpeg-devel mailing list