mirror of https://github.com/FFmpeg/FFmpeg.git
The table is automatically generated from the definition of enum CodecID in avcodec.h and contains the name of all known codecs, even those for which no encoder nor decoder exists or is enabled. The table is queried using the avcodec_get_name function. If CONFIG_SMALL is true, the table is not compiled in; the avcodec_get_name looks for names in the list of available decoders and encoders.pull/2/head
parent
8b52b46c97
commit
b3be9f4a88
5 changed files with 117 additions and 0 deletions
@ -0,0 +1,85 @@ |
||||
#!/bin/sh |
||||
|
||||
# Copyright (c) 2011 Nicolas George |
||||
# |
||||
# This file is part of FFmpeg. |
||||
# |
||||
# FFmpeg is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU Lesser General Public |
||||
# License as published by the Free Software Foundation; either |
||||
# version 2.1 of the License, or (at your option) any later version. |
||||
# |
||||
# FFmpeg is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
# Lesser General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU Lesser General Public |
||||
# License along with FFmpeg; if not, write to the Free Software Foundation, |
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||
|
||||
set -e |
||||
|
||||
config="$1" |
||||
codecs="$2" |
||||
out="$3" |
||||
test -n "$out" |
||||
|
||||
outval="" |
||||
|
||||
add_line () { |
||||
outval="$outval$* |
||||
" |
||||
} |
||||
|
||||
parse_config_h () { |
||||
while read define var value; do |
||||
case "$define $var $value" in |
||||
"#define CONFIG_"*_*" 1") eval "$var=1";; |
||||
esac |
||||
done |
||||
} |
||||
|
||||
define_codecid () { |
||||
id="$1" |
||||
n=${1#CODEC_ID_} |
||||
add_line "case ${id}:" |
||||
eval "c=\${CONFIG_${n}_DECODER}:\${CONFIG_${n}_ENCODER}" |
||||
case "$c" in |
||||
1:*) s="decoder";; |
||||
*:1) s="encoder";; |
||||
*) s="";; |
||||
esac |
||||
case "$s" in |
||||
"") add_line " return \"$n\";" ;; |
||||
*) |
||||
add_line " { extern AVCodec ff_${n}_${s};" |
||||
add_line " return ff_${n}_${s}.name; }" |
||||
;; |
||||
esac |
||||
} |
||||
|
||||
parse_enum_codecid () { |
||||
while read line; do |
||||
case "$line" in |
||||
"};") break;; |
||||
*CODEC_ID_FIRST*///*dummy*) ;; |
||||
CODEC_ID_*) define_codecid ${line%%[=,]*};; |
||||
esac |
||||
done |
||||
} |
||||
|
||||
parse_avcodec_h () { |
||||
while read line; do |
||||
case "$line" in |
||||
"enum CodecID {") parse_enum_codecid; break;; |
||||
esac |
||||
done |
||||
} |
||||
|
||||
parse_config_h < "$config" |
||||
parse_avcodec_h < "$codecs" |
||||
sed -e '/case.*:/ ! y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \ |
||||
-e 's/extern avcodec /extern AVCodec /' > "$out" <<EOF |
||||
$outval |
||||
EOF |
Loading…
Reference in new issue