changeset 2618:47a338888698

mencoder commandline handling
author arpi
date Fri, 02 Nov 2001 01:25:13 +0000
parents b97a9e3fdb63
children b66f42e9ec2d
files cfg-mencoder.h mencoder.c
diffstat 2 files changed, 68 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cfg-mencoder.h	Fri Nov 02 01:25:13 2001 +0000
@@ -0,0 +1,26 @@
+/*
+ * config for cfgparser
+ */
+
+#ifdef USE_FAKE_MONO
+extern int fakemono; // defined in dec_audio.c
+#endif
+#ifdef HAVE_ODIVX_POSTPROCESS
+extern int use_old_pp;
+#endif
+
+struct config conf[]={
+	/* name, pointer, type, flags, min, max */
+	{"include", cfg_include, CONF_TYPE_FUNC_PARAM, 0, 0, 0}, /* this must be the first!!! */
+
+
+#include "cfg-common.h"
+
+//	{"quiet", &quiet, CONF_TYPE_FLAG, 0, 0, 1},
+	{"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE, 0, 100},
+	{"v", cfg_inc_verbose, CONF_TYPE_FUNC, 0, 0, 0},
+//	{"-help", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
+//	{"help", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
+//	{"h", help_text, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
+	{NULL, NULL, 0, 0, 0, 0}
+};
--- a/mencoder.c	Fri Nov 02 00:47:38 2001 +0000
+++ b/mencoder.c	Fri Nov 02 01:25:13 2001 +0000
@@ -27,19 +27,23 @@
 
 #include <encore2.h>
 
-#include "get_path.c"
-
 #include <lame/lame.h>
 
 //--------------------------
 
 // cache2:
+static int stream_cache_size=0;
 #ifdef USE_STREAM_CACHE
 extern int cache_fill_status;
 #else
 #define cache_fill_status 0
 #endif
 
+int vcd_track=0;
+int audio_id=-1;
+int video_id=-1;
+int dvdsub_id=-1;
+
 char *audio_codec=NULL; // override audio codec
 char *video_codec=NULL; // override video codec
 int audio_family=-1;     // override audio codec family 
@@ -50,7 +54,7 @@
 //void skip_audio_frame(sh_audio_t *sh_audio){}
 //void resync_audio_stream(sh_audio_t *sh_audio){}
 
-int verbose=1; // must be global!
+int verbose=0; // must be global!
 
 double video_time_usage=0;
 double vout_time_usage=0;
@@ -67,9 +71,26 @@
 float force_fps=0;
 float force_ofps=0; // set to 24 for inverse telecine
 
+int force_srate=0;
+
 //#include "libmpeg2/mpeg2.h"
 //#include "libmpeg2/mpeg2_internal.h"
 
+//-------------------------- config stuff:
+
+#include "cfgparser.h"
+
+static int cfg_inc_verbose(struct config *conf){ ++verbose; return 0;}
+
+static int cfg_include(struct config *conf, char *filename){
+	return parse_config_file(conf, filename);
+}
+
+#include "get_path.c"
+
+#include "cfg-mplayer-def.h"
+#include "cfg-mencoder.h"
+
 //---------------------------------------------------------------------------
 
 // mini dummy libvo:
@@ -146,7 +167,7 @@
     eof=1;
 }
 
-int main(int argc,char* argv[]){
+int main(int argc,char* argv[], char *envp[]){
 
 stream_t* stream=NULL;
 demuxer_t* demuxer=NULL;
@@ -176,11 +197,22 @@
 double v_pts_corr=0;
 double v_timer_corr=0;
 
+char** filenames=NULL;
+char* filename=NULL;
+int num_filenames;
+
 //int out_buffer_size=0x200000;
 //unsigned char* out_buffer=malloc(out_buffer_size);
 
   mp_msg_init(verbose+MSGL_STATUS);
 
+  num_filenames=parse_command_line(conf, argc, argv, envp, &filenames);
+  if(num_filenames<0) exit(1); // error parsing cmdline
+  if(!num_filenames && !vcd_track && !dvd_title){
+	printf("\nMissing filename!\n\n");
+	exit(1);
+  }
+
   // check codec.conf
   if(!parse_codec_cfg("etc/codecs.conf")){
     mp_msg(MSGT_CPLAYER,MSGL_HINT,MSGTR_CopyCodecsConf);
@@ -189,13 +221,8 @@
 
 //  dvd_title=2;
 
-  if(argc>1)
-    stream=open_stream(argv[1],0,&file_format);
-  else
-//    stream=open_stream("/1/!ize/dinosaur.dvdrip.svcd-emb.mpg",0,&file_format);
-    stream=open_stream("/3d/abcug/Weird AL - Amish Paradise (MUSIC VIDEO).mpeg",0,&file_format);
-//    stream=open_stream("/3d/divx/405divx_sm_v2[1].avi",0,&file_format);
-//    stream=open_stream("/dev/cdrom",2,&file_format); // VCD track 2
+  filename=(num_filenames>0)?filenames[0]:NULL;
+  stream=open_stream(filename,vcd_track,&file_format);
 
   if(!stream){
 	printf("Cannot open file/device\n");
@@ -204,9 +231,9 @@
 
   printf("success: format: %d  data: 0x%X - 0x%X\n",file_format, (int)(stream->start_pos),(int)(stream->end_pos));
 
-  stream_enable_cache(stream,2048*1024);
+  if(stream_cache_size) stream_enable_cache(stream,stream_cache_size*1024);
 
-  demuxer=demux_open(stream,file_format,-1,-1,-1);
+  demuxer=demux_open(stream,file_format,video_id,audio_id,dvdsub_id);
   if(!demuxer){
 	printf("Cannot open demuxer\n");
 	exit(1);
@@ -681,4 +708,6 @@
 aviwrite_write_header(muxer,muxer_f); // update header
 fclose(muxer_f);
 
+if(stream) free_stream(stream); // kill cache thread
+
 }