mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
build: make encoding mode non-optional
Makes it easier to not break the build by confusing the ifdeffery.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user