mirror of
https://github.com/mpv-player/mpv
synced 2025-03-26 22:42:47 +01:00
Extended DVD chapter specification. Remove -last-chapter option.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4344 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
8fcddee536
commit
6465fc7b73
@ -16,8 +16,7 @@
|
||||
{"dvd-device", &dvd_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"dvd", &dvd_title, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
||||
{"dvdangle", &dvd_angle, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
||||
{"chapter", &dvd_chapter, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
||||
{"last-chapter", &dvd_last_chapter, CONF_TYPE_INT, CONF_RANGE, 1, 99, NULL},
|
||||
{"chapter", dvd_parse_chapter_range, CONF_TYPE_FUNC_PARAM, 0, 0, 0, NULL},
|
||||
#else
|
||||
{"dvd", "MPlayer was compiled WITHOUT libdvdread support!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
|
||||
#endif
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -13,6 +14,7 @@
|
||||
#include <sys/cdrio.h>
|
||||
#endif
|
||||
|
||||
#include "../cfgparser.h"
|
||||
#include "stream.h"
|
||||
#include "demuxer.h"
|
||||
|
||||
@ -421,6 +423,38 @@ tv_err:
|
||||
|
||||
}
|
||||
|
||||
int dvd_parse_chapter_range(struct config *conf, const char *range){
|
||||
char *s, *t;
|
||||
dvd_chapter = 1;
|
||||
dvd_last_chapter = 0;
|
||||
if (*range && isdigit(*range)) {
|
||||
dvd_chapter = strtol(range, &s, 10);
|
||||
if (range == s) {
|
||||
mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (*s == 0)
|
||||
return 0;
|
||||
else if (*s != '-') {
|
||||
mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
|
||||
return -1;
|
||||
}
|
||||
++s;
|
||||
if (*s == 0)
|
||||
return 0;
|
||||
if (! isdigit(*s)) {
|
||||
mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
|
||||
return -1;
|
||||
}
|
||||
dvd_last_chapter = strtol(s, &t, 10);
|
||||
if (s == t || *t) {
|
||||
mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef USE_DVDREAD
|
||||
|
||||
int dvd_aid_from_lang(stream_t *stream, unsigned char* lang){
|
||||
|
@ -184,6 +184,7 @@ extern int dvd_title;
|
||||
extern int dvd_chapter;
|
||||
extern int dvd_last_chapter;
|
||||
extern int dvd_angle;
|
||||
int dvd_parse_chapter_range(struct config*, const char*);
|
||||
//#endif
|
||||
|
||||
#ifdef USE_DVDREAD
|
||||
|
@ -27,6 +27,7 @@ static char* banner_text=
|
||||
#include "cpudetect.h"
|
||||
|
||||
#include "codec-cfg.h"
|
||||
#include "cfgparser.h"
|
||||
|
||||
#include "stream.h"
|
||||
#include "demuxer.h"
|
||||
@ -171,8 +172,6 @@ static int scale_srcH=0;
|
||||
static int vo_w=0, vo_h=0;
|
||||
//-------------------------- config stuff:
|
||||
|
||||
#include "cfgparser.h"
|
||||
|
||||
m_config_t* mconfig;
|
||||
|
||||
static int cfg_inc_verbose(struct config *conf){ ++verbose; return 0;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user