changeset 6903:c2d4100c964e

- fix mixer handling - some change in menu - fix evLoadPlay bug - etc
author pontscho
date Sun, 04 Aug 2002 19:23:58 +0000
parents 3ccdfd580f0d
children 2ef35e71ad78
files Gui/interface.c Gui/interface.h Gui/mplayer/gtk/about.c Gui/mplayer/gtk/eq.c Gui/mplayer/gtk/fs.c Gui/mplayer/gtk/mb.c Gui/mplayer/gtk/menu.c Gui/mplayer/gtk/opts.c Gui/mplayer/gtk/pl.c Gui/mplayer/gtk/sb.c Gui/mplayer/gtk/url.c Gui/mplayer/mw.h Gui/mplayer/play.c Gui/mplayer/widgets.c Gui/mplayer/widgets.h mplayer.c
diffstat 16 files changed, 75 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/interface.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/interface.c	Sun Aug 04 19:23:58 2002 +0000
@@ -286,6 +286,18 @@
 	mplEventHandling( evRedraw,0 );
 	break;
    case guiSetVolume:
+        if ( audio_out )
+	{
+	 float l,r;
+	 mixer_getvolume( &l,&r );
+	 guiIntfStruct.Volume=(r>l?r:l);
+	 if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
+	   else guiIntfStruct.Balance=50.0f;
+	 btnModify( evSetVolume,guiIntfStruct.Volume );
+	 btnModify( evSetBalance,guiIntfStruct.Balance );
+	}
+	break;
+   case guiSetValues:
 // -- audio
         if ( audio_out )
 	{
@@ -329,21 +341,31 @@
 	 }
 
        guiIntfStruct.DiskChanged=0;
-//       guiIntfStruct.FilenameChanged=0;
 
 // --- video opts	 
        if ( !gtkVODriver )
 	{
          int i = 0;
-         while ( video_out_drivers[i++] )
-	  if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) 
-	   {
-	    const vo_info_t *info = video_out_drivers[i - 1]->get_info();
-	     { gtkVODriver=gstrdup( (char *)info->short_name ); break; }
-	   }
+	 if ( video_driver && !gtkVODriver )
+	  {
+	   while ( video_out_drivers[i] )
+	    if ( video_out_drivers[i++]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
+	     {
+	      const vo_info_t *info = video_out_drivers[i - 1]->get_info();
+	      if ( !gstrcmp( video_driver,(char *)info->short_name ) ) gtkVODriver=gstrdup( video_driver );
+	     }
+	  }
+	  else
+           while ( video_out_drivers[i++] )
+	    if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) 
+	     {
+	      const vo_info_t *info = video_out_drivers[i - 1]->get_info();
+	      gtkVODriver=gstrdup( (char *)info->short_name );
+	      break;
+	     }
 	 }
 	
-	if ( gtkVODriver ) { if ( video_driver ) free( video_driver ); video_driver=strdup( gtkVODriver ); }
+	if ( gtkVODriver ) { gfree( (void **)&video_driver ); video_driver=gstrdup( gtkVODriver ); }
 	  else { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
 	
 	if ( gtkVPP )
@@ -393,7 +415,8 @@
 	  ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul;
 	 }
 	mixer_device=gtkAOOSSMixer;
-	if ( audio_driver ) free( audio_driver ); 
+	if ( audio_driver && !gtkAODriver ) gtkAODriver=gstrdup( audio_driver );
+	gfree( (void **)&audio_driver );
 	if ( !gstrcmp( gtkAODriver,"oss" ) && gtkAOOSSDevice )
 	 {
 	  char * tmp = calloc( 1,strlen( gtkAODriver ) + strlen( gtkAOOSSDevice ) + 2 );
--- a/Gui/interface.h	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/interface.h	Sun Aug 04 19:23:58 2002 +0000
@@ -115,6 +115,7 @@
 #define guiReDraw	    10
 #define guiSetVolume        11
 #define guiSetDefaults	    12
+#define guiSetValues	    13
 
 #define guiSetStop  0
 #define guiSetPlay  1
--- a/Gui/mplayer/gtk/about.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/gtk/about.c	Sun Aug 04 19:23:58 2002 +0000
@@ -15,7 +15,6 @@
  if ( gtkVAboutBox ) gtkActive( AboutBox );
    else AboutBox=create_About();
  gtk_widget_show( AboutBox );
- gtkIncVisible();
 }
 
 void ab_AboutBox_show( GtkButton * button,gpointer user_data )
@@ -25,7 +24,6 @@
 {
  gtkVAboutBox=(int)user_data; 
  gtk_widget_destroy( AboutBox );
- gtkDecVisible();
 }
 
 GtkWidget * create_About( void )
--- a/Gui/mplayer/gtk/eq.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/gtk/eq.c	Sun Aug 04 19:23:58 2002 +0000
@@ -142,13 +142,12 @@
 
  if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 ) gtk_widget_show( Config );
  gtk_widget_show( Equalizer );
- gtkIncVisible();
 }
 
 void HideEqualizer( void )
 {
  if ( !gtkVEqualizer ) return;
- gtkVEqualizer=0; gtkDecVisible();
+ gtkVEqualizer=0;
  gtk_widget_hide( Equalizer );
  gtk_widget_destroy( Equalizer );
  if ( gtkVEquConfig ) HideEquConfig();
--- a/Gui/mplayer/gtk/fs.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/gtk/fs.c	Sun Aug 04 19:23:58 2002 +0000
@@ -286,7 +286,7 @@
   
  gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal );
 
- gtk_widget_show( fsFileSelect ); gtkIncVisible();
+ gtk_widget_show( fsFileSelect );
 }
 
 void HideFileSelect( void )
@@ -294,7 +294,7 @@
  if ( !gtkVFileSelect ) return;
  gtk_widget_hide( fsFileSelect );
  gtk_widget_destroy( fsFileSelect );
- gtkVFileSelect=0; gtkDecVisible();
+ gtkVFileSelect=0;
 }
 
 void fs_fsFileSelect_destroy( GtkObject * object,gpointer user_data )
--- a/Gui/mplayer/gtk/mb.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/gtk/mb.c	Sun Aug 04 19:23:58 2002 +0000
@@ -19,11 +19,10 @@
  if ( gtkVMessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); }
  MessageBox=create_MessageBox( 0 );
  if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 );
- gtkIncVisible();
 }
 
 static void on_Ok_released( GtkButton * button,gpointer user_data  )
-{ gtkVMessageBox=0; gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); gtkDecVisible(); }
+{ gtkVMessageBox=0; gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); }
 
 static void on_MessageBox_show( GtkButton * button,gpointer user_data  )
 { gtkVMessageBox=(int)user_data; }
--- a/Gui/mplayer/gtk/menu.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/gtk/menu.c	Sun Aug 04 19:23:58 2002 +0000
@@ -294,10 +294,10 @@
 //    AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec );
 //    AddMenuItem( SubMenu,"Back 1 min", evBackward1min );
 //    AddMenuItem( SubMenu,"Fwd 1 min", evForward1min );
-   SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size );
-    AddMenuItem( SubMenu,MSGTR_MENU_NormalSize"      ", evNormalSize );
-    AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize );
-    AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen );
+//   SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size );
+//    AddMenuItem( SubMenu,MSGTR_MENU_NormalSize"      ", evNormalSize );
+//    AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize );
+//    AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen );
 #ifdef HAVE_VCD
    VCDSubMenu=AddSubMenu( Menu,MSGTR_MENU_VCD );
     AddMenuItem( VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD );
@@ -394,6 +394,10 @@
   AddMenuItem( Menu,MSGTR_MENU_Preferences, evPreferences );
   AddMenuItem( Menu,MSGTR_Equalizer, evEqualizer );
   AddSeparator( Menu );
+  AddMenuItem( Menu,MSGTR_MENU_NormalSize"      ", evNormalSize );
+  AddMenuItem( Menu,MSGTR_MENU_DoubleSize, evDoubleSize );
+  AddMenuItem( Menu,MSGTR_MENU_FullScreen, evFullScreen );
+  AddSeparator( Menu );
   AddMenuItem( Menu,MSGTR_MENU_Exit, evExit );
 
  return Menu;
--- a/Gui/mplayer/gtk/opts.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/gtk/opts.c	Sun Aug 04 19:23:58 2002 +0000
@@ -117,12 +117,12 @@
   int    i = 0;
   char * tmp[3]; tmp[2]="";
   old_audio_driver=0;
+  if ( audio_driver && !gtkAODriver ) gtkAODriver=gstrdup( audio_driver );
   while ( audio_out_drivers[i] )
    {
     const ao_info_t *info = audio_out_drivers[i++]->info;
     if ( !strcmp( info->short_name,"plugin" ) ) continue;
-    if ( gtkAODriver )
-      if ( !strcmp( gtkAODriver,info->short_name ) ) old_audio_driver=i - 1;
+    if ( !strcmp( gtkAODriver,info->short_name ) ) old_audio_driver=i - 1;
     tmp[0]=(char *)info->short_name; tmp[1]=(char *)info->name; gtk_clist_append( GTK_CLIST( CLADrivers ),tmp );
    }
   gtk_clist_select_row( GTK_CLIST( CLADrivers ),old_audio_driver,0 );
@@ -143,12 +143,21 @@
   int i = 0, c = 0;
   char * tmp[3]; tmp[2]="";
   old_video_driver=0; 
+  if ( video_driver && !gtkVODriver )
+   {
+    while ( video_out_drivers[i] )
+     if ( video_out_drivers[i++]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
+      {
+       const vo_info_t *info = video_out_drivers[i - 1]->get_info(); 
+       if ( !gstrcmp( video_driver,info->short_name ) ) gtkVODriver=gstrdup( video_driver );
+      }
+   }
+  i=0;
   while ( video_out_drivers[i] )
    if ( video_out_drivers[i++]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
     { 
      const vo_info_t *info = video_out_drivers[i - 1]->get_info();
-     if ( gtkVODriver )
-      if ( !strcmp( gtkVODriver,info->short_name ) ) old_video_driver=c; c++;
+     if ( !gstrcmp( gtkVODriver,info->short_name ) ) old_video_driver=c; c++;
      tmp[0]=(char *)info->short_name; tmp[1]=(char *)info->name; gtk_clist_append( GTK_CLIST( CLVDrivers ),tmp );
     }
   gtk_clist_select_row( GTK_CLIST( CLVDrivers ),old_video_driver,0 );
@@ -228,7 +237,7 @@
  gtk_signal_connect( GTK_OBJECT( CLADrivers ),"select_row",GTK_SIGNAL_FUNC( prCListRow ),(void*)0 );
  gtk_signal_connect( GTK_OBJECT( CLVDrivers ),"select_row",GTK_SIGNAL_FUNC( prCListRow ),(void*)1 );
 
- gtkVPreferences=1; gtkIncVisible();
+ gtkVPreferences=1;
  gtk_widget_show( Preferences );
  gtkSetLayer( Preferences );
  gtkMessageBox( GTK_MB_WARNING,MSGTR_PREFERENCES_Message );
@@ -237,7 +246,7 @@
 void HidePreferences( void )
 {
  if ( !gtkVPreferences ) return;
- gtkVPreferences=0; gtkDecVisible();
+ gtkVPreferences=0;
  gtk_widget_hide( Preferences ); gtk_widget_destroy( Preferences );
  HideOSSConfig();
 }
@@ -1465,7 +1474,7 @@
 
  gtk_widget_show( OSSConfig );
  gtkSetLayer( OSSConfig );
- gtkVOSSConfig=1; gtkIncVisible();
+ gtkVOSSConfig=1;
 }
 
 void HideOSSConfig( void )
@@ -1473,7 +1482,7 @@
  if ( !gtkVOSSConfig ) return;
  gtk_widget_hide( OSSConfig );
  gtk_widget_destroy( OSSConfig ); 
- gtkVOSSConfig=0; gtkDecVisible();
+ gtkVOSSConfig=0;
 }
 
 static void ossDestroy( GtkObject * object,gpointer user_data )
--- a/Gui/mplayer/gtk/pl.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/gtk/pl.c	Sun Aug 04 19:23:58 2002 +0000
@@ -169,7 +169,7 @@
   }
  gtk_clist_thaw( GTK_CLIST( CLSelected ) );
 
- gtk_widget_show( PlayList ); gtkIncVisible();
+ gtk_widget_show( PlayList );
 }
 
 void HidePlayList( void )
@@ -180,7 +180,7 @@
  if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=NULL;
  if ( old_path ) free( old_path ); old_path=strdup( current_path );
  gtk_widget_hide( PlayList );
- gtk_widget_destroy( PlayList ); gtkDecVisible();
+ gtk_widget_destroy( PlayList );
 }
 
 static void plDestroy( GtkObject * object,gpointer user_data )
--- a/Gui/mplayer/gtk/sb.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/gtk/sb.c	Sun Aug 04 19:23:58 2002 +0000
@@ -29,13 +29,12 @@
 {
  if ( gtkVSkinBrowser ) gtkActive( SkinBrowser );
    else SkinBrowser=create_SkinBrowser();
- gtkIncVisible();
 }
 
 void HideSkinBrowser( void )
 {
  if ( !gtkVSkinBrowser ) return;
- gtkVSkinBrowser=0; gtkDecVisible();
+ gtkVSkinBrowser=0;
  gtk_widget_destroy( SkinBrowser );
 }
 
--- a/Gui/mplayer/gtk/url.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/gtk/url.c	Sun Aug 04 19:23:58 2002 +0000
@@ -34,7 +34,7 @@
   }
  
  gtk_widget_show( URL );
- gtkVURLDialogBox=1; gtkIncVisible();
+ gtkVURLDialogBox=1;
 }
 
 void HideURLDialogBox( void )
@@ -42,7 +42,7 @@
  if ( !gtkVURLDialogBox ) return;
  gtk_widget_hide( URL );
  gtk_widget_destroy( URL );
- gtkVURLDialogBox=0; gtkDecVisible();
+ gtkVURLDialogBox=0;
 }
 
 static gboolean on_URL_destroy_event( GtkWidget * widget,GdkEvent * event,gpointer user_data )
--- a/Gui/mplayer/mw.h	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/mw.h	Sun Aug 04 19:23:58 2002 +0000
@@ -263,7 +263,6 @@
    case evPlaySwitchToPause:
 play:
 
-        mplMainAutoPlay=0;
         if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 2 ) ) goto NoPause;
 
 	vcd_track=0;
--- a/Gui/mplayer/play.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/play.c	Sun Aug 04 19:23:58 2002 +0000
@@ -102,6 +102,8 @@
   } 
   else
     {
+     if ( mplMainAutoPlay ) { mplMainAutoPlay=0; return; }
+
      guiIntfStruct.TimeSec=0;
      guiIntfStruct.Position=0;
      guiIntfStruct.AudioType=0;
--- a/Gui/mplayer/widgets.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/widgets.c	Sun Aug 04 19:23:58 2002 +0000
@@ -38,7 +38,6 @@
 int gtkPopupMenu = 0;
 int gtkPopupMenuParam = 0;
 int gtkInited = 0;
-int gtkVisible = 0;
 
 #include "gtk/sb.h"
 #include "gtk/pl.h"
@@ -117,8 +116,7 @@
 void gtkEventHandling( void )
 {
  int i;
- if ( gtkVisible > 0 )
-   for( i=0;i < 25;i++ ) gtk_main_iteration_do( 0 );
+ for( i=0;i < 25;i++ ) gtk_main_iteration_do( 0 );
 }
 
 // --- funcs
@@ -185,7 +183,7 @@
          } 
 	 else 
 	  {
-	   gtk_widget_destroy( SkinBrowser ); gtkDecVisible();
+	   gtk_widget_destroy( SkinBrowser );
 	   gtkMessageBox( GTK_MB_ERROR,"Skin dirs not found ... Please install skins." );
 	  }
         break;
@@ -219,13 +217,12 @@
    case evShowPopUpMenu:
         gtkPopupMenu=evNone;
         gtkPopupMenuParam=0;
-        if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); gtkDecVisible(); }
+        if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); }
         PopUpMenu=create_PopUpMenu();
         gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 );
-	gtkIncVisible();
         break;
    case evHidePopUpMenu:
-        if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); /*gtkVisible--;*/ PopUpMenu=NULL; }
+        if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); PopUpMenu=NULL; }
         break;
    case evPlayNetwork:
 	ShowURLDialogBox();
@@ -233,7 +230,3 @@
 	break;
   }
 }
-
-void gtkIncVisible( void ) { gtkVisible++; }
-void gtkDecVisible( void ) { if ( gtkVisible > 0 ) gtkVisible--; }
-
--- a/Gui/mplayer/widgets.h	Sun Aug 04 19:15:45 2002 +0000
+++ b/Gui/mplayer/widgets.h	Sun Aug 04 19:23:58 2002 +0000
@@ -41,8 +41,6 @@
 extern Pixmap      guiIcon;
 extern Pixmap	   guiIconMask;
 
-extern int gtkVisible;
-
 extern void widgetsCreate( void );
 
 extern void gtkInit( void );
@@ -61,7 +59,4 @@
 extern void gtkSetLayer( GtkWidget * wdg );
 extern void gtkActive( GtkWidget * wdg );
 
-extern void gtkIncVisible( void );
-extern void gtkDecVisible( void );
-
 #endif
--- a/mplayer.c	Sun Aug 04 19:15:45 2002 +0000
+++ b/mplayer.c	Sun Aug 04 19:23:58 2002 +0000
@@ -1358,7 +1358,7 @@
      guiGetEvent( guiSetFileName,filename );
      if ( sh_audio ) guiIntfStruct.AudioType=sh_audio->channels; else guiIntfStruct.AudioType=0;
      if ( !sh_video && sh_audio ) guiGetEvent( guiSetAudioOnly,(char *)1 ); else guiGetEvent( guiSetAudioOnly,(char *)0 );
-     guiGetEvent( guiSetVolume,NULL );
+     guiGetEvent( guiSetValues,NULL );
     }
 #endif
 
@@ -2930,6 +2930,7 @@
 	if ( sh_video ) guiIntfStruct.TimeSec=d_video->pts;
 	  else if ( sh_audio ) guiIntfStruct.TimeSec=sh_audio->timer;
 	guiGetEvent( guiReDraw,NULL );
+	guiGetEvent( guiSetVolume,NULL );
 	if(guiIntfStruct.Playing==0) break; // STOP
 	if(guiIntfStruct.Playing==2) osd_function=OSD_PAUSE;
         if ( guiIntfStruct.DiskChanged || guiIntfStruct.FilenameChanged ) goto goto_next_file;