summaryrefslogtreecommitdiffstats
path: root/common/encode_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-07 15:23:03 +0100
committerwm4 <wm4@nowhere>2014-03-07 15:23:03 +0100
commit74b7001500c0901b095986fafe7dca3e5c23c7f2 (patch)
treedaee66eb3955ff8bff726b916171a81a4bf0e451 /common/encode_lavc.c
parent4579d9ca58ee50dba6cb45e4f27e85f2ebbb8269 (diff)
downloadmpv-74b7001500c0901b095986fafe7dca3e5c23c7f2.tar.bz2
mpv-74b7001500c0901b095986fafe7dca3e5c23c7f2.tar.xz
encode: don't access ao->pts
This field will be moved out of the ao struct. The encoding code was basically using an invalid way of accessing this field. Since the AO will be moved into its own thread too and will do its own buffering, the AO and the playback core might not even agree which sample a PTS timestamp belongs to. Add some extrapolation code to handle this case.
Diffstat (limited to 'common/encode_lavc.c')
-rw-r--r--common/encode_lavc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/encode_lavc.c b/common/encode_lavc.c
index 39787430bf..5f9e2a0390 100644
--- a/common/encode_lavc.c
+++ b/common/encode_lavc.c
@@ -386,6 +386,14 @@ void encode_lavc_set_video_fps(struct encode_lavc_context *ctx, float fps)
ctx->vo_fps = fps;
}
+void encode_lavc_set_audio_pts(struct encode_lavc_context *ctx, double pts)
+{
+ if (ctx) {
+ ctx->last_audio_in_pts = pts;
+ ctx->samples_since_last_pts = 0;
+ }
+}
+
static void encode_2pass_prepare(struct encode_lavc_context *ctx,
AVDictionary **dictp,
AVStream *stream, struct stream **bytebuf,