[MPlayer-cvslog] CVS: main/libmpdemux demux_mkv.c, 1.37, 1.38 demux_ogg.c, 1.67, 1.68
Richard Felker CVS
syncmail at mplayerhq.hu
Sun Feb 27 19:11:19 CET 2005
CVS change done by Richard Felker CVS
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv30894/libmpdemux
Modified Files:
demux_mkv.c demux_ogg.c
Log Message:
Fix the ogg fourcc nightmare!!!
The problem: once upon a time, windows idiots decided to try to store
vorbis-in-ogg-in-avi. Of course this failed miserably, but they used
the audio format tag 0xfffe for "extended" to do this. Later someone
working on MPlayer somehow decided 0xfffe was the format for vorbis,
which is nonsense, and now that's conflicting with real wav files with
extended audio format. This patch changes demux_ogg (and mkv) to use
sane fourcc's for vorbis and theora and gets rid of the 0xfffe
nonsense so hopefully wav files with extended audio will work now.
If there are problems, we'll have to find workarounds...and drive an
18-wheeler full of cola thru the house of whoever wrote this 0xfffe
nonsense in MPlayer to begin with...
Index: demux_mkv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- demux_mkv.c 21 Jan 2005 18:25:44 -0000 1.37
+++ demux_mkv.c 27 Feb 2005 18:11:16 -0000 1.38
@@ -1823,7 +1823,7 @@
track->header_sizes[2] = track->private_size - offset
- track->header_sizes[0] - track->header_sizes[1];
- track->a_formattag = 0xFFFE;
+ track->a_formattag = mmioFOURCC('v', 'r', 'b', 's');
}
else if (!strcmp(track->codec_id, MKV_A_QDMC))
track->a_formattag = mmioFOURCC('Q', 'D', 'M', 'C');
@@ -1952,7 +1952,7 @@
track->default_duration = 1024.0 / (float)sh_a->samplerate;
}
}
- else if (track->a_formattag == 0xFFFE) /* VORBIS */
+ else if (track->a_formattag == mmioFOURCC('v', 'r', 'b', 's')) /* VORBIS */
{
for (i=0; i < 3; i++)
{
Index: demux_ogg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ogg.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- demux_ogg.c 22 Feb 2005 19:18:45 -0000 1.67
+++ demux_ogg.c 27 Feb 2005 18:11:16 -0000 1.68
@@ -15,6 +15,9 @@
#include "demuxer.h"
#include "stheader.h"
+#define FOURCC_VORBIS mmioFOURCC('v', 'r', 'b', 's')
+#define FOURCC_THEORA mmioFOURCC('t', 'h', 'e', 'o')
+
#ifdef TREMOR
#include <tremor/ogg.h>
#include <tremor/ivorbiscodec.h>
@@ -527,17 +530,17 @@
// We jump nothing for FLAC. Ain't this great? Packet contents have to be
// handled differently for each and every stream type. The joy! The joy!
if(!os->flac && ((*pack->packet & PACKET_TYPE_HEADER) &&
- (ds != d->audio || ( ((sh_audio_t*)ds->sh)->format != 0xFFFE || os->hdr_packets >= NUM_VORBIS_HDR_PACKETS ) ) &&
- (ds != d->video || (((sh_video_t*)ds->sh)->format != 0xFFFC))))
+ (ds != d->audio || ( ((sh_audio_t*)ds->sh)->format != FOURCC_VORBIS || os->hdr_packets >= NUM_VORBIS_HDR_PACKETS ) ) &&
+ (ds != d->video || (((sh_video_t*)ds->sh)->format != FOURCC_THEORA))))
return 0;
// For vorbis packet the packet is the data, for other codec we must jump
// the header
- if(ds == d->audio && ((sh_audio_t*)ds->sh)->format == 0xFFFE) {
+ if(ds == d->audio && ((sh_audio_t*)ds->sh)->format == FOURCC_VORBIS) {
context = ((sh_audio_t *)ds->sh)->context;
samplesize = ((sh_audio_t *)ds->sh)->samplesize;
}
- if (ds == d->video && ((sh_audio_t*)ds->sh)->format == 0xFFFC)
+ if (ds == d->video && ((sh_audio_t*)ds->sh)->format == FOURCC_THEORA)
context = ((sh_video_t *)ds->sh)->context;
data = demux_ogg_read_packet(os,pack,context,&pts,&flags,samplesize);
if(d->video->id < 0)
@@ -589,13 +592,13 @@
if(demuxer->video->id >= 0) {
sid = demuxer->video->id;
/* demux_ogg_read_packet needs decoder context for Theora streams */
- if (((sh_video_t*)demuxer->video->sh)->format == 0xFFFC)
+ if (((sh_video_t*)demuxer->video->sh)->format == FOURCC_THEORA)
context = ((sh_video_t*)demuxer->video->sh)->context;
}
else {
sid = demuxer->audio->id;
/* demux_ogg_read_packet needs decoder context for Vorbis streams */
- if(((sh_audio_t*)demuxer->audio->sh)->format == 0xFFFE) {
+ if(((sh_audio_t*)demuxer->audio->sh)->format == FOURCC_VORBIS) {
context = ((sh_audio_t*)demuxer->audio->sh)->context;
samplesize = ((sh_audio_t*)demuxer->audio->sh)->samplesize;
}
@@ -813,7 +816,7 @@
// Check for Vorbis
if(pack.bytes >= 7 && ! strncmp(&pack.packet[1],"vorbis", 6) ) {
sh_a = new_sh_audio(demuxer,ogg_d->num_sub);
- sh_a->format = 0xFFFE;
+ sh_a->format = FOURCC_VORBIS;
ogg_d->subs[ogg_d->num_sub].vorbis = 1;
if (identify)
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_AUDIO_ID=%d\n", n_audio);
@@ -842,7 +845,7 @@
sh_v->context = NULL;
sh_v->bih = (BITMAPINFOHEADER*)calloc(1,sizeof(BITMAPINFOHEADER));
sh_v->bih->biSize=sizeof(BITMAPINFOHEADER);
- sh_v->bih->biCompression= sh_v->format = 0xFFFC;
+ sh_v->bih->biCompression= sh_v->format = FOURCC_THEORA;
sh_v->fps = ((double)inf.fps_numerator)/
(double)inf.fps_denominator;
sh_v->frametime = ((double)inf.fps_denominator)/
@@ -1092,7 +1095,7 @@
}
mp_msg(MSGT_DEMUX,MSGL_V,"Ogg demuxer : found %d audio stream%s, %d video stream%s and %d text stream%s\n",n_audio,n_audio>1?"s":"",n_video,n_video>1?"s":"",ogg_d->n_text,ogg_d->n_text>1?"s":"");
-
+
return 1;
err_out:
@@ -1267,7 +1270,7 @@
od->video->id = -2;
od->audio->sh = sh_audio;
sh_audio->ds = od->audio;
- sh_audio->format = 0xFFFE;
+ sh_audio->format = FOURCC_VORBIS;
/// Return the joined demuxers
return new_demuxers_demuxer(demuxer,od,demuxer);
@@ -1304,13 +1307,13 @@
if(demuxer->video->id >= 0) {
ds = demuxer->video;
/* demux_ogg_read_packet needs decoder context for Theora streams */
- if (((sh_video_t*)demuxer->video->sh)->format == 0xFFFC)
+ if (((sh_video_t*)demuxer->video->sh)->format == FOURCC_THEORA)
context = ((sh_video_t*)demuxer->video->sh)->context;
rate = ogg_d->subs[ds->id].samplerate;
} else {
ds = demuxer->audio;
/* demux_ogg_read_packet needs decoder context for Vorbis streams */
- if(((sh_audio_t*)demuxer->audio->sh)->format == 0xFFFE)
+ if(((sh_audio_t*)demuxer->audio->sh)->format == FOURCC_VORBIS)
context = ((sh_audio_t*)demuxer->audio->sh)->context;
vi = &((ov_struct_t*)((sh_audio_t*)ds->sh)->context)->vi;
rate = (float)vi->rate;
More information about the MPlayer-cvslog
mailing list