mirror of https://github.com/mpv-player/mpv
mencoder commandline handling
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2619 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
39a160c63d
commit
f7e6998fd0
|
@ -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}
|
||||||
|
};
|
55
mencoder.c
55
mencoder.c
|
@ -27,19 +27,23 @@
|
||||||
|
|
||||||
#include <encore2.h>
|
#include <encore2.h>
|
||||||
|
|
||||||
#include "get_path.c"
|
|
||||||
|
|
||||||
#include <lame/lame.h>
|
#include <lame/lame.h>
|
||||||
|
|
||||||
//--------------------------
|
//--------------------------
|
||||||
|
|
||||||
// cache2:
|
// cache2:
|
||||||
|
static int stream_cache_size=0;
|
||||||
#ifdef USE_STREAM_CACHE
|
#ifdef USE_STREAM_CACHE
|
||||||
extern int cache_fill_status;
|
extern int cache_fill_status;
|
||||||
#else
|
#else
|
||||||
#define cache_fill_status 0
|
#define cache_fill_status 0
|
||||||
#endif
|
#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 *audio_codec=NULL; // override audio codec
|
||||||
char *video_codec=NULL; // override video codec
|
char *video_codec=NULL; // override video codec
|
||||||
int audio_family=-1; // override audio codec family
|
int audio_family=-1; // override audio codec family
|
||||||
|
@ -50,7 +54,7 @@ int video_family=-1; // override video codec family
|
||||||
//void skip_audio_frame(sh_audio_t *sh_audio){}
|
//void skip_audio_frame(sh_audio_t *sh_audio){}
|
||||||
//void resync_audio_stream(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 video_time_usage=0;
|
||||||
double vout_time_usage=0;
|
double vout_time_usage=0;
|
||||||
|
@ -67,9 +71,26 @@ static float c_total=0;
|
||||||
float force_fps=0;
|
float force_fps=0;
|
||||||
float force_ofps=0; // set to 24 for inverse telecine
|
float force_ofps=0; // set to 24 for inverse telecine
|
||||||
|
|
||||||
|
int force_srate=0;
|
||||||
|
|
||||||
//#include "libmpeg2/mpeg2.h"
|
//#include "libmpeg2/mpeg2.h"
|
||||||
//#include "libmpeg2/mpeg2_internal.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:
|
// mini dummy libvo:
|
||||||
|
@ -146,7 +167,7 @@ static void exit_sighandler(int x){
|
||||||
eof=1;
|
eof=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc,char* argv[]){
|
int main(int argc,char* argv[], char *envp[]){
|
||||||
|
|
||||||
stream_t* stream=NULL;
|
stream_t* stream=NULL;
|
||||||
demuxer_t* demuxer=NULL;
|
demuxer_t* demuxer=NULL;
|
||||||
|
@ -176,11 +197,22 @@ float audio_preload=0.3;
|
||||||
double v_pts_corr=0;
|
double v_pts_corr=0;
|
||||||
double v_timer_corr=0;
|
double v_timer_corr=0;
|
||||||
|
|
||||||
|
char** filenames=NULL;
|
||||||
|
char* filename=NULL;
|
||||||
|
int num_filenames;
|
||||||
|
|
||||||
//int out_buffer_size=0x200000;
|
//int out_buffer_size=0x200000;
|
||||||
//unsigned char* out_buffer=malloc(out_buffer_size);
|
//unsigned char* out_buffer=malloc(out_buffer_size);
|
||||||
|
|
||||||
mp_msg_init(verbose+MSGL_STATUS);
|
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
|
// check codec.conf
|
||||||
if(!parse_codec_cfg("etc/codecs.conf")){
|
if(!parse_codec_cfg("etc/codecs.conf")){
|
||||||
mp_msg(MSGT_CPLAYER,MSGL_HINT,MSGTR_CopyCodecsConf);
|
mp_msg(MSGT_CPLAYER,MSGL_HINT,MSGTR_CopyCodecsConf);
|
||||||
|
@ -189,13 +221,8 @@ double v_timer_corr=0;
|
||||||
|
|
||||||
// dvd_title=2;
|
// dvd_title=2;
|
||||||
|
|
||||||
if(argc>1)
|
filename=(num_filenames>0)?filenames[0]:NULL;
|
||||||
stream=open_stream(argv[1],0,&file_format);
|
stream=open_stream(filename,vcd_track,&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
|
|
||||||
|
|
||||||
if(!stream){
|
if(!stream){
|
||||||
printf("Cannot open file/device\n");
|
printf("Cannot open file/device\n");
|
||||||
|
@ -204,9 +231,9 @@ double v_timer_corr=0;
|
||||||
|
|
||||||
printf("success: format: %d data: 0x%X - 0x%X\n",file_format, (int)(stream->start_pos),(int)(stream->end_pos));
|
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){
|
if(!demuxer){
|
||||||
printf("Cannot open demuxer\n");
|
printf("Cannot open demuxer\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -681,4 +708,6 @@ fseek(muxer_f,0,SEEK_SET);
|
||||||
aviwrite_write_header(muxer,muxer_f); // update header
|
aviwrite_write_header(muxer,muxer_f); // update header
|
||||||
fclose(muxer_f);
|
fclose(muxer_f);
|
||||||
|
|
||||||
|
if(stream) free_stream(stream); // kill cache thread
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue