struct stream_sys_t
{
block_t *peeked;
+ uint64_t offset;
vlc_thread_t thread;
pid_t pid;
int write_fd, read_fd;
}
length = net_Read (stream, p_sys->read_fd, NULL, buf, buflen, false);
- return bonus + ((length >= 0) ? length : 0);
+ if (length < 0)
+ return 0;
+ length += bonus;
+ p_sys->offset += length;
+ return length;
}
/**
*/
static int Control (stream_t *stream, int query, va_list args)
{
- /*stream_sys_t *p_sys = stream->p_sys;*/
- (void)stream;
- (void)query; (void)args;
- return VLC_EGENERIC;
+ stream_sys_t *p_sys = stream->p_sys;
+
+ switch (query)
+ {
+ case STREAM_CAN_SEEK:
+ case STREAM_CAN_FASTSEEK:
+ *(va_arg (args, bool *)) = false;
+ break;
+ case STREAM_GET_POSITION:
+ *(va_arg (args, int64_t *)) = p_sys->offset;
+ break;
+ case STREAM_GET_SIZE:
+ *(va_arg (args, int64_t *)) = 0;
+ break;
+ case STREAM_GET_MTU:
+ *(va_arg (args, int *)) = 0;
+ break;
+ default:
+ return VLC_EGENERIC;
+ }
+ return VLC_SUCCESS;
}
/**
stream->pf_peek = Peek;
stream->pf_control = Control;
p_sys->peeked = NULL;
+ p_sys->offset = 0;
p_sys->pid = -1;
/* I am not a big fan of the pyramid style, but I cannot think of anything