[MPlayer-dev-eng] [PATCH] Recognize audio format mp3 in wav files

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Jul 25 21:33:27 CEST 2012


On Wed, Jul 25, 2012 at 11:20:34AM +0200, Ingo Brückl wrote:
> Reimar Döffinger wrote on Tue, 24 Jul 2012 21:58:51 +0200:
> 
> > On 24 Jul 2012, at 13:23, Ingo Brückl <ib at wupperonline.de> wrote:
> >> Subject says it all.
> >>
> >> I happen to have a wav file that contains mp3 data. MPlayer's default
> >> demuxer can't play it, while -demuxer lavf plays it just fine. The patch
> >> makes MPlayer's default demuxer to play it as well.
> >>
> >> If there are no objections, I'd like to commit.
> 
> > It doesn't really seem right to me, looks like it forces the demuxer to
> > misdetect it as raw MP3 file.
> 
> Yes, that's the basic idea.
> 
> > What exactly is the problem/why does it not work?
> > Is it maybe just a matter of enabling parsing in that case?
> 
> It is a wav file with RIFF/WAVE/fmt header, but audio format 0x55 0x00 (mp3).
> It currently will be detected as frmt == WAV and does not play.
> 
> I thought I've improved parsing, but if I didn't please advise.

The problem is that is it _is_ a WAV file, and it needs the parsing
steps related to WAV (like reading and respecting the data size).
I couldn't fully test it (my audio output isn't working right
currently), but I think this is the correct way to fix it:
Index: libmpdemux/demux_audio.c
===================================================================
--- libmpdemux/demux_audio.c	(revision 35040)
+++ libmpdemux/demux_audio.c	(working copy)
@@ -586,11 +586,12 @@
 	    }
 	}
 	if (sh_audio->format == 0x2001) {
-	    sh_audio->needs_parsing = 1;
 	    mp_msg(MSGT_DEMUX,MSGL_DBG2,"[demux_audio] DTS sync offset = %u\n", i);
         }
 
     }
+    // All formats that have a parser will need it when stored in WAV
+    sh_audio->needs_parsing = 1;
     stream_seek(s,demuxer->movi_start);
   } break;
   case fLaC:


More information about the MPlayer-dev-eng mailing list