mirror of
https://github.com/mpv-player/mpv
synced 2025-04-22 15:17:43 +00:00
remove unused cache-prefill and create cache-seek-min that controls when seek_long is prefered over waiting for cache to fill
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16153 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
f135605359
commit
84ec577508
@ -818,9 +818,10 @@ Playback will start when the cache has been filled up to <percentage>
|
|||||||
of the total.
|
of the total.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-cache-prefill <percentage> (not yet implemented)
|
.B \-cache-seek-min <percentage> (not yet implemented)
|
||||||
When the cache is emptied MPlayer will pause and restart playback when
|
If seek is to be done and it is within seek-min range, MPlayer will wait
|
||||||
the cache prefill threshold set with this option is reached.
|
cache to be filled to this position rather than performing an stream seek.
|
||||||
|
(default:50)
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
.B \-cdda <option1:option2> (CDDA only)
|
.B \-cdda <option1:option2> (CDDA only)
|
||||||
|
@ -375,7 +375,7 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
//---- For libmpdemux
|
//---- For libmpdemux
|
||||||
|
|
||||||
float stream_cache_prefill_percent=5.0;
|
float stream_cache_seek_min_percent=50.0;
|
||||||
float stream_cache_min_percent=20.0;
|
float stream_cache_min_percent=20.0;
|
||||||
|
|
||||||
#include <libmpdemux/demuxer.h>
|
#include <libmpdemux/demuxer.h>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
{"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},
|
{"cache-min", &stream_cache_min_percent, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL},
|
||||||
{"cache-prefill", &stream_cache_prefill_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},
|
||||||
#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
|
#endif
|
||||||
|
@ -42,7 +42,7 @@ typedef struct {
|
|||||||
int sector_size; // size of a single sector (2048/2324)
|
int sector_size; // size of a single sector (2048/2324)
|
||||||
int back_size; // we should keep back_size amount of old bytes for backward seek
|
int back_size; // we should keep back_size amount of old bytes for backward seek
|
||||||
int fill_limit; // we should fill buffer only if space>=fill_limit
|
int fill_limit; // we should fill buffer only if space>=fill_limit
|
||||||
int prefill; // we should fill min prefill bytes if cache gets empty
|
int seek_limit; // keep filling cache if distanse is less that seek limit
|
||||||
// filler's pointers:
|
// filler's pointers:
|
||||||
int eof;
|
int eof;
|
||||||
off_t min_filepos; // buffer contain only a part of the file, from min-max pos
|
off_t min_filepos; // buffer contain only a part of the file, from min-max pos
|
||||||
@ -122,7 +122,7 @@ int cache_fill(cache_vars_t* s){
|
|||||||
mp_msg(MSGT_CACHE,MSGL_DBG2,"Out of boundaries... seeking to 0x%X \n",read);
|
mp_msg(MSGT_CACHE,MSGL_DBG2,"Out of boundaries... seeking to 0x%X \n",read);
|
||||||
// streaming: drop cache contents only if seeking backward or too much fwd:
|
// streaming: drop cache contents only if seeking backward or too much fwd:
|
||||||
if(s->stream->type!=STREAMTYPE_STREAM ||
|
if(s->stream->type!=STREAMTYPE_STREAM ||
|
||||||
read<s->min_filepos || read>=s->max_filepos+s->buffer_size)
|
read<s->min_filepos || read>=s->max_filepos+s->seek_limit)
|
||||||
{
|
{
|
||||||
s->offset= // FIXME!?
|
s->offset= // FIXME!?
|
||||||
s->min_filepos=s->max_filepos=read; // drop cache content :(
|
s->min_filepos=s->max_filepos=read; // drop cache content :(
|
||||||
@ -250,7 +250,7 @@ static void exit_sighandler(int x){
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int stream_enable_cache(stream_t *stream,int size,int min,int prefill){
|
int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){
|
||||||
int ss=(stream->type==STREAMTYPE_VCD)?VCD_SECTOR_DATA:STREAM_BUFFER_SIZE;
|
int ss=(stream->type==STREAMTYPE_VCD)?VCD_SECTOR_DATA:STREAM_BUFFER_SIZE;
|
||||||
cache_vars_t* s;
|
cache_vars_t* s;
|
||||||
|
|
||||||
@ -264,13 +264,13 @@ int stream_enable_cache(stream_t *stream,int size,int min,int prefill){
|
|||||||
if(s == NULL) return 0;
|
if(s == NULL) return 0;
|
||||||
stream->cache_data=s;
|
stream->cache_data=s;
|
||||||
s->stream=stream; // callback
|
s->stream=stream; // callback
|
||||||
s->prefill=prefill;
|
s->seek_limit=seek_limit;
|
||||||
|
|
||||||
|
|
||||||
//make sure that we won't wait from cache_fill
|
//make sure that we won't wait from cache_fill
|
||||||
//more data than it is alowed to fill
|
//more data than it is alowed to fill
|
||||||
if (s->prefill > s->buffer_size - s->fill_limit ){
|
if (s->seek_limit > s->buffer_size - s->fill_limit ){
|
||||||
s->prefill = s->buffer_size - s->fill_limit;
|
s->seek_limit = s->buffer_size - s->fill_limit;
|
||||||
}
|
}
|
||||||
if (min > s->buffer_size - s->fill_limit) {
|
if (min > s->buffer_size - s->fill_limit) {
|
||||||
min = s->buffer_size - s->fill_limit;
|
min = s->buffer_size - s->fill_limit;
|
||||||
|
@ -1375,7 +1375,7 @@ int audio_stream_cache = 0;
|
|||||||
extern int hr_mp3_seek;
|
extern int hr_mp3_seek;
|
||||||
|
|
||||||
extern float stream_cache_min_percent;
|
extern float stream_cache_min_percent;
|
||||||
extern float stream_cache_prefill_percent;
|
extern float stream_cache_seek_min_percent;
|
||||||
|
|
||||||
demuxer_t* demux_open(stream_t *vs,int file_format,int audio_id,int video_id,int dvdsub_id,char* filename){
|
demuxer_t* demux_open(stream_t *vs,int file_format,int audio_id,int video_id,int dvdsub_id,char* filename){
|
||||||
stream_t *as = NULL,*ss = NULL;
|
stream_t *as = NULL,*ss = NULL;
|
||||||
@ -1392,7 +1392,7 @@ demuxer_t* demux_open(stream_t *vs,int file_format,int audio_id,int video_id,int
|
|||||||
}
|
}
|
||||||
if(audio_stream_cache) {
|
if(audio_stream_cache) {
|
||||||
if(!stream_enable_cache(as,audio_stream_cache*1024,audio_stream_cache*1024*(stream_cache_min_percent / 100.0),
|
if(!stream_enable_cache(as,audio_stream_cache*1024,audio_stream_cache*1024*(stream_cache_min_percent / 100.0),
|
||||||
audio_stream_cache*1024*(stream_cache_prefill_percent / 100.0))) {
|
audio_stream_cache*1024*(stream_cache_seek_min_percent / 100.0))) {
|
||||||
free_stream(as);
|
free_stream(as);
|
||||||
mp_msg(MSGT_DEMUXER,MSGL_ERR,"Can't enable audio stream cache\n");
|
mp_msg(MSGT_DEMUXER,MSGL_ERR,"Can't enable audio stream cache\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -98,7 +98,7 @@ int stream_cache_size=-1;
|
|||||||
extern int cache_fill_status;
|
extern int cache_fill_status;
|
||||||
|
|
||||||
float stream_cache_min_percent=20.0;
|
float stream_cache_min_percent=20.0;
|
||||||
float stream_cache_prefill_percent=5.0;
|
float stream_cache_seek_min_percent=50.0;
|
||||||
#else
|
#else
|
||||||
#define cache_fill_status 0
|
#define cache_fill_status 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -266,7 +266,7 @@ int forced_subs_only=0;
|
|||||||
extern int cache_fill_status;
|
extern int cache_fill_status;
|
||||||
|
|
||||||
float stream_cache_min_percent=20.0;
|
float stream_cache_min_percent=20.0;
|
||||||
float stream_cache_prefill_percent=5.0;
|
float stream_cache_seek_min_percent=50.0;
|
||||||
#else
|
#else
|
||||||
#define cache_fill_status 0
|
#define cache_fill_status 0
|
||||||
#endif
|
#endif
|
||||||
@ -1640,7 +1640,9 @@ goto_enable_cache:
|
|||||||
#endif
|
#endif
|
||||||
if(stream_cache_size>0){
|
if(stream_cache_size>0){
|
||||||
current_module="enable_cache";
|
current_module="enable_cache";
|
||||||
if(!stream_enable_cache(stream,stream_cache_size*1024,stream_cache_size*1024*(stream_cache_min_percent / 100.0),stream_cache_size*1024*(stream_cache_prefill_percent / 100.0)))
|
if(!stream_enable_cache(stream,stream_cache_size*1024,
|
||||||
|
stream_cache_size*1024*(stream_cache_min_percent / 100.0),
|
||||||
|
stream_cache_size*1024*(stream_cache_seek_min_percent / 100.0)))
|
||||||
if((eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY))) goto goto_next_file;
|
if((eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY))) goto goto_next_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user