Mercurial > mplayer.hg
changeset 36080:a5fd69f820f3
Make -chapter always available, even when compiled without DVD support.
Patch by Olivier Rolland [billl users.sourceforge.net].
author | reimar |
---|---|
date | Fri, 26 Apr 2013 19:43:01 +0000 |
parents | 4c42154f7aa3 |
children | eadb3ddad605 |
files | DOCS/man/en/mplayer.1 cfg-common.h stream/stream.c stream/stream.h stream/stream_dvd.c stream/stream_dvd.h |
diffstat | 6 files changed, 41 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1 Fri Apr 26 19:19:34 2013 +0000 +++ b/DOCS/man/en/mplayer.1 Fri Apr 26 19:43:01 2013 +0000 @@ -1543,7 +1543,7 @@ .PD 1 . .TP -.B \-chapter <chapter ID>[\-<endchapter ID>] (dvd:// and dvdnav:// only) +.B \-chapter <chapter ID>[\-<endchapter ID>] Specify which chapter to start playing at. Optionally specify which chapter to end playing at (default: 1). .
--- a/cfg-common.h Fri Apr 26 19:19:34 2013 +0000 +++ b/cfg-common.h Fri Apr 26 19:43:01 2013 +0000 @@ -315,6 +315,7 @@ // ------------------------- stream options -------------------- + {"chapter", parse_chapter_range, CONF_TYPE_FUNC_PARAM, 0, 0, 0, NULL}, #ifdef CONFIG_STREAM_CACHE {"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 32, 0x7fffffff, NULL}, {"nocache", &stream_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL}, @@ -331,7 +332,6 @@ {"dvd-speed", &dvd_speed, CONF_TYPE_INT, 0, 0, 0, NULL}, {"dvd", "-dvd N has been removed, use dvd://N instead.\n" , CONF_TYPE_PRINT, 0, 0, 0, NULL}, {"dvdangle", &dvd_angle, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL}, - {"chapter", dvd_parse_chapter_range, CONF_TYPE_FUNC_PARAM, 0, 0, 0, NULL}, #else {"dvd-device", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, {"dvd-speed", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
--- a/stream/stream.c Fri Apr 26 19:19:34 2013 +0000 +++ b/stream/stream.c Fri Apr 26 19:43:01 2013 +0000 @@ -16,6 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -704,3 +705,39 @@ if(s->eof && ptr == mem) return NULL; return mem; } + +int parse_chapter_range(const m_option_t *conf, const char *range) { + const char *s; + char *t; + if (!range) + return M_OPT_MISSING_PARAM; + s = range; + dvd_chapter = 1; + dvd_last_chapter = 0; + if(*range && isdigit(*range)) { + dvd_chapter = strtol(range, (char **) &s, 10); + if(range == s) { + mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range); + return M_OPT_INVALID; + } + } + if(*s == 0) + return 0; + else if(*s != '-') { + mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range); + return M_OPT_INVALID; + } + ++s; + if(*s == 0) + return 0; + if(! isdigit(*s)) { + mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range); + return M_OPT_INVALID; + } + dvd_last_chapter = strtol(s, &t, 10); + if (s == t || *t) { + mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range); + return M_OPT_INVALID; + } + return 0; +}
--- a/stream/stream.h Fri Apr 26 19:19:34 2013 +0000 +++ b/stream/stream.h Fri Apr 26 19:43:01 2013 +0000 @@ -396,4 +396,6 @@ int channels; } stream_language_t; +int parse_chapter_range(const m_option_t *conf, const char *range); + #endif /* MPLAYER_STREAM_H */
--- a/stream/stream_dvd.c Fri Apr 26 19:19:34 2013 +0000 +++ b/stream/stream_dvd.c Fri Apr 26 19:43:01 2013 +0000 @@ -16,7 +16,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -85,42 +84,6 @@ stream_opts_fields }; -int dvd_parse_chapter_range(const m_option_t *conf, const char *range) { - const char *s; - char *t; - if (!range) - return M_OPT_MISSING_PARAM; - s = range; - dvd_chapter = 1; - dvd_last_chapter = 0; - if(*range && isdigit(*range)) { - dvd_chapter = strtol(range, (char **) &s, 10); - if(range == s) { - mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range); - return M_OPT_INVALID; - } - } - if(*s == 0) - return 0; - else if(*s != '-') { - mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range); - return M_OPT_INVALID; - } - ++s; - if(*s == 0) - return 0; - if(! isdigit(*s)) { - mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range); - return M_OPT_INVALID; - } - dvd_last_chapter = strtol(s, &t, 10); - if (s == t || *t) { - mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range); - return M_OPT_INVALID; - } - return 0; -} - int dvd_chapter_from_cell(dvd_priv_t* dvd,int title,int cell) { pgc_t * cur_pgc;
--- a/stream/stream_dvd.h Fri Apr 26 19:19:34 2013 +0000 +++ b/stream/stream_dvd.h Fri Apr 26 19:43:01 2013 +0000 @@ -26,7 +26,6 @@ #include <dvdread/ifo_read.h> #include <dvdread/nav_read.h> #include "stream.h" -#include "m_option.h" typedef struct { dvd_reader_t *dvd; @@ -60,6 +59,5 @@ int dvd_aid_from_lang(stream_t *stream, const unsigned char* lang); int dvd_sid_from_lang(stream_t *stream, const unsigned char* lang); int dvd_chapter_from_cell(dvd_priv_t *dvd,int title,int cell); -int dvd_parse_chapter_range(const m_option_t *conf, const char *range); #endif /* MPLAYER_STREAM_DVD_H */