[MPlayer-cvslog] r36174 - in trunk: DOCS/man/en/mplayer.1 cfg-common.h stream/stream.c stream/stream.h stream/stream_dvd.c stream/stream_dvd.h

reimar subversion at mplayerhq.hu
Fri Apr 26 21:43:01 CEST 2013


Author: reimar
Date: Fri Apr 26 21:43:01 2013
New Revision: 36174

Log:
Make -chapter always available, even when compiled without DVD support.

Patch by Olivier Rolland [billl users.sourceforge.net].

Modified:
   trunk/cfg-common.h
   trunk/stream/stream.c
   trunk/stream/stream.h
   trunk/stream/stream_dvd.c
   trunk/stream/stream_dvd.h

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/cfg-common.h
==============================================================================
--- trunk/cfg-common.h	Fri Apr 26 21:19:34 2013	(r36173)
+++ trunk/cfg-common.h	Fri Apr 26 21:43:01 2013	(r36174)
@@ -315,6 +315,7 @@ const m_option_t common_opts[] = {
 
 // ------------------------- 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 @@ const m_option_t common_opts[] = {
     {"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},

Modified: trunk/stream/stream.c
==============================================================================
--- trunk/stream/stream.c	Fri Apr 26 21:19:34 2013	(r36173)
+++ trunk/stream/stream.c	Fri Apr 26 21:43:01 2013	(r36174)
@@ -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 @@ uint8_t *stream_read_until(stream_t *s, 
   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;
+}

Modified: trunk/stream/stream.h
==============================================================================
--- trunk/stream/stream.h	Fri Apr 26 21:19:34 2013	(r36173)
+++ trunk/stream/stream.h	Fri Apr 26 21:43:01 2013	(r36174)
@@ -396,4 +396,6 @@ typedef struct {
  int channels;
 } stream_language_t;
 
+int parse_chapter_range(const m_option_t *conf, const char *range);
+
 #endif /* MPLAYER_STREAM_H */

Modified: trunk/stream/stream_dvd.c
==============================================================================
--- trunk/stream/stream_dvd.c	Fri Apr 26 21:19:34 2013	(r36173)
+++ trunk/stream/stream_dvd.c	Fri Apr 26 21:43:01 2013	(r36174)
@@ -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 @@ static const struct m_struct_st stream_o
   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;

Modified: trunk/stream/stream_dvd.h
==============================================================================
--- trunk/stream/stream_dvd.h	Fri Apr 26 21:19:34 2013	(r36173)
+++ trunk/stream/stream_dvd.h	Fri Apr 26 21:43:01 2013	(r36174)
@@ -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_number_of_subs(stream_t *stream)
 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 */


More information about the MPlayer-cvslog mailing list