mirror of https://github.com/mpv-player/mpv
demux_mf: remove global option variables
This commit is contained in:
parent
fd5207f56d
commit
099cdbf019
|
@ -26,8 +26,8 @@
|
|||
#include "osdep/io.h"
|
||||
|
||||
#include "talloc.h"
|
||||
#include "config.h"
|
||||
#include "common/msg.h"
|
||||
#include "options/options.h"
|
||||
|
||||
#include "stream/stream.h"
|
||||
#include "demux.h"
|
||||
|
@ -142,11 +142,11 @@ static const struct {
|
|||
{0}
|
||||
};
|
||||
|
||||
static const char *probe_format(mf_t *mf, enum demux_check check)
|
||||
static const char *probe_format(mf_t *mf, char *type, enum demux_check check)
|
||||
{
|
||||
if (check > DEMUX_CHECK_REQUEST)
|
||||
return NULL;
|
||||
char *type = mf_type;
|
||||
char *org_type = type;
|
||||
if (!type || !type[0]) {
|
||||
char *p = strrchr(mf->names[0], '.');
|
||||
if (p)
|
||||
|
@ -157,7 +157,7 @@ static const char *probe_format(mf_t *mf, enum demux_check check)
|
|||
return type2format[i].codec;
|
||||
}
|
||||
if (check == DEMUX_CHECK_REQUEST) {
|
||||
if (!mf_type) {
|
||||
if (!org_type) {
|
||||
MP_ERR(mf, "file type was not set! (try --mf-type=ext)\n");
|
||||
} else {
|
||||
MP_ERR(mf, "--mf-type set to an unknown codec!\n");
|
||||
|
@ -183,7 +183,7 @@ static int demux_open_mf(demuxer_t *demuxer, enum demux_check check)
|
|||
if (!mf || mf->nr_of_files < 1)
|
||||
goto error;
|
||||
|
||||
const char *codec = probe_format(mf, check);
|
||||
const char *codec = probe_format(mf, demuxer->opts->mf_type, check);
|
||||
if (!codec)
|
||||
goto error;
|
||||
|
||||
|
@ -196,7 +196,7 @@ static int demux_open_mf(demuxer_t *demuxer, enum demux_check check)
|
|||
sh->codec = codec;
|
||||
sh_video->disp_w = 0;
|
||||
sh_video->disp_h = 0;
|
||||
sh_video->fps = mf_fps;
|
||||
sh_video->fps = demuxer->opts->mf_fps;
|
||||
|
||||
mf->sh = sh_video;
|
||||
demuxer->priv = (void *)mf;
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
|
||||
#include "mf.h"
|
||||
|
||||
double mf_fps = 1.0;
|
||||
char *mf_type = NULL; //"jpg";
|
||||
|
||||
static void mf_add(mf_t *mf, const char *fname)
|
||||
{
|
||||
char *entry = talloc_strdup(mf, fname);
|
||||
|
|
|
@ -67,19 +67,11 @@ extern const struct m_sub_options sws_conf;
|
|||
|
||||
extern const m_option_t lavfdopts_conf[];
|
||||
|
||||
extern double mf_fps;
|
||||
extern char * mf_type;
|
||||
extern const struct m_obj_list vf_obj_list;
|
||||
extern const struct m_obj_list af_obj_list;
|
||||
extern const struct m_obj_list vo_obj_list;
|
||||
extern const struct m_obj_list ao_obj_list;
|
||||
|
||||
static const m_option_t mfopts_conf[]={
|
||||
{"fps", &mf_fps, CONF_TYPE_DOUBLE, 0, 0, 0, NULL},
|
||||
{"type", &mf_type, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{NULL, NULL, 0, 0, 0, 0, NULL}
|
||||
};
|
||||
|
||||
#define OPT_BASE_STRUCT struct MPOpts
|
||||
|
||||
extern const struct m_sub_options image_writer_conf;
|
||||
|
@ -222,7 +214,8 @@ const m_option_t mp_opts[] = {
|
|||
OPT_STRING("audio-demuxer", audio_demuxer_name, 0),
|
||||
OPT_STRING("sub-demuxer", sub_demuxer_name, 0),
|
||||
|
||||
{"mf", (void *) mfopts_conf, CONF_TYPE_SUBCONFIG, 0,0,0, NULL},
|
||||
OPT_DOUBLE("mf-fps", mf_fps, 0),
|
||||
OPT_STRING("mf-type", mf_type, 0),
|
||||
#if HAVE_TV
|
||||
OPT_SUBSTRUCT("tv", tv_params, tv_params_conf, 0),
|
||||
#endif /* HAVE_TV */
|
||||
|
@ -654,6 +647,8 @@ const struct MPOpts mp_default_opts = {
|
|||
|
||||
.dvd_angle = 1,
|
||||
|
||||
.mf_fps = 1.0,
|
||||
|
||||
.ad_lavc_param = {
|
||||
.ac3drc = 1.,
|
||||
.downmix = 1,
|
||||
|
|
|
@ -253,6 +253,9 @@ typedef struct MPOpts {
|
|||
int bluray_angle;
|
||||
char *bluray_device;
|
||||
|
||||
double mf_fps;
|
||||
char *mf_type;
|
||||
|
||||
struct lavc_param {
|
||||
int fast;
|
||||
int show_all;
|
||||
|
|
Loading…
Reference in New Issue