[mplayer-dev-eng] audio/video selection broken

Rüdiger Kuhlmann mplayer-list-UGa6JdjLujS2 at ruediger-kuhlmann.de
Tue Dec 10 13:29:42 CET 2002


>--[Rüdiger Kuhlmann]--<mplayer-list-UGa6JdjLujS2 at ruediger-kuhlmann.de>

> the selection of the audio stream via menu has been broken in current CVS.
> Selecting a new audio ID via menu will cause mplayer to reinitialize even
> the audio_id value.

Okay, then, here's a patch for at least a work-around - if you have a better
idea, feel free to do it better:

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.624
diff -u -u -r1.624 mplayer.c
--- mplayer.c	5 Dec 2002 00:18:56 -0000	1.624
+++ mplayer.c	10 Dec 2002 12:50:48 -0000
@@ -201,6 +201,8 @@
 // streaming:
 int audio_id=-1;
 int video_id=-1;
+int gui_audio_id = -1;
+int gui_video_id = -1;
 int dvdsub_id=-1;
 int vobsub_id=-1;
 static char* audio_lang=NULL;
@@ -2892,6 +2894,9 @@
   } else
     break;
 } 
+
+audio_id = gui_audio_id;
+video_id = gui_video_id;
 
 #ifdef HAVE_NEW_GUI
  if( use_gui && !playtree_iter ) 
Index: mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.h,v
retrieving revision 1.23
diff -u -u -r1.23 mplayer.h
--- mplayer.h	28 Nov 2002 23:17:09 -0000	1.23
+++ mplayer.h	10 Dec 2002 12:50:48 -0000
@@ -48,8 +48,8 @@
 
 extern int auto_quality;
 
-extern int audio_id;
-extern int video_id;
+extern int audio_id, gui_audio_id;
+extern int video_id, gui_video_id;
 extern int dvdsub_id;
 
 extern void exit_player(char* how);
Index: Gui/mplayer/mw.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mw.c,v
retrieving revision 1.96
diff -u -u -r1.96 mw.c
--- Gui/mplayer/mw.c	5 Dec 2002 23:54:15 -0000	1.96
+++ Gui/mplayer/mw.c	10 Dec 2002 12:50:48 -0000
@@ -251,7 +252,7 @@
 
 void mplEventHandling( int msg,float param )
 {
- int j;
+ int j, iparam = (int) param;
 
  switch( msg )
   {
@@ -269,23 +270,41 @@
         gtkShow( evPlayNetwork,NULL );
 	break;
 
    case evSetAudio:
         if ( !guiIntfStruct.demuxer ) break;
-	audio_id=(int)param;
+	if (audio_id == iparam) break;
+	audio_id = gui_audio_id = iparam;
 	if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play;
 	guiIntfStruct.FilenameChanged=1;
 	break;
 
    case evSetVideo:
         if ( !guiIntfStruct.demuxer ) break;
-        video_id=(int)param;
+        if (video_id == iparam) break;
+        video_id = gui_video_id = iparam;
         if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play;
         guiIntfStruct.FilenameChanged=1;
         break;
 
 #ifdef HAVE_VCD
    case evSetVCDTrack:
-        guiIntfStruct.Track=(int)param;
+        guiIntfStruct.Track = iparam;
    case evPlayVCD:
  	gtkSet( gtkClearStruct,0,(void *)guiALL );
 	guiIntfStruct.StreamType=STREAMTYPE_VCD;
@@ -362,19 +381,19 @@
         break;
 #ifdef USE_DVDREAD
    case evSetDVDSubtitle:
-        dvdsub_id=(int)param;
+        dvdsub_id = iparam;
         goto play_dvd_2;
         break;
    case evSetDVDAudio:
-        audio_id=(int)param;
+        audio_id = iparam;
         goto play_dvd_2;
         break;
    case evSetDVDChapter:
-        guiIntfStruct.DVD.current_chapter=(int)param;
+        guiIntfStruct.DVD.current_chapter = iparam;
         goto play_dvd_2;
         break;
    case evSetDVDTitle:
-        guiIntfStruct.DVD.current_title=(int)param;
+        guiIntfStruct.DVD.current_title = iparam;
 	guiIntfStruct.DVD.current_chapter=1;
 	guiIntfStruct.DVD.current_angle=1;
         goto play_dvd_2;
@@ -448,7 +467,7 @@
 
 
    case evIconify:
-        switch ( (int)param )
+        switch ( iparam )
          {
           case 0: wsIconify( appMPlayer.mainWindow ); break;
           case 1: wsIconify( appMPlayer.subWindow ); break;
@@ -489,7 +508,7 @@
         break;
 
    case evSetAspect:
-	switch ( (int)param )
+	switch ( iparam )
 	 {
 	  case 2:  movie_aspect=16.0f / 9.0f; break;
 	  case 3:  movie_aspect=4.0f / 3.0f;  break;

Of course, a much better way would be being able to change the audio / video
stream on the fly without reloading...

-- 
         100 DM =  51  € 13 ¢.
         100  € = 195 DM 58 pf.
  mailto:ruediger at ruediger-kuhlmann.de
    http://www.ruediger-kuhlmann.de/



More information about the MPlayer-dev-eng mailing list