[FFmpeg-devel] [PATCH] List configurable codecs, (de)muxers, etc.

Måns Rullgård mans
Fri Jul 27 15:11:10 CEST 2007


Panagiotis Issaris <takis.issaris at uhasselt.be> writes:

> Hi,
>
> M?ns Rullg?rd wrote:
>> Aurelien Jacobs <aurel at gnuage.org> writes:
>> 
>>> Might be simplified using something like:
>>>   --list-*)
>>>   NAME=`echo "$opt" | sed......
>>>   NAME=`toupper $NAME`
>>>   show_list `eval \$${NAME}_LIST`
>> 
>> My thoughts as well.
>
> The attached patch takes Aurelien's suggestion into account.
>
> Currently it allows both:
> --list-encoder
> and
> --list-encoders
>
> While the --help info shows:
> --list-encoders
>
> As I found that nicer, although possibly a bit less consistent. What's
> your preference?
>
>  configure |   19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> With friendly regards,
> Takis
> Index: configure
> ===================================================================
> --- configure	(revision 9104)
> +++ configure	(working copy)
> @@ -160,6 +160,13 @@
>    echo "  --enable-protocol=NAME   enables protocol NAME"
>    echo "  --disable-protocol=NAME  disables protocol NAME"
>    echo "  --disable-protocols      disables all protocols"
> +  echo "  --list-decoders          show all available decoders"
> +  echo "  --list-encoders          show all available encoders"
> +  echo "  --list-muxers            show all available muxers"
> +  echo "  --list-demuxers          show all available demuxers"
> +  echo "  --list-parsers           show all available parsers"
> +  echo "  --list-protocols         show all available protocols"
> +  echo "  --list-bsfs              show all available bitstream filters"
>    echo
>    echo "Developer options (useful when working on FFmpeg itself):"
>    echo "  --enable-gprof           enable profiling with gprof [$gprof]"
> @@ -922,6 +929,13 @@
>      exit 1
>  }
>  
> +show_list() {
> +    for i in $*; do
> +        echo $i|sed 's/_[^_]*$//'
> +    done | sort
> +    exit 0
> +}

I agree with Diego's comments on this.

>  for opt do
>    optval="${opt#*=}"
>    case "$opt" in
> @@ -997,6 +1011,11 @@
>    echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
>    $action $option
>    ;;
> +  --list-*)
> +    NAME=`echo "$opt" | sed 's/--list-//;s/s$//;s/$/_LIST/'`
> +    NAME=`toupper $NAME`
> +    show_list `eval echo \\$${NAME}`

This (untested) looks nicer to me:

NAME="${opt#--list-}"
NAME=$(toupper ${NAME%s})
eval show_list \$${NAME}_LIST

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list