Mercurial > mplayer.hg
changeset 8312:ef8c992672f4
- audio track handling in menu (idea from R¸«ädiger Kuhlmann)
- some userfriendly changes in menu
author | pontscho |
---|---|
date | Fri, 29 Nov 2002 00:58:25 +0000 |
parents | 37ab4e646f65 |
children | 5ffa1973272e |
files | Gui/app.c Gui/app.h Gui/interface.c Gui/interface.h Gui/mplayer/gtk/menu.c Gui/mplayer/mw.c mplayer.c |
diffstat | 7 files changed, 43 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/app.c Thu Nov 28 23:17:14 2002 +0000 +++ b/Gui/app.c Fri Nov 29 00:58:25 2002 +0000 @@ -62,7 +62,8 @@ { evSetURL, "evSetURL" }, { evLoadAudioFile, "evLoadAudioFile" }, { evDropSubtitle, "evDropSubtitle" }, - { evSetAspect, "evSetAspect" } + { evSetAspect, "evSetAspect" }, + { evSetAudio, "evSetAudio" } }; int evBoxs = sizeof( evNames ) / sizeof( evName );
--- a/Gui/app.h Thu Nov 28 23:17:14 2002 +0000 +++ b/Gui/app.h Fri Nov 29 00:58:25 2002 +0000 @@ -57,7 +57,8 @@ #define evPlayNetwork 41 #define evLoadAudioFile 42 #define evSetAspect 44 -// 45 ... +#define evSetAudio 45 +// 46 ... #define evExit 1000
--- a/Gui/interface.c Thu Nov 28 23:17:14 2002 +0000 +++ b/Gui/interface.c Fri Nov 29 00:58:25 2002 +0000 @@ -454,6 +454,9 @@ case guiReDrawSubWindow: wsPostRedisplay( &appMPlayer.subWindow ); break; + case guiSetDemuxer: + guiIntfStruct.demuxer=(void *)arg; + break; case guiSetShVideo: { if ( !appMPlayer.subWindow.isFullScreen )
--- a/Gui/interface.h Thu Nov 28 23:17:14 2002 +0000 +++ b/Gui/interface.h Fri Nov 29 00:58:25 2002 +0000 @@ -59,6 +59,7 @@ guiUnknowErrorStruct error; void * sh_video; + void * demuxer; void * event_struct; int DiskChanged; @@ -123,6 +124,7 @@ #define guiSetDefaults 12 #define guiSetValues 13 #define guiSetFileFormat 14 +#define guiSetDemuxer 15 #define guiSetStop 0 #define guiSetPlay 1
--- a/Gui/mplayer/gtk/menu.c Thu Nov 28 23:17:14 2002 +0000 +++ b/Gui/mplayer/gtk/menu.c Fri Nov 29 00:58:25 2002 +0000 @@ -14,6 +14,8 @@ #include "../widgets.h" #include "../app.h" +#include "../../../libmpdemux/demuxer.h" + void ActivateMenuItem( int Item ) { // fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 ); @@ -411,11 +413,29 @@ gtk_widget_set_sensitive( MenuItem,FALSE ); } #endif - AspectMenu=AddSubMenu( Menu,MSGTR_MENU_AspectRatio ); - AddMenuItem( AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect ); - AddMenuItem( AspectMenu,"16:9",( 2 << 16 ) + evSetAspect ); - AddMenuItem( AspectMenu,"4:3",( 3 << 16 ) + evSetAspect ); - AddMenuItem( AspectMenu,"2.35",( 4 << 16 ) + evSetAspect ); + + if ( guiIntfStruct.Playing ) + { + AspectMenu=AddSubMenu( Menu,MSGTR_MENU_AspectRatio ); + AddMenuItem( AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect ); + AddMenuItem( AspectMenu,"16:9",( 2 << 16 ) + evSetAspect ); + AddMenuItem( AspectMenu,"4:3",( 3 << 16 ) + evSetAspect ); + AddMenuItem( AspectMenu,"2.35",( 4 << 16 ) + evSetAspect ); + } + + if ( guiIntfStruct.demuxer ) + { + int i,c = 0; + + for ( i=0;i < MAX_A_STREAMS;i++ ) + if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] ) + { + char tmp[32]; + snprintf( tmp,32,"Track %d",i ); + if ( !c ) { SubMenu=AddSubMenu( Menu, "Audio track" ); c=1; } + AddMenuItem( SubMenu,tmp,( i << 16 ) + evSetAudio ); + } + } AddSeparator( Menu ); MenuItem=AddMenuCheckItem( Menu,MSGTR_MENU_Mute,muted,evMute ); @@ -424,11 +444,11 @@ AddMenuItem( Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser ); AddMenuItem( Menu,MSGTR_MENU_Preferences, evPreferences ); AddMenuItem( Menu,MSGTR_Equalizer, evEqualizer ); - AddSeparator( Menu ); if ( guiIntfStruct.NoWindow == False ) { int b1 = 0, b2 = 0; + AddSeparator( Menu ); if ( !appMPlayer.subWindow.isFullScreen && guiIntfStruct.Playing ) { if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth * 2 )&& @@ -439,12 +459,6 @@ AddMenuCheckItem( Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize ); AddMenuCheckItem( Menu,MSGTR_MENU_FullScreen,appMPlayer.subWindow.isFullScreen,evFullScreen ); } - else - { - MenuItem=AddMenuCheckItem( Menu,MSGTR_MENU_NormalSize" ",0,evNormalSize ); gtk_widget_set_sensitive( MenuItem,FALSE ); - MenuItem=AddMenuCheckItem( Menu,MSGTR_MENU_DoubleSize,0,evDoubleSize ); gtk_widget_set_sensitive( MenuItem,FALSE ); - MenuItem=AddMenuCheckItem( Menu,MSGTR_MENU_FullScreen,0,evFullScreen ); gtk_widget_set_sensitive( MenuItem,FALSE ); - } AddSeparator( Menu ); AddMenuItem( Menu,MSGTR_MENU_Exit, evExit );
--- a/Gui/mplayer/mw.c Thu Nov 28 23:17:14 2002 +0000 +++ b/Gui/mplayer/mw.c Fri Nov 29 00:58:25 2002 +0000 @@ -270,6 +270,13 @@ case evSetURL: gtkShow( evPlayNetwork,NULL ); break; + + case evSetAudio: + if ( !guiIntfStruct.demuxer ) break; + audio_id=(int)param; + if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play; + guiIntfStruct.FilenameChanged=1; + break; #ifdef HAVE_VCD case evSetVCDTrack:
--- a/mplayer.c Thu Nov 28 23:17:14 2002 +0000 +++ b/mplayer.c Fri Nov 29 00:58:25 2002 +0000 @@ -1350,6 +1350,7 @@ if ( !sh_video && sh_audio ) guiGetEvent( guiSetAudioOnly,(char *)1 ); else guiGetEvent( guiSetAudioOnly,(char *)0 ); guiGetEvent( guiSetFileFormat,(char *)demuxer->file_format ); if ( guiGetEvent( guiSetValues,(char *)sh_video ) ) goto goto_next_file; + guiGetEvent( guiSetDemuxer,(char *)demuxer ); } #endif