summaryrefslogtreecommitdiffstats
path: root/mp_core.h
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2008-12-08 20:04:08 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-01-14 02:06:13 +0200
commit321c93ee998266cff4ce5b5eff2aaba4e2311dd0 (patch)
treeaa457dd522f75e384902e54e3d71e4f93071237e /mp_core.h
parent5204fda1213f1bb876fd71f16f44767edc8eae46 (diff)
downloadmpv-321c93ee998266cff4ce5b5eff2aaba4e2311dd0.tar.bz2
mpv-321c93ee998266cff4ce5b5eff2aaba4e2311dd0.tar.xz
core: Rewrite some of the A/V sync related code
Notable functionality changes: * Timing change between any two frames is now accurately limited to 1/10 of their nominal distance. Previous code did not always use the correct duration. * The status line now keeps showing the same A-V sync value from one video frame change to the next. Previously it kept recalculating the value using a new audio position but the same video position when the status line was updated between video frames. This incorrectly showed the video losing sync with audio. * The status line now displays actual measured A-V difference in autosync mode too. The previous code displayed values that completely ignored real timing in autosync mode, showing 0 A-V difference even when video was significantly behind audio due to inadequate decoding speed. The new behavior can make the shown A-V values appear more unstable if the audio out has unreliable delay measurements (the most likely reason to use autosync), but this is a display change rather than a timing quality change. * Autosync mode now tries to adjust timing by the amount of time vo_flip() calls take, so the calls start earlier and finish at the time the frame should be shown. Previously non-autosync mode adjusted for this but autosync did not. * The warning about the system being too slow to decode the video in realtime is now displayed in autosync mode too.
Diffstat (limited to 'mp_core.h')
-rw-r--r--mp_core.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/mp_core.h b/mp_core.h
index a346c75dce..c9a843a78e 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -1,6 +1,8 @@
#ifndef MPLAYER_MP_CORE_H
#define MPLAYER_MP_CORE_H
+#include <stdbool.h>
+
#include "options.h"
#include "mixer.h"
#include "subreader.h"
@@ -76,6 +78,9 @@ typedef struct MPContext {
// struct.
int num_buffered_frames;
+ // Show a video frame as quickly as possible without trying to adjust
+ // for AV sync. Used when starting a file or after seeking.
+ bool update_video_immediately;
// AV sync: the next frame should be shown when the audio out has this
// much (in seconds) buffered data left. Increased when more data is
// written to the ao, decreased when moving to the next frame.
@@ -84,6 +89,17 @@ typedef struct MPContext {
double delay;
// AV sync: time until next frame should be shown
float time_frame;
+ // How long the last vo flip() call took. Used to adjust timing with
+ // the goal of making flip() calls finish (rather than start) at the
+ // specified time.
+ float last_vo_flip_duration;
+ // How much video timing has been changed to make it match the audio
+ // timeline. Used for status line information only.
+ double total_avsync_change;
+ // A-V sync difference when last frame was displayed. Kept to display
+ // the same value if the status line is updated at a time where no new
+ // video frame is shown.
+ double last_av_difference;
// Timestamp from the last time some timing functions read the
// current time, in (occasionally wrapping) microseconds. Used
@@ -118,6 +134,10 @@ typedef struct MPContext {
// step this many frames, then pause
int step_frames;
+ // Set after showing warning about decoding being too slow for realtime
+ // playback rate. Used to avoid showing it multiple times.
+ bool drop_message_shown;
+
#ifdef CONFIG_DVDNAV
struct mp_image *nav_smpi; ///< last decoded dvdnav video image
unsigned char *nav_buffer; ///< last read dvdnav video frame