changeset 21966:d9494ca70ca7

Simplify by using av_codec_get_id and include riff.h only in demux_lavf.c
author reimar
date Sun, 21 Jan 2007 15:44:58 +0000
parents 5a2311125dc4
children ddcdba92023c
files libmpcodecs/ae_lavc.c libmpdemux/demux_lavf.c libmpdemux/muxer_lavf.c
diffstat 3 files changed, 14 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ae_lavc.c	Sun Jan 21 11:10:52 2007 +0000
+++ b/libmpcodecs/ae_lavc.c	Sun Jan 21 15:44:58 2007 +0000
@@ -31,12 +31,10 @@
 #if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
 #ifdef USE_LIBAVFORMAT_SO
 #include <ffmpeg/avformat.h>
-#include <ffmpeg/riff.h>
 #else
 #include "libavformat/avformat.h"
-#include "libavformat/riff.h"
 #endif
-extern const AVCodecTag mp_wav_tags[];
+extern const struct AVCodecTag *mp_wav_taglists[];
 #endif
 
 static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a)
@@ -182,9 +180,7 @@
 	if(lavc_param_atag == 0)
 	{
 #if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
-		lavc_param_atag = codec_get_wav_tag(lavc_acodec->id);
-                if(!lavc_param_atag)
-                        lavc_param_atag =  codec_get_tag(mp_wav_tags, lavc_acodec->id);
+		lavc_param_atag = av_codec_get_tag(mp_wav_taglists, lavc_acodec->id);
 #else
 		lavc_param_atag = lavc_find_atag(lavc_param_acodec);
 #endif
--- a/libmpdemux/demux_lavf.c	Sun Jan 21 11:10:52 2007 +0000
+++ b/libmpdemux/demux_lavf.c	Sun Jan 21 15:44:58 2007 +0000
@@ -67,7 +67,7 @@
 
 int64_t ff_gcd(int64_t a, int64_t b);
 
-const AVCodecTag mp_wav_tags[] = {
+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')},
@@ -86,7 +86,9 @@
     { 0, 0 },
 };
 
-const AVCodecTag mp_bmp_tags[] = {
+const struct AVCodecTag *mp_wav_taglists[] = {codec_wav_tags, mp_wav_tags, 0};
+
+static const AVCodecTag mp_bmp_tags[] = {
     { CODEC_ID_DSICINVIDEO,       MKTAG('D', 'C', 'I', 'V')},
     { CODEC_ID_FLIC,              MKTAG('F', 'L', 'I', 'C')},
     { CODEC_ID_IDCIN,             MKTAG('I', 'D', 'C', 'I')},
@@ -99,6 +101,8 @@
     { 0, 0 },
 };
 
+const struct AVCodecTag *mp_bmp_taglists[] = {codec_bmp_tags, mp_bmp_tags, 0};
+
 static int mp_open(URLContext *h, const char *filename, int flags){
     return 0;
 }
@@ -252,9 +256,7 @@
             priv->astreams[priv->audio_streams] = i;
             priv->audio_streams++;
             if(!codec->codec_tag)
-                codec->codec_tag= codec_get_wav_tag(codec->codec_id);
-            if(!codec->codec_tag)
-                codec->codec_tag= codec_get_tag(mp_wav_tags, codec->codec_id);
+                codec->codec_tag= av_codec_get_tag(mp_wav_taglists, codec->codec_id);
             wf->wFormatTag= codec->codec_tag;
             wf->nChannels= codec->channels;
             wf->nSamplesPerSec= codec->sample_rate;
@@ -326,9 +328,7 @@
             bih=calloc(sizeof(BITMAPINFOHEADER) + codec->extradata_size,1);
 
             if(!codec->codec_tag)
-                codec->codec_tag= codec_get_bmp_tag(codec->codec_id);
-            if(!codec->codec_tag)
-                codec->codec_tag= codec_get_tag(mp_bmp_tags, codec->codec_id);
+                codec->codec_tag= av_codec_get_tag(mp_bmp_taglists, codec->codec_id);
             bih->biSize= sizeof(BITMAPINFOHEADER) + codec->extradata_size;
             bih->biWidth= codec->width;
             bih->biHeight= codec->height;
--- a/libmpdemux/muxer_lavf.c	Sun Jan 21 11:10:52 2007 +0000
+++ b/libmpdemux/muxer_lavf.c	Sun Jan 21 15:44:58 2007 +0000
@@ -22,9 +22,9 @@
 #else
 #include "avformat.h"
 #endif
-#include "libavformat/riff.h"
 
-extern const AVCodecTag mp_wav_tags[];
+extern const struct AVCodecTag *mp_wav_taglists[];
+extern const struct AVCodecTag *mp_bmp_taglists[];
 
 extern char *info_name;
 extern char *info_artist;
@@ -207,9 +207,7 @@
 
 	if(stream->type == MUXER_TYPE_AUDIO)
 	{
-		ctx->codec_id = codec_get_wav_id(stream->wf->wFormatTag); 
-                if(!ctx->codec_id)
-                        ctx->codec_id = codec_get_id(mp_wav_tags, stream->wf->wFormatTag);
+		ctx->codec_id = av_codec_get_id(mp_wav_taglists, stream->wf->wFormatTag); 
 #if 0 //breaks aac in mov at least
 		ctx->codec_tag = codec_get_wav_tag(ctx->codec_id);
 #endif
@@ -238,7 +236,7 @@
 	}
 	else if(stream->type == MUXER_TYPE_VIDEO)
 	{
-		ctx->codec_id = codec_get_bmp_id(stream->bih->biCompression);
+		ctx->codec_id = av_codec_get_id(mp_bmp_taglists, stream->bih->biCompression);
                 if(ctx->codec_id <= 0 || force_fourcc)
                     ctx->codec_tag= stream->bih->biCompression;
 		mp_msg(MSGT_MUXER, MSGL_INFO, "VIDEO CODEC ID: %d\n", ctx->codec_id);