summaryrefslogtreecommitdiffstats
path: root/mencoder.c
diff options
context:
space:
mode:
authorods15 <ods15@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-17 19:28:01 +0000
committerods15 <ods15@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-17 19:28:01 +0000
commite805f50a7652c4d7b8ce8fb7d0a81f8ded8b0b82 (patch)
tree1ef6b7def953f70275fb770bdf93061908ad5a4d /mencoder.c
parent78600ea9bc1bf62ee4484a8c05ef3b2372373fa7 (diff)
downloadmpv-e805f50a7652c4d7b8ce8fb7d0a81f8ded8b0b82.tar.bz2
mpv-e805f50a7652c4d7b8ce8fb7d0a81f8ded8b0b82.tar.xz
-delay for MEncoder, step 5.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15997 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mencoder.c')
-rw-r--r--mencoder.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/mencoder.c b/mencoder.c
index 0d49c8c49f..745123fc8c 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -246,6 +246,10 @@ static float calc_a_pts(demux_stream_t *d_audio);
\return The current audio pts.
*/
static float forward_audio(float pts, demux_stream_t *d_audio, muxer_stream_t* mux_a);
+/** \brief Seeks slowly by dumping frames.
+ \return 1 for success, 2 for EOF.
+*/
+static int slowseek(float end_pts, demux_stream_t *d_video, demux_stream_t *d_audio, muxer_stream_t* mux_a, s_frame_data * frame_data, int framecopy, int print_info);
#ifdef USE_EDL
#include "edl.h"
@@ -1650,29 +1654,11 @@ static float forward_audio(float pts, demux_stream_t *d_audio, muxer_stream_t* m
return a_pts;
}
-#ifdef USE_EDL
-static int edl_seek(edl_record_ptr next_edl_record, demuxer_t* demuxer, demux_stream_t *d_audio, muxer_stream_t* mux_a, s_frame_data * frame_data, int framecopy) {
- sh_video_t * sh_video = demuxer->video ? demuxer->video->sh : NULL;
+static int slowseek(float end_pts, demux_stream_t *d_video, demux_stream_t *d_audio, muxer_stream_t* mux_a, s_frame_data * frame_data, int framecopy, int print_info) {
+ sh_video_t * sh_video = d_video->sh;
vf_instance_t * vfilter = sh_video ? sh_video->vfilter : NULL;
int done = 0;
- if (!sh_video) return 0;
- if (sh_video->pts >= next_edl_record->stop_sec) return 1; // nothing to do...
-
- if (!edl_seek_type) {
- if(demux_seek(demuxer, next_edl_record->stop_sec - sh_video->pts, 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);
- return 1;
- }
- // non-seekable stream.
- return 0;
- }
-
- // slow seek, read every frame.
-
while (!interrupted) {
float a_pts = 0.;
@@ -1686,14 +1672,14 @@ static int edl_seek(edl_record_ptr next_edl_record, demuxer_t* demuxer, demux_st
frame_data->already_read = 1;
if (!framecopy || (sh_video->ds->flags & 1)) return 1;
}
- if (sh_video->pts >= next_edl_record->stop_sec) done = 1;
+ if (sh_video->pts >= end_pts) done = 1;
if (vfilter) {
int softskip = (vfilter->control(vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) == CONTROL_TRUE);
decode_video(sh_video, frame_data->start, frame_data->in_size, !softskip);
}
- mp_msg(MSGT_MENCODER, MSGL_STATUS,
+ if (print_info) mp_msg(MSGT_MENCODER, MSGL_STATUS,
"EDL SKIP: Start: %.2f End: %.2lf Current: V: %.2f A: %.2f \r",
next_edl_record->start_sec, next_edl_record->stop_sec,
sh_video->pts, a_pts);
@@ -1701,4 +1687,28 @@ static int edl_seek(edl_record_ptr next_edl_record, demuxer_t* demuxer, demux_st
if (interrupted) return 2;
return 1;
}
+
+#ifdef USE_EDL
+static int edl_seek(edl_record_ptr next_edl_record, demuxer_t* demuxer, demux_stream_t *d_audio, muxer_stream_t* mux_a, s_frame_data * frame_data, int framecopy) {
+ sh_video_t * sh_video = demuxer->video ? demuxer->video->sh : NULL;
+
+ if (!sh_video) return 0;
+ if (sh_video->pts >= next_edl_record->stop_sec) return 1; // nothing to do...
+
+ if (!edl_seek_type) {
+ if(demux_seek(demuxer, next_edl_record->stop_sec - sh_video->pts, 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);
+ return 1;
+ }
+ // non-seekable stream.
+ return 0;
+ }
+
+ // slow seek, read every frame.
+
+ return slowseek(next_edl_record->stop_sec, demuxer->video, d_audio, mux_a, frame_data, framecopy, 1);
+}
#endif