2008-04-22 09:33:39 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2002-07-23 16:46:51 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2005-12-08 22:12:57 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "mp_msg.h"
|
|
|
|
#include "help_mp.h"
|
|
|
|
#include "mixer.h"
|
|
|
|
#include "mplayer.h"
|
|
|
|
#include "m_config.h"
|
|
|
|
#include "m_option.h"
|
2007-08-28 11:20:24 +00:00
|
|
|
#include "get_path.h"
|
2007-08-25 12:25:34 +00:00
|
|
|
#include "libvo/sub.h"
|
2005-12-08 22:12:57 +00:00
|
|
|
#include "libvo/video_out.h"
|
2007-08-25 12:25:34 +00:00
|
|
|
#include "stream/stream.h"
|
|
|
|
#include "libmpdemux/demuxer.h"
|
2007-08-25 13:05:07 +00:00
|
|
|
#include "libass/ass.h"
|
|
|
|
#include "libass/ass_mp.h"
|
2002-07-23 16:46:51 +00:00
|
|
|
|
|
|
|
#include "cfg.h"
|
2002-07-25 21:31:36 +00:00
|
|
|
#include "app.h"
|
2002-07-23 16:46:51 +00:00
|
|
|
#include "interface.h"
|
|
|
|
#include "mplayer/play.h"
|
|
|
|
|
|
|
|
// --- params
|
|
|
|
|
|
|
|
int gtkEnableAudioEqualizer = 0;
|
|
|
|
|
2006-12-02 17:24:17 +00:00
|
|
|
int gtkVfPP = 0;
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_LIBAVCODEC
|
2006-12-02 17:24:17 +00:00
|
|
|
int gtkVfLAVC = 0;
|
2002-11-02 16:09:05 +00:00
|
|
|
#endif
|
2002-08-14 23:02:45 +00:00
|
|
|
|
2002-07-23 16:46:51 +00:00
|
|
|
int gtkAONorm = 0;
|
|
|
|
int gtkAOSurround = 0;
|
|
|
|
int gtkAOExtraStereo = 0;
|
|
|
|
float gtkAOExtraStereoMul = 1.0;
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_OSS_AUDIO
|
2002-07-23 16:46:51 +00:00
|
|
|
char * gtkAOOSSMixer;
|
2004-07-30 15:58:36 +00:00
|
|
|
char * gtkAOOSSMixerChannel;
|
2002-07-23 16:46:51 +00:00
|
|
|
char * gtkAOOSSDevice;
|
2002-12-28 13:39:51 +00:00
|
|
|
#endif
|
2008-08-06 23:19:29 +00:00
|
|
|
#ifdef CONFIG_ALSA
|
2004-07-30 15:58:36 +00:00
|
|
|
char * gtkAOALSAMixer;
|
|
|
|
char * gtkAOALSAMixerChannel;
|
|
|
|
char * gtkAOALSADevice;
|
|
|
|
#endif
|
2008-08-03 15:21:40 +00:00
|
|
|
#ifdef CONFIG_SDL
|
2003-01-02 12:42:32 +00:00
|
|
|
char * gtkAOSDLDriver;
|
|
|
|
#endif
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_ESD
|
2005-02-12 16:05:11 +00:00
|
|
|
char * gtkAOESDDevice;
|
|
|
|
#endif
|
2002-07-23 16:46:51 +00:00
|
|
|
|
2002-11-25 18:18:45 +00:00
|
|
|
int gtkCacheOn = 0;
|
|
|
|
int gtkCacheSize = 2048;
|
|
|
|
|
2002-11-28 23:17:14 +00:00
|
|
|
int gtkAutoSyncOn = 0;
|
|
|
|
int gtkAutoSync = 0;
|
|
|
|
|
2008-08-03 15:21:40 +00:00
|
|
|
#ifdef CONFIG_DXR3
|
2002-10-10 14:06:49 +00:00
|
|
|
char * gtkDXR3Device;
|
|
|
|
#endif
|
|
|
|
|
2002-07-23 16:46:51 +00:00
|
|
|
int gtkSubDumpMPSub = 0;
|
|
|
|
int gtkSubDumpSrt = 0;
|
|
|
|
|
2002-09-28 19:42:10 +00:00
|
|
|
int gtkLoadFullscreen = 0;
|
2003-02-01 16:42:02 +00:00
|
|
|
int gtkShowVideoWindow = 1;
|
2003-01-17 22:50:18 +00:00
|
|
|
int gtkEnablePlayBar = 1;
|
2002-09-28 19:42:10 +00:00
|
|
|
|
2003-03-20 12:42:16 +00:00
|
|
|
int gui_save_pos = 1;
|
|
|
|
int gui_main_pos_x = -2;
|
|
|
|
int gui_main_pos_y = -2;
|
|
|
|
int gui_sub_pos_x = -1;
|
|
|
|
int gui_sub_pos_y = -1;
|
2006-10-25 00:05:14 +00:00
|
|
|
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_ASS
|
2006-10-25 00:05:14 +00:00
|
|
|
gtkASS_t gtkASS;
|
|
|
|
#endif
|
2002-07-23 16:46:51 +00:00
|
|
|
// ---
|
|
|
|
|
2002-11-28 21:34:14 +00:00
|
|
|
extern int stop_xscreensaver;
|
2008-04-15 13:20:15 +00:00
|
|
|
extern int disable_gui_conf;
|
2008-12-03 23:01:03 +00:00
|
|
|
int m_config_parse_config_file(m_config_t* config, char *conffile);
|
2002-07-23 16:46:51 +00:00
|
|
|
|
|
|
|
static m_config_t * gui_conf;
|
2008-01-13 16:17:57 +00:00
|
|
|
static const m_option_t gui_opts[] =
|
2002-07-23 16:46:51 +00:00
|
|
|
{
|
|
|
|
{ "enable_audio_equ",>kEnableAudioEqualizer,CONF_TYPE_FLAG,0,0,1,NULL },
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2002-10-02 13:16:15 +00:00
|
|
|
{ "vo_driver",&video_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
|
2002-07-23 16:46:51 +00:00
|
|
|
{ "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 },
|
2002-08-15 22:52:52 +00:00
|
|
|
{ "vo_direct_render",&vo_directrendering,CONF_TYPE_FLAG,0,0,1,NULL },
|
2008-08-03 15:21:40 +00:00
|
|
|
#ifdef CONFIG_DXR3
|
2002-10-10 14:06:49 +00:00
|
|
|
{ "vo_dxr3_device",>kDXR3Device,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
#endif
|
2002-07-23 16:46:51 +00:00
|
|
|
|
2002-08-15 22:52:52 +00:00
|
|
|
{ "v_framedrop",&frame_dropping,CONF_TYPE_INT,CONF_RANGE,0,2,NULL },
|
2002-08-29 17:16:34 +00:00
|
|
|
{ "v_flip",&flip,CONF_TYPE_INT,CONF_RANGE,-1,1,NULL },
|
2002-08-15 22:52:52 +00:00
|
|
|
{ "v_ni",&force_ni,CONF_TYPE_FLAG,0,0,1,NULL },
|
|
|
|
{ "v_idx",&index_mode,CONF_TYPE_INT,CONF_RANGE,-1,2,NULL },
|
2002-09-28 18:03:34 +00:00
|
|
|
{ "v_vfm",&video_fm_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
|
|
|
|
{ "a_afm",&audio_fm_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
|
2002-08-14 23:02:45 +00:00
|
|
|
|
2006-12-02 17:24:17 +00:00
|
|
|
{ "vf_pp",>kVfPP,CONF_TYPE_FLAG,0,0,1,NULL },
|
2002-08-15 22:52:52 +00:00
|
|
|
{ "vf_autoq",&auto_quality,CONF_TYPE_INT,CONF_RANGE,0,100,NULL },
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_LIBAVCODEC
|
2006-12-02 17:24:17 +00:00
|
|
|
{ "vf_lavc",>kVfLAVC,CONF_TYPE_FLAG,0,0,1,NULL },
|
2002-11-02 16:09:05 +00:00
|
|
|
#endif
|
2002-07-23 16:46:51 +00:00
|
|
|
|
2002-10-02 13:16:15 +00:00
|
|
|
{ "ao_driver",&audio_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
|
2002-07-23 16:46:51 +00:00
|
|
|
{ "ao_volnorm",>kAONorm,CONF_TYPE_FLAG,0,0,1,NULL },
|
2005-02-12 16:05:11 +00:00
|
|
|
{ "softvol",&soft_vol,CONF_TYPE_FLAG,0,0,1,NULL },
|
2002-07-23 16:46:51 +00:00
|
|
|
{ "ao_surround",>kAOSurround,CONF_TYPE_FLAG,0,0,1,NULL },
|
|
|
|
{ "ao_extra_stereo",>kAOExtraStereo,CONF_TYPE_FLAG,0,0,1,NULL },
|
|
|
|
{ "ao_extra_stereo_coefficient",>kAOExtraStereoMul,CONF_TYPE_FLOAT,CONF_RANGE,-10,10,NULL },
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_OSS_AUDIO
|
2002-07-23 16:46:51 +00:00
|
|
|
{ "ao_oss_mixer",>kAOOSSMixer,CONF_TYPE_STRING,0,0,0,NULL },
|
2004-07-30 15:58:36 +00:00
|
|
|
{ "ao_oss_mixer_channel",>kAOOSSMixerChannel,CONF_TYPE_STRING,0,0,0,NULL },
|
2002-07-23 16:46:51 +00:00
|
|
|
{ "ao_oss_device",>kAOOSSDevice,CONF_TYPE_STRING,0,0,0,NULL },
|
2002-12-28 13:39:51 +00:00
|
|
|
#endif
|
2008-08-06 23:19:29 +00:00
|
|
|
#ifdef CONFIG_ALSA
|
2004-07-30 15:58:36 +00:00
|
|
|
{ "ao_alsa_mixer",>kAOALSAMixer,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
{ "ao_alsa_mixer_channel",>kAOALSAMixerChannel,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
{ "ao_alsa_device",>kAOALSADevice,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
#endif
|
2008-08-03 15:21:40 +00:00
|
|
|
#ifdef CONFIG_SDL
|
2003-01-02 12:42:32 +00:00
|
|
|
{ "ao_sdl_subdriver",>kAOSDLDriver,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
#endif
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_ESD
|
2005-02-12 16:05:11 +00:00
|
|
|
{ "ao_esd_device",>kAOESDDevice,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
#endif
|
2003-01-12 23:38:55 +00:00
|
|
|
|
|
|
|
{ "dvd_device",&dvd_device,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
{ "cdrom_device",&cdrom_device,CONF_TYPE_STRING,0,0,0,NULL },
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2003-01-11 09:20:36 +00:00
|
|
|
{ "osd_level",&osd_level,CONF_TYPE_INT,CONF_RANGE,0,3,NULL },
|
2002-08-15 22:52:52 +00:00
|
|
|
{ "sub_auto_load",&sub_auto,CONF_TYPE_FLAG,0,0,1,NULL },
|
|
|
|
{ "sub_unicode",&sub_unicode,CONF_TYPE_FLAG,0,0,1,NULL },
|
2008-07-30 12:01:30 +00:00
|
|
|
#ifdef CONFIG_ASS
|
2006-10-25 00:05:14 +00:00
|
|
|
{ "ass_enabled",&ass_enabled,CONF_TYPE_FLAG,0,0,1,NULL },
|
|
|
|
{ "ass_use_margins",&ass_use_margins,CONF_TYPE_FLAG,0,0,1,NULL },
|
|
|
|
{ "ass_top_margin",&ass_top_margin,CONF_TYPE_INT,CONF_RANGE,0,512,NULL },
|
|
|
|
{ "ass_bottom_margin",&ass_bottom_margin,CONF_TYPE_INT,CONF_RANGE,0,512,NULL },
|
|
|
|
#endif
|
2002-08-15 22:52:52 +00:00
|
|
|
{ "sub_pos",&sub_pos,CONF_TYPE_INT,CONF_RANGE,0,200,NULL },
|
2003-01-02 14:41:40 +00:00
|
|
|
{ "sub_overlap",&suboverlap_enabled,CONF_TYPE_FLAG,0,0,0,NULL },
|
2008-08-07 10:36:07 +00:00
|
|
|
#ifdef CONFIG_ICONV
|
2003-01-21 19:12:46 +00:00
|
|
|
{ "sub_cp",&sub_cp,CONF_TYPE_STRING,0,0,0,NULL },
|
2003-03-17 00:48:26 +00:00
|
|
|
#endif
|
2002-08-15 22:52:52 +00:00
|
|
|
{ "font_factor",&font_factor,CONF_TYPE_FLOAT,CONF_RANGE,0.0,10.0,NULL },
|
|
|
|
{ "font_name",&font_name,CONF_TYPE_STRING,0,0,0,NULL },
|
2008-08-07 10:36:07 +00:00
|
|
|
#ifdef CONFIG_FREETYPE
|
2002-08-29 17:16:34 +00:00
|
|
|
{ "font_encoding",&subtitle_font_encoding,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
{ "font_text_scale",&text_font_scale_factor,CONF_TYPE_FLOAT,CONF_RANGE,0,100,NULL },
|
|
|
|
{ "font_osd_scale",&osd_font_scale_factor,CONF_TYPE_FLOAT,CONF_RANGE,0,100,NULL },
|
2002-09-28 18:03:34 +00:00
|
|
|
{ "font_blur",&subtitle_font_radius,CONF_TYPE_FLOAT,CONF_RANGE,0,8,NULL },
|
2002-08-29 17:16:34 +00:00
|
|
|
{ "font_outline",&subtitle_font_thickness,CONF_TYPE_FLOAT,CONF_RANGE,0,8,NULL },
|
|
|
|
{ "font_autoscale",&subtitle_autoscale,CONF_TYPE_INT,CONF_RANGE,0,3,NULL },
|
2002-08-29 21:06:33 +00:00
|
|
|
#endif
|
2002-09-28 18:03:34 +00:00
|
|
|
|
2002-11-28 23:17:14 +00:00
|
|
|
{ "cache",>kCacheOn,CONF_TYPE_FLAG,0,0,1,NULL },
|
2002-11-25 18:18:45 +00:00
|
|
|
{ "cache_size",>kCacheSize,CONF_TYPE_INT,CONF_RANGE,-1,65535,NULL },
|
2003-01-17 22:39:43 +00:00
|
|
|
|
2009-05-13 02:58:57 +00:00
|
|
|
{ "playbar",>kEnablePlayBar,CONF_TYPE_FLAG,0,0,1,NULL },
|
2002-09-28 19:42:10 +00:00
|
|
|
{ "load_fullscreen",>kLoadFullscreen,CONF_TYPE_FLAG,0,0,1,NULL },
|
2003-02-01 16:42:02 +00:00
|
|
|
{ "show_videowin", >kShowVideoWindow,CONF_TYPE_FLAG,0,0,1,NULL },
|
2002-11-28 21:34:14 +00:00
|
|
|
{ "stopxscreensaver",&stop_xscreensaver,CONF_TYPE_FLAG,0,0,1,NULL },
|
2002-11-28 23:17:14 +00:00
|
|
|
|
|
|
|
{ "autosync",>kAutoSyncOn,CONF_TYPE_FLAG,0,0,1,NULL },
|
|
|
|
{ "autosync_size",>kAutoSync,CONF_TYPE_INT,CONF_RANGE,0,10000,NULL },
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2002-07-25 21:31:36 +00:00
|
|
|
{ "gui_skin",&skinName,CONF_TYPE_STRING,0,0,0,NULL },
|
2002-07-23 16:46:51 +00:00
|
|
|
|
2003-03-20 12:42:16 +00:00
|
|
|
{ "gui_save_pos", &gui_save_pos, CONF_TYPE_FLAG,0,0,1,NULL},
|
|
|
|
{ "gui_main_pos_x", &gui_main_pos_x, CONF_TYPE_INT,0,0,0,NULL},
|
|
|
|
{ "gui_main_pos_y", &gui_main_pos_y, CONF_TYPE_INT,0,0,0,NULL},
|
|
|
|
{ "gui_video_out_pos_x", &gui_sub_pos_x, CONF_TYPE_INT,0,0,0,NULL},
|
|
|
|
{ "gui_video_out_pos_y", &gui_sub_pos_y, CONF_TYPE_INT,0,0,0,NULL},
|
|
|
|
|
2002-07-23 16:46:51 +00:00
|
|
|
{ "equ_channel_1",>kEquChannel1,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
{ "equ_channel_2",>kEquChannel2,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
{ "equ_channel_3",>kEquChannel3,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
{ "equ_channel_4",>kEquChannel4,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
{ "equ_channel_5",>kEquChannel5,CONF_TYPE_STRING,0,0,0,NULL },
|
|
|
|
{ "equ_channel_6",>kEquChannel6,CONF_TYPE_STRING,0,0,0,NULL },
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2002-07-23 16:46:51 +00:00
|
|
|
#if 1
|
2002-07-30 11:50:20 +00:00
|
|
|
#define audio_equ_row( i,j ) { "equ_band_"#i#j,>kEquChannels[i][j],CONF_TYPE_FLOAT,CONF_RANGE,-15.0,15.0,NULL },
|
2002-07-23 16:46:51 +00:00
|
|
|
audio_equ_row( 0,0 ) audio_equ_row( 0,1 ) audio_equ_row( 0,2 ) audio_equ_row( 0,3 ) audio_equ_row( 0,4 ) audio_equ_row( 0,5 ) audio_equ_row( 0,6 ) audio_equ_row( 0,7 ) audio_equ_row( 0,8 ) audio_equ_row( 0,9 )
|
|
|
|
audio_equ_row( 1,0 ) audio_equ_row( 1,1 ) audio_equ_row( 1,2 ) audio_equ_row( 1,3 ) audio_equ_row( 1,4 ) audio_equ_row( 1,5 ) audio_equ_row( 1,6 ) audio_equ_row( 1,7 ) audio_equ_row( 1,8 ) audio_equ_row( 1,9 )
|
|
|
|
audio_equ_row( 2,0 ) audio_equ_row( 2,1 ) audio_equ_row( 2,2 ) audio_equ_row( 2,3 ) audio_equ_row( 2,4 ) audio_equ_row( 2,5 ) audio_equ_row( 2,6 ) audio_equ_row( 2,7 ) audio_equ_row( 2,8 ) audio_equ_row( 2,9 )
|
|
|
|
audio_equ_row( 3,0 ) audio_equ_row( 3,1 ) audio_equ_row( 3,2 ) audio_equ_row( 3,3 ) audio_equ_row( 3,4 ) audio_equ_row( 3,5 ) audio_equ_row( 3,6 ) audio_equ_row( 3,7 ) audio_equ_row( 3,8 ) audio_equ_row( 3,9 )
|
|
|
|
audio_equ_row( 4,0 ) audio_equ_row( 4,1 ) audio_equ_row( 4,2 ) audio_equ_row( 4,3 ) audio_equ_row( 4,4 ) audio_equ_row( 4,5 ) audio_equ_row( 4,6 ) audio_equ_row( 4,7 ) audio_equ_row( 4,8 ) audio_equ_row( 4,9 )
|
|
|
|
audio_equ_row( 5,0 ) audio_equ_row( 5,1 ) audio_equ_row( 5,2 ) audio_equ_row( 5,3 ) audio_equ_row( 5,4 ) audio_equ_row( 5,5 ) audio_equ_row( 5,6 ) audio_equ_row( 5,7 ) audio_equ_row( 5,8 ) audio_equ_row( 5,9 )
|
|
|
|
#undef audio_equ_row
|
|
|
|
#endif
|
|
|
|
|
|
|
|
{ NULL, NULL, 0, 0, 0, 0, NULL }
|
|
|
|
};
|
|
|
|
|
2002-08-26 22:20:58 +00:00
|
|
|
char * gfgets( char * str, int size, FILE * f )
|
|
|
|
{
|
|
|
|
char * s = fgets( str,size,f );
|
|
|
|
char c;
|
|
|
|
if ( s )
|
|
|
|
{
|
|
|
|
c=s[ strlen( s ) - 1 ]; if ( c == '\n' || c == '\r' ) s[ strlen( s ) - 1 ]=0;
|
|
|
|
c=s[ strlen( s ) - 1 ]; if ( c == '\n' || c == '\r' ) s[ strlen( s ) - 1 ]=0;
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2002-07-23 16:46:51 +00:00
|
|
|
int cfg_read( void )
|
|
|
|
{
|
|
|
|
char * cfg = get_path( "gui.conf" );
|
2002-08-26 22:20:58 +00:00
|
|
|
FILE * f;
|
2002-07-23 16:46:51 +00:00
|
|
|
|
|
|
|
// -- read configuration
|
2004-12-15 01:22:24 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_V,"[cfg] reading config file: %s\n",cfg );
|
2003-08-13 16:29:32 +00:00
|
|
|
gui_conf=m_config_new();
|
2002-07-23 16:46:51 +00:00
|
|
|
m_config_register_options( gui_conf,gui_opts );
|
2009-05-13 02:58:57 +00:00
|
|
|
if ( !disable_gui_conf && m_config_parse_config_file( gui_conf,cfg ) < 0 )
|
2002-07-23 16:46:51 +00:00
|
|
|
{
|
2006-04-28 23:06:42 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_ConfigFileError );
|
2002-09-28 19:42:10 +00:00
|
|
|
// exit( 1 );
|
2002-07-23 16:46:51 +00:00
|
|
|
}
|
|
|
|
free( cfg );
|
|
|
|
|
|
|
|
// -- read pl
|
2002-08-26 22:20:58 +00:00
|
|
|
cfg=get_path( "gui.pl" );
|
|
|
|
if ( (f=fopen( cfg,"rt" )) )
|
|
|
|
{
|
|
|
|
while ( !feof( f ) )
|
|
|
|
{
|
|
|
|
char tmp[512]; plItem * item;
|
|
|
|
if ( gfgets( tmp,512,f ) == NULL ) continue;
|
|
|
|
item=calloc( 1,sizeof( plItem ) );
|
|
|
|
item->path=strdup( tmp );
|
|
|
|
gfgets( tmp,512,f );
|
|
|
|
item->name=strdup( tmp );
|
|
|
|
gtkSet( gtkAddPlItem,0,(void*)item );
|
|
|
|
}
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
free( cfg );
|
|
|
|
|
|
|
|
//-- read previously visited urls
|
|
|
|
cfg=get_path( "gui.url" );
|
|
|
|
if ( (f=fopen( cfg,"rt" )) )
|
|
|
|
{
|
|
|
|
while ( !feof( f ) )
|
|
|
|
{
|
|
|
|
char tmp[512]; URLItem * item;
|
|
|
|
if ( gfgets( tmp,512,f ) == NULL ) continue;
|
|
|
|
item=calloc( 1,sizeof( URLItem ) );
|
|
|
|
item->url=strdup( tmp );
|
|
|
|
gtkSet( gtkAddURLItem,0,(void*)item );
|
|
|
|
}
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
free( cfg );
|
|
|
|
|
2003-01-21 13:33:40 +00:00
|
|
|
// -- reade file loader history
|
|
|
|
cfg=get_path( "gui.history" );
|
|
|
|
if ( (f=fopen( cfg,"rt+" )) )
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
while ( !feof( f ) )
|
|
|
|
{
|
|
|
|
char tmp[512];
|
|
|
|
if ( gfgets( tmp,512,f ) == NULL ) continue;
|
|
|
|
fsHistory[i++]=gstrdup( tmp );
|
|
|
|
}
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
free( cfg );
|
|
|
|
|
2002-07-23 16:46:51 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfg_write( void )
|
|
|
|
{
|
|
|
|
char * cfg = get_path( "gui.conf" );
|
|
|
|
FILE * f;
|
|
|
|
int i;
|
|
|
|
|
2009-05-13 02:58:57 +00:00
|
|
|
// -- save configuration
|
2002-07-23 16:46:51 +00:00
|
|
|
if ( (f=fopen( cfg,"wt+" )) )
|
|
|
|
{
|
|
|
|
for ( i=0;gui_opts[i].name;i++ )
|
|
|
|
{
|
2002-11-12 12:39:05 +00:00
|
|
|
char* v = m_option_print(&gui_opts[i],gui_opts[i].p);
|
2008-01-13 16:22:43 +00:00
|
|
|
if(v == (char *)-1) {
|
|
|
|
mp_msg(MSGT_GPLAYER,MSGL_WARN,MSGTR_UnableToSaveOption, gui_opts[i].name);
|
|
|
|
v = NULL;
|
|
|
|
}
|
2002-11-12 12:39:05 +00:00
|
|
|
if(v) {
|
|
|
|
fprintf( f,"%s = \"%s\"\n",gui_opts[i].name, v);
|
|
|
|
free(v);
|
2008-01-13 16:22:43 +00:00
|
|
|
}
|
2002-07-23 16:46:51 +00:00
|
|
|
}
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
free( cfg );
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2002-07-23 16:46:51 +00:00
|
|
|
// -- save playlist
|
|
|
|
cfg=get_path( "gui.pl" );
|
|
|
|
if ( (f=fopen( cfg,"wt+" )) )
|
|
|
|
{
|
|
|
|
plCurrent=plList;
|
|
|
|
while ( plCurrent )
|
|
|
|
{
|
|
|
|
if ( plCurrent->path && plCurrent->name )
|
2009-05-13 02:58:57 +00:00
|
|
|
{
|
2002-07-23 16:46:51 +00:00
|
|
|
fprintf( f,"%s\n",plCurrent->path );
|
|
|
|
fprintf( f,"%s\n",plCurrent->name );
|
|
|
|
}
|
|
|
|
plCurrent=plCurrent->next;
|
|
|
|
}
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
free( cfg );
|
|
|
|
|
2002-08-26 22:20:58 +00:00
|
|
|
// -- save URL's
|
|
|
|
cfg=get_path( "gui.url" );
|
|
|
|
if ( (f=fopen( cfg,"wt+" )) )
|
|
|
|
{
|
|
|
|
while ( URLList )
|
|
|
|
{
|
|
|
|
if ( URLList->url ) fprintf( f,"%s\n",URLList->url );
|
|
|
|
URLList=URLList->next;
|
|
|
|
}
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
free( cfg );
|
|
|
|
|
2003-01-21 13:33:40 +00:00
|
|
|
// -- save file loader history
|
|
|
|
cfg=get_path( "gui.history" );
|
|
|
|
if ( (f=fopen( cfg,"wt+" )) )
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
// while ( fsHistory[i] != NULL )
|
|
|
|
for ( i=0;i < 5; i++)
|
|
|
|
if( fsHistory[i] ) fprintf( f,"%s\n",fsHistory[i] );
|
|
|
|
fclose( f );
|
|
|
|
}
|
|
|
|
free( cfg );
|
|
|
|
|
2002-07-23 16:46:51 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|