From e02c9b9902f5bd356088cfbff3b9c333e50f1e47 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 29 Apr 2018 20:03:24 +0200 Subject: build: make encoding mode non-optional Makes it easier to not break the build by confusing the ifdeffery. --- player/audio.c | 2 -- player/loadfile.c | 13 ++++--------- player/main.c | 6 ------ player/osd.c | 5 +---- player/playloop.c | 4 ---- 5 files changed, 5 insertions(+), 25 deletions(-) (limited to 'player') diff --git a/player/audio.c b/player/audio.c index 9b1340ec96..28e7867ca1 100644 --- a/player/audio.c +++ b/player/audio.c @@ -555,9 +555,7 @@ static int write_to_ao(struct MPContext *mpctx, uint8_t **planes, int samples, int format; struct mp_chmap channels; ao_get_format(ao, &samplerate, &format, &channels); -#if HAVE_ENCODING encode_lavc_set_audio_pts(mpctx->encode_lavc_ctx, playing_audio_pts(mpctx)); -#endif if (samples == 0) return 0; double real_samplerate = samplerate / mpctx->audio_speed; diff --git a/player/loadfile.c b/player/loadfile.c index cf3c1eb013..65d693e264 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1300,16 +1300,14 @@ reopen_file: update_demuxer_properties(mpctx); -#if HAVE_ENCODING - if (mpctx->encode_lavc_ctx && mpctx->current_track[0][STREAM_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, STREAM_AUDIO); if (mpctx->encode_lavc_ctx) { + if (mpctx->current_track[0][STREAM_VIDEO]) + encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_VIDEO); + if (mpctx->current_track[0][STREAM_AUDIO]) + encode_lavc_expect_stream(mpctx->encode_lavc_ctx, STREAM_AUDIO); encode_lavc_set_metadata(mpctx->encode_lavc_ctx, mpctx->demuxer->metadata); } -#endif update_playback_speed(mpctx); @@ -1557,7 +1555,6 @@ 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); @@ -1568,8 +1565,6 @@ void mp_play_files(struct MPContext *mpctx) 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 ef54a0ac4d..f56191a297 100644 --- a/player/main.c +++ b/player/main.c @@ -164,11 +164,9 @@ void mp_destroy(struct MPContext *mpctx) uninit_audio_out(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); mpctx->encode_lavc_ctx = NULL; -#endif command_uninit(mpctx); @@ -229,10 +227,8 @@ static bool handle_help_options(struct MPContext *mpctx) property_print_help(mpctx); return true; } -#if HAVE_ENCODING if (encode_lavc_showhelp(log, opts->encode_opts)) return true; -#endif return false; } @@ -414,7 +410,6 @@ int mp_initialize(struct MPContext *mpctx, char **options) cocoa_set_mpv_handle(ctx); #endif -#if HAVE_ENCODING if (opts->encode_opts->file && opts->encode_opts->file[0]) { mpctx->encode_lavc_ctx = encode_lavc_init(mpctx->global); if(!mpctx->encode_lavc_ctx) { @@ -424,7 +419,6 @@ int mp_initialize(struct MPContext *mpctx, char **options) m_config_set_profile(mpctx->mconfig, "encoding", 0); mp_input_enable_section(mpctx->input, "encode", MP_INPUT_EXCLUSIVE); } -#endif #if !HAVE_LIBASS MP_WARN(mpctx, "Compiled without libass.\n"); diff --git a/player/osd.c b/player/osd.c index fd6b421849..52c9b83286 100644 --- a/player/osd.c +++ b/player/osd.c @@ -198,7 +198,6 @@ static char *get_term_status_msg(struct MPContext *mpctx) saddf(&line, " ct:%7.3f", mpctx->total_avsync_change); } -#if HAVE_ENCODING double position = get_current_pos_ratio(mpctx, true); char lavcbuf[80]; if (encode_lavc_getstatus(mpctx->encode_lavc_ctx, lavcbuf, sizeof(lavcbuf), @@ -206,9 +205,7 @@ static char *get_term_status_msg(struct MPContext *mpctx) { // encoding stats saddf(&line, " %s", lavcbuf); - } else -#endif - { + } else { // VO stats if (mpctx->vo_chain) { if (mpctx->display_sync_active) { diff --git a/player/playloop.c b/player/playloop.c index a0945db845..a7771b8be3 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -227,9 +227,7 @@ void reset_playback_state(struct MPContext *mpctx) mpctx->cache_buffer = 100; mpctx->seek_slave = NULL; -#if HAVE_ENCODING encode_lavc_discontinuity(mpctx->encode_lavc_ctx); -#endif update_internal_pause_state(mpctx); update_core_idle_state(mpctx); @@ -1067,12 +1065,10 @@ static void handle_eof(struct MPContext *mpctx) void run_playloop(struct MPContext *mpctx) { -#if HAVE_ENCODING if (encode_lavc_didfail(mpctx->encode_lavc_ctx)) { mpctx->stop_play = PT_QUIT; return; } -#endif update_demuxer_properties(mpctx); -- cgit v1.2.3