diff options
author | wm4 <wm4@nowhere> | 2014-07-05 16:59:12 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-07-05 17:07:15 +0200 |
commit | de71b502495cf3c1ce778a141da574d715582f97 (patch) | |
tree | 57698bfa5ea3c9ebcf03d93cfd056abd53432522 /player | |
parent | 0cc35946235bd356db2836b77a842c7363bdde5c (diff) | |
download | mpv-de71b502495cf3c1ce778a141da574d715582f97.tar.bz2 mpv-de71b502495cf3c1ce778a141da574d715582f97.tar.xz |
dvd: move angle switching code
No need to provide a "nice" API for it; just do this stuff directly in
the command code.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/player/command.c b/player/command.c index 8dd9f079ac..9f8a830058 100644 --- a/player/command.c +++ b/player/command.c @@ -864,15 +864,20 @@ static int mp_property_angle(void *ctx, struct m_property *prop, { MPContext *mpctx = ctx; struct demuxer *demuxer = mpctx->master_demuxer; - int angle = -1; - int angles; + if (!demuxer) + return M_PROPERTY_UNAVAILABLE; - if (demuxer) - angle = demuxer_get_current_angle(demuxer); - if (angle < 0) + int ris, angles = -1, angle = 1; + + ris = stream_control(demuxer->stream, STREAM_CTRL_GET_NUM_ANGLES, &angles); + if (ris == STREAM_UNSUPPORTED) return M_PROPERTY_UNAVAILABLE; - angles = demuxer_angles_count(demuxer); - if (angles <= 1) + + ris = stream_control(demuxer->stream, STREAM_CTRL_GET_ANGLE, &angle); + if (ris == STREAM_UNSUPPORTED) + return -1; + + if (angle < 0 || angles <= 1) return M_PROPERTY_UNAVAILABLE; switch (action) { @@ -884,14 +889,23 @@ static int mp_property_angle(void *ctx, struct m_property *prop, return M_PROPERTY_OK; } case M_PROPERTY_SET: - angle = demuxer_set_angle(demuxer, *(int *)arg); - if (angle >= 0) { - if (mpctx->d_video) - video_reset_decoding(mpctx->d_video); + angle = *(int *)arg; + if (angle < 0 || angle > angles) + return M_PROPERTY_ERROR; + demux_flush(demuxer); + + ris = stream_control(demuxer->stream, STREAM_CTRL_SET_ANGLE, &angle); + if (ris != STREAM_OK) + return M_PROPERTY_ERROR; + + demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL); + + if (mpctx->d_video) + video_reset_decoding(mpctx->d_video); + + if (mpctx->d_audio) + audio_reset_decoding(mpctx->d_audio); - if (mpctx->d_audio) - audio_reset_decoding(mpctx->d_audio); - } return M_PROPERTY_OK; case M_PROPERTY_GET_TYPE: { struct m_option opt = { |