1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-22 06:42:03 +00:00

add [video||audio]_driver_list

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7583 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
pontscho 2002-10-02 13:16:15 +00:00
parent 5ad47aba11
commit f4eefb71c8
6 changed files with 38 additions and 43 deletions

View File

@ -52,7 +52,7 @@ static config_t gui_opts[] =
{
{ "enable_audio_equ",&gtkEnableAudioEqualizer,CONF_TYPE_FLAG,0,0,1,NULL },
{ "vo_driver",&video_driver,CONF_TYPE_STRING,0,0,0,NULL },
{ "vo_driver",&video_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
{ "vo_panscan",&vo_panscan,CONF_TYPE_FLOAT,CONF_RANGE,0.0,1.0,NULL },
{ "vo_doublebuffering",&vo_doublebuffering,CONF_TYPE_FLAG,0,0,1,NULL },
{ "vo_direct_render",&vo_directrendering,CONF_TYPE_FLAG,0,0,1,NULL },
@ -69,7 +69,7 @@ static config_t gui_opts[] =
{ "vf_lavc",&gtkVopLAVC,CONF_TYPE_FLAG,0,0,1,NULL },
{ "vf_fame",&gtkVopFAME,CONF_TYPE_FLAG,0,0,1,NULL },
{ "ao_driver",&audio_driver,CONF_TYPE_STRING,0,0,0,NULL },
{ "ao_driver",&audio_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
{ "ao_nosound",&gtkAONoSound,CONF_TYPE_FLAG,0,0,1,NULL },
{ "ao_volnorm",&gtkAONorm,CONF_TYPE_FLAG,0,0,1,NULL },
{ "ao_surround",&gtkAOSurround,CONF_TYPE_FLAG,0,0,1,NULL },

View File

@ -90,6 +90,21 @@ void gset( char ** str,char * what )
else gstrcat( str,what );
}
void gaddlist( char *** list,char * entry )
{
int i;
if ( (*list) )
{
for ( i=0;(*list)[i];i++ ) free( (*list)[i] );
free( (*list) );
}
(*list)=malloc( 8 );
(*list)[0]=gstrdup( entry );
(*list)[1]=NULL;
}
#ifdef USE_ICONV
char * gconvert_uri_to_filename( char * str )
{
@ -462,7 +477,7 @@ int guiGetEvent( int type,char * arg )
}
// -- subtitle
#ifdef HAVE_DXR3
if ( !gstrcmp( video_driver,"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS && !gtkVopLAVC && !gtkVopFAME )
if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS && !gtkVopLAVC && !gtkVopFAME )
{
gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME );
guiIntfStruct.Playing=0;
@ -481,19 +496,19 @@ int guiGetEvent( int type,char * arg )
// --- video opts
if ( !video_driver )
if ( !video_driver_list )
{
int i = 0;
while ( video_out_drivers[i++] )
if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
{
const vo_info_t *info = video_out_drivers[i - 1]->get_info();
video_driver=gstrdup( (char *)info->short_name );
gaddlist( &video_driver_list,(char *)info->short_name );
break;
}
}
if ( !video_driver ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
{
int i = 0;
@ -502,7 +517,7 @@ int guiGetEvent( int type,char * arg )
if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
{
const vo_info_t *info = video_out_drivers[i - 1]->get_info();
if ( ( !gstrcmp( video_driver,(char *)info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) )
if ( ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) )
{ guiIntfStruct.NoWindow=True; break; }
}
}
@ -510,7 +525,7 @@ int guiGetEvent( int type,char * arg )
#ifdef HAVE_DXR3
remove_vop( "lavc" );
remove_vop( "fame" );
if ( !gstrcmp( video_driver,"dxr3" ) )
if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) )
{
if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) )
{
@ -534,12 +549,11 @@ int guiGetEvent( int type,char * arg )
ao_plugin_cfg.pl_extrastereo_mul=gtkAOExtraStereoMul;
}
mixer_device=gtkAOOSSMixer;
if ( !gstrncmp( audio_driver,"oss",3 ) && gtkAOOSSDevice )
if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) && gtkAOOSSDevice )
{
char * tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 5 );
sprintf( tmp,"oss:%s",gtkAOOSSDevice );
gfree( (void *)&audio_driver );
audio_driver=tmp;
gaddlist( &audio_driver_list,tmp );
}
// -- subtitle

View File

@ -197,6 +197,7 @@ extern char * gconvert_uri_to_filename( char * str );
extern char * gstrdup( char * str );
extern int gstrcmp( char * a,char * b );
extern void gfree( void ** p );
extern void gaddlist( char *** list,char * entry );
#define guiSetFilename( s,n ) { gfree( (void **)&s ); s=gstrdup( n ); }

View File

@ -173,7 +173,7 @@ void ShowPreferences( void )
{
const ao_info_t *info = audio_out_drivers[i++]->info;
if ( !strcmp( info->short_name,"plugin" ) ) continue;
if ( !gstrcmp( audio_driver,(char *)info->short_name ) ) old_audio_driver=i - 1;
if ( audio_driver_list && !gstrcmp( audio_driver_list[0],(char *)info->short_name ) ) old_audio_driver=i - 1;
tmp[0]=(char *)info->short_name; tmp[1]=(char *)info->name; gtk_clist_append( GTK_CLIST( CLADrivers ),tmp );
}
gtk_clist_select_row( GTK_CLIST( CLADrivers ),old_audio_driver,0 );
@ -199,6 +199,7 @@ void ShowPreferences( void )
if (flip != -1)
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBFlip ),flip );
gtk_adjustment_set_value( HSPanscanadj,vo_panscan );
{
int i = 0, c = 0;
char * tmp[3]; tmp[2]="";
@ -207,7 +208,7 @@ void ShowPreferences( void )
if ( video_out_drivers[i++]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
{
const vo_info_t *info = video_out_drivers[i - 1]->get_info();
if ( !gstrcmp( video_driver,(char *)info->short_name ) ) old_video_driver=c; c++;
if ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)info->short_name ) ) old_video_driver=c; c++;
tmp[0]=(char *)info->short_name; tmp[1]=(char *)info->name; gtk_clist_append( GTK_CLIST( CLVDrivers ),tmp );
}
gtk_clist_select_row( GTK_CLIST( CLVDrivers ),old_video_driver,0 );
@ -418,10 +419,9 @@ void prButton( GtkButton * button,gpointer user_data )
gtkAONoSound=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNoSound ) );
gtkSet( gtkSetExtraStereo,HSExtraStereoMuladj->value,NULL );
gtkSet( gtkSetAudioDelay,HSAudioDelayadj->value,NULL );
gfree( (void **)&audio_driver );
audio_driver=gstrdup( ao_driver[0] );
gfree( (void **)&video_driver );
video_driver=gstrdup( vo_driver[0] );
gaddlist( &audio_driver_list,ao_driver[0] );
gaddlist( &video_driver_list,vo_driver[0] );
// -- 2. page
vo_doublebuffering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDoubleBuffer ) );
@ -473,37 +473,17 @@ void prButton( GtkButton * button,gpointer user_data )
{
int i;
char * tmp = gtk_entry_get_text( GTK_ENTRY( EVFM ) );
if ( video_fm_list )
{
for ( i=0;video_fm_list[i];i++ ) gfree( (void **)&video_fm_list[i] );
gfree( (void **)&video_fm_list );
}
for( i=0;mpcodecs_vd_drivers[i];i++ )
if ( !gstrcmp( tmp,(char *)mpcodecs_vd_drivers[i]->info->name ) )
{
video_fm_list=malloc( 8 );
video_fm_list[0]=gstrdup( (char *)mpcodecs_vd_drivers[i]->info->short_name );
video_fm_list[1]=NULL;
break;
}
if ( !gstrcmp( tmp,(char *)mpcodecs_vd_drivers[i]->info->name ) )
{ gaddlist( &video_fm_list,(char *)mpcodecs_vd_drivers[i]->info->short_name ); break; }
}
{
int i;
char * tmp = gtk_entry_get_text( GTK_ENTRY( EAFM ) );
if ( audio_fm_list )
{
for ( i=0;audio_fm_list[i];i++ ) gfree( (void **)&audio_fm_list[i] );
gfree( (void **)&audio_fm_list );
}
for( i=0;mpcodecs_ad_drivers[i];i++ )
if ( !gstrcmp( tmp,(char *)mpcodecs_ad_drivers[i]->info->name ) )
{
audio_fm_list=malloc( 8 );
audio_fm_list[0]=gstrdup( (char *)mpcodecs_ad_drivers[i]->info->short_name );
audio_fm_list[1]=NULL;
break;
}
if ( !gstrcmp( tmp,(char *)mpcodecs_ad_drivers[i]->info->name ) )
{ gaddlist( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; }
}
case bCancel:

View File

@ -215,8 +215,6 @@ static int play_n_frames=-1;
static int play_n_frames_mf=-1;
// screen info:
char* video_driver=NULL; // OBSOLETE, FIXME gui
char* audio_driver=NULL; // OBSOLETE, FIXME gui
char** video_driver_list=NULL;
char** audio_driver_list=NULL;

View File

@ -11,6 +11,8 @@ extern int vcd_track;
extern char ** audio_fm_list;
extern char ** video_fm_list;
extern char ** video_driver_list;
extern char ** audio_driver_list;
extern char * video_driver;
extern char * audio_driver;
extern float audio_delay;