[Mplayer-cvslog] CVS: main/libmpdemux demux_ogg.c,1.44,1.45

Moritz Bunkus CVS syncmail at mplayerhq.hu
Tue Apr 6 08:36:48 CEST 2004


CVS change done by Moritz Bunkus CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv3775

Modified Files:
	demux_ogg.c 
Log Message:
Changed -sid/-aid/-vid to be zero based and select the n'th stream of its type, e.g. -sid 1 will select the second subtitle stream.

Index: demux_ogg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ogg.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- demux_ogg.c	2 Apr 2004 19:20:34 -0000	1.44
+++ demux_ogg.c	6 Apr 2004 06:36:46 -0000	1.45
@@ -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)




More information about the MPlayer-cvslog mailing list