[MPlayer-dev-eng] [PATCH] change to -aid/-sid/-vid for OGM/Ogg files
Moritz Bunkus
moritz at bunkus.org
Fri Apr 2 21:55:13 CEST 2004
Heya,
this patch changes the -aid/-sid/-vid behaviour for OGM/Ogg. They now
select the n'th stream of the given type, e.g. -sid 1 will select the
second subtitle track no matter how many tracks exist in the file before
the track.
This together with the -slang patch by Andriy Gritsenko that I've
already applied will make it more consistent with the other demuxer's
behaviour.
If no one objects I'll apply it in a couple of days.
Mosu
--
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds
-------------- next part --------------
Index: demux_ogg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ogg.c,v
retrieving revision 1.44
diff -u -r1.44 demux_ogg.c
--- demux_ogg.c 2 Apr 2004 19:20:34 -0000 1.44
+++ demux_ogg.c 2 Apr 2004 19:50:47 -0000
@@ -652,6 +652,7 @@
stream_t *s;
char* buf;
int np,s_no, n_audio = 0, n_video = 0, n_text = 0;
+ int audio_id = -1, video_id = -1, text_id = -1;
ogg_sync_state* sync;
ogg_page* page;
ogg_packet pack;
@@ -889,6 +890,8 @@
mp_msg(MSGT_DEMUX, MSGL_V, "OGG stream %d is text\n", ogg_d->num_sub);
ogg_d->subs[ogg_d->num_sub].samplerate= get_uint64(&st->time_unit)/10;
ogg_d->subs[ogg_d->num_sub].text = 1;
+ if (demuxer->sub->id == n_text)
+ text_id = ogg_d->num_sub;
n_text++;
demux_ogg_init_sub();
//// Unknown header type
@@ -903,26 +906,28 @@
if(sh_a) {
// If the audio stream is not defined we took the first one
if(demuxer->audio->id == -1) {
- demuxer->audio->id = ogg_d->num_sub;
+ demuxer->audio->id = n_audio - 1;
// if(sh_a->wf) print_wave_header(sh_a->wf);
}
/// Is it the stream we want
- if(demuxer->audio->id == ogg_d->num_sub) {
+ if(demuxer->audio->id == (n_audio - 1)) {
demuxer->audio->sh = sh_a;
sh_a->ds = demuxer->audio;
ds = demuxer->audio;
+ audio_id = ogg_d->num_sub;
}
}
if(sh_v) {
/// Also for video
if(demuxer->video->id == -1) {
- demuxer->video->id = ogg_d->num_sub;
+ demuxer->video->id = n_video - 1;
// if(sh_v->bih) print_video_header(sh_v->bih);
}
- if(demuxer->video->id == ogg_d->num_sub) {
+ if(demuxer->video->id == (n_video - 1)) {
demuxer->video->sh = sh_v;
sh_v->ds = demuxer->video;
ds = demuxer->video;
+ video_id = ogg_d->num_sub;
}
}
/// Add the header packets if the stream isn't seekable
@@ -939,12 +944,18 @@
/// Finish to setup the demuxer
demuxer->priv = ogg_d;
- if(!n_video)
+ if(!n_video || (video_id < 0))
demuxer->video->id = -2;
- if(!n_audio)
+ else
+ demuxer->video->id = video_id;
+ if(!n_audio || (audio_id < 0))
demuxer->audio->id = -2;
- if(!n_text)
+ else
+ demuxer->audio->id = audio_id;
+ if(!n_text || (text_id < 0))
demuxer->sub->id = -2;
+ else
+ demuxer->sub->id = text_id;
ogg_d->final_granulepos=0;
if(!s->end_pos)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20040402/8b472ef4/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list