summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-04 22:21:57 +0100
committerwm4 <wm4@nowhere>2013-03-04 22:21:57 +0100
commit7889e38f21a4ed65f020a1805b799478f1ad6e55 (patch)
treec63fc87cdf380117e8a2fbe035f11862c1c485c0 /core
parent6ef1a1cddd9ae43c80a337b5224955735b987074 (diff)
downloadmpv-7889e38f21a4ed65f020a1805b799478f1ad6e55.tar.bz2
mpv-7889e38f21a4ed65f020a1805b799478f1ad6e55.tar.xz
Remove vo_fps global variable
This is needed by the encode stuff for some reason, so we have to explicitly pass it. Functionality shouldn't change.
Diffstat (limited to 'core')
-rw-r--r--core/encode.h1
-rw-r--r--core/encode_lavc.c9
-rw-r--r--core/encode_lavc.h2
-rw-r--r--core/mplayer.c15
4 files changed, 22 insertions, 5 deletions
diff --git a/core/encode.h b/core/encode.h
index f0f65f14c5..fdeb273f34 100644
--- a/core/encode.h
+++ b/core/encode.h
@@ -16,6 +16,7 @@ void encode_lavc_discontinuity(struct encode_lavc_context *ctx);
bool encode_lavc_showhelp(struct MPOpts *opts);
int encode_lavc_getstatus(struct encode_lavc_context *ctx, char *buf, int bufsize, float relative_position, float playback_time);
void encode_lavc_expect_stream(struct encode_lavc_context *ctx, enum AVMediaType mt);
+void encode_lavc_set_video_fps(struct encode_lavc_context *ctx, float fps);
bool encode_lavc_didfail(struct encode_lavc_context *ctx); // check if encoding failed
#endif
diff --git a/core/encode_lavc.c b/core/encode_lavc.c
index 070b806253..9bb1abcdcd 100644
--- a/core/encode_lavc.c
+++ b/core/encode_lavc.c
@@ -365,6 +365,11 @@ void encode_lavc_finish(struct encode_lavc_context *ctx)
ctx->finished = true;
}
+void encode_lavc_set_video_fps(struct encode_lavc_context *ctx, float fps)
+{
+ ctx->vo_fps = fps;
+}
+
static void encode_2pass_prepare(struct encode_lavc_context *ctx,
AVDictionary **dictp,
AVStream *stream, struct stream **bytebuf,
@@ -458,8 +463,8 @@ AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
if (ctx->options->fps > 0)
r = av_d2q(ctx->options->fps, ctx->options->fps * 1001 + 2);
- else if (ctx->options->autofps && vo_fps > 0) {
- r = av_d2q(vo_fps, vo_fps * 1001 + 2);
+ else if (ctx->options->autofps && ctx->vo_fps > 0) {
+ r = av_d2q(ctx->vo_fps, ctx->vo_fps * 1001 + 2);
mp_msg(
MSGT_ENCODE, MSGL_INFO, "vo-lavc: option -ofps not specified "
"but -oautofps is active, using guess of %u/%u\n",
diff --git a/core/encode_lavc.h b/core/encode_lavc.h
index fa935e039a..a0245c991a 100644
--- a/core/encode_lavc.h
+++ b/core/encode_lavc.h
@@ -35,6 +35,8 @@
struct encode_lavc_context {
struct encode_output_conf *options;
+ float vo_fps;
+
// these are processed from the options
AVFormatContext *avc;
AVRational timebase;
diff --git a/core/mplayer.c b/core/mplayer.c
index b56415151d..d217f98932 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -2314,6 +2314,15 @@ static void vo_update_window_title(struct MPContext *mpctx)
mpctx->video_out->window_title = talloc_steal(mpctx, title);
}
+static void update_fps(struct MPContext *mpctx)
+{
+#ifdef CONFIG_ENCODING
+ struct sh_video *sh_video = mpctx->sh_video;
+ if (mpctx->encode_lavc_ctx && sh_video)
+ encode_lavc_set_video_fps(mpctx->encode_lavc_ctx, sh_video->fps);
+#endif
+}
+
int reinit_video_chain(struct MPContext *mpctx)
{
struct MPOpts *opts = &mpctx->opts;
@@ -2338,7 +2347,7 @@ int reinit_video_chain(struct MPContext *mpctx)
mpctx->sh_video->fps = force_fps;
mpctx->sh_video->frametime = 1.0f / mpctx->sh_video->fps;
}
- vo_fps = mpctx->sh_video->fps;
+ update_fps(mpctx);
if (!mpctx->sh_video->fps && !force_fps && !opts->correct_pts) {
mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "FPS not specified in the "
@@ -2453,7 +2462,7 @@ static double update_video_nocorrect_pts(struct MPContext *mpctx)
if (mpctx->sh_audio)
mpctx->delay -= frame_time;
// video_read_frame can change fps (e.g. for ASF video)
- vo_fps = sh_video->fps;
+ update_fps(mpctx);
int framedrop_type = check_framedrop(mpctx, frame_time);
void *decoded_frame;
@@ -3215,7 +3224,7 @@ static void run_playloop(struct MPContext *mpctx)
double buffered_audio = -1;
while (mpctx->sh_video) { // never loops, for "break;" only
struct vo *vo = mpctx->video_out;
- vo_fps = mpctx->sh_video->fps;
+ update_fps(mpctx);
video_left = vo->hasframe || vo->frame_loaded;
if (!vo->frame_loaded && (!mpctx->paused || mpctx->restart_playback)) {