summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-09-13 16:48:34 +0200
committerwm4 <wm4@nowhere>2019-09-13 17:31:59 +0200
commita9d83eac40c94f44d19fab7b6955331f10efe301 (patch)
tree151a76d57c17649b025e262f44fae5fb0eefd889 /player/command.c
parentcf36e3d15b31958927b81b9ec99793c3a99bafc2 (diff)
downloadmpv-a9d83eac40c94f44d19fab7b6955331f10efe301.tar.bz2
mpv-a9d83eac40c94f44d19fab7b6955331f10efe301.tar.xz
Remove optical disc fancification layers
This removes anything related to DVD/BD/CD that negatively affected the core code. It includes trying to rewrite timestamps (since DVDs and Blurays do not set packet stream timestamps to playback time, and can even have resets mid-stream), export of chapters, stream languages, export of title/track lists, and all that. Only basic seeking is supported. It is very much possible that seeking completely fails on some discs (on some parts of the timeline), because timestamp rewriting was removed. Note that I don't give a shit about optical media. If you want to watch them, rip them. Keeping some bare support for DVD/BD is the most I'm going to do to appease the type of lazy, obnoxious users who will care. There are other players which are better at optical discs.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c145
1 files changed, 0 insertions, 145 deletions
diff --git a/player/command.c b/player/command.c
index 0dc9e9a8b9..13b5fb74df 100644
--- a/player/command.c
+++ b/player/command.c
@@ -901,39 +901,6 @@ static int mp_property_playback_time(void *ctx, struct m_property *prop,
return property_time(action, arg, get_playback_time(mpctx));
}
-/// Current BD/DVD title (RW)
-static int mp_property_disc_title(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- struct demuxer *d = mpctx->demuxer;
- if (!d || !d->extended_ctrls)
- return M_PROPERTY_UNAVAILABLE;
- unsigned int title = -1;
- switch (action) {
- case M_PROPERTY_GET:
- if (demux_stream_control(d, STREAM_CTRL_GET_CURRENT_TITLE, &title) < 0)
- return M_PROPERTY_UNAVAILABLE;
- *(int*)arg = title;
- return M_PROPERTY_OK;
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){
- .type = CONF_TYPE_INT,
- .flags = M_OPT_MIN,
- .min = -1,
- };
- return M_PROPERTY_OK;
- case M_PROPERTY_SET:
- title = *(int*)arg;
- if (demux_stream_control(d, STREAM_CTRL_SET_CURRENT_TITLE, &title) < 0)
- return M_PROPERTY_NOT_IMPLEMENTED;
- if (!mpctx->stop_play)
- mpctx->stop_play = PT_CURRENT_ENTRY;
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
/// Current chapter (RW)
static int mp_property_chapter(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -1216,53 +1183,6 @@ static int property_list_editions(void *ctx, struct m_property *prop,
get_edition_entry, mpctx);
}
-/// Number of titles in BD/DVD
-static int mp_property_disc_titles(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- struct demuxer *demuxer = mpctx->demuxer;
- unsigned int num_titles;
- if (!demuxer || !demuxer->extended_ctrls ||
- demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES,
- &num_titles) < 1)
- return M_PROPERTY_UNAVAILABLE;
- return m_property_int_ro(action, arg, num_titles);
-}
-
-static int get_disc_title_entry(int item, int action, void *arg, void *ctx)
-{
- struct MPContext *mpctx = ctx;
- struct demuxer *demuxer = mpctx->demuxer;
-
- double len = item;
- if (demux_stream_control(demuxer, STREAM_CTRL_GET_TITLE_LENGTH, &len) < 1)
- len = -1;
-
- struct m_sub_property props[] = {
- {"id", SUB_PROP_INT(item)},
- {"length", {.type = CONF_TYPE_TIME}, {.time = len},
- .unavailable = len < 0},
- {0}
- };
-
- return m_property_read_sub(props, action, arg);
-}
-
-static int mp_property_list_disc_titles(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- struct demuxer *demuxer = mpctx->demuxer;
- unsigned int num_titles;
- if (!demuxer || !demuxer->extended_ctrls ||
- demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES,
- &num_titles) < 1)
- return M_PROPERTY_UNAVAILABLE;
- return m_property_read_list(action, arg, num_titles,
- get_disc_title_entry, mpctx);
-}
-
/// Number of chapters in file
static int mp_property_chapters(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -1286,67 +1206,6 @@ static int mp_property_editions(void *ctx, struct m_property *prop,
return m_property_int_ro(action, arg, demuxer->num_editions);
}
-/// Current dvd angle (RW)
-static int mp_property_angle(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- struct demuxer *demuxer = mpctx->demuxer;
- if (!demuxer || !demuxer->extended_ctrls)
- return M_PROPERTY_UNAVAILABLE;
-
- int ris, angles = -1, angle = 1;
-
- ris = demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_ANGLES, &angles);
- if (ris == STREAM_UNSUPPORTED)
- return M_PROPERTY_UNAVAILABLE;
-
- ris = demux_stream_control(demuxer, STREAM_CTRL_GET_ANGLE, &angle);
- if (ris == STREAM_UNSUPPORTED)
- return -1;
-
- if (angle < 0 || angles <= 1)
- return M_PROPERTY_UNAVAILABLE;
-
- switch (action) {
- case M_PROPERTY_GET:
- *(int *) arg = angle;
- return M_PROPERTY_OK;
- case M_PROPERTY_PRINT: {
- *(char **) arg = talloc_asprintf(NULL, "%d/%d", angle, angles);
- return M_PROPERTY_OK;
- }
- case M_PROPERTY_SET:
- angle = *(int *)arg;
- if (angle < 0 || angle > angles)
- return M_PROPERTY_ERROR;
-
- demux_flush(demuxer);
- ris = demux_stream_control(demuxer, STREAM_CTRL_SET_ANGLE, &angle);
- if (ris == STREAM_OK) {
- demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL);
- demux_flush(demuxer);
- }
-
- reset_audio_state(mpctx);
- reset_video_state(mpctx);
- mp_wakeup_core(mpctx);
-
- return ris == STREAM_OK ? M_PROPERTY_OK : M_PROPERTY_ERROR;
- case M_PROPERTY_GET_TYPE: {
- struct m_option opt = {
- .type = CONF_TYPE_INT,
- .flags = CONF_RANGE,
- .min = 1,
- .max = angles,
- };
- *(struct m_option *)arg = opt;
- return M_PROPERTY_OK;
- }
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
static int get_tag_entry(int item, int action, void *arg, void *ctx)
{
struct mp_tags *tags = ctx;
@@ -3774,13 +3633,10 @@ static const struct m_property mp_properties_base[] = {
{"audio-pts", mp_property_audio_pts},
{"playtime-remaining", mp_property_playtime_remaining},
{"playback-time", mp_property_playback_time},
- {"disc-title", mp_property_disc_title},
{"chapter", mp_property_chapter},
{"edition", mp_property_edition},
- {"disc-titles", mp_property_disc_titles},
{"chapters", mp_property_chapters},
{"editions", mp_property_editions},
- {"angle", mp_property_angle},
{"metadata", mp_property_metadata},
{"filtered-metadata", mp_property_filtered_metadata},
{"chapter-metadata", mp_property_chapter_metadata},
@@ -3808,7 +3664,6 @@ static const struct m_property mp_properties_base[] = {
{"chapter-list", mp_property_list_chapters},
{"track-list", property_list_tracks},
{"edition-list", property_list_editions},
- {"disc-title-list", mp_property_list_disc_titles},
{"playlist", mp_property_playlist},
{"playlist-pos", mp_property_playlist_pos},