From 9bb936a80e72ae3439ded56f08f3d558700537c2 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Mon, 13 Aug 2012 11:27:20 +0200 Subject: [PATCH] lavc: reimplement avcodec_get_name with descriptors. --- libavcodec/Makefile | 8 ---- libavcodec/codec_names.sh | 84 --------------------------------------- libavcodec/utils.c | 9 ++--- 3 files changed, 4 insertions(+), 97 deletions(-) delete mode 100755 libavcodec/codec_names.sh diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 251a6b22fc..34e4cc302b 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -785,7 +785,6 @@ OBJS-$(!CONFIG_SMALL) += inverse.o SKIPHEADERS += %_tablegen.h \ %_tables.h \ aac_tablegen_decl.h \ - codec_names.h \ fft-internal.h \ old_codec_ids.h \ tableprint.h \ @@ -860,10 +859,3 @@ $(SUBDIR)motionpixels.o: $(SUBDIR)motionpixels_tables.h $(SUBDIR)pcm.o: $(SUBDIR)pcm_tables.h $(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h endif - -CODEC_NAMES_SH := $(SRC_PATH)/$(SUBDIR)codec_names.sh -AVCODEC_H := $(SRC_PATH)/$(SUBDIR)avcodec.h -$(SUBDIR)codec_names.h: $(CODEC_NAMES_SH) config.h $(AVCODEC_H) - $(CC) $(CPPFLAGS) $(CFLAGS) -E $(AVCODEC_H) | \ - $(CODEC_NAMES_SH) config.h $@ -$(SUBDIR)utils.o: $(SUBDIR)codec_names.h diff --git a/libavcodec/codec_names.sh b/libavcodec/codec_names.sh deleted file mode 100755 index 44ccb45afe..0000000000 --- a/libavcodec/codec_names.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/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" -out="$2" -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#AV_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;; - *AV_CODEC_ID_FIRST*=*) ;; - AV_CODEC_ID_*) define_codecid ${line%%[=,]*};; - esac - done -} - -parse_avcodec_h () { - while read line; do - case "$line" in - "enum AVCodecID {") parse_enum_codecid; break;; - esac - done -} - -parse_config_h < "$config" -parse_avcodec_h # use stdin -sed -e '/case.*:/!y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \ - -e 's/extern avcodec /extern AVCodec /' > "$out" <name; av_log(NULL, AV_LOG_WARNING, "Codec 0x%x is not in the full list.\n", id); -#endif codec = avcodec_find_decoder(id); if (codec) return codec->name;