~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to mencoder.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
220
220
    vo_osd_changed(OSDTYPE_SUBTITLE);
221
221
}
222
222
 
223
 
//-------------------------- config stuff:
224
 
 
225
 
m_config_t* mconfig;
226
 
 
227
 
static int cfg_inc_verbose(m_option_t *conf){ ++verbose; return 0;}
228
 
 
229
 
static int cfg_include(m_option_t *conf, const char *filename){
230
 
        return m_config_parse_config_file(mconfig, filename);
231
 
}
232
 
 
233
223
static double seek_to_sec;
234
224
static off_t seek_to_byte=0;
235
225
 
248
238
static edl_record_ptr next_edl_record = NULL; ///< only for traversing edl_records
249
239
static short edl_muted; ///< Stores whether EDL is currently in muted mode.
250
240
static short edl_seeking; ///< When non-zero, stream is seekable.
251
 
static short edl_seek_type; ///< When non-zero, frames are discarded instead of seeking.
 
241
static int edl_seek_type; ///< When non-zero, frames are discarded instead of seeking.
252
242
 
253
243
/* This header requires all the global variable declarations. */
254
244
#include "cfg-mencoder.h"
269
259
{
270
260
  char *conffile;
271
261
  if (!disable_system_conf &&
272
 
      m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mencoder.conf") < 0)
 
262
      m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mencoder.conf", 1) < 0)
273
263
    mencoder_exit(1,MSGTR_ConfigFileError);
274
264
 
275
265
  if (!disable_user_conf) {
276
266
    if ((conffile = get_path("mencoder.conf")) == NULL) {
277
267
      mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_GetpathProblem);
278
268
    } else {
279
 
      if (m_config_parse_config_file(conf, conffile) < 0)
 
269
      if (m_config_parse_config_file(conf, conffile, 1) < 0)
280
270
        mencoder_exit(1,MSGTR_ConfigFileError);
281
271
      free(conffile);
282
272
    }
561
551
 
562
552
double v_pts_corr=0;
563
553
double v_timer_corr=0;
 
554
double sub_offset=0;
 
555
int did_seek=0;
564
556
 
565
557
m_entry_t* filelist = NULL;
566
558
char* filename=NULL;
777
769
    }
778
770
  }
779
771
 
 
772
  if (vobsub_name)
 
773
    vo_vobsub = vobsub_open(vobsub_name, spudec_ifo, 1, &vo_spudec);
 
774
 
780
775
// set up video encoder:
781
776
 
782
777
if (!curfile) { // curfile is non zero when a second file is opened
806
801
    }
807
802
#endif
808
803
}
809
 
else {
 
804
else if (!vo_spudec) {
810
805
init_vo_spudec(stream, sh_video, d_dvdsub ? d_dvdsub->sh : NULL);
811
806
}
812
807
 
832
827
 
833
828
mux_v=muxer_new_stream(muxer,MUXER_TYPE_VIDEO);
834
829
 
835
 
mux_v->buffer_size=0x200000; // 2MB
 
830
mux_v->buffer_size=0x800000; // 8MB
836
831
mux_v->buffer=malloc(mux_v->buffer_size);
837
832
 
838
833
mux_v->source=sh_video;
1217
1212
 
1218
1213
if (sh_audio && audio_delay != 0.) fixdelay(d_video, d_audio, mux_a, &frame_data, mux_v->codec==VCODEC_COPY);
1219
1214
 
 
1215
// Just assume a seek. Also works if time stamps do not start with 0
 
1216
did_seek = 1;
 
1217
 
1220
1218
while(!at_eof){
1221
1219
 
1222
1220
    int blit_frame=0;
1256
1254
            if (result == 2) { at_eof=1; break; } // EOF
1257
1255
            else if (result == 0) edl_seeking = 0; // no seeking
1258
1256
            else { // sucess
 
1257
                did_seek = 1;
1259
1258
                edl_muted = 0;
1260
1259
                if (last_pos >= sh_video->pts) {
1261
1260
                    // backwards seek detected!! Forget about this EDL skip altogether.
1463
1462
                      ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) != CONTROL_TRUE);
1464
1463
    void *decoded_frame = decode_video(sh_video,frame_data.start,frame_data.in_size,
1465
1464
                                       drop_frame, MP_NOPTS_VALUE, NULL);
1466
 
    blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE);}
 
1465
    if (did_seek && sh_video->pts != MP_NOPTS_VALUE) {
 
1466
        did_seek = 0;
 
1467
        sub_offset = sh_video->pts;
 
1468
    }
 
1469
    // NOTE: this is not really correct, but it allows -ass to work mostly
 
1470
    // v_muxer_time was tried before, but it is completely off when -ss is used
 
1471
    // (see bug #1960).
 
1472
    // sh_video->pts causes flickering with subtitles and complaints from MPEG-4
 
1473
    // encoder due to not being monotonic.
 
1474
    // If you change this please note the reason here!
 
1475
    blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, v_muxer_time + sub_offset);}
1467
1476
    v_muxer_time = adjusted_muxer_time(mux_v); // update after muxing
1468
1477
 
1469
1478
    if (sh_video->vf_initialized < 0) mencoder_exit(1, NULL);