diff options
Diffstat (limited to 'mencoder.c')
-rw-r--r-- | mencoder.c | 322 |
1 files changed, 174 insertions, 148 deletions
diff --git a/mencoder.c b/mencoder.c index 558e3f5e4b..af1b015d90 100644 --- a/mencoder.c +++ b/mencoder.c @@ -55,6 +55,7 @@ #include <sys/time.h> #include "mp_msg.h" +#include "av_log.h" #include "help_mp.h" #include "codec-cfg.h" @@ -100,9 +101,15 @@ #include "libavcodec/avcodec.h" #include "libmpcodecs/ae.h" +#include "options.h" +#include "defaultopts.h" + +MPOpts opts; +struct osd_state *osd; + +const int under_mencoder = 1; int vo_doublebuffering=0; int vo_directrendering=0; -int vo_config_count=1; int forced_subs_only=0; //-------------------------- @@ -118,9 +125,6 @@ float stream_cache_seek_min_percent=50.0; #define cache_fill_status 0 #endif -int audio_id=-1; -int video_id=-1; -int dvdsub_id=-1; int vobsub_id=-1; char* audio_lang=NULL; char* dvdsub_lang=NULL; @@ -170,7 +174,6 @@ static int audio_density=2; double force_fps=0; static double force_ofps=0; // set to 24 for inverse telecine static int skip_limit=-1; -float playback_speed=1.0; static int force_srate=0; static int audio_output_format=0; @@ -217,27 +220,30 @@ char *info_sourceform=NULL; char *info_comment=NULL; // Needed by libmpcodecs vf_vo.c -int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height, - uint32_t d_width, uint32_t d_height, uint32_t flags, - char *title, uint32_t format) { - return 1; -} -// Needed by libmpdemux. -int mp_input_check_interrupt(int time) { - usec_sleep(time); - return 0; -} +int vo_config(struct vo *vo, uint32_t width, uint32_t height, + uint32_t d_width, uint32_t d_height, uint32_t flags, + char *title, uint32_t format) { abort(); } +int vo_control(struct vo *vo, uint32_t request, void *data) { abort(); } +void vo_seek_reset(struct vo *vo) { abort(); } +int vo_draw_image(struct vo *vo, struct mp_image *mpi, double pts) { abort(); } +int vo_draw_frame(struct vo *vo, uint8_t *src[]) { abort(); } +int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y) { abort(); } +void vo_draw_osd(struct vo *vo, struct osd_state *osd) { abort(); } +void vo_flip_page(struct vo *vo, uint32_t pts_us, int duration) { abort(); } +void vo_check_events(struct vo *vo) { abort(); } + // Needed by getch2 -void mplayer_put_key(int code) +struct mp_fifo; +void mplayer_put_key(struct mp_fifo *fifo, int code) { } -#include "libass/ass_mp.h" +#include "ass_mp.h" char *current_module; #include "mpcommon.h" // Needed by mpcommon.c -void set_osd_subtitle(subtitle *subs) { +void set_osd_subtitle(struct MPContext *mpctx, subtitle *subs) { vo_sub = subs; vo_osd_changed(OSDTYPE_SUBTITLE); } @@ -310,9 +316,9 @@ static int edl_seek(edl_record_ptr next_edl_record, demuxer_t* demuxer, demux_st static void mencoder_exit(int level, const char *how) { if (how) - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ExitingHow, how); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nExiting... (%s)\n", how); else - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_Exiting); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nExiting...\n"); exit(level); } @@ -322,14 +328,14 @@ static void parse_cfgfiles( m_config_t* conf ) char *conffile; if (!disable_system_conf && m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mencoder.conf") < 0) - mencoder_exit(1,MSGTR_ConfigFileError); + mencoder_exit(1,_("config file error")); if (!disable_user_conf) { if ((conffile = get_path("mencoder.conf")) == NULL) { - mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_GetpathProblem); + mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"get_path(\"config\") problem\n"); } else { if (m_config_parse_config_file(conf, conffile) < 0) - mencoder_exit(1,MSGTR_ConfigFileError); + mencoder_exit(1,_("config file error")); free(conffile); } } @@ -343,7 +349,6 @@ static int dec_audio(sh_audio_t *sh_audio,unsigned char* buffer,int total){ int at_eof=0; while(size<total && !at_eof){ int len=total-size; - if(len>MAX_OUTBURST) len=MAX_OUTBURST; if (decode_audio(sh_audio, len) < 0) at_eof=1; if(len>sh_audio->a_out_buffer_len) len=sh_audio->a_out_buffer_len; fast_memcpy(buffer+size,sh_audio->a_out_buffer,len); @@ -417,12 +422,12 @@ ao_data_t ao_data = {0,0,0,0,OUTBURST,-1,0}; audio_encoding_params_t aparams; audio_encoder_t *aencoder = NULL; -user_correct_pts = 0; - mp_msg_init(); + set_av_log_callback(); // Create the config context and register the options - mconfig = m_config_new(); + set_default_mencoder_options(&opts); + mconfig = m_config_new(&opts, cfg_include); m_config_register_options(mconfig,mencoder_opts); // Preparse the command line @@ -443,19 +448,19 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){ if(!parse_codec_cfg(NULL)){ mencoder_exit(1,NULL); } - mp_msg(MSGT_MENCODER,MSGL_V,MSGTR_BuiltinCodecsConf); + mp_tmsg(MSGT_MENCODER,MSGL_V,"Using built-in default codecs.conf.\n"); } } } parse_cfgfiles(mconfig); filelist = m_config_parse_me_command_line(mconfig, argc, argv); - if(!filelist) mencoder_exit(1, MSGTR_ErrorParsingCommandLine); + if(!filelist) mencoder_exit(1, _("error parsing command line")); { char *extension; - if (!out_filename) mencoder_exit(1,MSGTR_MissingOutputFilename); + if (!out_filename) mencoder_exit(1,_("No output file specified, please see the -o option.")); extension=strrchr(out_filename,'.'); if (extension != NULL && strlen(extension) > 3 && strlen(extension) < 6) { @@ -465,14 +470,14 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){ { case MUXER_TYPE_AVI: if (strcasecmp(extension,"avi")) - mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatAVI); + mp_tmsg(MSGT_MENCODER, MSGL_WARN, "\nWARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help.\n"); break; case MUXER_TYPE_MPEG: if (strcasecmp(extension,"mpg") && strcasecmp(extension,"mpeg") && strcasecmp(extension,"vob")) - mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatMPG); + mp_tmsg(MSGT_MENCODER, MSGL_WARN, "\nWARNING: OUTPUT FILE FORMAT IS _MPEG_. See -of help.\n"); break; } } @@ -480,13 +485,16 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){ /* Display what configure line was used */ mp_msg(MSGT_MENCODER, MSGL_V, "Configuration: " CONFIGURATION "\n"); +#define FormatNotRecognized _("============ Sorry, this file format is not recognized/supported =============\n"\ +"=== If this file is an AVI, ASF or MPEG stream, please contact the author! ===\n") + if (frameno_filename) { stream2=open_stream(frameno_filename,0,&i); if(stream2){ - demuxer2=demux_open(stream2,DEMUXER_TYPE_AVI,-1,-1,-2,NULL); - if(demuxer2) mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_UsingPass3ControlFile, frameno_filename); - else mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized); + demuxer2=demux_open(&opts, stream2,DEMUXER_TYPE_AVI,-1,-1,-2,NULL); + if(demuxer2) mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Using pass3 control file: %s\n", frameno_filename); + else mp_tmsg(MSGT_DEMUXER,MSGL_ERR, FormatNotRecognized); } } @@ -505,7 +513,7 @@ if (frameno_filename) { #ifdef CONFIG_BITMAP_FONT if(font_name){ vo_font=read_font_desc(font_name,font_factor,verbose>1); - if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name); + if(!vo_font) mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Cannot load bitmap font: %s\n",font_name); } else { // try default: vo_font=read_font_desc(get_path("font/font.desc"),font_factor,verbose>1); @@ -517,7 +525,7 @@ if (frameno_filename) { } #endif - vo_init_osd(); + osd = osd_create(); /* HACK, for some weird reason, push() has to be called twice, otherwise options are not saved correctly */ @@ -528,29 +536,29 @@ play_next_file: filename = filelist[curfile].name; if(!filename){ - mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_MissingFilename); + mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "\nFilename missing.\n\n"); mencoder_exit(1,NULL); } stream=open_stream(filename,0,&file_format); if(!stream){ - mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_CannotOpenFile_Device); + mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "Cannot open file/device.\n"); mencoder_exit(1,NULL); } - mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_OpenedStream, file_format, (int)(stream->start_pos), (int)(stream->end_pos)); + mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "success: format: %d data: 0x%X - 0x%x\n", file_format, (int)(stream->start_pos), (int)(stream->end_pos)); #ifdef CONFIG_DVDREAD if(stream->type==STREAMTYPE_DVD){ - if(audio_lang && audio_id==-1) audio_id=dvd_aid_from_lang(stream,audio_lang); - if(dvdsub_lang && dvdsub_id==-1) dvdsub_id=dvd_sid_from_lang(stream,dvdsub_lang); + if(audio_lang && opts.audio_id==-1) opts.audio_id=dvd_aid_from_lang(stream,audio_lang); + if(dvdsub_lang && opts.sub_id==-1) opts.sub_id=dvd_sid_from_lang(stream,dvdsub_lang); } #endif #ifdef CONFIG_DVDNAV if(stream->type==STREAMTYPE_DVDNAV){ - if(audio_lang && audio_id==-1) audio_id=mp_dvdnav_aid_from_lang(stream,audio_lang); - if(dvdsub_lang && dvdsub_id==-1) dvdsub_id=mp_dvdnav_sid_from_lang(stream,dvdsub_lang); + if(audio_lang && opts.audio_id==-1) opts.audio_id=mp_dvdnav_aid_from_lang(stream,audio_lang); + if(dvdsub_lang && opts.sub_id==-1) opts.sub_id=mp_dvdnav_sid_from_lang(stream,dvdsub_lang); } #endif @@ -558,35 +566,35 @@ if(stream->type==STREAMTYPE_DVDNAV){ if(stream_cache_size>0) stream_enable_cache(stream,stream_cache_size*1024,0,0); - if(demuxer2) audio_id=-2; /* do NOT read audio packets... */ + if(demuxer2) opts.audio_id=-2; /* do NOT read audio packets... */ - //demuxer=demux_open(stream,file_format,video_id,audio_id,dvdsub_id); - demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id,filename); + //demuxer=demux_open(stream,file_format,opts.video_id,opts.audio_id,opts.sub_id); + demuxer=demux_open(&opts, stream,file_format,opts.audio_id,opts.video_id,opts.sub_id,filename); if(!demuxer){ - mp_msg(MSGT_DEMUXER, MSGL_FATAL, MSGTR_FormatNotRecognized); - mp_msg(MSGT_DEMUXER, MSGL_FATAL, MSGTR_CannotOpenDemuxer); + mp_tmsg(MSGT_DEMUXER, MSGL_FATAL, FormatNotRecognized); + mp_tmsg(MSGT_DEMUXER, MSGL_FATAL, "Cannot open demuxer.\n"); mencoder_exit(1,NULL); } if (ts_prog) { demux_program_t prog = { .progid = ts_prog }; if (demux_control(demuxer, DEMUXER_CTRL_IDENTIFY_PROGRAM, &prog) != DEMUXER_CTRL_NOTIMPL) { - audio_id = prog.aid; // switching is handled by select_audio below - video_id = prog.vid; - demuxer_switch_video(demuxer, video_id); + opts.audio_id = prog.aid; // switching is handled by select_audio below + opts.video_id = prog.vid; + demuxer_switch_video(demuxer, opts.video_id); } } - select_audio(demuxer, audio_id, audio_lang); + select_audio(demuxer, opts.audio_id, audio_lang); - if (dvdsub_id == -1 && dvdsub_lang) - dvdsub_id = demuxer_sub_track_by_lang(demuxer, dvdsub_lang); + if (opts.sub_id < -1 && dvdsub_lang) + opts.sub_id = demuxer_sub_track_by_lang(demuxer, dvdsub_lang); - if (dvdsub_id == -1) - dvdsub_id = demuxer_default_sub_track(demuxer); + if (opts.sub_id < -1) + opts.sub_id = demuxer_default_sub_track(demuxer); for (i = 0; i < MAX_S_STREAMS; i++) { sh_sub_t *sh = demuxer->s_streams[i]; - if (sh && sh->sid == dvdsub_id) { + if (sh && sh->sid == opts.sub_id) { demuxer->sub->id = i; demuxer->sub->sh = sh; break; @@ -594,8 +602,8 @@ if(stream->type==STREAMTYPE_DVDNAV){ } if(dvd_chapter>1) { - float pts; - if (demuxer_seek_chapter(demuxer, dvd_chapter-1, 1, &pts, NULL, NULL) >= 0 && pts > -1.0) + double pts; + if (demuxer_seek_chapter(demuxer, dvd_chapter-1, &pts, NULL) >= 0 && pts > -1.0) seek_to_sec = pts; } @@ -607,16 +615,16 @@ sh_video=d_video->sh; if(!sh_video) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_VideoStreamRequired); + mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Video stream is mandatory!\n"); mencoder_exit(1,NULL); } if(!video_read_properties(sh_video)){ - mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_CannotReadVideoProperties); + mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "Video: Cannot read properties.\n"); mencoder_exit(1,NULL); } - mp_msg(MSGT_MENCODER,MSGL_INFO, MSGTR_FilefmtFourccSizeFpsFtime, + mp_tmsg(MSGT_MENCODER,MSGL_INFO, "[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.3f ftime:=%6.4f\n", demuxer->file_format,sh_video->format, sh_video->disp_w,sh_video->disp_h, sh_video->fps,sh_video->frametime ); @@ -624,21 +632,21 @@ sh_video=d_video->sh; if(force_fps){ sh_video->fps=force_fps; sh_video->frametime=1.0f/sh_video->fps; - mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_ForcingInputFPS, sh_video->fps); + mp_tmsg(MSGT_MENCODER,MSGL_INFO,"Input fps will be interpreted as %5.3f instead.\n", sh_video->fps); } if(sh_audio && out_audio_codec<0){ - if(audio_id==-2) - mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_DemuxerDoesntSupportNosound); - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_NoAudioEncoderSelected); + if(opts.audio_id==-2) + mp_tmsg(MSGT_MENCODER,MSGL_ERR,"This demuxer doesn't support -nosound yet.\n"); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nNo audio encoder (-oac) selected. Select one (see -oac help) or use -nosound.\n"); mencoder_exit(1,NULL); } if(sh_video && out_video_codec<0){ - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_NoVideoEncoderSelected); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nNo video encoder (-ovc) selected. Select one (see -ovc help).\n"); mencoder_exit(1,NULL); } -if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_speed != 1.0)){ +if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || opts.playback_speed != 1.0)){ // Go through the codec.conf and find the best codec... mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); if(!init_best_audio_codec(sh_audio,audio_codec_list,audio_fm_list)){ @@ -649,12 +657,12 @@ if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_spee if (sh_audio) { new_srate = sh_audio->samplerate; - if (playback_speed != 1.0) { - new_srate *= playback_speed; + if (opts.playback_speed != 1.0) { + new_srate *= opts.playback_speed; // limits are taken from libaf/af_resample.c if (new_srate < 8000) new_srate = 8000; if (new_srate > 192000) new_srate = 192000; - playback_speed = (float)new_srate / (float)sh_audio->samplerate; + opts.playback_speed = (float)new_srate / (float)sh_audio->samplerate; } } @@ -664,7 +672,7 @@ if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_spee // current_module="read_subtitles_file"; if(sub_name && sub_name[0]){ subdata=sub_read_file(sub_name[0], sh_video->fps); - if(!subdata) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,sub_name[0]); + if(!subdata) mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Cannot load subtitles: %s\n",sub_name[0]); } else if(sub_auto && filename) { // auto load sub file ... char **tmp = NULL; @@ -684,7 +692,7 @@ if (!curfile) { // curfile is non zero when a second file is opened if (vobsub_out) { unsigned int palette[16], width, height; unsigned char tmp[3] = { 0, 0, 0 }; - if (spudec_ifo && vobsub_parse_ifo(NULL,spudec_ifo, palette, &width, &height, 1, dvdsub_id, tmp) >= 0) + if (spudec_ifo && vobsub_parse_ifo(NULL,spudec_ifo, palette, &width, &height, 1, opts.sub_id, tmp) >= 0) vobsub_writer = vobsub_out_open(vobsub_out, palette, sh_video->disp_w, sh_video->disp_h, vobsub_out_id?vobsub_out_id:(char *)tmp, vobsub_out_index); #ifdef CONFIG_DVDREAD @@ -694,7 +702,7 @@ if (vobsub_out) { int i; dvd_priv_t *dvd = (dvd_priv_t*)stream->priv; for (i = 0; i < dvd->nr_of_subtitles; ++i) - if (dvd->subtitles[i].id == dvdsub_id) { + if (dvd->subtitles[i].id == opts.sub_id) { tmp[0] = (dvd->subtitles[i].language >> 8) & 0xff; tmp[1] = dvd->subtitles[i].language & 0xff; tmp[2] = 0; @@ -725,13 +733,13 @@ if (vo_spudec) ostream = open_output_stream(out_filename, 0); if(!ostream) { - mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CannotOpenOutputFile, out_filename); + mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Cannot open output file '%s'.\n", out_filename); mencoder_exit(1,NULL); } muxer=muxer_new_muxer(out_file_format,ostream); if(!muxer) { - mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CannotInitializeMuxer); + mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Cannot initialize muxer."); mencoder_exit(1,NULL); } #if 0 @@ -753,14 +761,14 @@ mux_v->source=sh_video; mux_v->h.dwSampleSize=0; // VBR #ifdef CONFIG_LIBAVCODEC { - double fps = force_ofps?force_ofps:sh_video->fps*playback_speed; + double fps = force_ofps?force_ofps:sh_video->fps*opts.playback_speed; AVRational q= av_d2q(fps, fps*1001+2); mux_v->h.dwScale= q.den; mux_v->h.dwRate = q.num; } #else mux_v->h.dwScale=10000; -mux_v->h.dwRate=mux_v->h.dwScale*(force_ofps?force_ofps:sh_video->fps*playback_speed); +mux_v->h.dwRate=mux_v->h.dwScale*(force_ofps?force_ofps:sh_video->fps*opts.playback_speed); #endif mux_v->codec=out_video_codec; @@ -789,7 +797,7 @@ case VCODEC_COPY: mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); } } - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_VCodecFramecopy, + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "videocodec: framecopy (%dx%d %dbpp fourcc=%x)\n", mux_v->bih->biWidth, mux_v->bih->biHeight, mux_v->bih->biBitCount, mux_v->bih->biCompression); @@ -798,10 +806,10 @@ case VCODEC_COPY: if ((mux_v->bih->biSize != sh_video->bih->biSize) || memcmp(mux_v->bih, sh_video->bih, sh_video->bih->biSize)) { - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_VCodecFramecopy, + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "videocodec: framecopy (%dx%d %dbpp fourcc=%x)\n", sh_video->bih->biWidth, sh_video->bih->biHeight, sh_video->bih->biBitCount, sh_video->bih->biCompression); - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_FrameCopyFileMismatch); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nAll video files must have identical fps, resolution, and codec for -ovc copy.\n"); mencoder_exit(1,NULL); } } @@ -809,9 +817,9 @@ case VCODEC_COPY: if ((mux_v->bih->biWidth != sh_video->disp_w) || (mux_v->bih->biHeight != sh_video->disp_h) || (mux_v->bih->biCompression != sh_video->format)) { - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_VCodecFramecopy, + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "videocodec: framecopy (%dx%d %dbpp fourcc=%x)\n", sh_video->disp_w, sh_video->disp_w, 24, sh_video->format); - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_FrameCopyFileMismatch); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nAll video files must have identical fps, resolution, and codec for -ovc copy.\n"); mencoder_exit(1,NULL); } } @@ -834,24 +842,24 @@ default: { if (!ve) { switch(mux_v->codec){ case VCODEC_LIBAVCODEC: - sh_video->vfilter=vf_open_encoder(NULL,"lavc",(char *)mux_v); break; + sh_video->vfilter=vf_open_encoder(&opts, NULL,"lavc",(char *)mux_v); break; case VCODEC_RAW: - sh_video->vfilter=vf_open_encoder(NULL,"raw",(char *)mux_v); break; + sh_video->vfilter=vf_open_encoder(&opts, NULL,"raw",(char *)mux_v); break; case VCODEC_VFW: - sh_video->vfilter=vf_open_encoder(NULL,"vfw",(char *)mux_v); break; + sh_video->vfilter=vf_open_encoder(&opts, NULL,"vfw",(char *)mux_v); break; case VCODEC_LIBDV: - sh_video->vfilter=vf_open_encoder(NULL,"libdv",(char *)mux_v); break; + sh_video->vfilter=vf_open_encoder(&opts, NULL,"libdv",(char *)mux_v); break; case VCODEC_XVID: - sh_video->vfilter=vf_open_encoder(NULL,"xvid",(char *)mux_v); break; + sh_video->vfilter=vf_open_encoder(&opts, NULL,"xvid",(char *)mux_v); break; case VCODEC_QTVIDEO: - sh_video->vfilter=vf_open_encoder(NULL,"qtvideo",(char *)mux_v); break; + sh_video->vfilter=vf_open_encoder(&opts, NULL,"qtvideo",(char *)mux_v); break; case VCODEC_NUV: - sh_video->vfilter=vf_open_encoder(NULL,"nuv",(char *)mux_v); break; + sh_video->vfilter=vf_open_encoder(&opts, NULL,"nuv",(char *)mux_v); break; case VCODEC_X264: - sh_video->vfilter=vf_open_encoder(NULL,"x264",(char *)mux_v); break; + sh_video->vfilter=vf_open_encoder(&opts, NULL,"x264",(char *)mux_v); break; } if(!mux_v->bih || !sh_video->vfilter){ - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_EncoderOpenFailed); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"Failed to open the encoder.\n"); mencoder_exit(1,NULL); } ve = sh_video->vfilter; @@ -859,9 +867,9 @@ default: { // append 'expand' filter, it fixes stride problems and renders osd: if (auto_expand) { char* vf_args[] = { "osd", "1", NULL }; - sh_video->vfilter=vf_open_filter(sh_video->vfilter,"expand",vf_args); + sh_video->vfilter=vf_open_filter(&opts, sh_video->vfilter,"expand",vf_args); } - sh_video->vfilter=append_filters(sh_video->vfilter); + sh_video->vfilter=append_filters(sh_video->vfilter, opts.vf_settings); mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n"); init_best_video_codec(sh_video,video_codec_list,video_fm_list); @@ -876,7 +884,7 @@ if ((force_fourcc != NULL) && (strlen(force_fourcc) >= 4)) { mux_v->bih->biCompression = mmioFOURCC(force_fourcc[0], force_fourcc[1], force_fourcc[2], force_fourcc[3]); - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ForcingOutputFourcc, + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Forcing output FourCC to %x [%.4s].\n", mux_v->bih->biCompression, (char *)&mux_v->bih->biCompression); } @@ -893,7 +901,7 @@ if (force_audiofmttag != -1) { if (sh_audio->wf) { sh_audio->wf->wFormatTag = sh_audio->format; } - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ForcingOutputAudiofmtTag, + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Forcing output audio format tag to 0x%x.\n", force_audiofmttag); } @@ -902,7 +910,7 @@ mux_a=muxer_new_stream(muxer,MUXER_TYPE_AUDIO); mux_a->buffer_size=0x100000; //16384; mux_a->buffer=malloc(mux_a->buffer_size); if (!mux_a->buffer) - mencoder_exit(1,MSGTR_MemAllocFailed); + mencoder_exit(1,_("Memory allocation failed.\n")); mux_a->source=sh_audio; @@ -916,7 +924,7 @@ if(!init_audio_filters(sh_audio, new_srate, // output: &ao_data.samplerate, &ao_data.channels, &ao_data.format)) { - mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError); + mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Error at audio filter chain pre-init!\n"); mencoder_exit(1, NULL); } @@ -930,15 +938,19 @@ if(mux_a->codec != ACODEC_COPY) { if(!init_audio_filters(sh_audio, new_srate, &aparams.sample_rate, &aparams.channels, &aencoder->input_format)) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoMatchingFilter); + mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Couldn't find matching filter/ao format!\n"); mencoder_exit(1,NULL); } } + +#define NoSpeedWithFrameCopy _("WARNING: -speed is not guaranteed to work correctly with -oac copy!\n"\ +"Your encode might be broken!\n") + switch(mux_a->codec){ case ACODEC_COPY: - if (playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy); + if (opts.playback_speed != 1.0) mp_tmsg(MSGT_CPLAYER, MSGL_WARN, NoSpeedWithFrameCopy); if (sh_audio->format >= 0x10000) { - mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantCopyAudioFormat, sh_audio->format); + mp_tmsg(MSGT_MENCODER,MSGL_ERR,"Audio format 0x%x is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.\n", sh_audio->format); mencoder_exit(1,NULL); } if (sh_audio->wf){ @@ -964,9 +976,9 @@ case ACODEC_COPY: mux_a->h.dwScale=mux_a->h.dwSampleSize; mux_a->h.dwRate=mux_a->wf->nAvgBytesPerSec; } - mux_a->h.dwRate *= playback_speed; - mux_a->wf->nSamplesPerSec *= playback_speed; - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, + mux_a->h.dwRate *= opts.playback_speed; + mux_a->wf->nSamplesPerSec *= opts.playback_speed; + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d B/s=%d sample-%d)\n", mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec, mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize); break; @@ -991,34 +1003,34 @@ timer_start=GetTimerMS(); } // if (!curfile) // if this was the first file. else { if (!mux_a != !sh_audio) { - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_NoAudioFileMismatch); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nCannot mix video-only files with audio and video files. Try -nosound.\n"); mencoder_exit(1,NULL); } if (sh_audio && mux_a->codec == ACODEC_COPY) { - if (playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy); - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, + if (opts.playback_speed != 1.0) mp_tmsg(MSGT_CPLAYER, MSGL_WARN, NoSpeedWithFrameCopy); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d B/s=%d sample-%d)\n", mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec, mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize); if (sh_audio->wf) { if ((mux_a->wf->wFormatTag != sh_audio->wf->wFormatTag) || (mux_a->wf->nChannels != sh_audio->wf->nChannels) || - (mux_a->wf->nSamplesPerSec != sh_audio->wf->nSamplesPerSec * playback_speed)) + (mux_a->wf->nSamplesPerSec != sh_audio->wf->nSamplesPerSec * opts.playback_speed)) { - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, - sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * playback_speed), + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d B/s=%d sample-%d)\n", + sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * opts.playback_speed), sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0); - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nAll files must have identical audio codec and format for -oac copy.\n"); mencoder_exit(1,NULL); } } else { if ((mux_a->wf->wFormatTag != sh_audio->format) || (mux_a->wf->nChannels != sh_audio->channels) || - (mux_a->wf->nSamplesPerSec != sh_audio->samplerate * playback_speed)) + (mux_a->wf->nSamplesPerSec != sh_audio->samplerate * opts.playback_speed)) { - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy, - sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * playback_speed), + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d B/s=%d sample-%d)\n", + sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * opts.playback_speed), sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0); - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nAll files must have identical audio codec and format for -oac copy.\n"); mencoder_exit(1,NULL); } } @@ -1029,7 +1041,7 @@ else { if (!init_audio_filters(sh_audio, new_srate, &out_srate, &out_channels, &out_format)) { - mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_NoMatchingFilter); + mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "Couldn't find matching filter/ao format!\n"); mencoder_exit(1, NULL); } mux_a->wf->nSamplesPerSec = out_srate; @@ -1049,18 +1061,18 @@ if (seek_to_sec) { if (out_file_format == MUXER_TYPE_MPEG) { if (audio_preload > 0.4) { - mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_LimitingAudioPreload); + mp_tmsg(MSGT_MENCODER, MSGL_WARN, "Limiting audio preload to 0.4s.\n"); audio_preload = 0.4; } if (audio_density < 4) { - mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_IncreasingAudioDensity); + mp_tmsg(MSGT_MENCODER, MSGL_WARN, "Increasing audio density to 4.\n"); audio_density = 4; } } if(file_format == DEMUXER_TYPE_TV) { - mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_ZeroingAudioPreloadAndMaxPtsCorrection); + mp_tmsg(MSGT_MENCODER, MSGL_WARN, "Forcing audio preload to 0, max pts correction to 0.\n"); audio_preload = 0.0; default_max_pts_correction = 0; } @@ -1243,7 +1255,7 @@ if(sh_audio){ frame_data.in_size=video_read_frame(sh_video,&frame_data.frame_time,&frame_data.start,force_fps); sh_video->timer+=frame_data.frame_time; } - frame_data.frame_time /= playback_speed; + frame_data.frame_time /= opts.playback_speed; if(frame_data.in_size<0){ at_eof=1; break; } ++decoded_frameno; @@ -1316,9 +1328,16 @@ case VCODEC_FRAMENO: break; default: // decode_video will callback down to ve_*.c encoders, through the video filters + sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SET_OSD_OBJ, osd); {void *decoded_frame = decode_video(sh_video,frame_data.start,frame_data.in_size, - skip_flag>0 && (!sh_video->vfilter || ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) != CONTROL_TRUE), MP_NOPTS_VALUE); - blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE);} + skip_flag>0 && (!sh_video->vfilter || sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) != CONTROL_TRUE), MP_NOPTS_VALUE); + blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE); + if (blit_frame) { + struct vf_instance *vf = sh_video->vfilter; + vf->control(vf, VFCTRL_DRAW_EOSD, NULL); + vf->control(vf, VFCTRL_DRAW_OSD, osd); + } + } if (sh_video->vf_initialized < 0) mencoder_exit(1, NULL); @@ -1337,7 +1356,7 @@ default: // Eventually this entire block should probably be removed. if(skip_limit==0){ // skipping not allowed -> write empty frame: - if (!encode_duplicates || !sh_video->vfilter || ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE) + if (!encode_duplicates || !sh_video->vfilter || sh_video->vfilter->control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE) muxer_write_chunk(mux_v,0,0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); } else { // skipping allowed -> skip it and distriubute timer error: @@ -1353,17 +1372,17 @@ videorate+=(GetTimerMS() - ptimer_start); if(skip_flag<0){ // duplicate frame - if(!quiet) mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_DuplicateFrames,-skip_flag); + if(!quiet) mp_tmsg(MSGT_MENCODER, MSGL_WARN, "\n%d duplicate frame(s)!\n",-skip_flag); while(skip_flag<0){ duplicatedframes++; - if (!encode_duplicates || !sh_video->vfilter || ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE) + if (!encode_duplicates || !sh_video->vfilter || sh_video->vfilter->control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE) muxer_write_chunk(mux_v,0,0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); ++skip_flag; } } else if(skip_flag>0){ // skip frame - if(!quiet) mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_SkipFrame); + if(!quiet) mp_tmsg(MSGT_MENCODER, MSGL_WARN, "\nSkipping frame!\n"); skippedframes++; --skip_flag; } @@ -1392,7 +1411,7 @@ if(sh_audio && !demuxer2){ // av = compensated (with out buffering delay) A-V diff AV_delay=(a_pts-v_pts); AV_delay-=audio_delay; - AV_delay /= playback_speed; + AV_delay /= opts.playback_speed; AV_delay-=mux_a->timer-(mux_v->timer-(v_timer_corr+v_pts_corr)); // adjust for encoder delays AV_delay -= (float) mux_a->encoder_delay * mux_a->h.dwScale/mux_a->h.dwRate; @@ -1402,9 +1421,9 @@ if(sh_audio && !demuxer2){ if(x<-max_pts_correction) x=-max_pts_correction; else if(x> max_pts_correction) x= max_pts_correction; if(default_max_pts_correction>=0) - max_pts_correction=default_max_pts_correction*playback_speed; + max_pts_correction=default_max_pts_correction*opts.playback_speed; else - max_pts_correction=sh_video->frametime*0.10 *playback_speed; // +-10% of time + max_pts_correction=sh_video->frametime*0.10 *opts.playback_speed; // +-10% of time // sh_video->timer-=x; c_total+=x; v_pts_corr+=x; @@ -1484,13 +1503,13 @@ if(sh_audio && !demuxer2){ } else #endif - update_subtitles(sh_video, sh_video->pts, d_dvdsub, 0); + update_subtitles(NULL, &opts, sh_video, sh_video->pts, 0, d_dvdsub, 0); frame_data = (s_frame_data){ .start = NULL, .in_size = 0, .frame_time = 0., .already_read = 0 }; #if 0 if(ferror(muxer_f)) { - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ErrorWritingFile, out_filename); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n", out_filename); mencoder_exit(1, NULL); } #endif @@ -1520,11 +1539,11 @@ if (!interrupted && filelist[++curfile].name != 0) { /* Emit the remaining frames in the video system */ /*TODO emit frmaes delayed by decoder lag*/ if(sh_video && sh_video->vfilter){ - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_FlushingVideoFrames); - if (!((vf_instance_t *)sh_video->vfilter)->fmt.have_configured) - mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_FiltersHaveNotBeenConfiguredEmptyFile); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nFlushing video frames.\n"); + if (!sh_video->vfilter->fmt.have_configured) + mp_tmsg(MSGT_MENCODER, MSGL_WARN, "Filters have not been configured! Empty file?\n"); else - ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, + sh_video->vfilter->control(sh_video->vfilter, VFCTRL_FLUSH_FRAMES, 0); } @@ -1538,7 +1557,7 @@ stream_seek(muxer->stream,0); if (muxer->cont_write_header) muxer_write_header(muxer); // update header #if 0 if(ferror(muxer_f) || fclose(muxer_f) != 0) { - mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ErrorWritingFile, out_filename); + mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n", out_filename); mencoder_exit(1, NULL); } #endif @@ -1546,18 +1565,18 @@ if(vobsub_writer) vobsub_out_close(vobsub_writer); if(out_video_codec==VCODEC_FRAMENO && mux_v->timer>100){ - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"650MB",(int)((650*1024*1024-muxer_f_size)/mux_v->timer/125)); - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"700MB",(int)((700*1024*1024-muxer_f_size)/mux_v->timer/125)); - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"800MB",(int)((800*1024*1024-muxer_f_size)/mux_v->timer/125)); - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"2 x 650MB",(int)((2*650*1024*1024-muxer_f_size)/mux_v->timer/125)); - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"2 x 700MB",(int)((2*700*1024*1024-muxer_f_size)/mux_v->timer/125)); - mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"2 x 800MB",(int)((2*800*1024*1024-muxer_f_size)/mux_v->timer/125)); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","650MB",(int)((650*1024*1024-muxer_f_size)/mux_v->timer/125)); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","700MB",(int)((700*1024*1024-muxer_f_size)/mux_v->timer/125)); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","800MB",(int)((800*1024*1024-muxer_f_size)/mux_v->timer/125)); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","2 x 650MB",(int)((2*650*1024*1024-muxer_f_size)/mux_v->timer/125)); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","2 x 700MB",(int)((2*700*1024*1024-muxer_f_size)/mux_v->timer/125)); + mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","2 x 800MB",(int)((2*800*1024*1024-muxer_f_size)/mux_v->timer/125)); } -mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_VideoStreamResult, +mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nVideo stream: %8.3f kbit/s (%d B/s) size: %"PRIu64" bytes %5.3f secs %d frames\n", (float)(mux_v->size/mux_v->timer*8.0f/1000.0f), (int)(mux_v->size/mux_v->timer), (uint64_t)mux_v->size, (float)mux_v->timer, decoded_frameno); if(sh_audio) -mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_AudioStreamResult, +mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nAudio stream: %8.3f kbit/s (%d B/s) size: %"PRIu64" bytes %5.3f secs\n", (float)(mux_a->size/mux_a->timer*8.0f/1000.0f), (int)(mux_a->size/mux_a->timer), (uint64_t)mux_a->size, (float)mux_a->timer); if(sh_audio){ uninit_audio(sh_audio);sh_audio=NULL; } @@ -1679,14 +1698,20 @@ static int slowseek(float end_pts, demux_stream_t *d_video, demux_stream_t *d_au if (sh_video->pts >= end_pts) done = 1; if (vfilter) { + sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SET_OSD_OBJ, + osd); int softskip = (vfilter->control(vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) == CONTROL_TRUE); void *decoded_frame = decode_video(sh_video, frame_data->start, frame_data->in_size, !softskip, MP_NOPTS_VALUE); if (decoded_frame) - filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE); + if (filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE)) { + struct vf_instance *vf = sh_video->vfilter; + vf->control(vf, VFCTRL_DRAW_EOSD, NULL); + vf->control(vf, VFCTRL_DRAW_OSD, osd); + } } - if (print_info) mp_msg(MSGT_MENCODER, MSGL_STATUS, - MSGTR_EdlSkipStartEndCurrent, + if (print_info) mp_tmsg(MSGT_MENCODER, MSGL_STATUS, + "EDL SKIP: Start: %.2f End: %.2f Current: V: %.2f A: %.2f \r", next_edl_record->start_sec, next_edl_record->stop_sec, sh_video->pts, a_pts); } @@ -1725,6 +1750,7 @@ static int edl_seek(edl_record_ptr next_edl_record, demuxer_t* demuxer, demux_st if(demux_seek(demuxer, next_edl_record->stop_sec - sh_video->pts, audio_delay, 0)){ sh_video->pts = demuxer->video->pts; //if (vo_vobsub) vobsub_seek(vo_vobsub,sh_video->pts); + resync_video_stream(sh_video); //if(vo_spudec) spudec_reset(vo_spudec); if (audio_delay != 0.0) fixdelay(demuxer->video, d_audio, mux_a, frame_data, framecopy); return 1; |