comparison mencoder.c @ 8164:487cfc28525d

New config system + cleanup of header inter dependency
author albeu
date Tue, 12 Nov 2002 01:56:42 +0000
parents 9fc45fe0d444
children 3be7b22b6713
comparison
equal deleted inserted replaced
8163:51e5033ee687 8164:487cfc28525d
31 "\n"; 31 "\n";
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"
38 #include "m_config.h"
39 #include "parser-mecmd.h"
40 #else
36 #include "cfgparser.h" 41 #include "cfgparser.h"
42 #include "playtree.h"
43 #endif
37 44
38 #include "libmpdemux/stream.h" 45 #include "libmpdemux/stream.h"
39 #include "libmpdemux/demuxer.h" 46 #include "libmpdemux/demuxer.h"
40 #include "libmpdemux/stheader.h" 47 #include "libmpdemux/stheader.h"
41 #include "libmpdemux/mp3_hdr.h" 48 #include "libmpdemux/mp3_hdr.h"
42 #include "libmpdemux/aviwrite.h" 49 #include "libmpdemux/aviwrite.h"
43 50
44 #include "playtree.h"
45 51
46 #include "libvo/video_out.h" 52 #include "libvo/video_out.h"
47 53
48 #include "libao2/afmt.h" 54 #include "libao2/afmt.h"
49 55
193 //static int vo_w=0, vo_h=0; 199 //static int vo_w=0, vo_h=0;
194 200
195 //-------------------------- config stuff: 201 //-------------------------- config stuff:
196 202
197 m_config_t* mconfig; 203 m_config_t* mconfig;
204
205 #ifdef NEW_CONFIG
206 extern int
207 m_config_parse_config_file(m_config_t* config, char *conffile);
208 #endif
209
198 210
199 static int cfg_inc_verbose(struct config *conf){ ++verbose; return 0;} 211 static int cfg_inc_verbose(struct config *conf){ ++verbose; return 0;}
200 212
201 static int cfg_include(struct config *conf, char *filename){ 213 static int cfg_include(struct config *conf, char *filename){
202 return m_config_parse_config_file(mconfig, filename); 214 return m_config_parse_config_file(mconfig, filename);
324 #endif 336 #endif
325 337
326 double v_pts_corr=0; 338 double v_pts_corr=0;
327 double v_timer_corr=0; 339 double v_timer_corr=0;
328 340
341 #ifdef NEW_CONFIG
342 m_entry_t* filelist = NULL;
343 #else
329 play_tree_t* playtree; 344 play_tree_t* playtree;
330 play_tree_iter_t* playtree_iter; 345 play_tree_iter_t* playtree_iter;
346 #endif
331 char* filename=NULL; 347 char* filename=NULL;
332 char* frameno_filename="frameno.avi"; 348 char* frameno_filename="frameno.avi";
333 349
334 int decoded_frameno=0; 350 int decoded_frameno=0;
335 int next_frameno=-1; 351 int next_frameno=-1;
355 mp_msg(MSGT_MENCODER,MSGL_HINT,MSGTR_CopyCodecsConf); 371 mp_msg(MSGT_MENCODER,MSGL_HINT,MSGTR_CopyCodecsConf);
356 mencoder_exit(1,NULL); 372 mencoder_exit(1,NULL);
357 } 373 }
358 } 374 }
359 375
360 // FIXME: get rid of -dvd and other tricky options and config/playtree 376 // FIXME: get rid of -dvd and other tricky options
361 stream2=open_stream(frameno_filename,0,&i); 377 stream2=open_stream(frameno_filename,0,&i);
362 if(stream2){ 378 if(stream2){
363 demuxer2=demux_open(stream2,DEMUXER_TYPE_AVI,-1,-1,-2); 379 demuxer2=demux_open(stream2,DEMUXER_TYPE_AVI,-1,-1,-2);
364 if(demuxer2) printf(MSGTR_UsingPass3ControllFile,frameno_filename); 380 if(demuxer2) printf(MSGTR_UsingPass3ControllFile,frameno_filename);
365 } 381 }
366 382
383 // New config code
384 #ifdef NEW_CONFIG
385 mconfig = m_config_new();
386 m_config_register_options(mconfig,mencoder_opts);
387 parse_cfgfiles(mconfig);
388 filelist = m_config_parse_me_command_line(mconfig, argc, argv);
389 if(!filelist) mencoder_exit(1, "error parsing cmdline");
390 m_entry_set_options(mconfig,&filelist[0]);
391 filename = filelist[0].name;
392 // Warn the user if he put more than 1 filename ?
393 #else
367 playtree = play_tree_new(); 394 playtree = play_tree_new();
368 mconfig = m_config_new(playtree); 395 mconfig = m_config_new(playtree);
369 m_config_register_options(mconfig,mencoder_opts); 396 m_config_register_options(mconfig,mencoder_opts);
370 parse_cfgfiles(mconfig); 397 parse_cfgfiles(mconfig);
371 398
379 playtree_iter = NULL; 406 playtree_iter = NULL;
380 } 407 }
381 filename = play_tree_iter_get_file(playtree_iter,1); 408 filename = play_tree_iter_get_file(playtree_iter,1);
382 } 409 }
383 } 410 }
411 #endif
384 412
385 if(!filename && !vcd_track && !dvd_title && !tv_param_on){ 413 if(!filename && !vcd_track && !dvd_title && !tv_param_on){
386 printf(MSGTR_MissingFilename); 414 printf(MSGTR_MissingFilename);
387 mencoder_exit(1,NULL); 415 mencoder_exit(1,NULL);
388 } 416 }