1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-25 04:38:01 +00:00

options: move -cache-min and cache-seek-min to option struct

This commit is contained in:
Clément Bœsch 2010-11-11 16:36:09 +01:00 committed by Uoti Urpala
parent 449484179f
commit e7d3e63a3f
5 changed files with 10 additions and 11 deletions

View File

@ -389,8 +389,8 @@ const m_option_t common_opts[] = {
#ifdef CONFIG_STREAM_CACHE
{"cache", &stream_cache_size, CONF_TYPE_INT, CONF_RANGE, 32, 1048576, 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},
{"cache-seek-min", &stream_cache_seek_min_percent, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL},
OPT_FLOATRANGE("cache-min", stream_cache_min_percent, 0, 0, 99),
OPT_FLOATRANGE("cache-seek-min", stream_cache_seek_min_percent, 0, 0, 99),
#else
{"cache", "MPlayer was compiled without cache2 support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
#endif /* CONFIG_STREAM_CACHE */

View File

@ -22,6 +22,8 @@ void set_default_mplayer_options(struct MPOpts *opts)
.stream_dump_name = "stream.dump",
.loop_times = -1,
.ordered_chapters = 1,
.stream_cache_min_percent = 20.0,
.stream_cache_seek_min_percent = 50.0,
.chapterrange = {-1, -1},
.edition_id = -1,
.user_correct_pts = -1,

View File

@ -1068,9 +1068,6 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts,
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,
int audio_id, int video_id, int dvdsub_id,
char *filename)
@ -1117,9 +1114,9 @@ demuxer_t *demux_open(struct MPOpts *opts, stream_t *vs, int file_format,
if (!stream_enable_cache
(as, 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 *
(stream_cache_seek_min_percent / 100.0))) {
(opts->stream_cache_seek_min_percent / 100.0))) {
free_stream(as);
mp_msg(MSGT_DEMUXER, MSGL_ERR,
"Can't enable audio stream cache\n");

View File

@ -314,10 +314,6 @@ int file_filter=1;
// cache2:
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:
int stream_dump_type=0;
@ -3757,6 +3753,8 @@ if(mpctx->stream->type==STREAMTYPE_DVDNAV){
goto_enable_cache:
if(stream_cache_size>0){
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";
res = stream_enable_cache(mpctx->stream,stream_cache_size*1024,
stream_cache_size*1024*(stream_cache_min_percent / 100.0),

View File

@ -33,6 +33,8 @@ typedef struct MPOpts {
int capture_dump;
int loop_times;
int ordered_chapters;
float stream_cache_min_percent;
float stream_cache_seek_min_percent;
int chapterrange[2];
int edition_id;
int correct_pts;