[MPlayer-dev-eng] [PATCH] add our own codec_id -> fourcc mapping tables to demux_lavf

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Nov 5 19:55:59 CET 2006


Hello,
this patch will fix the audio of some files (e.g.
http://samples.mplayerhq.hu/A-codecs/MACE/Bach1-1.aiff and
http://samples.mplayerhq.hu/MXF/ebu_small.mxf )
but the main point is to make it easy to move entries from the
libavformat/riff.c.
The hope is that if it is that simple we can start a more rational
discussion about what actually belongs there an which are just hacks to
please MPlayer.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c	(revision 20716)
+++ libmpdemux/demux_lavf.c	(working copy)
@@ -33,8 +33,14 @@
 #ifdef USE_LIBAVFORMAT_SO
 #include <ffmpeg/avformat.h>
 #include <ffmpeg/opt.h>
+typedef struct CodecTag {
+    int id;
+    unsigned int tag;
+    unsigned int invalid_asf : 1;
+} CodecTag;
 #else
 #include "avformat.h"
+#include "riff.h"
 #include "avi.h"
 #include "opt.h"
 #endif
@@ -65,6 +71,18 @@
 
 int64_t ff_gcd(int64_t a, int64_t b);
 
+const CodecTag mp_wav_tags[] = {
+    { CODEC_ID_ADPCM_4XM, MKTAG('4', 'X', 'M', 'A')},
+    { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')},
+    { CODEC_ID_PCM_S8,    MKTAG('t', 'w', 'o', 's')},
+    { 0, 0 },
+};
+
+const CodecTag mp_bmp_tags[] = {
+    { CODEC_ID_XAN_WC3, MKTAG('W', 'C', '3', 'V')},
+    { 0, 0 },
+};
+
 static int mp_open(URLContext *h, const char *filename, int flags){
     return 0;
 }
@@ -213,6 +231,8 @@
             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);
             wf->wFormatTag= codec->codec_tag;
             wf->nChannels= codec->channels;
             wf->nSamplesPerSec= codec->sample_rate;
@@ -279,6 +299,8 @@
 	    priv->video_streams++;
             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);
             bih->biSize= sizeof(BITMAPINFOHEADER) + codec->extradata_size;
             bih->biWidth= codec->width;
             bih->biHeight= codec->height;


More information about the MPlayer-dev-eng mailing list