1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-22 19:34:14 +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.
``--dvbin=<options>``
Pass the following parameters to the DVB input module, in order to
override the default ones:
``--dvbin-card=<1-4>``
Specifies using card number 1-4 (default: 1).
:card=<1-4>: Specifies using card number 1-4 (default: 1).
:file=<filename>: Instructs mpv to read the channels list from
``<filename>``. Default is
``~/.mpv/channels.conf.{sat,ter,cbl,atsc}`` (based
on your card type) or ``~/.mpv/channels.conf`` as a
last resort.
:timeout=<1-30>: Maximum number of seconds to wait when trying to tune a
frequency before giving up (default: 30).
``--dvbin-file=<filename>``
Instructs mpv to read the channels list from ``<filename>``. Default is
``~/.mpv/channels.conf.{sat,ter,cbl,atsc}`` (based on your card type) or
``~/.mpv/channels.conf`` as a last resort.
``--dvbin-timeout=<1-30>``
Maximum number of seconds to wait when trying to tune a frequency before
giving up (default: 30).
``--dvd-device=<path>``
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 stream_pvr_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 int sws_chr_vshift;
@ -248,7 +248,7 @@ const m_option_t mp_opts[] = {
OPT_SUBSTRUCT("pvr", stream_pvr_opts, stream_pvr_conf, 0),
#endif /* HAVE_PVR */
#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
// ------------------------- a-v sync options --------------------

View File

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

View File

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

View File

@ -75,7 +75,7 @@ typedef struct {
void *priv;
} dvb_config_t;
typedef struct {
typedef struct dvb_params {
struct mp_log *log;
int fd;
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 "stream.h"
#include "options/m_config.h"
#include "options/m_option.h"
#include "options/options.h"
#include "options/path.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
static dvb_priv_t stream_defaults = {
.cfg_prog = "",
.cfg_card = 1,
.cfg_timeout = 30,
};
#define OPT_BASE_STRUCT dvb_priv_t
#define OPT_BASE_STRUCT struct dvb_params
/// URL definition
static const m_option_t stream_params[] = {
@ -77,17 +72,21 @@ static const m_option_t stream_params[] = {
{0}
};
const m_option_t dvbin_opts_conf[] = {
{"prog", &stream_defaults.cfg_prog, CONF_TYPE_STRING, 0, 0 ,0, NULL},
{"card", &stream_defaults.cfg_card, CONF_TYPE_INT, M_OPT_RANGE, 1, 4, NULL},
{"timeout", &stream_defaults.cfg_timeout, CONF_TYPE_INT, M_OPT_RANGE, 1, 30, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
const struct m_sub_options stream_dvb_conf = {
.opts = (const m_option_t[]) {
OPT_STRING("prog", cfg_prog, 0),
OPT_INTRANGE("card", cfg_card, 0, 1, 4),
OPT_INTRANGE("timeout", cfg_timeout, 0, 1, 30),
{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)
{
dvb_channels_list *list;
@ -816,14 +815,17 @@ dvb_config_t *dvb_get_config(stream_t *stream)
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 = {
.name = "dvbin",
.open = dvb_open,
.protocols = (const char*[]){ "dvb", NULL },
.priv_size = sizeof(dvb_priv_t),
.priv_defaults = &stream_defaults,
.get_defaults = get_defaults,
.options = stream_params,
.url_options = (const char*[]){
"hostname=prog",