diff options
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 64 |
1 files changed, 36 insertions, 28 deletions
@@ -35,10 +35,10 @@ #ifdef CONFIG_RADIO #include "stream/stream_radio.h" #endif -#ifdef HAVE_PVR +#ifdef CONFIG_PVR #include "stream/pvr.h" #endif -#ifdef HAS_DVBIN_SUPPORT +#ifdef CONFIG_DVBIN #include "stream/dvbin.h" #endif #ifdef CONFIG_DVDREAD @@ -384,13 +384,14 @@ static int mp_property_time_pos(m_option_t *prop, int action, static int mp_property_chapter(m_option_t *prop, int action, void *arg, MPContext *mpctx) { - int chapter; + int chapter = -1; float next_pts = 0; int chapter_num; int step_all; char *chapter_name = NULL; - chapter = demuxer_get_current_chapter(mpctx->demuxer); + if (mpctx->demuxer) + chapter = demuxer_get_current_chapter(mpctx->demuxer); if (chapter < 0) return M_PROPERTY_UNAVAILABLE; @@ -455,11 +456,12 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg, static int mp_property_angle(m_option_t *prop, int action, void *arg, MPContext *mpctx) { - int angle; + int angle = -1; int angles; char *angle_name = NULL; - angle = demuxer_get_current_angle(mpctx->demuxer); + if (mpctx->demuxer) + angle = demuxer_get_current_angle(mpctx->demuxer); if (angle < 0) return M_PROPERTY_UNAVAILABLE; angles = demuxer_angles_count(mpctx->demuxer); @@ -841,6 +843,8 @@ static int mp_property_audio(m_option_t *prop, int action, void *arg, case M_PROPERTY_STEP_UP: case M_PROPERTY_SET: + if (!mpctx->demuxer) + return M_PROPERTY_UNAVAILABLE; if (action == M_PROPERTY_SET && arg) tmp = *((int *) arg); else @@ -1781,7 +1785,7 @@ static int mp_property_sub_forced_only(m_option_t *prop, int action, } -#ifdef HAVE_FREETYPE +#ifdef CONFIG_FREETYPE /// Subtitle scale (RW) static int mp_property_sub_scale(m_option_t *prop, int action, void *arg, MPContext *mpctx) @@ -1869,7 +1873,7 @@ static int mp_property_tv_color(m_option_t *prop, int action, void *arg, #endif -#ifdef HAVE_TV_TELETEXT +#ifdef CONFIG_TV_TELETEXT static int mp_property_teletext_common(m_option_t *prop, int action, void *arg, MPContext *mpctx) { @@ -1950,7 +1954,7 @@ static int mp_property_teletext_page(m_option_t *prop, int action, void *arg, } -#endif /* HAVE_TV_TELETEXT */ +#endif /* CONFIG_TV_TELETEXT */ ///@} @@ -2081,7 +2085,7 @@ static const m_option_t mp_properties[] = { M_OPT_RANGE, 0, 1, NULL }, { "sub_forced_only", mp_property_sub_forced_only, CONF_TYPE_FLAG, M_OPT_RANGE, 0, 1, NULL }, -#ifdef HAVE_FREETYPE +#ifdef CONFIG_FREETYPE { "sub_scale", mp_property_sub_scale, CONF_TYPE_FLOAT, M_OPT_RANGE, 0, 100, NULL }, #endif @@ -2101,7 +2105,7 @@ static const m_option_t mp_properties[] = { M_OPT_RANGE, -100, 100, (void *) TV_COLOR_HUE }, #endif -#ifdef HAVE_TV_TELETEXT +#ifdef CONFIG_TV_TELETEXT { "teletext_page", mp_property_teletext_page, CONF_TYPE_INT, M_OPT_RANGE, 100, 899, (void*)TV_VBI_CONTROL_GET_PAGE }, { "teletext_subpage", mp_property_teletext_common, CONF_TYPE_INT, @@ -2214,7 +2218,7 @@ static struct { { "sub_delay", MP_CMD_SUB_DELAY, 0, 0, OSD_MSG_SUB_DELAY, MSGTR_SubDelayStatus }, { "sub_visibility", MP_CMD_SUB_VISIBILITY, 1, 0, -1, MSGTR_SubVisibleStatus }, { "sub_forced_only", MP_CMD_SUB_FORCED_ONLY, 1, 0, -1, MSGTR_SubForcedOnlyStatus }, -#ifdef HAVE_FREETYPE +#ifdef CONFIG_FREETYPE { "sub_scale", MP_CMD_SUB_SCALE, 0, 0, -1, MSGTR_SubScale}, #endif #ifdef CONFIG_ASS @@ -2659,6 +2663,10 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) break; case MP_CMD_STOP: + // Go back to the starting point. + while (play_tree_iter_up_step + (mpctx->playtree_iter, 0, 1) != PLAY_TREE_ITER_END) + /* NOP */ ; mpctx->eof = PT_STOP; brk_cmd = 1; break; @@ -2712,28 +2720,28 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) if (mpctx->file_format == DEMUXER_TYPE_TV) tv_set_freq((tvi_handle_t *) (mpctx->demuxer->priv), cmd->args[0].v.f * 16.0); -#ifdef HAVE_PVR +#ifdef CONFIG_PVR else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_set_freq (mpctx->stream, ROUND (cmd->args[0].v.f)); set_osd_msg (OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s", pvr_get_current_channelname (mpctx->stream), pvr_get_current_stationname (mpctx->stream)); } -#endif /* HAVE_PVR */ +#endif /* CONFIG_PVR */ break; case MP_CMD_TV_STEP_FREQ: if (mpctx->file_format == DEMUXER_TYPE_TV) tv_step_freq((tvi_handle_t *) (mpctx->demuxer->priv), cmd->args[0].v.f * 16.0); -#ifdef HAVE_PVR +#ifdef CONFIG_PVR else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_force_freq_step (mpctx->stream, ROUND (cmd->args[0].v.f)); set_osd_msg (OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: f %d", pvr_get_current_channelname (mpctx->stream), pvr_get_current_frequency (mpctx->stream)); } -#endif /* HAVE_PVR */ +#endif /* CONFIG_PVR */ break; case MP_CMD_TV_SET_NORM: @@ -2760,7 +2768,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) //vo_osd_changed(OSDTYPE_SUBTITLE); } } -#ifdef HAVE_PVR +#ifdef CONFIG_PVR else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_set_channel_step (mpctx->stream, cmd->args[0].v.i); @@ -2768,9 +2776,9 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) pvr_get_current_channelname (mpctx->stream), pvr_get_current_stationname (mpctx->stream)); } -#endif /* HAVE_PVR */ +#endif /* CONFIG_PVR */ } -#ifdef HAS_DVBIN_SUPPORT +#ifdef CONFIG_DVBIN if (mpctx->stream->type == STREAMTYPE_DVB) { int dir; int v = cmd->args[0].v.i; @@ -2785,7 +2793,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) if (dvb_step_channel(mpctx->stream, dir)) mpctx->eof = mpctx->dvbin_reopen = 1; } -#endif /* HAS_DVBIN_SUPPORT */ +#endif /* CONFIG_DVBIN */ break; case MP_CMD_TV_SET_CHANNEL: @@ -2798,17 +2806,17 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) //vo_osd_changed(OSDTYPE_SUBTITLE); } } -#ifdef HAVE_PVR +#ifdef CONFIG_PVR else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_set_channel (mpctx->stream, cmd->args[0].v.s); set_osd_msg (OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s", pvr_get_current_channelname (mpctx->stream), pvr_get_current_stationname (mpctx->stream)); } -#endif /* HAVE_PVR */ +#endif /* CONFIG_PVR */ break; -#ifdef HAS_DVBIN_SUPPORT +#ifdef CONFIG_DVBIN case MP_CMD_DVB_SET_CHANNEL: if (mpctx->stream->type == STREAMTYPE_DVB) { mpctx->last_dvb_step = 1; @@ -2818,7 +2826,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) mpctx->eof = mpctx->dvbin_reopen = 1; } break; -#endif /* HAS_DVBIN_SUPPORT */ +#endif /* CONFIG_DVBIN */ case MP_CMD_TV_LAST_CHANNEL: if (mpctx->file_format == DEMUXER_TYPE_TV) { @@ -2829,14 +2837,14 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) //vo_osd_changed(OSDTYPE_SUBTITLE); } } -#ifdef HAVE_PVR +#ifdef CONFIG_PVR else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) { pvr_set_lastchannel (mpctx->stream); set_osd_msg (OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s", pvr_get_current_channelname (mpctx->stream), pvr_get_current_stationname (mpctx->stream)); } -#endif /* HAVE_PVR */ +#endif /* CONFIG_PVR */ break; case MP_CMD_TV_STEP_NORM: @@ -2848,7 +2856,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) if (mpctx->file_format == DEMUXER_TYPE_TV) tv_step_chanlist((tvi_handle_t *) (mpctx->demuxer->priv)); break; -#ifdef HAVE_TV_TELETEXT +#ifdef CONFIG_TV_TELETEXT case MP_CMD_TV_TELETEXT_ADD_DEC: { tvi_handle_t* tvh=(tvi_handle_t *)(mpctx->demuxer->priv); @@ -2863,7 +2871,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) tvh->functions->control(tvh->priv,TV_VBI_CONTROL_GO_LINK,&(cmd->args[0].v.i)); break; } -#endif /* HAVE_TV_TELETEXT */ +#endif /* CONFIG_TV_TELETEXT */ #endif /* CONFIG_TV */ case MP_CMD_SUB_LOAD: |