[MPlayer-dev-eng] [PATCH] Fix for audio-on-OGM timestamp calculation

Moritz Bunkus moritz at bunkus.org
Sat Sep 14 18:58:47 CEST 2002


Hi.

Attached is a small patch that fixes the way mplayer calculates the
timestamps for audio streams other than Vorbis (e.g. MP3, AC3) when
reading an OGG/OGM file. The problem was that vi.rate was also
dependant of the audio channels. According to Xiph's documentation
this is false:

'The granule position of pages contining Vorbis audio is in units of
PCM audio samples (per channel; a stereo stream's granule position does
no increment at twice the speed of a mono stream).'
(see http://www.xiph.org/ogg/vorbis/doc/vorbis-ogg.html)

The patch is against the CVS version from 2002/09/14.

-- 
 ==> Ciao, Mosu (Moritz Bunkus)
-------------- next part --------------
--- demux_ogg.c	2002-08-28 19:07:55.000000000 +0200
+++ demux_ogg-bunkus.c	2002-09-14 18:54:49.000000000 +0200
@@ -529,7 +529,7 @@
 	if(extra_size > 0)
 	  memcpy(sh_a->wf+sizeof(WAVEFORMATEX),pack.packet+142,extra_size);
 
-	ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate * sh_a->channels;
+	ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate; // * sh_a->channels;
 	n_audio++;
 	mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is audio (old hdr)\n",ogg_d->num_sub);
 	if(verbose) print_wave_header(sh_a->wf);
@@ -580,7 +580,7 @@
 	if(extra_size)
 	  memcpy(sh_a->wf+sizeof(WAVEFORMATEX),st+1,extra_size);
 
-	ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate * sh_a->channels;
+	ogg_d->subs[ogg_d->num_sub].samplerate = sh_a->samplerate; // * sh_a->channels;
 	n_audio++;
 	mp_msg(MSGT_DEMUX,MSGL_V,"OGG stream %d is audio (new hdr)\n",ogg_d->num_sub);
 	if(verbose) print_wave_header(sh_a->wf);


More information about the MPlayer-dev-eng mailing list