[vlc-devel] commit: decomp: implement minimal controls ( Rémi Denis-Courmont )
git version control
git at videolan.org
Wed Dec 10 18:59:01 CET 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Dec 10 19:58:41 2008 +0200| [2e3d76dc7690fc0cf89e6995c5378fedc1f16ede] | committer: Rémi Denis-Courmont
decomp: implement minimal controls
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2e3d76dc7690fc0cf89e6995c5378fedc1f16ede
---
modules/stream_filter/decomp.c | 33 ++++++++++++++++++++++++++++-----
1 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/modules/stream_filter/decomp.c b/modules/stream_filter/decomp.c
index 4e482d9..aa183e5 100644
--- a/modules/stream_filter/decomp.c
+++ b/modules/stream_filter/decomp.c
@@ -57,6 +57,7 @@ vlc_module_end ()
struct stream_sys_t
{
block_t *peeked;
+ uint64_t offset;
vlc_thread_t thread;
pid_t pid;
int write_fd, read_fd;
@@ -158,7 +159,11 @@ static int Read (stream_t *stream, void *buf, unsigned int buflen)
}
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;
}
/**
@@ -198,10 +203,27 @@ static int Peek (stream_t *stream, const uint8_t **pbuf, unsigned int len)
*/
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;
}
/**
@@ -219,6 +241,7 @@ static int Open (stream_t *stream, const char *path)
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
More information about the vlc-devel
mailing list