1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-23 11:47:45 +00:00

stream_dvb: remove global option variables

This commit is contained in:
wm4 2014-06-10 21:44:50 +02:00
parent 77a7aa2c41
commit 959b718957
6 changed files with 35 additions and 37 deletions

View File

@ -735,18 +735,17 @@ OPTIONS
This option is useful for debugging only. This option is useful for debugging only.
``--dvbin=<options>`` ``--dvbin-card=<1-4>``
Pass the following parameters to the DVB input module, in order to Specifies using card number 1-4 (default: 1).
override the default ones:
:card=<1-4>: Specifies using card number 1-4 (default: 1). ``--dvbin-file=<filename>``
:file=<filename>: Instructs mpv to read the channels list from Instructs mpv to read the channels list from ``<filename>``. Default is
``<filename>``. Default is ``~/.mpv/channels.conf.{sat,ter,cbl,atsc}`` (based on your card type) or
``~/.mpv/channels.conf.{sat,ter,cbl,atsc}`` (based ``~/.mpv/channels.conf`` as a last resort.
on your card type) or ``~/.mpv/channels.conf`` as a
last resort. ``--dvbin-timeout=<1-30>``
:timeout=<1-30>: Maximum number of seconds to wait when trying to tune a Maximum number of seconds to wait when trying to tune a frequency before
frequency before giving up (default: 30). giving up (default: 30).
``--dvd-device=<path>`` ``--dvd-device=<path>``
Specify the DVD device or .iso filename (default: ``/dev/dvd``). You can Specify the DVD device or .iso filename (default: ``/dev/dvd``). You can

View File

@ -64,8 +64,8 @@ static void print_help(struct mp_log *log)
extern const struct m_sub_options tv_params_conf; 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_pvr_conf;
extern const struct m_sub_options stream_cdda_conf; extern const struct m_sub_options stream_cdda_conf;
extern const struct m_sub_options stream_dvb_conf;
extern const m_option_t dvbin_opts_conf[];
extern const m_option_t lavfdopts_conf[]; extern const m_option_t lavfdopts_conf[];
extern int sws_chr_vshift; extern int sws_chr_vshift;
@ -248,7 +248,7 @@ const m_option_t mp_opts[] = {
OPT_SUBSTRUCT("pvr", stream_pvr_opts, stream_pvr_conf, 0), OPT_SUBSTRUCT("pvr", stream_pvr_opts, stream_pvr_conf, 0),
#endif /* HAVE_PVR */ #endif /* HAVE_PVR */
#if HAVE_DVBIN #if HAVE_DVBIN
{"dvbin", (void *) dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, OPT_SUBSTRUCT("dvbin", stream_dvb_opts, stream_dvb_conf, 0),
#endif #endif
// ------------------------- a-v sync options -------------------- // ------------------------- a-v sync options --------------------

View File

@ -241,6 +241,7 @@ typedef struct MPOpts {
struct tv_params *tv_params; struct tv_params *tv_params;
struct pvr_params *stream_pvr_opts; struct pvr_params *stream_pvr_opts;
struct cdda_params *stream_cdda_opts; struct cdda_params *stream_cdda_opts;
struct dvb_params *stream_dvb_opts;
char *cdrom_device; char *cdrom_device;

View File

@ -59,10 +59,6 @@
#include "command.h" #include "command.h"
#include "libmpv/client.h" #include "libmpv/client.h"
#if HAVE_DVBIN
#include "stream/dvbin.h"
#endif
static void uninit_sub(struct MPContext *mpctx, int order) static void uninit_sub(struct MPContext *mpctx, int order)
{ {
if (mpctx->d_sub[order]) if (mpctx->d_sub[order])

View File

@ -75,7 +75,7 @@ typedef struct {
void *priv; void *priv;
} dvb_config_t; } dvb_config_t;
typedef struct { typedef struct dvb_params {
struct mp_log *log; struct mp_log *log;
int fd; int fd;
int card; int card;

View File

@ -47,7 +47,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "osdep/io.h" #include "osdep/io.h"
#include "stream.h" #include "stream.h"
#include "options/m_config.h"
#include "options/m_option.h" #include "options/m_option.h"
#include "options/options.h"
#include "options/path.h" #include "options/path.h"
#include "dvbin.h" #include "dvbin.h"
@ -61,14 +63,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//TODO: CAMBIARE list_ptr e da globale a per_priv //TODO: CAMBIARE list_ptr e da globale a per_priv
#define OPT_BASE_STRUCT struct dvb_params
static dvb_priv_t stream_defaults = {
.cfg_prog = "",
.cfg_card = 1,
.cfg_timeout = 30,
};
#define OPT_BASE_STRUCT dvb_priv_t
/// URL definition /// URL definition
static const m_option_t stream_params[] = { static const m_option_t stream_params[] = {
@ -77,17 +72,21 @@ static const m_option_t stream_params[] = {
{0} {0}
}; };
const m_option_t dvbin_opts_conf[] = { const struct m_sub_options stream_dvb_conf = {
{"prog", &stream_defaults.cfg_prog, CONF_TYPE_STRING, 0, 0 ,0, NULL}, .opts = (const m_option_t[]) {
{"card", &stream_defaults.cfg_card, CONF_TYPE_INT, M_OPT_RANGE, 1, 4, NULL}, OPT_STRING("prog", cfg_prog, 0),
{"timeout", &stream_defaults.cfg_timeout, CONF_TYPE_INT, M_OPT_RANGE, 1, 30, NULL}, OPT_INTRANGE("card", cfg_card, 0, 1, 4),
OPT_INTRANGE("timeout", cfg_timeout, 0, 1, 30),
{NULL, NULL, 0, 0, 0, 0, NULL} {0}
},
.size = sizeof(struct dvb_params),
.defaults = &(const struct dvb_params){
.cfg_prog = "",
.cfg_card = 1,
.cfg_timeout = 30,
},
}; };
static dvb_channels_list *dvb_get_channels(struct mp_log *log, char *filename, int type) static dvb_channels_list *dvb_get_channels(struct mp_log *log, char *filename, int type)
{ {
dvb_channels_list *list; dvb_channels_list *list;
@ -816,14 +815,17 @@ dvb_config_t *dvb_get_config(stream_t *stream)
return conf; return conf;
} }
static void *get_defaults(stream_t *st)
{
return m_sub_options_copy(st, &stream_dvb_conf, st->opts->stream_dvb_opts);
}
const stream_info_t stream_info_dvb = { const stream_info_t stream_info_dvb = {
.name = "dvbin", .name = "dvbin",
.open = dvb_open, .open = dvb_open,
.protocols = (const char*[]){ "dvb", NULL }, .protocols = (const char*[]){ "dvb", NULL },
.priv_size = sizeof(dvb_priv_t), .priv_size = sizeof(dvb_priv_t),
.priv_defaults = &stream_defaults, .get_defaults = get_defaults,
.options = stream_params, .options = stream_params,
.url_options = (const char*[]){ .url_options = (const char*[]){
"hostname=prog", "hostname=prog",