Mercurial > mplayer.hg
annotate Gui/cfg.c @ 7038:bfb03691fb4b
skip blocks with small chroma dc support
author | michael |
---|---|
date | Sat, 17 Aug 2002 20:48:23 +0000 |
parents | e37a67d5e117 |
children | 8e9607c5897e |
rev | line source |
---|---|
6770 | 1 |
2 #include <stdlib.h> | |
3 #include <stdio.h> | |
4 #include <string.h> | |
5 | |
6 #include "../config.h" | |
7 #include "../mp_msg.h" | |
8 #include "../mplayer.h" | |
9 #include "../cfgparser.h" | |
10 | |
7019 | 11 #ifdef USE_SETLOCALE |
12 #include <locale.h> | |
13 #endif | |
14 | |
6770 | 15 #include "../../libvo/video_out.h" |
16 | |
17 #include "cfg.h" | |
6797
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
18 #include "app.h" |
6770 | 19 #include "interface.h" |
20 #include "mplayer/play.h" | |
21 | |
22 // --- params | |
23 | |
24 int gtkEnableAudioEqualizer = 0; | |
25 | |
7009 | 26 int gtkVopPP = 0; |
27 int gtkVopLAVC = 0; | |
28 int gtkVopFAME = 0; | |
29 | |
6770 | 30 int gtkAONoSound = 0; |
31 float gtkAODelay = 0.0f; | |
32 int gtkAONorm = 0; | |
33 int gtkAOSurround = 0; | |
34 int gtkAOExtraStereo = 0; | |
35 float gtkAOExtraStereoMul = 1.0; | |
36 char * gtkAOOSSMixer; | |
37 char * gtkAOOSSDevice; | |
38 | |
39 int gtkSubDumpMPSub = 0; | |
40 int gtkSubDumpSrt = 0; | |
41 | |
42 // --- | |
43 | |
44 extern char * get_path( char * filename ); | |
45 extern int flip; | |
46 extern int frame_dropping; | |
47 | |
48 static m_config_t * gui_conf; | |
49 static config_t gui_opts[] = | |
50 { | |
51 { "enable_audio_equ",>kEnableAudioEqualizer,CONF_TYPE_FLAG,0,0,1,NULL }, | |
52 | |
7019 | 53 { "vo_driver",&video_driver,CONF_TYPE_STRING,0,0,0,NULL }, |
6770 | 54 { "vo_panscan",&vo_panscan,CONF_TYPE_FLOAT,CONF_RANGE,0.0,1.0,NULL }, |
55 { "vo_doublebuffering",&vo_doublebuffering,CONF_TYPE_FLAG,0,0,1,NULL }, | |
7019 | 56 { "vo_direct_render",&vo_directrendering,CONF_TYPE_FLAG,0,0,1,NULL }, |
6770 | 57 |
7019 | 58 { "v_framedrop",&frame_dropping,CONF_TYPE_INT,CONF_RANGE,0,2,NULL }, |
59 { "v_flip",&flip,CONF_TYPE_FLAG,0,0,1,NULL }, | |
60 { "v_ni",&force_ni,CONF_TYPE_FLAG,0,0,1,NULL }, | |
61 { "v_idx",&index_mode,CONF_TYPE_INT,CONF_RANGE,-1,2,NULL }, | |
62 { "v_vfm",&video_family,CONF_TYPE_INT,CONF_RANGE,-1,10,NULL }, | |
7009 | 63 |
64 { "vf_pp",>kVopPP,CONF_TYPE_FLAG,0,0,1,NULL }, | |
7019 | 65 { "vf_autoq",&auto_quality,CONF_TYPE_INT,CONF_RANGE,0,100,NULL }, |
7009 | 66 { "vf_lavc",>kVopLAVC,CONF_TYPE_FLAG,0,0,1,NULL }, |
67 { "vf_fame",>kVopFAME,CONF_TYPE_FLAG,0,0,1,NULL }, | |
6770 | 68 |
7019 | 69 { "ao_driver",&audio_driver,CONF_TYPE_STRING,0,0,0,NULL }, |
6770 | 70 { "ao_nosound",>kAONoSound,CONF_TYPE_FLAG,0,0,1,NULL }, |
71 { "ao_volnorm",>kAONorm,CONF_TYPE_FLAG,0,0,1,NULL }, | |
72 { "ao_surround",>kAOSurround,CONF_TYPE_FLAG,0,0,1,NULL }, | |
73 { "ao_extra_stereo",>kAOExtraStereo,CONF_TYPE_FLAG,0,0,1,NULL }, | |
74 { "ao_extra_stereo_coefficient",>kAOExtraStereoMul,CONF_TYPE_FLOAT,CONF_RANGE,-10,10,NULL }, | |
75 { "ao_delay",>kAODelay,CONF_TYPE_FLOAT,CONF_RANGE,-100,100,NULL }, | |
76 { "ao_oss_mixer",>kAOOSSMixer,CONF_TYPE_STRING,0,0,0,NULL }, | |
77 { "ao_oss_device",>kAOOSSDevice,CONF_TYPE_STRING,0,0,0,NULL }, | |
78 | |
79 { "osd_level",&osd_level,CONF_TYPE_INT,CONF_RANGE,0,2,NULL }, | |
7019 | 80 { "sub_auto_load",&sub_auto,CONF_TYPE_FLAG,0,0,1,NULL }, |
81 { "sub_unicode",&sub_unicode,CONF_TYPE_FLAG,0,0,1,NULL }, | |
82 { "sub_pos",&sub_pos,CONF_TYPE_INT,CONF_RANGE,0,200,NULL }, | |
83 { "font_factor",&font_factor,CONF_TYPE_FLOAT,CONF_RANGE,0.0,10.0,NULL }, | |
84 { "font_name",&font_name,CONF_TYPE_STRING,0,0,0,NULL }, | |
6797
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
85 |
06d29dbdf20d
upsz, sorry, i forgott this :) (skin name saving:)
pontscho
parents:
6794
diff
changeset
|
86 { "gui_skin",&skinName,CONF_TYPE_STRING,0,0,0,NULL }, |
6770 | 87 |
88 { "equ_channel_1",>kEquChannel1,CONF_TYPE_STRING,0,0,0,NULL }, | |
89 { "equ_channel_2",>kEquChannel2,CONF_TYPE_STRING,0,0,0,NULL }, | |
90 { "equ_channel_3",>kEquChannel3,CONF_TYPE_STRING,0,0,0,NULL }, | |
91 { "equ_channel_4",>kEquChannel4,CONF_TYPE_STRING,0,0,0,NULL }, | |
92 { "equ_channel_5",>kEquChannel5,CONF_TYPE_STRING,0,0,0,NULL }, | |
93 { "equ_channel_6",>kEquChannel6,CONF_TYPE_STRING,0,0,0,NULL }, | |
94 | |
95 #if 1 | |
6840 | 96 #define audio_equ_row( i,j ) { "equ_band_"#i#j,>kEquChannels[i][j],CONF_TYPE_FLOAT,CONF_RANGE,-15.0,15.0,NULL }, |
6770 | 97 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 ) |
98 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 ) | |
99 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 ) | |
100 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 ) | |
101 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 ) | |
102 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 ) | |
103 #undef audio_equ_row | |
104 #endif | |
105 | |
106 { NULL, NULL, 0, 0, 0, 0, NULL } | |
107 }; | |
108 | |
109 int cfg_read( void ) | |
110 { | |
111 char * cfg = get_path( "gui.conf" ); | |
112 | |
113 // -- read configuration | |
114 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[cfg] read config file: %s\n",cfg ); | |
115 gui_conf=m_config_new( play_tree_new() ); | |
116 m_config_register_options( gui_conf,gui_opts ); | |
117 if ( m_config_parse_config_file( gui_conf,cfg ) < 0 ) | |
118 { | |
119 mp_msg( MSGT_GPLAYER,MSGL_FATAL,"[cfg] config file read error ...\n" ); | |
120 exit( 1 ); | |
121 } | |
122 free( cfg ); | |
123 | |
124 // -- read pl | |
125 { | |
126 FILE * f; | |
127 cfg=get_path( "gui.pl" ); | |
128 if ( (f=fopen( cfg,"rt" )) == NULL ) return 1; | |
129 while ( !feof( f ) ) | |
130 { | |
131 char tmp[512]; plItem * item = calloc( 1,sizeof( plItem ) ); char c; | |
132 if ( fgets( tmp,512,f ) == NULL ) continue; | |
133 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; | |
134 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; | |
135 item->path=strdup( tmp ); | |
136 fgets( tmp,512,f ); | |
137 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; | |
138 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; | |
139 item->name=strdup( tmp ); | |
140 gtkSet( gtkAddPlItem,0,(void*)item ); | |
141 } | |
142 fclose( f ); | |
143 free( cfg ); | |
144 } | |
145 return 0; | |
146 } | |
147 | |
148 int cfg_write( void ) | |
149 { | |
150 char * cfg = get_path( "gui.conf" ); | |
151 FILE * f; | |
152 int i; | |
153 | |
7019 | 154 #ifdef USE_SETLOCALE |
155 setlocale( LC_ALL,"" ); | |
156 #endif | |
157 | |
6770 | 158 // -- save configuration |
159 if ( (f=fopen( cfg,"wt+" )) ) | |
160 { | |
161 for ( i=0;gui_opts[i].name;i++ ) | |
162 { | |
163 switch ( gui_opts[i].type ) | |
164 { | |
165 case CONF_TYPE_INT: | |
166 case CONF_TYPE_FLAG: fprintf( f,"%s = %d\n",gui_opts[i].name,*( (int *)gui_opts[i].p ) ); break; | |
167 case CONF_TYPE_FLOAT: fprintf( f,"%s = %f\n",gui_opts[i].name,*( (float *)gui_opts[i].p ) ); break; | |
6794 | 168 case CONF_TYPE_STRING: |
169 { | |
170 char * tmp = *( (char **)gui_opts[i].p ); | |
171 if ( tmp && tmp[0] ) fprintf( f,"%s = \"%s\"\n",gui_opts[i].name,tmp ); | |
172 break; | |
173 } | |
6770 | 174 } |
175 } | |
176 fclose( f ); | |
177 } | |
178 free( cfg ); | |
179 | |
180 // -- save playlist | |
181 cfg=get_path( "gui.pl" ); | |
182 if ( (f=fopen( cfg,"wt+" )) ) | |
183 { | |
184 plCurrent=plList; | |
185 while ( plCurrent ) | |
186 { | |
187 if ( plCurrent->path && plCurrent->name ) | |
188 { | |
189 fprintf( f,"%s\n",plCurrent->path ); | |
190 fprintf( f,"%s\n",plCurrent->name ); | |
191 } | |
192 plCurrent=plCurrent->next; | |
193 } | |
194 fclose( f ); | |
195 } | |
196 free( cfg ); | |
197 | |
198 return 0; | |
199 } | |
200 |