1
mirror of https://github.com/mpv-player/mpv synced 2025-01-13 00:06:25 +01:00

- audio track handling in menu (idea from Rüdiger Kuhlmann)

- some userfriendly changes in menu


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8313 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
pontscho 2002-11-29 00:58:25 +00:00
parent 4984919e0b
commit 73d2051d61
7 changed files with 43 additions and 14 deletions

View File

@ -62,7 +62,8 @@ evName evNames[] =
{ evSetURL, "evSetURL" }, { evSetURL, "evSetURL" },
{ evLoadAudioFile, "evLoadAudioFile" }, { evLoadAudioFile, "evLoadAudioFile" },
{ evDropSubtitle, "evDropSubtitle" }, { evDropSubtitle, "evDropSubtitle" },
{ evSetAspect, "evSetAspect" } { evSetAspect, "evSetAspect" },
{ evSetAudio, "evSetAudio" }
}; };
int evBoxs = sizeof( evNames ) / sizeof( evName ); int evBoxs = sizeof( evNames ) / sizeof( evName );

View File

@ -57,7 +57,8 @@
#define evPlayNetwork 41 #define evPlayNetwork 41
#define evLoadAudioFile 42 #define evLoadAudioFile 42
#define evSetAspect 44 #define evSetAspect 44
// 45 ... #define evSetAudio 45
// 46 ...
#define evExit 1000 #define evExit 1000

View File

@ -454,6 +454,9 @@ int guiGetEvent( int type,char * arg )
case guiReDrawSubWindow: case guiReDrawSubWindow:
wsPostRedisplay( &appMPlayer.subWindow ); wsPostRedisplay( &appMPlayer.subWindow );
break; break;
case guiSetDemuxer:
guiIntfStruct.demuxer=(void *)arg;
break;
case guiSetShVideo: case guiSetShVideo:
{ {
if ( !appMPlayer.subWindow.isFullScreen ) if ( !appMPlayer.subWindow.isFullScreen )

View File

@ -59,6 +59,7 @@ typedef struct
guiUnknowErrorStruct error; guiUnknowErrorStruct error;
void * sh_video; void * sh_video;
void * demuxer;
void * event_struct; void * event_struct;
int DiskChanged; int DiskChanged;
@ -123,6 +124,7 @@ extern guiInterface_t guiIntfStruct;
#define guiSetDefaults 12 #define guiSetDefaults 12
#define guiSetValues 13 #define guiSetValues 13
#define guiSetFileFormat 14 #define guiSetFileFormat 14
#define guiSetDemuxer 15
#define guiSetStop 0 #define guiSetStop 0
#define guiSetPlay 1 #define guiSetPlay 1

View File

@ -14,6 +14,8 @@
#include "../widgets.h" #include "../widgets.h"
#include "../app.h" #include "../app.h"
#include "../../../libmpdemux/demuxer.h"
void ActivateMenuItem( int Item ) void ActivateMenuItem( int Item )
{ {
// fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 ); // fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 );
@ -411,11 +413,29 @@ GtkWidget * create_PopUpMenu( void )
gtk_widget_set_sensitive( MenuItem,FALSE ); gtk_widget_set_sensitive( MenuItem,FALSE );
} }
#endif #endif
AspectMenu=AddSubMenu( Menu,MSGTR_MENU_AspectRatio );
AddMenuItem( AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect ); if ( guiIntfStruct.Playing )
AddMenuItem( AspectMenu,"16:9",( 2 << 16 ) + evSetAspect ); {
AddMenuItem( AspectMenu,"4:3",( 3 << 16 ) + evSetAspect ); AspectMenu=AddSubMenu( Menu,MSGTR_MENU_AspectRatio );
AddMenuItem( AspectMenu,"2.35",( 4 << 16 ) + evSetAspect ); 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 ); AddSeparator( Menu );
MenuItem=AddMenuCheckItem( Menu,MSGTR_MENU_Mute,muted,evMute ); MenuItem=AddMenuCheckItem( Menu,MSGTR_MENU_Mute,muted,evMute );
@ -424,11 +444,11 @@ GtkWidget * create_PopUpMenu( void )
AddMenuItem( Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser ); AddMenuItem( Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser );
AddMenuItem( Menu,MSGTR_MENU_Preferences, evPreferences ); AddMenuItem( Menu,MSGTR_MENU_Preferences, evPreferences );
AddMenuItem( Menu,MSGTR_Equalizer, evEqualizer ); AddMenuItem( Menu,MSGTR_Equalizer, evEqualizer );
AddSeparator( Menu );
if ( guiIntfStruct.NoWindow == False ) if ( guiIntfStruct.NoWindow == False )
{ {
int b1 = 0, b2 = 0; int b1 = 0, b2 = 0;
AddSeparator( Menu );
if ( !appMPlayer.subWindow.isFullScreen && guiIntfStruct.Playing ) if ( !appMPlayer.subWindow.isFullScreen && guiIntfStruct.Playing )
{ {
if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth * 2 )&& if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth * 2 )&&
@ -439,12 +459,6 @@ GtkWidget * create_PopUpMenu( void )
AddMenuCheckItem( Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize ); AddMenuCheckItem( Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize );
AddMenuCheckItem( Menu,MSGTR_MENU_FullScreen,appMPlayer.subWindow.isFullScreen,evFullScreen ); 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 ); AddSeparator( Menu );
AddMenuItem( Menu,MSGTR_MENU_Exit, evExit ); AddMenuItem( Menu,MSGTR_MENU_Exit, evExit );

View File

@ -270,6 +270,13 @@ void mplEventHandling( int msg,float param )
case evSetURL: case evSetURL:
gtkShow( evPlayNetwork,NULL ); gtkShow( evPlayNetwork,NULL );
break; 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 #ifdef HAVE_VCD
case evSetVCDTrack: case evSetVCDTrack:

View File

@ -1350,6 +1350,7 @@ fflush(stdout);
if ( !sh_video && sh_audio ) guiGetEvent( guiSetAudioOnly,(char *)1 ); else guiGetEvent( guiSetAudioOnly,(char *)0 ); if ( !sh_video && sh_audio ) guiGetEvent( guiSetAudioOnly,(char *)1 ); else guiGetEvent( guiSetAudioOnly,(char *)0 );
guiGetEvent( guiSetFileFormat,(char *)demuxer->file_format ); guiGetEvent( guiSetFileFormat,(char *)demuxer->file_format );
if ( guiGetEvent( guiSetValues,(char *)sh_video ) ) goto goto_next_file; if ( guiGetEvent( guiSetValues,(char *)sh_video ) ) goto goto_next_file;
guiGetEvent( guiSetDemuxer,(char *)demuxer );
} }
#endif #endif