stream_cdda: remove global option variables

This commit is contained in:
wm4 committed 2014-06-11 00:34:46 +02:00
1 parent 7689f5f7ce
commit 77a7aa2c41
6 files changed
+66 -64

No files matched your search

+23 -28
View File
@@ -427,42 +427,37 @@ OPTIONS
on the situation, either of these might be slower than the other method.
This option allows control over this.
``--cdda=<option1:option2>``
This option can be used to tune the CD Audio reading feature of mpv.
``--cdda-...``
These options can be used to tune the CD Audio reading feature of mpv.
Available options are:
``--cdda-speed=<value>``
Set CD spin speed.
``speed=<value>``
Set CD spin speed.
``--cdda-paranoia=<0-2>``
Set paranoia level. Values other than 0 seem to break playback of
anything but the first track.
``paranoia=<0-2>``
Set paranoia level. Values other than 0 seem to break playback of
anything but the first track.
:0: disable checking (default)
:1: overlap checking only
:2: full data correction and verification
:0: disable checking (default)
:1: overlap checking only
:2: full data correction and verification
``--cdda-sector-size=<value>``
Set atomic read size.
``generic-dev=<value>``
Use specified generic SCSI device.
``--cdda-overlap=<value>``
Force minimum overlap search during verification to <value> sectors.
``sector-size=<value>``
Set atomic read size.
``--cdda-toc-bias``
Assume that the beginning offset of track 1 as reported in the TOC
will be addressed as LBA 0. Some discs need this for getting track
boundaries correctly.
``overlap=<value>``
Force minimum overlap search during verification to <value> sectors.
``--cdda-toc-offset=<value>``
Add ``<value>`` sectors to the values reported when addressing tracks.
May be negative.
``toc-bias``
Assume that the beginning offset of track 1 as reported in the TOC
will be addressed as LBA 0. Some discs need this for getting track
boundaries correctly.
``toc-offset=<value>``
Add ``<value>`` sectors to the values reported when addressing tracks.
May be negative.
``(no-)skip``
(Never) accept imperfect data reconstruction.
``--cdda-skip=<es|no``
(Never) accept imperfect data reconstruction.
``--cdrom-device=<path>``
Specify the CD-ROM device (default: ``/dev/cdrom``).
+3 -3
View File
@@ -46,7 +46,6 @@
/* defined in demux: */
extern const m_option_t demux_rawaudio_opts[];
extern const m_option_t demux_rawvideo_opts[];
extern const m_option_t cdda_opts[];
extern int sws_flags;
@@ -64,6 +63,7 @@ static void print_help(struct mp_log *log)
extern const struct m_sub_options tv_params_conf;
extern const struct m_sub_options stream_pvr_conf;
extern const struct m_sub_options stream_cdda_conf;
extern const m_option_t dvbin_opts_conf[];
extern const m_option_t lavfdopts_conf[];
@@ -170,7 +170,6 @@ const m_option_t mp_opts[] = {
({"no", 0})),
OPT_INTRANGE("cache-pause-restart", stream_cache_unpause, 0, 0, 0x7fffffff),
{"cdrom-device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
#if HAVE_DVDREAD || HAVE_DVDNAV
{"dvd-device", &dvd_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"dvd-speed", &dvd_speed, CONF_TYPE_INT, 0, 0, 0, NULL},
@@ -231,7 +230,8 @@ const m_option_t mp_opts[] = {
OPT_FLAG("quvi-fetch-subtitles", quvi_fetch_subtitles, 0),
#if HAVE_CDDA
{ "cdda", (void *)&cdda_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
OPT_SUBSTRUCT("cdda", stream_cdda_opts, stream_cdda_conf, 0),
OPT_STRING("cdrom-device", cdrom_device, 0),
#endif
// demuxer.c - select audio/sub file/demuxer
+3
View File
@@ -240,6 +240,9 @@ typedef struct MPOpts {
struct tv_params *tv_params;
struct pvr_params *stream_pvr_opts;
struct cdda_params *stream_cdda_opts;
char *cdrom_device;
struct lavc_param {
int fast;
-1
View File
@@ -53,7 +53,6 @@
#define TOTAL_BUFFER_SIZE (STREAM_MAX_BUFFER_SIZE + STREAM_MAX_SECTOR_SIZE)
/// We keep these 2 for the gui atm, but they will be removed.
char *cdrom_device = NULL;
char *dvd_device = NULL;
int dvd_title = 0;
+1 -1
View File
@@ -249,7 +249,7 @@ bool stream_manages_timeline(stream_t *s);
extern int dvd_title;
extern int dvd_angle;
extern int dvd_speed;
extern char *dvd_device, *cdrom_device;
extern char *dvd_device;
extern int bluray_angle;
extern char *bluray_device;
+36 -31
View File
@@ -43,11 +43,13 @@
#include "stream.h"
#include "options/m_option.h"
#include "options/m_config.h"
#include "options/options.h"
#include "compat/mpbswap.h"
#include "common/msg.h"
typedef struct {
typedef struct cdda_params {
cdrom_drive_t *cd;
cdrom_paranoia_t *cdp;
int sector;
@@ -57,21 +59,17 @@ typedef struct {
// options
int speed;
int paranoia_mode;
char *generic_dev;
int sector_size;
int search_overlap;
int toc_bias;
int toc_offset;
int no_skip;
int skip;
char *device;
int span[2];
} cdda_priv;
static cdda_priv cdda_dflts = {
.search_overlap = -1,
};
#define OPT_BASE_STRUCT struct cdda_params
#define OPT_BASE_STRUCT cdda_priv
static const m_option_t cdda_params_fields[] = {
OPT_INTPAIR("span", span, 0),
OPT_INTRANGE("speed", speed, 0, 1, 100),
@@ -79,23 +77,24 @@ static const m_option_t cdda_params_fields[] = {
{0}
};
/// We keep these options but now they set the defaults
const m_option_t cdda_opts[] = {
{"speed", &cdda_dflts.speed, CONF_TYPE_INT, M_OPT_RANGE, 1, 100, NULL},
{"paranoia", &cdda_dflts.paranoia_mode, CONF_TYPE_INT, M_OPT_RANGE, 0, 2,
NULL},
{"generic-dev", &cdda_dflts.generic_dev, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"sector-size", &cdda_dflts.sector_size, CONF_TYPE_INT, M_OPT_RANGE, 1,
100, NULL},
{"overlap", &cdda_dflts.search_overlap, CONF_TYPE_INT, M_OPT_RANGE, 0, 75,
NULL},
{"toc-bias", &cdda_dflts.toc_bias, CONF_TYPE_INT, 0, 0, 0, NULL},
{"toc-offset", &cdda_dflts.toc_offset, CONF_TYPE_INT, 0, 0, 0, NULL},
{"noskip", &cdda_dflts.no_skip, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"skip", &cdda_dflts.no_skip, CONF_TYPE_FLAG, 0, 1, 0, NULL},
{"device", &cdda_dflts.device, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"span", &cdda_dflts.span, CONF_TYPE_INT_PAIR, 0, 0, 0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
const struct m_sub_options stream_cdda_conf = {
.opts = (const m_option_t[]) {
OPT_INTRANGE("speed", speed, 0, 1, 100),
OPT_INTRANGE("paranoia", paranoia_mode, 0, 0, 2),
OPT_INTRANGE("sector-size", sector_size, 0, 1, 100),
OPT_INTRANGE("overlap", search_overlap, 0, 0, 75),
OPT_INT("toc-bias", toc_bias, 0),
OPT_INT("toc-offset", toc_offset, 0),
OPT_FLAG("skip", skip, 0),
OPT_STRING("device", device, 0),
OPT_INTPAIR("span", span, 0),
{0}
},
.size = sizeof(struct cdda_params),
.defaults = &(const struct cdda_params){
.search_overlap = -1,
.skip = 1,
},
};
static const char *cdtext_name[] = {
@@ -292,9 +291,10 @@ static int open_cdda(stream_t *st)
cdrom_drive_t *cdd = NULL;
int last_track;
if (!p->device) {
if (cdrom_device)
p->device = talloc_strdup(NULL, cdrom_device);
if (!p->device || !p->device[0]) {
talloc_free(p->device);
if (st->opts->cdrom_device && st->opts->cdrom_device[0])
p->device = talloc_strdup(NULL, st->opts->cdrom_device);
else
p->device = talloc_strdup(NULL, DEFAULT_CDROM_DEVICE);
}
@@ -367,10 +367,10 @@ static int open_cdda(stream_t *st)
else
mode = PARANOIA_MODE_FULL;
if (p->no_skip)
mode |= PARANOIA_MODE_NEVERSKIP;
else
if (p->skip)
mode &= ~PARANOIA_MODE_NEVERSKIP;
else
mode |= PARANOIA_MODE_NEVERSKIP;
if (p->search_overlap > 0)
mode |= PARANOIA_MODE_OVERLAP;
@@ -403,12 +403,17 @@ static int open_cdda(stream_t *st)
return STREAM_OK;
}
static void *get_defaults(stream_t *st)
{
return m_sub_options_copy(st, &stream_cdda_conf, st->opts->stream_cdda_opts);
}
const stream_info_t stream_info_cdda = {
.name = "cdda",
.open = open_cdda,
.protocols = (const char*[]){"cdda", NULL },
.priv_size = sizeof(cdda_priv),
.priv_defaults = &cdda_dflts,
.get_defaults = get_defaults,
.options = cdda_params_fields,
.url_options = (const char*[]){
"hostname=span",