📄 interface.c
字号:
guiIntfStruct.SubtitleChanged=1; //what is this for? (mw) return; } if ( subdata ) { mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_DeletingSubtitles ); sub_free( subdata ); subdata=NULL; vo_sub=NULL; if ( vo_osd_list ) { int len; mp_osd_obj_t * osd = vo_osd_list; while ( osd ) { if ( osd->type == OSDTYPE_SUBTITLE ) break; osd=osd->next; } if ( osd && osd->flags&OSDFLAG_VISIBLE ) { len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 ); memset( osd->bitmap_buffer,0,len ); memset( osd->alpha_buffer,0,len ); } } } if ( name ) { mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_LoadingSubtitles,name ); subdata=sub_read_file( name, guiIntfStruct.FPS ); if ( !subdata ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name ); sub_name = (malloc(2 * sizeof(char*))); //when mplayer will be restarted sub_name[0] = strdup(name); //sub_name[0] will be read sub_name[1] = NULL; } update_set_of_subtitles();}static void add_vf( char * str ){ mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_AddingVideoFilter,str ); if ( vf_settings ) { int i = 0; while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { i=-1; break; } if ( i != -1 ) { vf_settings=realloc( vf_settings,( i + 2 ) * sizeof( m_obj_settings_t ) ); vf_settings[i].name=strdup( str );vf_settings[i].attribs = NULL; vf_settings[i+1].name=NULL; } } else { vf_settings=malloc( 2 * sizeof( m_obj_settings_t ) ); vf_settings[0].name=strdup( str );vf_settings[0].attribs = NULL; vf_settings[1].name=NULL; }}static void remove_vf( char * str ){ int n = 0; if ( !vf_settings ) return; mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_RemovingVideoFilter,str ); while ( vf_settings[n++].name ); n--; if ( n > -1 ) { int i = 0,m = -1; while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { m=i - 1; break; } i--; if ( m > -1 ) { if ( n == 1 ) { free( vf_settings[0].name );free( vf_settings[0].attribs ); free( vf_settings ); vf_settings=NULL; } else { free( vf_settings[i].name );free( vf_settings[i].attribs ); memcpy( &vf_settings[i],&vf_settings[i + 1],( n - i ) * sizeof( m_obj_settings_t ) ); } } }}int guiGetEvent( int type,char * arg ){ ao_functions_t *audio_out = NULL; vo_functions_t *video_out = NULL; mixer_t *mixer = NULL; stream_t * stream = (stream_t *) arg;#ifdef USE_DVDREAD dvd_priv_t * dvdp = (dvd_priv_t *) arg;#endif if (guiIntfStruct.mpcontext) { audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext); video_out = mpctx_get_video_out(guiIntfStruct.mpcontext); mixer = mpctx_get_mixer(guiIntfStruct.mpcontext); } switch ( type ) { case guiXEvent: guiIntfStruct.event_struct=(void *)arg; wsEvents( wsDisplay,(XEvent *)arg,NULL ); gtkEventHandling(); break; case guiCEvent: switch ( (int)arg ) { case guiSetPlay: guiIntfStruct.Playing=1;// if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); break; case guiSetStop: guiIntfStruct.Playing=0;// if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); break; case guiSetPause: guiIntfStruct.Playing=2; break; } mplState(); break; case guiSetState: mplState(); break; case guiSetFileName: if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); break; case guiSetAudioOnly: guiIntfStruct.AudioOnly=(int)arg; if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); } else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); break; case guiSetContext: guiIntfStruct.mpcontext=(void *)arg; case guiSetDemuxer: guiIntfStruct.demuxer=(void *)arg; break; case guiSetAfilter: guiIntfStruct.afilter=(void *)arg; break; case guiSetShVideo: { if ( !appMPlayer.subWindow.isFullScreen ) { wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight ); wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); } guiIntfStruct.MovieWidth=vo_dwidth; guiIntfStruct.MovieHeight=vo_dheight; if (guiWinID>=0) wsMoveWindow( &appMPlayer.mainWindow,0,0, vo_dheight); } break;#ifdef USE_DVDREAD case guiSetDVD: guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts; guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts; guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles; guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels; memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) ); guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles; memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) ); guiIntfStruct.DVD.current_title=dvd_title + 1; guiIntfStruct.DVD.current_chapter=dvd_chapter + 1; guiIntfStruct.DVD.current_angle=dvd_angle + 1; guiIntfStruct.Track=dvd_title + 1; break;#endif case guiSetStream: guiIntfStruct.StreamType=stream->type; switch( stream->type ) {#ifdef USE_DVDREAD case STREAMTYPE_DVD: guiGetEvent( guiSetDVD,(char *)stream->priv ); break;#endif#ifdef HAVE_VCD case STREAMTYPE_VCD: { int i; if (!stream->priv) { guiIntfStruct.VCDTracks=0; break; } for ( i=1;i < 100;i++ ) if ( vcd_seek_to_track( stream->priv,i ) < 0 ) break; vcd_seek_to_track( stream->priv,vcd_track ); guiIntfStruct.VCDTracks=--i; break; }#endif default: break; } break; case guiIEvent: mp_msg( MSGT_GPLAYER,MSGL_V,"cmd: %d\n",(int)arg ); switch( (int)arg ) { case MP_CMD_QUIT: mplEventHandling( evExit,0 ); break; case MP_CMD_VO_FULLSCREEN: mplEventHandling( evFullScreen,0 ); break; default: mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 ); } break; case guiReDraw: mplEventHandling( evRedraw,0 ); break; case guiSetVolume: if ( audio_out ) { float l,r; mixer_getvolume( mixer,&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 guiSetFileFormat: guiIntfStruct.FileFormat=(int)arg; break; case guiSetValues:// -- video guiIntfStruct.sh_video=arg; if ( arg ) { sh_video_t * sh = (sh_video_t *)arg; guiIntfStruct.FPS=sh->fps; } if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled ); else btnSet( evSetMoviePosition,btnReleased ); // -- audio if ( audio_out ) { float l,r; mixer_getvolume( mixer,&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 ); } if ( gtkEnableAudioEqualizer ) { equalizer_t eq; int i,j; for ( i=0;i<6;i++ ) for ( j=0;j<10;j++ ) { eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j]; gtkSet( gtkSetEqualizer,0,&eq ); } }// -- subtitle#ifdef HAVE_DXR3 if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS#ifdef USE_LIBAVCODEC && !gtkVfLAVC#endif ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVC ); guiIntfStruct.Playing=0; return True; }#endif break; case guiSetDefaults:// if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged ) if ( 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; force_fps=0; } guiIntfStruct.demuxer=NULL; guiIntfStruct.sh_video=NULL; wsPostRedisplay( &appMPlayer.subWindow ); break; case guiSetParameters: guiGetEvent( guiSetDefaults,NULL ); switch ( guiIntfStruct.StreamType ) { case STREAMTYPE_PLAYLIST: break;#ifdef HAVE_VCD case STREAMTYPE_VCD: { char tmp[512]; sprintf( tmp,"vcd://%d",guiIntfStruct.Track + 1 ); guiSetFilename( guiIntfStruct.Filename,tmp ); } break;#endif#ifdef USE_DVDREAD case STREAMTYPE_DVD: { char tmp[512]; sprintf( tmp,"dvd://%d",guiIntfStruct.Title ); guiSetFilename( guiIntfStruct.Filename,tmp ); } dvd_chapter=guiIntfStruct.Chapter; dvd_angle=guiIntfStruct.Angle; break;#endif } //if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore! { if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename ); else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename ); }// --- video opts if ( !video_driver_list ) { int i = 0; while ( video_out_drivers[i++] ) if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) { gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name ); break; } } if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); } { int i = 0; guiIntfStruct.NoWindow=False; while ( video_out_drivers[i++] ) if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) { if ( ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)video_out_drivers[i - 1]->info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) ) { guiIntfStruct.NoWindow=True; break; } } }#ifdef HAVE_DXR3#ifdef USE_LIBAVCODEC remove_vf( "lavc" );#endif if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) ) { if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) ) {#ifdef USE_LIBAVCODEC if ( gtkVfLAVC ) add_vf( "lavc" );#endif } }#endif// --- if ( gtkVfPP ) add_vf( "pp" ); else remove_vf( "pp" ); // --- audio opts// if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; } if (gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm"); if (gtkEnableAudioEqualizer) greplace(&af_cfg.list, "equalizer", "equalizer"); if ( gtkAOExtraStereo ) { char *name = malloc(12 + 20 + 1); snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul); name[12 + 20] = 0; greplace(&af_cfg.list, "extrastereo", name); free(name); }#ifdef USE_OSS_AUDIO if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) ) { char *tmp; mixer_device = gtkAOOSSMixer; mixer_channel = gtkAOOSSMixerChannel; if (gtkAOOSSDevice) { tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 ); sprintf( tmp,"oss:%s",gtkAOOSSDevice ); } else tmp = strdup("oss"); gaddlist( &audio_driver_list,tmp ); free(tmp); }#endif#if defined(HAVE_ALSA9) || defined (HAVE_ALSA1X) if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) ) { char *tmp; mixer_device = gtkAOALSAMixer; mixer_channel = gtkAOALSAMixerChannel; if (gtkAOALSADevice) { tmp = calloc( 1,strlen( gtkAOALSADevice ) + 14 ); sprintf( tmp,"alsa:device=%s",gtkAOALSADevice ); } else tmp = strdup("alsa"); gaddlist( &audio_driver_list,tmp ); free(tmp); }#endif#ifdef HAVE_SDL if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) ) { char *tmp; if (gtkAOSDLDriver) { tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 ); sprintf( tmp,"sdl:%s",gtkAOSDLDriver ); } else tmp = strdup("sdl"); gaddlist( &audio_driver_list,tmp ); free(tmp); }#endif#ifdef USE_ESD if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"esd",3 ) ) { char *tmp; if (gtkAOESDDevice) { tmp = calloc( 1,strlen( gtkAOESDDevice ) + 10 ); sprintf( tmp,"esd:%s",gtkAOESDDevice ); } else tmp = strdup("esd"); gaddlist( &audio_driver_list,tmp ); free(tmp);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -