[MPlayer-cvslog] r37202 - trunk/libmpdemux/demux_real.c

reimar subversion at mplayerhq.hu
Tue May 13 23:06:41 CEST 2014


Author: reimar
Date: Tue May 13 23:06:40 2014
New Revision: 37202

Log:
demux_real: always select a stream to play if available.

Nowadays this should not hurt, MPlayer should be able
to able if a stream is selected that never has any data,
and it allows us to play the stream if some data actually
appears later at some point.

Modified:
   trunk/libmpdemux/demux_real.c

Modified: trunk/libmpdemux/demux_real.c
==============================================================================
--- trunk/libmpdemux/demux_real.c	Tue May 13 23:06:39 2014	(r37201)
+++ trunk/libmpdemux/demux_real.c	Tue May 13 23:06:40 2014	(r37202)
@@ -1832,9 +1832,7 @@ header_end:
     // detect streams:
     if(demuxer->video->id==-1 && v_streams>0){
 	// find the valid video stream:
-	if(!ds_fill_buffer(demuxer->video)){
-          mp_msg(MSGT_DEMUXER,MSGL_INFO,"RM: " MSGTR_MissingVideoStream);
-	}
+	ds_fill_buffer(demuxer->video);
     }
     if(demuxer->audio->id==-1 && a_streams>0){
 	// find the valid audio stream:
@@ -1842,6 +1840,32 @@ header_end:
           mp_msg(MSGT_DEMUXER,MSGL_INFO,"RM: " MSGTR_MissingAudioStream);
 	}
     }
+    if(demuxer->video->id==-1 && v_streams>0){
+	// try video once more in case there were too many audio packets first.
+	demuxer->video->eof = 0;
+	demuxer->video->fill_count = 0;
+	if(!ds_fill_buffer(demuxer->video)){
+          mp_msg(MSGT_DEMUXER,MSGL_INFO,"RM: " MSGTR_MissingVideoStream);
+	}
+    }
+    if(demuxer->video->id==-1 && v_streams>0){
+        // worst case just select the first
+        int i;
+        for (i = 0; i < MAX_V_STREAMS; i++)
+            if (demuxer->v_streams[i]) {
+                demuxer->video->id = i;
+                demuxer->video->sh = demuxer->v_streams[i];
+            }
+    }
+    if(demuxer->audio->id==-1 && a_streams>0){
+        // worst case just select the first
+        int i;
+        for (i = 0; i < MAX_A_STREAMS; i++)
+            if (demuxer->a_streams[i]) {
+                demuxer->audio->id = i;
+                demuxer->audio->sh = demuxer->a_streams[i];
+            }
+    }
 
     if(demuxer->video->sh){
 	sh_video_t *sh=demuxer->video->sh;


More information about the MPlayer-cvslog mailing list