mirror of
https://github.com/mpv-player/mpv
synced 2025-04-01 23:00:41 +00:00
options: move -cache-min and cache-seek-min to option struct
This commit is contained in:
parent
449484179f
commit
e7d3e63a3f
@ -389,8 +389,8 @@ const m_option_t common_opts[] = {
|
|||||||
#ifdef CONFIG_STREAM_CACHE
|
#ifdef CONFIG_STREAM_CACHE
|
||||||
{"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 32, 1048576, NULL},
|
{"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 32, 1048576, NULL},
|
||||||
{"nocache", &stream_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
{"nocache", &stream_cache_size, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
||||||
{"cache-min", &stream_cache_min_percent, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL},
|
OPT_FLOATRANGE("cache-min", stream_cache_min_percent, 0, 0, 99),
|
||||||
{"cache-seek-min", &stream_cache_seek_min_percent, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL},
|
OPT_FLOATRANGE("cache-seek-min", stream_cache_seek_min_percent, 0, 0, 99),
|
||||||
#else
|
#else
|
||||||
{"cache", "MPlayer was compiled without cache2 support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
|
{"cache", "MPlayer was compiled without cache2 support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
|
||||||
#endif /* CONFIG_STREAM_CACHE */
|
#endif /* CONFIG_STREAM_CACHE */
|
||||||
|
@ -22,6 +22,8 @@ void set_default_mplayer_options(struct MPOpts *opts)
|
|||||||
.stream_dump_name = "stream.dump",
|
.stream_dump_name = "stream.dump",
|
||||||
.loop_times = -1,
|
.loop_times = -1,
|
||||||
.ordered_chapters = 1,
|
.ordered_chapters = 1,
|
||||||
|
.stream_cache_min_percent = 20.0,
|
||||||
|
.stream_cache_seek_min_percent = 50.0,
|
||||||
.chapterrange = {-1, -1},
|
.chapterrange = {-1, -1},
|
||||||
.edition_id = -1,
|
.edition_id = -1,
|
||||||
.user_correct_pts = -1,
|
.user_correct_pts = -1,
|
||||||
|
@ -1068,9 +1068,6 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts,
|
|||||||
return demuxer;
|
return demuxer;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern float stream_cache_min_percent;
|
|
||||||
extern float stream_cache_seek_min_percent;
|
|
||||||
|
|
||||||
demuxer_t *demux_open(struct MPOpts *opts, stream_t *vs, int file_format,
|
demuxer_t *demux_open(struct MPOpts *opts, stream_t *vs, int file_format,
|
||||||
int audio_id, int video_id, int dvdsub_id,
|
int audio_id, int video_id, int dvdsub_id,
|
||||||
char *filename)
|
char *filename)
|
||||||
@ -1117,9 +1114,9 @@ demuxer_t *demux_open(struct MPOpts *opts, stream_t *vs, int file_format,
|
|||||||
if (!stream_enable_cache
|
if (!stream_enable_cache
|
||||||
(as, opts->audio_stream_cache * 1024,
|
(as, opts->audio_stream_cache * 1024,
|
||||||
opts->audio_stream_cache * 1024 *
|
opts->audio_stream_cache * 1024 *
|
||||||
(stream_cache_min_percent / 100.0),
|
(opts->stream_cache_min_percent / 100.0),
|
||||||
opts->audio_stream_cache * 1024 *
|
opts->audio_stream_cache * 1024 *
|
||||||
(stream_cache_seek_min_percent / 100.0))) {
|
(opts->stream_cache_seek_min_percent / 100.0))) {
|
||||||
free_stream(as);
|
free_stream(as);
|
||||||
mp_msg(MSGT_DEMUXER, MSGL_ERR,
|
mp_msg(MSGT_DEMUXER, MSGL_ERR,
|
||||||
"Can't enable audio stream cache\n");
|
"Can't enable audio stream cache\n");
|
||||||
|
@ -314,10 +314,6 @@ int file_filter=1;
|
|||||||
|
|
||||||
// cache2:
|
// cache2:
|
||||||
int stream_cache_size=-1;
|
int stream_cache_size=-1;
|
||||||
#ifdef CONFIG_STREAM_CACHE
|
|
||||||
float stream_cache_min_percent=20.0;
|
|
||||||
float stream_cache_seek_min_percent=50.0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// dump:
|
// dump:
|
||||||
int stream_dump_type=0;
|
int stream_dump_type=0;
|
||||||
@ -3757,6 +3753,8 @@ if(mpctx->stream->type==STREAMTYPE_DVDNAV){
|
|||||||
goto_enable_cache:
|
goto_enable_cache:
|
||||||
if(stream_cache_size>0){
|
if(stream_cache_size>0){
|
||||||
int res;
|
int res;
|
||||||
|
float stream_cache_min_percent = opts->stream_cache_min_percent;
|
||||||
|
float stream_cache_seek_min_percent = opts->stream_cache_seek_min_percent;
|
||||||
current_module="enable_cache";
|
current_module="enable_cache";
|
||||||
res = stream_enable_cache(mpctx->stream,stream_cache_size*1024,
|
res = stream_enable_cache(mpctx->stream,stream_cache_size*1024,
|
||||||
stream_cache_size*1024*(stream_cache_min_percent / 100.0),
|
stream_cache_size*1024*(stream_cache_min_percent / 100.0),
|
||||||
|
@ -33,6 +33,8 @@ typedef struct MPOpts {
|
|||||||
int capture_dump;
|
int capture_dump;
|
||||||
int loop_times;
|
int loop_times;
|
||||||
int ordered_chapters;
|
int ordered_chapters;
|
||||||
|
float stream_cache_min_percent;
|
||||||
|
float stream_cache_seek_min_percent;
|
||||||
int chapterrange[2];
|
int chapterrange[2];
|
||||||
int edition_id;
|
int edition_id;
|
||||||
int correct_pts;
|
int correct_pts;
|
||||||
|
Loading…
Reference in New Issue
Block a user