1
mirror of https://github.com/mpv-player/mpv synced 2024-09-05 02:48:21 +02:00

- fix three submenu bug

- audio/video track hiding
	- normal/double/fullscreen handling
	- dvd audio channel setting bug
- fix file/url/vcd/dvd playing
- fix variables initialization
- some small bug fix
- applied some patch from Rüdiger Kuhlmann


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8424 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
pontscho 2002-12-11 01:21:12 +00:00
parent d9b33edbba
commit 15dc6ef3f7
9 changed files with 109 additions and 78 deletions

View File

@ -58,7 +58,7 @@
#define evLoadAudioFile 42
#define evSetAspect 44
#define evSetAudio 45
#define evSetVideo 46
#define evSetVideo 46
// 47 ...
#define evExit 1000

View File

@ -13,6 +13,7 @@
#include "mplayer/gtk/eq.h"
#include "mplayer/widgets.h"
#include "mplayer/mplayer.h"
#include "mplayer/play.h"
#include "../mplayer.h"
#include "app.h"
@ -264,6 +265,7 @@ void guiInit( void )
mplSubRender=1;
// ---
if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE );
if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name );
#if defined( USE_OSD ) || defined( USE_SUB )
@ -435,10 +437,11 @@ int guiGetEvent( int type,char * arg )
case guiCEvent:
switch ( (int)arg )
{
case guiSetPlay: guiIntfStruct.Playing=1; mplState(); break;
case guiSetStop: guiIntfStruct.Playing=0; mplState(); break;
case guiSetPause: guiIntfStruct.Playing=2; mplState(); break;
case guiSetPlay: guiIntfStruct.Playing=1; break;
case guiSetStop: guiIntfStruct.Playing=0; break;
case guiSetPause: guiIntfStruct.Playing=2; break;
}
mplState();
break;
case guiSetState:
mplState();
@ -451,9 +454,6 @@ int guiGetEvent( int type,char * arg )
if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); }
else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
break;
case guiReDrawSubWindow:
wsPostRedisplay( &appMPlayer.subWindow );
break;
case guiSetDemuxer:
guiIntfStruct.demuxer=(void *)arg;
break;
@ -500,8 +500,6 @@ int guiGetEvent( int type,char * arg )
if ( vcd_seek_to_track( stream->fd,i ) < 0 ) break;
vcd_seek_to_track( stream->fd,vcd_track );
guiIntfStruct.VCDTracks=--i;
mp_msg( MSGT_GPLAYER,MSGL_INFO,"[gui] vcd tracks: %d\n",guiIntfStruct.VCDTracks );
guiIntfStruct.Track=vcd_track;
break;
}
#endif
@ -554,12 +552,6 @@ int guiGetEvent( int type,char * arg )
if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled );
else btnSet( evSetMoviePosition,btnReleased );
if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
else stream_cache_size=-1;
if ( gtkAutoSyncOn ) autosync=gtkAutoSync;
else autosync=0;
// -- audio
if ( audio_out )
{
@ -604,14 +596,42 @@ int guiGetEvent( int type,char * arg )
#endif
break;
case guiSetDefaults:
if ( filename && !guiIntfStruct.Filename )
{
gtkSet( gtkDelPl,0,NULL ); guiIntfStruct.StreamType=STREAMTYPE_FILE;
guiSetFilename( guiIntfStruct.Filename,filename );
if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
{
audio_id=-1;
video_id=-1;
dvdsub_id=-1;
vobsub_id=-1;
stream_cache_size=-1;
autosync=0;
vcd_track=0;
dvd_title=0;
}
wsPostRedisplay( &appMPlayer.subWindow );
break;
case guiSetParameters:
switch ( guiIntfStruct.StreamType )
{
case STREAMTYPE_PLAYLIST:
break;
#ifdef HAVE_VCD
case STREAMTYPE_VCD:
vcd_track=guiIntfStruct.Track;
break;
#endif
#ifdef USE_DVDREAD
case STREAMTYPE_DVD:
dvd_title=guiIntfStruct.Title;
dvd_chapter=guiIntfStruct.Chapter;
dvd_angle=guiIntfStruct.Angle;
break;
#endif
}
if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST )
{
if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename );
else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename );
}
guiIntfStruct.DiskChanged=0;
// --- video opts
if ( !video_driver_list )
@ -674,7 +694,7 @@ int guiGetEvent( int type,char * arg )
mixer_device=gtkAOOSSMixer;
if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) && gtkAOOSSDevice )
{
char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 5 );
char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 );
sprintf( tmp,"oss:%s",gtkAOOSSDevice );
gaddlist( &audio_driver_list,tmp );
}
@ -692,9 +712,19 @@ int guiGetEvent( int type,char * arg )
#endif
// --- misc
if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
else stream_cache_size=-1;
if ( gtkAutoSyncOn ) autosync=gtkAutoSync;
else autosync=0;
if ( guiIntfStruct.AudioFile ) audio_stream=guiIntfStruct.AudioFile;
else if ( guiIntfStruct.FilenameChanged ) audio_stream=NULL;
guiIntfStruct.DiskChanged=0;
guiIntfStruct.FilenameChanged=0;
guiIntfStruct.NewPlay=0;
break;
}
return False;

View File

@ -63,9 +63,13 @@ typedef struct
void * event_struct;
int DiskChanged;
int NewPlay;
#ifdef USE_DVDREAD
guiDVDStruct DVD;
int Title;
int Angle;
int Chapter;
#endif
#ifdef HAVE_VCD
@ -125,6 +129,7 @@ extern guiInterface_t guiIntfStruct;
#define guiSetValues 13
#define guiSetFileFormat 14
#define guiSetDemuxer 15
#define guiSetParameters 16
#define guiSetStop 0
#define guiSetPlay 1

View File

@ -379,14 +379,15 @@ GtkWidget * create_PopUpMenu( void )
DVDAudioLanguageMenu=AddSubMenu( DVDSubMenu,MSGTR_MENU_AudioLanguages );
if ( guiIntfStruct.DVD.nr_of_audio_channels )
{
char tmp[64]; int i;
char tmp[64]; int i, id = audio_id;
for ( i=0;i < guiIntfStruct.DVD.nr_of_audio_channels;i++ )
{
snprintf( tmp,64,"%s - %s %s",GetLanguage( guiIntfStruct.DVD.audio_streams[i].language ),
ChannelTypes[ guiIntfStruct.DVD.audio_streams[i].type ],
ChannelNumbers[ guiIntfStruct.DVD.audio_streams[i].channels ] );
if ( id == -1 ) id=guiIntfStruct.DVD.audio_streams[i].id;
AddMenuCheckItem( DVDAudioLanguageMenu,tmp,
audio_id == guiIntfStruct.DVD.audio_streams[i].id,
id == guiIntfStruct.DVD.audio_streams[i].id,
( guiIntfStruct.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio );
}
}
@ -424,7 +425,7 @@ GtkWidget * create_PopUpMenu( void )
AddMenuItem( AspectMenu,"2.35",( 4 << 16 ) + evSetAspect );
}
if ( guiIntfStruct.demuxer && guiIntfStruct.StreamType != STREAMTYPE_DVD )
if ( guiIntfStruct.Playing && guiIntfStruct.demuxer && guiIntfStruct.StreamType != STREAMTYPE_DVD )
{
int i,c = 0;

View File

@ -252,6 +252,7 @@ extern int osd_visible;
void mplEventHandling( int msg,float param )
{
int j;
int iparam = (int)param;
switch( msg )
{
@ -270,22 +271,20 @@ void mplEventHandling( int msg,float param )
break;
case evSetAudio:
if ( !guiIntfStruct.demuxer ) break;
audio_id=(int)param;
if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play;
guiIntfStruct.FilenameChanged=1;
if ( !guiIntfStruct.demuxer || audio_id == iparam ) break;
audio_id=iparam;
guiIntfStruct.NewPlay=1;
break;
case evSetVideo:
if ( !guiIntfStruct.demuxer ) break;
video_id=(int)param;
if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play;
guiIntfStruct.FilenameChanged=1;
break;
if ( !guiIntfStruct.demuxer || video_id == iparam ) break;
video_id=iparam;
guiIntfStruct.NewPlay=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;
@ -299,6 +298,7 @@ void mplEventHandling( int msg,float param )
play_dvd_2:
gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD) );
guiIntfStruct.StreamType=STREAMTYPE_DVD;
goto play;
#endif
case evPlay:
case evPlaySwitchToPause:
@ -306,18 +306,11 @@ play:
if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 2 ) ) goto NoPause;
vcd_track=0;
dvd_title=0;
if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiIntfStruct.StreamType == STREAMTYPE_FILE ) )
{
plItem * next = gtkSet( gtkGetCurrPlItem,0,NULL );
plLastPlayed=next;
guiSetDF( guiIntfStruct.Filename,next->path,next->name );
guiIntfStruct.StreamType=STREAMTYPE_FILE;
guiIntfStruct.FilenameChanged=1;
gfree( (void **)&guiIntfStruct.AudioFile );
gfree( (void **)&guiIntfStruct.Subtitlename );
mplSetFileName( next->path,next->name,STREAMTYPE_FILE );
}
switch ( guiIntfStruct.StreamType )
@ -335,10 +328,9 @@ play:
{
if ( !guiIntfStruct.Track )
{
if ( guiIntfStruct.VCDTracks == 1 ) guiIntfStruct.Track=1;
else guiIntfStruct.Track=2;
if ( guiIntfStruct.VCDTracks > 1 ) guiIntfStruct.Track=2;
else guiIntfStruct.Track=1;
}
vcd_track=guiIntfStruct.Track;
guiIntfStruct.DiskChanged=1;
}
break;
@ -350,31 +342,32 @@ play:
mplSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
if ( guiIntfStruct.Playing != 2 )
{
dvd_title=guiIntfStruct.DVD.current_title;
dvd_angle=guiIntfStruct.DVD.current_angle;
dvd_chapter=guiIntfStruct.DVD.current_chapter;
guiIntfStruct.Title=guiIntfStruct.DVD.current_title;
guiIntfStruct.Chapter=guiIntfStruct.DVD.current_chapter;
guiIntfStruct.Angle=guiIntfStruct.DVD.current_angle;
guiIntfStruct.DiskChanged=1;
}
break;
#endif
}
guiIntfStruct.NewPlay=1;
mplPlay();
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;
@ -387,7 +380,11 @@ NoPause:
mplPause();
break;
case evStop: guiIntfStruct.Playing=guiSetStop; mplState(); break;
case evStop:
guiIntfStruct.Playing=guiSetStop;
mplState();
guiIntfStruct.NoWindow=False;
break;
case evLoadPlay:
mplMainAutoPlay=1;
@ -448,7 +445,7 @@ set_volume:
case evIconify:
switch ( (int)param )
switch ( iparam )
{
case 0: wsIconify( appMPlayer.mainWindow ); break;
case 1: wsIconify( appMPlayer.subWindow ); break;
@ -489,7 +486,7 @@ set_volume:
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;
@ -499,10 +496,10 @@ set_volume:
}
wsClearWindow( appMPlayer.subWindow );
#ifdef USE_DVDREAD
if ( guiIntfStruct.StreamType == STREAMTYPE_DVD ) goto play_dvd_2;
if ( guiIntfStruct.StreamType == STREAMTYPE_DVD || guiIntfStruct.StreamType == STREAMTYPE_VCD ) goto play_dvd_2;
else
#endif
guiIntfStruct.FilenameChanged=1;
guiIntfStruct.NewPlay=1;
break;
// --- timer events

View File

@ -10,6 +10,7 @@
#include "../wm/ws.h"
#include "../../config.h"
#include "../../help_mp.h"
#include "../../mplayer.h"
#include "../../libvo/x11_common.h"
#include "../../input/input.h"
@ -99,7 +100,7 @@ void mplEnd( void )
plLastPlayed=next;
guiSetDF( guiIntfStruct.Filename,next->path,next->name );
guiIntfStruct.StreamType=STREAMTYPE_FILE;
guiIntfStruct.FilenameChanged=1;
guiIntfStruct.FilenameChanged=guiIntfStruct.NewPlay=1;
gfree( (void **)&guiIntfStruct.AudioFile );
gfree( (void **)&guiIntfStruct.Subtitlename );
}
@ -110,6 +111,8 @@ void mplEnd( void )
guiIntfStruct.TimeSec=0;
guiIntfStruct.Position=0;
guiIntfStruct.AudioType=0;
guiIntfStruct.NoWindow=False;
#ifdef USE_DVDREAD
guiIntfStruct.DVD.current_title=1;
guiIntfStruct.DVD.current_chapter=1;
@ -255,10 +258,10 @@ void mplSetFileName( char * dir,char * name,int type )
if ( !name ) return;
if ( !dir ) guiSetFilename( guiIntfStruct.Filename,name )
else guiSetDF( guiIntfStruct.Filename,dir,name )
else guiSetDF( guiIntfStruct.Filename,dir,name );
// filename=guiIntfStruct.Filename;
guiIntfStruct.StreamType=type;
guiIntfStruct.FilenameChanged=1;
gfree( (void **)&guiIntfStruct.AudioFile );
gfree( (void **)&guiIntfStruct.Subtitlename );
}

View File

@ -234,7 +234,7 @@ int cmd_button( char * in )
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 )
{ ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 1; }
{ ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; }
defList->Items[ defList->NumberOfItems ].pressed=btnReleased;
if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled;
defList->Items[ defList->NumberOfItems ].tmp=1;

View File

@ -868,8 +868,8 @@ if(!use_stdin && !slave_mode){
// =================== GUI idle loop (STOP state) ===========================
#ifdef HAVE_NEW_GUI
if ( use_gui ) {
guiGetEvent( guiReDrawSubWindow,0 );
file_format=DEMUXER_TYPE_UNKNOWN;
guiGetEvent( guiSetDefaults,0 );
while ( guiIntfStruct.Playing != 1 )
{
mp_cmd_t* cmd;
@ -878,14 +878,8 @@ if(!use_stdin && !slave_mode){
guiGetEvent( guiReDraw,NULL );
if ( (cmd = mp_input_get_cmd(0,0)) != NULL) guiGetEvent( guiIEvent,(char *)cmd->id );
}
guiGetEvent( guiSetDefaults,NULL );
if ( ( guiIntfStruct.FilenameChanged || !filename )
//#ifdef USE_DVDREAD
// && ( guiIntfStruct.StreamType != STREAMTYPE_DVD )
//#endif
)
guiGetEvent( guiSetParameters,NULL );
if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM )
{
play_tree_t * entry = play_tree_new();
play_tree_add_file( entry,guiIntfStruct.Filename );
@ -905,7 +899,6 @@ if(!use_stdin && !slave_mode){
filename = play_tree_iter_get_file(playtree_iter,1);
}
}
guiIntfStruct.FilenameChanged=0;
}
}
#endif
@ -951,6 +944,10 @@ if(!use_stdin && !slave_mode){
}
inited_flags|=INITED_STREAM;
#ifdef HAVE_NEW_GUI
if ( use_gui ) guiGetEvent( guiSetStream,(char *)stream );
#endif
if(stream->type == STREAMTYPE_PLAYLIST) {
play_tree_t* entry;
// Handle playlist
@ -1348,8 +1345,6 @@ fflush(stdout);
#ifdef HAVE_NEW_GUI
if ( use_gui )
{
guiGetEvent( guiSetStream,(char *)stream );
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( guiSetFileFormat,(char *)demuxer->file_format );
@ -2700,12 +2695,11 @@ if(rel_seek_secs || abs_seek_pos){
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;
if ( guiIntfStruct.DiskChanged || guiIntfStruct.NewPlay ) goto goto_next_file;
#ifdef USE_DVDREAD
if ( stream->type == STREAMTYPE_DVD )
{
dvd_priv_t * dvdp = stream->priv;
/*guiIntfStruct.DVD.current_chapter=dvdp->cur_cell + 1;*/
guiIntfStruct.DVD.current_chapter=dvd_chapter_from_cell(dvdp,guiIntfStruct.DVD.current_title-1, dvdp->cur_cell)+1;
}
#endif

View File

@ -51,6 +51,7 @@ extern int auto_quality;
extern int audio_id;
extern int video_id;
extern int dvdsub_id;
extern int vobsub_id;
extern void exit_player(char* how);