From 698142597eb833c7d32d38b78966658526637149 Mon Sep 17 00:00:00 2001 From: albeu Date: Wed, 9 Apr 2008 00:46:21 +0000 Subject: [PATCH] Split the lavf taglists out of the lavf muxer to allow using libmpmux without libmpdemux. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26360 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/Makefile | 3 +- libmpdemux/demux_lavf.c | 60 +---------------------------- libmpdemux/mp_taglists.c | 81 ++++++++++++++++++++++++++++++++++++++++ libmpdemux/mp_taglists.h | 28 ++++++++++++++ libmpdemux/muxer_lavf.c | 5 +-- 5 files changed, 115 insertions(+), 62 deletions(-) create mode 100644 libmpdemux/mp_taglists.c create mode 100644 libmpdemux/mp_taglists.h diff --git a/libmpdemux/Makefile b/libmpdemux/Makefile index 38d28ec399..37c70ae82b 100644 --- a/libmpdemux/Makefile +++ b/libmpdemux/Makefile @@ -38,6 +38,7 @@ SRCS_COMMON = aac_hdr.c \ extension.c \ mf.c \ mp3_hdr.c \ + mp_taglists.c \ mpeg_hdr.c \ mpeg_packetizer.c \ parse_es.c \ @@ -67,6 +68,6 @@ SRCS_MENCODER-$(LIBAVFORMAT) += muxer_lavf.c include ../mpcommon.mak -demux_lavf.o: CFLAGS += -I../libavcodec +demux_lavf.o mp_taglists.o: CFLAGS += -I../libavcodec dep depend: CFLAGS += $(EXTRAXX_INC) diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 0b243cdd18..c0ddcc7e3a 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -37,6 +37,8 @@ #include "libavcodec/opt.h" #include "libavformat/riff.h" +#include "mp_taglists.h" + #define PROBE_BUF_SIZE 2048 extern char *audio_lang; @@ -76,64 +78,6 @@ typedef struct lavf_priv_t{ extern void print_wave_header(WAVEFORMATEX *h, int verbose_level); extern void print_video_header(BITMAPINFOHEADER *h, int verbose_level); -static const AVCodecTag mp_wav_tags[] = { - { CODEC_ID_ADPCM_4XM, MKTAG('4', 'X', 'M', 'A')}, - { CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')}, - { CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S')}, - { CODEC_ID_ADPCM_THP, MKTAG('T', 'H', 'P', 'A')}, - { CODEC_ID_AMR_NB, MKTAG('n', 'b', 0, 0)}, - { CODEC_ID_COOK, MKTAG('c', 'o', 'o', 'k')}, - { CODEC_ID_DSICINAUDIO, MKTAG('D', 'C', 'I', 'A')}, - { CODEC_ID_INTERPLAY_DPCM, MKTAG('I', 'N', 'P', 'A')}, - { CODEC_ID_MUSEPACK7, MKTAG('M', 'P', 'C', ' ')}, - { CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8')}, - { CODEC_ID_NELLYMOSER, MKTAG('N', 'E', 'L', 'L')}, - { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2')}, - { CODEC_ID_ROQ_DPCM, MKTAG('R', 'o', 'Q', 'A')}, - { CODEC_ID_SHORTEN, MKTAG('s', 'h', 'r', 'n')}, - { CODEC_ID_SPEEX, MKTAG('s', 'p', 'x', ' ')}, - { CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1')}, - { CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K')}, - { CODEC_ID_WESTWOOD_SND1, MKTAG('S', 'N', 'D', '1')}, - { CODEC_ID_XAN_DPCM, MKTAG('A', 'x', 'a', 'n')}, - { 0, 0 }, -}; - -const struct AVCodecTag *mp_wav_taglists[] = {codec_wav_tags, mp_wav_tags, 0}; - -static const AVCodecTag mp_wav_override_tags[] = { - { CODEC_ID_PCM_S8, MKTAG('t', 'w', 'o', 's')}, - { CODEC_ID_PCM_U8, 1}, - { CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's')}, - { CODEC_ID_PCM_S16LE, 1}, - { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')}, - { 0, 0 }, -}; - -const struct AVCodecTag *mp_wav_override_taglists[] = {mp_wav_override_tags, 0}; - -static const AVCodecTag mp_bmp_tags[] = { - { CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'V')}, - { CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')}, - { CODEC_ID_C93, MKTAG('C', '9', '3', 'V')}, - { CODEC_ID_DSICINVIDEO, MKTAG('D', 'C', 'I', 'V')}, - { CODEC_ID_DXA, MKTAG('D', 'X', 'A', '1')}, - { CODEC_ID_FLIC, MKTAG('F', 'L', 'I', 'C')}, - { CODEC_ID_IDCIN, MKTAG('I', 'D', 'C', 'I')}, - { CODEC_ID_INTERPLAY_VIDEO, MKTAG('I', 'N', 'P', 'V')}, - { CODEC_ID_ROQ, MKTAG('R', 'o', 'Q', 'V')}, - { CODEC_ID_THP, MKTAG('T', 'H', 'P', 'V')}, - { CODEC_ID_TIERTEXSEQVIDEO, MKTAG('T', 'S', 'E', 'Q')}, - { CODEC_ID_TXD, MKTAG('T', 'X', 'D', 'V')}, - { CODEC_ID_VMDVIDEO, MKTAG('V', 'M', 'D', 'V')}, - { CODEC_ID_WS_VQA, MKTAG('V', 'Q', 'A', 'V')}, - { CODEC_ID_XAN_WC3, MKTAG('W', 'C', '3', 'V')}, - { CODEC_ID_NUV, MKTAG('N', 'U', 'V', '1')}, - { 0, 0 }, -}; - -const struct AVCodecTag *mp_bmp_taglists[] = {codec_bmp_tags, mp_bmp_tags, 0}; - static int mp_read(void *opaque, uint8_t *buf, int size) { stream_t *stream = opaque; int ret; diff --git a/libmpdemux/mp_taglists.c b/libmpdemux/mp_taglists.c new file mode 100644 index 0000000000..106b74861a --- /dev/null +++ b/libmpdemux/mp_taglists.c @@ -0,0 +1,81 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include "libavformat/avformat.h" +#include "libavformat/riff.h" + +static const AVCodecTag mp_wav_tags[] = { + { CODEC_ID_ADPCM_4XM, MKTAG('4', 'X', 'M', 'A')}, + { CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')}, + { CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S')}, + { CODEC_ID_ADPCM_THP, MKTAG('T', 'H', 'P', 'A')}, + { CODEC_ID_AMR_NB, MKTAG('n', 'b', 0, 0)}, + { CODEC_ID_COOK, MKTAG('c', 'o', 'o', 'k')}, + { CODEC_ID_DSICINAUDIO, MKTAG('D', 'C', 'I', 'A')}, + { CODEC_ID_INTERPLAY_DPCM, MKTAG('I', 'N', 'P', 'A')}, + { CODEC_ID_MUSEPACK7, MKTAG('M', 'P', 'C', ' ')}, + { CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8')}, + { CODEC_ID_NELLYMOSER, MKTAG('N', 'E', 'L', 'L')}, + { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2')}, + { CODEC_ID_ROQ_DPCM, MKTAG('R', 'o', 'Q', 'A')}, + { CODEC_ID_SHORTEN, MKTAG('s', 'h', 'r', 'n')}, + { CODEC_ID_SPEEX, MKTAG('s', 'p', 'x', ' ')}, + { CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1')}, + { CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K')}, + { CODEC_ID_WESTWOOD_SND1, MKTAG('S', 'N', 'D', '1')}, + { CODEC_ID_XAN_DPCM, MKTAG('A', 'x', 'a', 'n')}, + { 0, 0 }, +}; + +const struct AVCodecTag *mp_wav_taglists[] = {codec_wav_tags, mp_wav_tags, 0}; + +static const AVCodecTag mp_wav_override_tags[] = { + { CODEC_ID_PCM_S8, MKTAG('t', 'w', 'o', 's')}, + { CODEC_ID_PCM_U8, 1}, + { CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's')}, + { CODEC_ID_PCM_S16LE, 1}, + { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')}, + { 0, 0 }, +}; + +const struct AVCodecTag *mp_wav_override_taglists[] = {mp_wav_override_tags, 0}; + +static const AVCodecTag mp_bmp_tags[] = { + { CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'V')}, + { CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')}, + { CODEC_ID_C93, MKTAG('C', '9', '3', 'V')}, + { CODEC_ID_DSICINVIDEO, MKTAG('D', 'C', 'I', 'V')}, + { CODEC_ID_DXA, MKTAG('D', 'X', 'A', '1')}, + { CODEC_ID_FLIC, MKTAG('F', 'L', 'I', 'C')}, + { CODEC_ID_IDCIN, MKTAG('I', 'D', 'C', 'I')}, + { CODEC_ID_INTERPLAY_VIDEO, MKTAG('I', 'N', 'P', 'V')}, + { CODEC_ID_ROQ, MKTAG('R', 'o', 'Q', 'V')}, + { CODEC_ID_THP, MKTAG('T', 'H', 'P', 'V')}, + { CODEC_ID_TIERTEXSEQVIDEO, MKTAG('T', 'S', 'E', 'Q')}, + { CODEC_ID_TXD, MKTAG('T', 'X', 'D', 'V')}, + { CODEC_ID_VMDVIDEO, MKTAG('V', 'M', 'D', 'V')}, + { CODEC_ID_WS_VQA, MKTAG('V', 'Q', 'A', 'V')}, + { CODEC_ID_XAN_WC3, MKTAG('W', 'C', '3', 'V')}, + { CODEC_ID_NUV, MKTAG('N', 'U', 'V', '1')}, + { 0, 0 }, +}; + +const struct AVCodecTag *mp_bmp_taglists[] = {codec_bmp_tags, mp_bmp_tags, 0}; + diff --git a/libmpdemux/mp_taglists.h b/libmpdemux/mp_taglists.h new file mode 100644 index 0000000000..a5262652b7 --- /dev/null +++ b/libmpdemux/mp_taglists.h @@ -0,0 +1,28 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_MP_TAGLISTS_H +#define MPLAYER_MP_TAGLISTS_H + +extern const struct AVCodecTag *mp_wav_taglists[]; + +extern const struct AVCodecTag *mp_wav_override_taglists[]; + +extern const struct AVCodecTag *mp_bmp_taglists[]; + +#endif /* MPLAYER_MP_TAGLISTS_H */ diff --git a/libmpdemux/muxer_lavf.c b/libmpdemux/muxer_lavf.c index 8019044ec9..cd52168cdc 100644 --- a/libmpdemux/muxer_lavf.c +++ b/libmpdemux/muxer_lavf.c @@ -20,10 +20,9 @@ #include "libavformat/avformat.h" #include "libavutil/avstring.h" -enum PixelFormat imgfmt2pixfmt(int fmt); +#include "mp_taglists.h" -extern const struct AVCodecTag *mp_wav_taglists[]; -extern const struct AVCodecTag *mp_bmp_taglists[]; +enum PixelFormat imgfmt2pixfmt(int fmt); extern char *info_name; extern char *info_artist;