diff options
author | rfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-10 00:07:34 +0000 |
---|---|---|
committer | rfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-10 00:07:34 +0000 |
commit | 412bac90a8c06e5ac296827d1716d7f4f5d84941 (patch) | |
tree | 4890615a97e1a176ed62e1902d206b754adea65e | |
parent | 9a93e7607aa958d83d2612f4fc34e33cfbe414c5 (diff) |
initial seeking (-ss) support in mencoder
make mplayer's default video encoder fallback to libavcodec or raw if divx4 isn't supported
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4621 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | cfg-mencoder.h | 2 | ||||
-rw-r--r-- | mencoder.c | 32 |
2 files changed, 31 insertions, 3 deletions
diff --git a/cfg-mencoder.h b/cfg-mencoder.h index 7f16024e62..b5b65b9af0 100644 --- a/cfg-mencoder.h +++ b/cfg-mencoder.h @@ -96,6 +96,8 @@ static config_t mencoder_opts[]={ /* name, pointer, type, flags, min, max */ {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL}, /* this must be the first!!! */ +// {"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, + {"ss", &seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, NULL}, {"endpos", parse_end_at, CONF_TYPE_FUNC_PARAM, 0, 0, 0, NULL}, {"ofps", &force_ofps, CONF_TYPE_FLOAT, CONF_MIN, 0, 0, NULL}, diff --git a/mencoder.c b/mencoder.c index 008dc064b8..dd7bf92bcc 100644 --- a/mencoder.c +++ b/mencoder.c @@ -125,7 +125,17 @@ int out_audio_codec=ACODEC_VBRMP3; int out_audio_codec=ACODEC_PCM; #endif -int out_video_codec=VCODEC_DIVX4; +int out_video_codec= +#ifdef HAVE_DIVX4ENCORE + VCODEC_DIVX4; +#else +#ifdef USE_LIBAVCODEC + VCODEC_LIBAVCODEC; +#else + VCODEC_RAW; +#endif +#endif + // audio stream skip/resync functions requires only for seeking. // (they should be implemented in the audio codec layer) @@ -198,6 +208,9 @@ static int cfg_include(struct config *conf, char *filename){ return m_config_parse_config_file(mconfig, filename); } +static char *seek_to_sec=NULL; +static off_t seek_to_byte=0; + static int parse_end_at(struct config *conf, const char* param); static uint8_t* flip_upside_down(uint8_t* dst, const uint8_t* src, int width, int height); @@ -597,7 +610,7 @@ if(!init_video(sh_video,pitches)){ } // if(out_video_codec) -if(sh_audio && (out_audio_codec || !sh_audio->wf)){ +if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf)){ // Go through the codec.conf and find the best codec... sh_audio->codec=NULL; if(audio_family!=-1) mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_TryForceAudioFmt,audio_family); @@ -622,7 +635,7 @@ if(sh_audio && (out_audio_codec || !sh_audio->wf)){ } } -if(sh_audio && (out_audio_codec || !sh_audio->wf)){ +if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf)){ mp_msg(MSGT_MENCODER,MSGL_V,"Initializing audio codec...\n"); if(!init_audio(sh_audio)){ mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CouldntInitAudioCodec); @@ -1194,6 +1207,19 @@ signal(SIGTERM,exit_sighandler); // kill timer_start=GetTimerMS(); +if (seek_to_sec) { + int a,b; float d; + + if (sscanf(seek_to_sec, "%d:%d:%f", &a,&b,&d)==3) + d += 3600*a + 60*b; + else if (sscanf(seek_to_sec, "%d:%f", &a, &d)==2) + d += 60*a; + else + sscanf(seek_to_sec, "%f", &d); + + demux_seek(demuxer, d, 1); +} + while(!eof){ float frame_time=0; |