[MPlayer-dev-eng] [PATCH] OGG demuxer audio codec detection

Moritz Bunkus moritz at bunkus.org
Tue Jul 30 11:51:30 CEST 2002


Hi.

Here's a very small patch that changes the audio codec detection for
the OGG demuxer from atoi(...) to strtol(..., 16). Background: the
stream header has a four-character array for the codec type. Most of
the time these numbers are in hex (0x0055 for MP3, 0x2000 for AC3...)
and not in decimal (atoi...).

I don't know how endianess is handled in MPlayer so I'll leave it to
your capable hands.

-- 
 ==> Ciao, Mosu (Moritz Bunkus)
-------------- next part --------------
--- demux_ogg.c	2002-05-23 11:47:07.000000000 +0200
+++ demux_ogg-mb.c	2002-07-30 11:36:05.000000000 +0200
@@ -499,7 +499,7 @@
 	buffer[4] = '\0';
 	sh_a = new_sh_audio(demuxer,ogg_d->num_sub);
 	sh_a->wf = (WAVEFORMATEX*)calloc(1,sizeof(WAVEFORMATEX)+extra_size);
-	sh_a->format =  sh_a->wf->wFormatTag = atoi(buffer);
+	sh_a->format =  sh_a->wf->wFormatTag = strtol(buffer, NULL, 16);
 	sh_a->channels = sh_a->wf->nChannels = st->sh.audio.channels;
 	sh_a->samplerate = sh_a->wf->nSamplesPerSec = st->samples_per_unit;
 	sh_a->wf->nAvgBytesPerSec = st->sh.audio.avgbytespersec;


More information about the MPlayer-dev-eng mailing list