From 971e8456fc36eb36213c60ab57828aec8640819b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 25 Aug 2013 22:49:27 +0200 Subject: stream: fix url_options field, make protocols field not fixed length The way the url_options field was handled was not entirely sane: it's actually a flexible array member, so it points to garbage for streams which do not initialize this member (it just points to the data right after the struct, which is garbage in theory and practice). This was not actually a problem, since the field is only used if priv_size is set (due to how this stuff is used). But it doesn't allow setting priv_size only, which might be useful in some cases. Also, make the protocols array not a fixed size array. Most stream implementations have only 1 protocol prefix, but stream_lavf.c has over 10 (whitelists ffmpeg protocols). The high size of the fixed size protocol array wastes space, and it is _still_ annoying to add new prefixes to stream_lavf (have to bump the maximum length), so make it arbitrary length. The two changes (plus some more cosmetic changes) arte conflated into one, because it was annoying going over all the stream implementations. --- stream/stream_memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'stream/stream_memory.c') diff --git a/stream/stream_memory.c b/stream/stream_memory.c index eaf74bb07e..ff2b42e020 100644 --- a/stream/stream_memory.c +++ b/stream/stream_memory.c @@ -72,7 +72,7 @@ static int open_f(stream_t *stream, int mode) } const stream_info_t stream_info_memory = { - "memory", - open_f, - { "memory", NULL }, + .name = "memory", + .open = open_f, + .protocols = (const char*[]){ "memory", NULL }, }; -- cgit v1.2.3