mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
implemented STREAM_CTRL_GET_SIZE
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21674 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
874627a371
commit
fc2b02cf7e
@ -68,6 +68,22 @@ static int seek_forward(stream_t *s,off_t newpos) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int control(stream_t *s, int cmd, void *arg) {
|
||||||
|
switch(cmd) {
|
||||||
|
case STREAM_CTRL_GET_SIZE: {
|
||||||
|
off_t size;
|
||||||
|
|
||||||
|
size = lseek(s->fd, 0, SEEK_END);
|
||||||
|
lseek(s->fd, s->pos, SEEK_SET);
|
||||||
|
if(size != (off_t)-1) {
|
||||||
|
*((off_t*)arg) = size;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return STREAM_UNSUPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
|
static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
|
||||||
int f;
|
int f;
|
||||||
mode_t m = 0;
|
mode_t m = 0;
|
||||||
@ -148,6 +164,7 @@ static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
|
|||||||
stream->fd = f;
|
stream->fd = f;
|
||||||
stream->fill_buffer = fill_buffer;
|
stream->fill_buffer = fill_buffer;
|
||||||
stream->write_buffer = write_buffer;
|
stream->write_buffer = write_buffer;
|
||||||
|
stream->control = control;
|
||||||
|
|
||||||
m_struct_free(&stream_opts,opts);
|
m_struct_free(&stream_opts,opts);
|
||||||
return STREAM_OK;
|
return STREAM_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user