diff options
author | ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-22 06:20:48 +0000 |
---|---|---|
committer | ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-22 06:20:48 +0000 |
commit | 376bbbdae0e6c91bc6fe572b030f9fff20f83692 (patch) | |
tree | df873477cb85669d4e8b8c72fe27be97e55e8e96 | |
parent | 673246be0c4d85d1aba6865e2451bed19bb01f43 (diff) | |
download | mpv-376bbbdae0e6c91bc6fe572b030f9fff20f83692.tar.bz2 mpv-376bbbdae0e6c91bc6fe572b030f9fff20f83692.tar.xz |
Combine common code for check whether chapter is available.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25490 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | command.c | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -385,11 +385,12 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg, int step_all; char *chapter_name = NULL; + chapter = demuxer_get_current_chapter(mpctx->demuxer); + if (chapter < 0) + return M_PROPERTY_UNAVAILABLE; + switch (action) { case M_PROPERTY_GET: - chapter = demuxer_get_current_chapter(mpctx->demuxer); - if (chapter < 0) - return M_PROPERTY_UNAVAILABLE; if (!arg) return M_PROPERTY_ERROR; *(int *) arg = chapter; @@ -397,9 +398,6 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg, case M_PROPERTY_PRINT: { if (!arg) return M_PROPERTY_ERROR; - chapter = demuxer_get_current_chapter(mpctx->demuxer); - if (chapter < 0) - return M_PROPERTY_UNAVAILABLE; chapter_name = demuxer_chapter_display_name(mpctx->demuxer, chapter); if (!chapter_name) return M_PROPERTY_UNAVAILABLE; @@ -410,9 +408,6 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg, if (!arg) return M_PROPERTY_ERROR; M_PROPERTY_CLAMP(prop, *(int*)arg); - chapter = demuxer_get_current_chapter(mpctx->demuxer); - if (chapter < 0) - return M_PROPERTY_UNAVAILABLE; step_all = *(int *)arg - (chapter + 1); chapter += step_all; break; @@ -420,9 +415,6 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg, case M_PROPERTY_STEP_DOWN: { step_all = (arg && *(int*)arg != 0 ? *(int*)arg : 1) * (action == M_PROPERTY_STEP_UP ? 1 : -1); - chapter = demuxer_get_current_chapter(mpctx->demuxer); - if (chapter < 0) - return M_PROPERTY_UNAVAILABLE; chapter += step_all; if (chapter < 0) chapter = 0; |