changeset 6623:7bc4c6ba9485

add -audiofile support for gui
author pontscho
date Tue, 02 Jul 2002 22:31:50 +0000
parents da08877b9512
children 122efdee5b52
files Gui/events.c Gui/events.h Gui/interface.c Gui/interface.h Gui/mplayer/gtk/fs.c Gui/mplayer/gtk/fs.h Gui/mplayer/gtk/menu.c Gui/mplayer/mw.h Gui/mplayer/sw.h Gui/mplayer/widgets.c help_mp-en.h help_mp-hu.h libmpdemux/demuxer.c libmpdemux/stream.h mplayer.c
diffstat 15 files changed, 68 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/events.c	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/events.c	Tue Jul 02 22:31:50 2002 +0000
@@ -46,7 +46,8 @@
   { evLoadSubtitle,      "evLoadSubtitle"      },
   { evPlayDVD,		 "evPlayDVD"	       },
   { evPlayVCD,		 "evPlayVCD"	       },
-  { evSetURL,		 "evSetURL"	       }
+  { evSetURL,		 "evSetURL"	       },
+  { evLoadAudioFile,	 "evLoadAudioFile"     }
  };
 
 int evBoxs = sizeof( evNames ) / sizeof( evName );
--- a/Gui/events.h	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/events.h	Tue Jul 02 22:31:50 2002 +0000
@@ -50,6 +50,7 @@
 #define evPlayDVD           39
 #define evPlayVCD	    40
 #define evPlayNetwork       41
+#define evLoadAudioFile	    42
 
 #define evExit              1000
 
--- a/Gui/interface.c	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/interface.c	Tue Jul 02 22:31:50 2002 +0000
@@ -178,13 +178,6 @@
 #endif
 	break;
    case guiReDraw:
-//        if ( audio_out )
-//         {
-//	  float l,r;
- //	  mixer_getvolume( &l,&r );
-//	  guiIntfStruct.Volume=(r>l?r:l);
-//	  printf( "!!! guiIntfStruct.Volume: %.2f   \n",guiIntfStruct.Volume );
-//	 }
 	mplEventHandling( evRedraw,0 );
 	break;
    case guiSetVolume:
--- a/Gui/interface.h	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/interface.h	Tue Jul 02 22:31:50 2002 +0000
@@ -91,6 +91,9 @@
 
    char * Othername;
    int    OtherChanged;
+   
+   char * AudioFile;
+   int    AudioFileChanged;
 
    int    SkinChange;
 } guiInterface_t;
--- a/Gui/mplayer/gtk/fs.c	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/mplayer/gtk/fs.c	Tue Jul 02 22:31:50 2002 +0000
@@ -35,7 +35,6 @@
 gchar           fsFilter[64] = "*";
 
 int             fsPressed = 0;
-int             fsMessage = -1;
 int             fsType    = 0;
 
 int gtkVFileSelect = 0;
@@ -64,11 +63,18 @@
            { "SSA (*.ssa)",   						   "*.ssa" },
            { "AQT (*.aqt)",   						   "*.aqt" },
 	   { "Subtitles (*.utf,*.sub,*.srt,*.smi,*.rt,*.txt,*.ssa,*.aqt)", "*.utf,*.sub,*.srt,*.smi,*.rt,*.txt,*.ssa,*.aqt" },
-           { "All files ( * )", "*"     } };
+           { "All files ( * )", 					   "*"     } };
 
 #define fsNumberOfOtherFilterNames 0
 char * fsOtherFilterNames[fsNumberOfOtherFilterNames+1][2] =
          { { "All files ( * )", "*"     } };
+	 
+#define fsNumberOfAudioFilterNames 3
+char * fsAudioFileNames[fsNumberOfAudioFilterNames+1][2] =
+	 { { "WAV files (*.wav)",					   "*.wav" },
+	   { "MP3 files (*.mp2, *.mp3)",				   "*.mp2,*.mp3" },
+	   { "Audio files (*.wav,*.mp2,*.mp3)",				   "*.wav,*.mp2,*.mp3" },
+	   { "All files ( * )",						   "*" } };
 
 GtkWidget   * fsFileNamesList;
 GtkWidget   * fsFNameList;
@@ -207,7 +213,6 @@
  switch ( type )
   {
    case fsVideoSelector:
-        fsMessage=evFileLoaded;
         gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
         fsList_items=NULL;
         for( i=0;i<fsNumberOfVideoFilterNames + 1;i++ )
@@ -234,6 +239,15 @@
         g_list_free( fsList_items );
         gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsOtherFilterNames[fsNumberOfOtherFilterNames][0] );
         break;
+   case fsAudioSelector:
+	gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect );
+	fsList_items=NULL;
+	for( i=0;i<fsNumberOfAudioFilterNames + 1;i++ )
+	  fsList_items=g_list_append( fsList_items,fsAudioFileNames[i][0] );
+	gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
+	g_list_free( fsList_items );
+	gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsAudioFileNames[fsNumberOfAudioFilterNames - 1][0] );
+	break;
   }
  
  gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal );
@@ -269,31 +283,26 @@
    case fsVideoSelector:
           for( i=0;i<fsNumberOfVideoFilterNames+1;i++ )
            if( !strcmp( str,fsVideoFilterNames[i][0] ) )
-            {
-             strcpy( fsFilter,fsVideoFilterNames[i][1] );
-             CheckDir( fsFNameList,get_current_dir_name() );
-             break;
-            }
+            { strcpy( fsFilter,fsVideoFilterNames[i][1] ); break; }
           break;
    case fsSubtitleSelector:
           for( i=0;i<fsNumberOfSubtitleFilterNames+1;i++ )
            if( !strcmp( str,fsSubtitleFilterNames[i][0] ) )
-            {
-             strcpy( fsFilter,fsSubtitleFilterNames[i][1] );
-             CheckDir( fsFNameList,get_current_dir_name() );
-             break;
-            }
+            { strcpy( fsFilter,fsSubtitleFilterNames[i][1] ); break; }
           break;
    case fsOtherSelector:
           for( i=0;i<fsNumberOfOtherFilterNames+1;i++ )
            if( !strcmp( str,fsOtherFilterNames[i][0] ) )
-            {
-             strcpy( fsFilter,fsOtherFilterNames[i][1] );
-             CheckDir( fsFNameList,get_current_dir_name() );
-             break;
-            }
+            { strcpy( fsFilter,fsOtherFilterNames[i][1] ); break; }
           break;
+   case fsAudioSelector:
+          for( i=0;i<fsNumberOfAudioFilterNames+1;i++ )
+           if( !strcmp( str,fsAudioFileNames[i][0] ) )
+            { strcpy( fsFilter,fsAudioFileNames[i][1] ); break; }
+	  break;
+   default: return;
   }
+ CheckDir( fsFNameList,get_current_dir_name() );
 }
 
 void fs_fsPathCombo_activate( GtkEditable * editable,gpointer user_data )
@@ -375,6 +384,8 @@
           guiSetDF( guiIntfStruct.Filename,fsSelectedDirectory,fsSelectedFile );
           guiIntfStruct.StreamType=STREAMTYPE_FILE;
           guiIntfStruct.FilenameChanged=1;
+	  if ( guiIntfStruct.AudioFile ) free( guiIntfStruct.AudioFile );
+	  guiIntfStruct.AudioFile=NULL;
           break;
    case fsSubtitleSelector:
           guiSetDF( guiIntfStruct.Subtitlename,fsSelectedDirectory,fsSelectedFile );
@@ -383,6 +394,9 @@
    case fsOtherSelector:
           guiSetDF( guiIntfStruct.Othername,fsSelectedDirectory,fsSelectedFile );
           break;
+   case fsAudioSelector:
+          guiSetDF( guiIntfStruct.AudioFile,fsSelectedDirectory,fsSelectedFile );
+          break;
   }
 
  HideFileSelect();
@@ -394,7 +408,7 @@
    item=item->next;
   }
  if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name() );
- if (  mplMainAutoPlay ) mplEventHandling( evPlay,0 );
+ if ( mplMainAutoPlay ) mplEventHandling( evPlay,0 );
 }
 
 void fs_Cancel_released( GtkButton * button,gpointer user_data )
--- a/Gui/mplayer/gtk/fs.h	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/mplayer/gtk/fs.h	Tue Jul 02 22:31:50 2002 +0000
@@ -6,6 +6,7 @@
 #define fsVideoSelector    0
 #define fsSubtitleSelector 1
 #define fsOtherSelector    2
+#define fsAudioSelector	   3
 
 extern GtkWidget   * fsFileSelect;
 
--- a/Gui/mplayer/gtk/menu.c	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/mplayer/gtk/menu.c	Tue Jul 02 22:31:50 2002 +0000
@@ -277,6 +277,7 @@
 #endif
     AddMenuItem( SubMenu,MSGTR_MENU_PlayURL, evSetURL );
     AddMenuItem( SubMenu,MSGTR_MENU_LoadSubtitle"   ", evLoadSubtitle );
+    AddMenuItem( SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile );
    SubMenu=AddSubMenu( Menu,MSGTR_MENU_Playing );
     AddMenuItem( SubMenu,MSGTR_MENU_Play"        ", evPlay );
     AddMenuItem( SubMenu,MSGTR_MENU_Pause, evPause );
--- a/Gui/mplayer/mw.h	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/mplayer/mw.h	Tue Jul 02 22:31:50 2002 +0000
@@ -351,6 +351,9 @@
         mplMainRender=1;
         gtkShow( evLoadSubtitle,NULL );
         break;
+   case evLoadAudioFile:
+	gtkShow( evLoadAudioFile,NULL );
+	break;
    case evPrev:
 	mplPrev();
         mplMainRender=1;
@@ -413,17 +416,6 @@
           case 1: wsIconify( appMPlayer.subWindow ); break;
          }
         break;
-   case evNormalSize:
-        if ( guiIntfStruct.Playing )
-         {
-          appMPlayer.subWindow.isFullScreen=True;
-          appMPlayer.subWindow.OldX=( wsMaxX - guiIntfStruct.MovieWidth ) / 2;
-          appMPlayer.subWindow.OldY=( wsMaxY - guiIntfStruct.MovieHeight ) / 2;
-          appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight;
-          wsFullScreen( &appMPlayer.subWindow );
-	  vo_fs=0;
-         }
-        break;
    case evDoubleSize:
         if ( guiIntfStruct.Playing )
          {
@@ -435,6 +427,17 @@
 	  vo_fs=0;
          }
         break;
+   case evNormalSize:
+        if ( guiIntfStruct.Playing )
+         {
+          appMPlayer.subWindow.isFullScreen=True;
+          appMPlayer.subWindow.OldX=( wsMaxX - guiIntfStruct.MovieWidth ) / 2;
+          appMPlayer.subWindow.OldY=( wsMaxY - guiIntfStruct.MovieHeight ) / 2;
+          appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight;
+          wsFullScreen( &appMPlayer.subWindow );
+	  vo_fs=0;
+	  break;
+         } else if ( !appMPlayer.subWindow.isFullScreen ) break;
    case evFullScreen:
         for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
          {
--- a/Gui/mplayer/sw.h	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/mplayer/sw.h	Tue Jul 02 22:31:50 2002 +0000
@@ -66,7 +66,7 @@
            {
             if( SubVisible++%2 ) wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID );
              else if ( wsWMType != wsWMNetWM && wsWMType != wsWMKDE ) wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID );
-    }
+	   }
           msButton=0;
           mplSubMoved=0;
           break;
--- a/Gui/mplayer/widgets.c	Tue Jul 02 21:10:42 2002 +0000
+++ b/Gui/mplayer/widgets.c	Tue Jul 02 22:31:50 2002 +0000
@@ -174,6 +174,10 @@
         ShowFileSelect( fsSubtitleSelector,0 );
 	gtkSetLayer( fsFileSelect );
         break;
+   case evLoadAudioFile:
+	ShowFileSelect( fsAudioSelector,0 );
+	gtkSetLayer( fsFileSelect );
+	break;
    case evAbout:
 	ShowAboutBox();
 	gtkSetLayer( AboutBox );
--- a/help_mp-en.h	Tue Jul 02 21:10:42 2002 +0000
+++ b/help_mp-en.h	Tue Jul 02 22:31:50 2002 +0000
@@ -236,6 +236,7 @@
 #define MSGTR_FileSelect "Select file ..."
 #define MSGTR_SubtitleSelect "Select subtitle ..."
 #define MSGTR_OtherSelect "Select ..."
+#define MSGTR_AudioFileSelect "Select external audio channel ..."
 #define MSGTR_MessageBox "MessageBox"
 #define MSGTR_PlayList "PlayList"
 #define MSGTR_SkinBrowser "Skin Browser"
@@ -283,6 +284,7 @@
 #define MSGTR_MENU_PlayDVD "Play DVD ..."
 #define MSGTR_MENU_PlayURL "Play URL ..."
 #define MSGTR_MENU_LoadSubtitle "Load subtitle ..."
+#define MSGTR_MENU_LoadExternAudioFile "Load external audio file ..."
 #define MSGTR_MENU_Playing "Playing"
 #define MSGTR_MENU_Play "Play"
 #define MSGTR_MENU_Pause "Pause"
--- a/help_mp-hu.h	Tue Jul 02 21:10:42 2002 +0000
+++ b/help_mp-hu.h	Tue Jul 02 22:31:50 2002 +0000
@@ -231,6 +231,7 @@
 #define MSGTR_FileSelect "File kiválasztása ..."
 #define MSGTR_SubtitleSelect "Felirat kiválasztása ..."
 #define MSGTR_OtherSelect "File kiválasztása ..."
+#define MSGTR_AudioFileSelect "Külső audio csatorna választása ..."
 #define MSGTR_MessageBox "Üzenetablak"
 #define MSGTR_PlayList "Lejátszási lista"
 #define MSGTR_SkinBrowser "Skin böngésző"
@@ -278,6 +279,7 @@
 #define MSGTR_MENU_PlayDVD "DVD lejátszás ..."  
 #define MSGTR_MENU_PlayURL "URL lejátszás ..."  
 #define MSGTR_MENU_LoadSubtitle "Felirat betöltése ..."
+#define MSGTR_MENU_LoadExternAudioFile "Külső hang betöltése ..."
 #define MSGTR_MENU_Playing "Lejátszás"
 #define MSGTR_MENU_Play "Lejátszás"
 #define MSGTR_MENU_Pause "Pillanatállj"
--- a/libmpdemux/demuxer.c	Tue Jul 02 21:10:42 2002 +0000
+++ b/libmpdemux/demuxer.c	Tue Jul 02 22:31:50 2002 +0000
@@ -946,7 +946,7 @@
 return demuxer;
 }
 
-static char* audio_stream = NULL;
+char* audio_stream = NULL;
 static char* sub_stream = NULL;
 static int demuxer_type = 0, audio_demuxer_type = 0, sub_demuxer_type = 0;
 extern m_config_t* mconfig;
--- a/libmpdemux/stream.h	Tue Jul 02 21:10:42 2002 +0000
+++ b/libmpdemux/stream.h	Tue Jul 02 22:31:50 2002 +0000
@@ -202,6 +202,8 @@
 int dvd_parse_chapter_range(struct config*, const char*);
 //#endif
 
+extern char * audio_stream;
+
 #ifdef USE_DVDNAV
 #include "dvdnav_stream.h"
 #endif
--- a/mplayer.c	Tue Jul 02 21:10:42 2002 +0000
+++ b/mplayer.c	Tue Jul 02 22:31:50 2002 +0000
@@ -862,6 +862,7 @@
          }
    	guiIntfStruct.FilenameChanged=0;
        } 
+     audio_stream=guiIntfStruct.AudioFile; 
     }
 #endif
 //---------------------------------------------------------------------------