diff options
author | wm4 <wm4@nowhere> | 2016-02-01 22:28:47 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-02-01 22:28:47 +0100 |
commit | a0804329927904fdeb70d9712ff23baaab161bb4 (patch) | |
tree | 591fb123c622d76c2836cd6b5e3b46ea6ad4c483 /player | |
parent | 5c8378b71aaa4fbfda69ed9f50fe10f40cd124f2 (diff) | |
download | mpv-a0804329927904fdeb70d9712ff23baaab161bb4.tar.bz2 mpv-a0804329927904fdeb70d9712ff23baaab161bb4.tar.xz |
player: refactor: reduce some dependencies on current_track
Don't mind me.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 10 | ||||
-rw-r--r-- | player/loadfile.c | 26 | ||||
-rw-r--r-- | player/misc.c | 3 |
3 files changed, 15 insertions, 24 deletions
diff --git a/player/command.c b/player/command.c index fd793c87c9..c753a42c97 100644 --- a/player/command.c +++ b/player/command.c @@ -1831,11 +1831,7 @@ static struct track* track_next(struct MPContext *mpctx, int order, struct track *cur = mpctx->tracks[n]; // One track can be selected only one time - pretend already selected // tracks don't exist. - for (int r = 0; r < NUM_PTRACKS; r++) { - if (r != order && mpctx->current_track[r][type] == cur) - cur = NULL; - } - if (!cur) + if (cur->selected) continue; if (cur->type == type) { if (cur == track) { @@ -2518,9 +2514,9 @@ static int mp_property_vd_imgparams(void *ctx, struct m_property *prop, { MPContext *mpctx = ctx; struct vo_chain *vo_c = mpctx->vo_chain; - struct track *track = mpctx->current_track[0][STREAM_VIDEO]; - if (!vo_c || !track) + if (!vo_c) return M_PROPERTY_UNAVAILABLE; + struct track *track = mpctx->current_track[0][STREAM_VIDEO]; struct mp_codec_params *c = track && track->stream ? track->stream->codec : NULL; if (vo_c->vf->input_params.imgfmt) { diff --git a/player/loadfile.c b/player/loadfile.c index 7d5a5f847d..57c3588b9f 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1158,13 +1158,6 @@ reopen_file: enable_demux_thread(mpctx); - if (mpctx->current_track[0][STREAM_VIDEO] && - mpctx->current_track[0][STREAM_VIDEO]->attached_picture) - { - MP_INFO(mpctx, - "Displaying attached picture. Use --no-audio-display to prevent this.\n"); - } - #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); @@ -1176,20 +1169,23 @@ reopen_file: } #endif - if (!mpctx->current_track[0][STREAM_VIDEO] && - !mpctx->current_track[0][STREAM_AUDIO]) - { - MP_FATAL(mpctx, "No video or audio streams selected.\n"); - mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY; - goto terminate_playback; - } - update_playback_speed(mpctx); reinit_video_chain(mpctx); reinit_audio_chain(mpctx); reinit_sub_all(mpctx); + if (!mpctx->vo_chain && !mpctx->ao_chain) { + MP_FATAL(mpctx, "No video or audio streams selected.\n"); + mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY; + goto terminate_playback; + } + + if (mpctx->vo_chain && mpctx->vo_chain->is_coverart) { + MP_INFO(mpctx, + "Displaying attached picture. Use --no-audio-display to prevent this.\n"); + } + MP_VERBOSE(mpctx, "Starting playback...\n"); mpctx->playback_initialized = true; diff --git a/player/misc.c b/player/misc.c index c86a03608c..1343c60eaf 100644 --- a/player/misc.c +++ b/player/misc.c @@ -172,8 +172,7 @@ void error_on_track(struct MPContext *mpctx, struct track *track) if (track->type == STREAM_VIDEO) MP_INFO(mpctx, "Video: no video\n"); if (mpctx->opts->stop_playback_on_init_failure || - (!mpctx->current_track[0][STREAM_AUDIO] && - !mpctx->current_track[0][STREAM_VIDEO])) + !(mpctx->vo_chain || mpctx->ao_chain)) { if (!mpctx->stop_play) mpctx->stop_play = PT_ERROR; |