From 51dac4e0702e361b88e5a373fbb0165f5ad47420 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 18 Aug 2012 19:51:58 +0000 Subject: stream: change STREAM_CTRL_GET_SIZE argument type to uint64_t Update endpos each time libavformat asks for it. Fixes playback of still downloading files to not stop before we really reached the end. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35107 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: libmpdemux/demux_lavf.c Change STREAM_CTRL_GET_SIZE argument type from off_t to uint64_t. Also fix the incorrect type of the uint64_res variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35360 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: libmpdemux/demux_lavf.c libmpdemux/muxer_lavf.c Note: also merges the "forgotten" cache support from r35107. --- demux/demux_lavf.c | 2 +- stream/cache2.c | 11 ++++++++++- stream/stream_file.c | 2 +- stream/stream_lavf.c | 2 +- stream/stream_smb.c | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 769cf02101..dd8af7cb47 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -112,7 +112,7 @@ static int64_t mp_seek(void *opaque, int64_t pos, int whence) else if (whence == SEEK_SET) pos += stream->start_pos; else if (whence == AVSEEK_SIZE && stream->end_pos > 0) { - off_t size; + uint64_t size; if (stream_control(stream, STREAM_CTRL_GET_SIZE, &size) == STREAM_OK) return size; return stream->end_pos - stream->start_pos; diff --git a/stream/cache2.c b/stream/cache2.c index b6df32821e..d547f9e5ea 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -87,7 +87,7 @@ typedef struct { // callback stream_t* stream; volatile int control; - volatile unsigned control_uint_arg; + volatile uint64_t control_uint_arg; volatile double control_double_arg; volatile struct stream_lang_req control_lang_arg; volatile int control_res; @@ -260,6 +260,7 @@ static int cache_fill(cache_vars_t *s) static int cache_execute_control(cache_vars_t *s) { double double_res; unsigned uint_res; + uint64_t uint64_res; int needs_flush = 0; static unsigned last; int quit = s->control == -2; @@ -314,6 +315,10 @@ static int cache_execute_control(cache_vars_t *s) { s->control_res = s->stream->control(s->stream, s->control, &uint_res); s->control_uint_arg = uint_res; break; + case STREAM_CTRL_GET_SIZE: + s->control_res = s->stream->control(s->stream, s->control, &uint64_res); + s->control_uint_arg = uint64_res; + break; case STREAM_CTRL_GET_LANG: s->control_res = s->stream->control(s->stream, s->control, (void *)&s->control_lang_arg); break; @@ -640,6 +645,7 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { case STREAM_CTRL_GET_ASPECT_RATIO: case STREAM_CTRL_GET_NUM_ANGLES: case STREAM_CTRL_GET_ANGLE: + case STREAM_CTRL_GET_SIZE: case -2: s->control = cmd; break; @@ -682,6 +688,9 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { case STREAM_CTRL_GET_ANGLE: *(unsigned *)arg = s->control_uint_arg; break; + case STREAM_CTRL_GET_SIZE: + *(uint64_t *)arg = s->control_uint_arg; + break; case STREAM_CTRL_GET_LANG: *(struct stream_lang_req *)arg = s->control_lang_arg; break; diff --git a/stream/stream_file.c b/stream/stream_file.c index abf0b37855..fe893af0b4 100644 --- a/stream/stream_file.c +++ b/stream/stream_file.c @@ -105,7 +105,7 @@ static int control(stream_t *s, int cmd, void *arg) { size = lseek(s->fd, 0, SEEK_END); lseek(s->fd, s->pos, SEEK_SET); if(size != (off_t)-1) { - *((off_t*)arg) = size; + *(uint64_t*)arg = size; return 1; } } diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c index d21e35e6a3..9619a06b1a 100644 --- a/stream/stream_lavf.c +++ b/stream/stream_lavf.c @@ -63,7 +63,7 @@ static int control(stream_t *s, int cmd, void *arg) case STREAM_CTRL_GET_SIZE: size = avio_size(avio); if(size >= 0) { - *(off_t *)arg = size; + *(uint64_t *)arg = size; return 1; } break; diff --git a/stream/stream_smb.c b/stream/stream_smb.c index e2f77ce3a1..ecd2a6260a 100644 --- a/stream/stream_smb.c +++ b/stream/stream_smb.c @@ -77,7 +77,7 @@ static int control(stream_t *s, int cmd, void *arg) { off_t size = smbc_lseek(s->fd,0,SEEK_END); smbc_lseek(s->fd,s->pos,SEEK_SET); if(size != (off_t)-1) { - *((off_t*)arg) = size; + *(uint64_t *)arg = size; return 1; } } -- cgit v1.2.3