comparison mencoder.c @ 10594:57bdcdb061d7

Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
author alex
date Wed, 13 Aug 2003 16:29:32 +0000
parents b411916cb86a
children b82e3ecb11e0
comparison
equal deleted inserted replaced
10593:27711ab2889f 10594:57bdcdb061d7
31 #include "help_mp.h" 31 #include "help_mp.h"
32 32
33 #include "cpudetect.h" 33 #include "cpudetect.h"
34 34
35 #include "codec-cfg.h" 35 #include "codec-cfg.h"
36 #ifdef NEW_CONFIG
37 #include "m_option.h" 36 #include "m_option.h"
38 #include "m_config.h" 37 #include "m_config.h"
39 #include "parser-mecmd.h" 38 #include "parser-mecmd.h"
40 #else
41 #include "cfgparser.h"
42 #include "playtree.h"
43 #endif
44 39
45 #include "libmpdemux/stream.h" 40 #include "libmpdemux/stream.h"
46 #include "libmpdemux/demuxer.h" 41 #include "libmpdemux/demuxer.h"
47 #include "libmpdemux/stheader.h" 42 #include "libmpdemux/stheader.h"
48 #include "libmpdemux/mp3_hdr.h" 43 #include "libmpdemux/mp3_hdr.h"
210 205
211 //-------------------------- config stuff: 206 //-------------------------- config stuff:
212 207
213 m_config_t* mconfig; 208 m_config_t* mconfig;
214 209
215 #ifdef NEW_CONFIG 210 extern int m_config_parse_config_file(m_config_t* config, char *conffile);
216 extern int 211
217 m_config_parse_config_file(m_config_t* config, char *conffile); 212 static int cfg_inc_verbose(m_option_t *conf){ ++verbose; return 0;}
218 #endif 213
219 214 static int cfg_include(m_option_t *conf, char *filename){
220
221 static int cfg_inc_verbose(struct config *conf){ ++verbose; return 0;}
222
223 static int cfg_include(struct config *conf, char *filename){
224 return m_config_parse_config_file(mconfig, filename); 215 return m_config_parse_config_file(mconfig, filename);
225 } 216 }
226 217
227 static char *seek_to_sec=NULL; 218 static char *seek_to_sec=NULL;
228 static off_t seek_to_byte=0; 219 static off_t seek_to_byte=0;
229 220
230 static int parse_end_at(struct config *conf, const char* param); 221 static int parse_end_at(m_option_t *conf, const char* param);
231 //static uint8_t* flip_upside_down(uint8_t* dst, const uint8_t* src, int width, int height); 222 //static uint8_t* flip_upside_down(uint8_t* dst, const uint8_t* src, int width, int height);
232 223
233 #include "get_path.c" 224 #include "get_path.c"
234 225
235 #include "cfg-mplayer-def.h" 226 #include "cfg-mplayer-def.h"
341 #endif 332 #endif
342 333
343 double v_pts_corr=0; 334 double v_pts_corr=0;
344 double v_timer_corr=0; 335 double v_timer_corr=0;
345 336
346 #ifdef NEW_CONFIG
347 m_entry_t* filelist = NULL; 337 m_entry_t* filelist = NULL;
348 #else
349 play_tree_t* playtree;
350 play_tree_iter_t* playtree_iter;
351 #endif
352 char* filename=NULL; 338 char* filename=NULL;
353 char* frameno_filename="frameno.avi"; 339 char* frameno_filename="frameno.avi";
354 340
355 int decoded_frameno=0; 341 int decoded_frameno=0;
356 int next_frameno=-1; 342 int next_frameno=-1;
411 demuxer2=demux_open(stream2,DEMUXER_TYPE_AVI,-1,-1,-2,NULL); 397 demuxer2=demux_open(stream2,DEMUXER_TYPE_AVI,-1,-1,-2,NULL);
412 if(demuxer2) printf(MSGTR_UsingPass3ControllFile,frameno_filename); 398 if(demuxer2) printf(MSGTR_UsingPass3ControllFile,frameno_filename);
413 else mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized); 399 else mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized);
414 } 400 }
415 401
416 // New config code
417 #ifdef NEW_CONFIG
418 mconfig = m_config_new(); 402 mconfig = m_config_new();
419 m_config_register_options(mconfig,mencoder_opts); 403 m_config_register_options(mconfig,mencoder_opts);
420 parse_cfgfiles(mconfig); 404 parse_cfgfiles(mconfig);
421 filelist = m_config_parse_me_command_line(mconfig, argc, argv); 405 filelist = m_config_parse_me_command_line(mconfig, argc, argv);
422 if(!filelist) mencoder_exit(1, "error parsing cmdline"); 406 if(!filelist) mencoder_exit(1, "error parsing cmdline");
423 m_entry_set_options(mconfig,&filelist[0]); 407 m_entry_set_options(mconfig,&filelist[0]);
424 filename = filelist[0].name; 408 filename = filelist[0].name;
425 // Warn the user if he put more than 1 filename ?
426 #else
427 playtree = play_tree_new();
428 mconfig = m_config_new(playtree);
429 m_config_register_options(mconfig,mencoder_opts);
430 parse_cfgfiles(mconfig);
431
432 if(m_config_parse_command_line(mconfig, argc, argv) < 0) mencoder_exit(1, "error parsing cmdline");
433 playtree = play_tree_cleanup(playtree);
434 if(playtree) {
435 playtree_iter = play_tree_iter_new(playtree,mconfig);
436 if(playtree_iter) {
437 if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) {
438 play_tree_iter_free(playtree_iter);
439 playtree_iter = NULL;
440 }
441 filename = play_tree_iter_get_file(playtree_iter,1);
442 }
443 }
444 #endif
445 409
446 if(!filename){ 410 if(!filename){
447 printf(MSGTR_MissingFilename); 411 printf(MSGTR_MissingFilename);
448 mencoder_exit(1,NULL); 412 mencoder_exit(1,NULL);
449 } 413 }
1331 if(stream) free_stream(stream); // kill cache thread 1295 if(stream) free_stream(stream); // kill cache thread
1332 1296
1333 return interrupted; 1297 return interrupted;
1334 } 1298 }
1335 1299
1336 static int parse_end_at(struct config *conf, const char* param) 1300 static int parse_end_at(m_option_t *conf, const char* param)
1337 { 1301 {
1338 1302
1339 end_at_type = END_AT_NONE; 1303 end_at_type = END_AT_NONE;
1340 1304
1341 /* End at size parsing */ 1305 /* End at size parsing */