summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
Diffstat (limited to 'player')
-rw-r--r--player/loadfile.c18
-rw-r--r--player/main.c7
-rw-r--r--player/video.c7
3 files changed, 19 insertions, 13 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 8065b6f007..cf3c1eb013 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1302,9 +1302,9 @@ reopen_file:
#if HAVE_ENCODING
if (mpctx->encode_lavc_ctx && mpctx->current_track[0][STREAM_VIDEO])
- encode_lavc_expect_stream(mpctx->encode_lavc_ctx, AVMEDIA_TYPE_VIDEO);
+ encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_VIDEO);
if (mpctx->encode_lavc_ctx && mpctx->current_track[0][STREAM_AUDIO])
- encode_lavc_expect_stream(mpctx->encode_lavc_ctx, AVMEDIA_TYPE_AUDIO);
+ encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_AUDIO);
if (mpctx->encode_lavc_ctx) {
encode_lavc_set_metadata(mpctx->encode_lavc_ctx,
mpctx->demuxer->metadata);
@@ -1556,6 +1556,20 @@ void mp_play_files(struct MPContext *mpctx)
}
cancel_open(mpctx);
+
+#if HAVE_ENCODING
+ if (mpctx->encode_lavc_ctx) {
+ // Make sure all streams get finished.
+ uninit_audio_out(mpctx);
+ uninit_video_out(mpctx);
+
+ if (!encode_lavc_free(mpctx->encode_lavc_ctx))
+ mpctx->stop_play = PT_ERROR;
+
+ mpctx->encode_lavc_ctx = NULL;
+ }
+#endif
+
}
// Abort current playback and set the given entry to play next.
diff --git a/player/main.c b/player/main.c
index b070b1aabe..ef54a0ac4d 100644
--- a/player/main.c
+++ b/player/main.c
@@ -165,10 +165,10 @@ void mp_destroy(struct MPContext *mpctx)
uninit_video_out(mpctx);
#if HAVE_ENCODING
+ // If it's still set here, it's an error.
encode_lavc_free(mpctx->encode_lavc_ctx);
-#endif
-
mpctx->encode_lavc_ctx = NULL;
+#endif
command_uninit(mpctx);
@@ -416,8 +416,7 @@ int mp_initialize(struct MPContext *mpctx, char **options)
#if HAVE_ENCODING
if (opts->encode_opts->file && opts->encode_opts->file[0]) {
- mpctx->encode_lavc_ctx = encode_lavc_init(opts->encode_opts,
- mpctx->global);
+ mpctx->encode_lavc_ctx = encode_lavc_init(mpctx->global);
if(!mpctx->encode_lavc_ctx) {
MP_INFO(mpctx, "Encoding initialization failed.\n");
return -1;
diff --git a/player/video.c b/player/video.c
index 1a85cf511f..f4623f29e8 100644
--- a/player/video.c
+++ b/player/video.c
@@ -263,13 +263,6 @@ void reinit_video_chain_src(struct MPContext *mpctx, struct track *track)
mp_pin_connect(vo_c->filter->f->pins[0], vo_c->dec_src);
}
-#if HAVE_ENCODING
- if (mpctx->encode_lavc_ctx) {
- encode_lavc_set_video_fps(mpctx->encode_lavc_ctx,
- vo_c->filter->container_fps);
- }
-#endif
-
if (!recreate_video_filters(mpctx))
goto err_out;