[FFmpeg-devel] [PATCH] ffmpeg: add verbose consistency checks in case of filtering inconsistent options

Michael Niedermayer michaelni at gmx.at
Sun Nov 3 16:31:02 CET 2013


On Sun, Nov 03, 2013 at 10:50:16AM +0100, Stefano Sabatini wrote:
> In particular, warn in case -filter and streamcopy is used at the same
> time, fix trac ticket #678.
> ---
>  ffmpeg_opt.c | 37 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index c9283d6..12bfb34 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -1171,6 +1171,26 @@ static char *get_ost_filters(OptionsContext *o, AVFormatContext *oc,
>                       "null" : "anull");
>  }
>  
> +#define CHECK_STREAMCOPY_FILTERS(ost, type) do {                        \
> +    if (ost->stream_copy) {                                             \
> +        char *filter_script = NULL, *filter = NULL;                     \
> +        MATCH_PER_STREAM_OPT(filter_scripts, str, filter_script, oc, st); \
> +        MATCH_PER_STREAM_OPT(filters,        str, filter,        oc, st); \
> +                                                                        \
> +        if (filter_script || filter) {                                  \
> +            av_log(NULL, AV_LOG_ERROR,                                  \
> +                   "Filter '%s' or filter_script '%s' was defined for %s output stream " \
> +                   "%d:%d but codec copy was selected.\n"               \
> +                   "Filtering and streamcopy cannot be used together.", \
> +                   (char *)av_x_if_null(filter, "(none)"),              \
> +                   (char *)av_x_if_null(filter_script, "(none)"),       \
> +                   av_get_media_type_string(AVMEDIA_TYPE_##type),       \
> +                   ost->file_index, ost->index);                        \
> +            exit_program(1);                                            \
> +        }                                                               \
> +    }                                                                   \
> +} while (0)

i would prefer this as function instead of macro due to better
readability

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

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131103/164585a9/attachment.asc>


More information about the ffmpeg-devel mailing list