Commit 573582de authored by Jean-Paul Saman's avatar Jean-Paul Saman

stream_filter: httplive.c: EXT-X-ALLOW-CACHE

If #EXT-X-ALLOW-CACHE is set to NO, then it is not allowed to cache the files
after playback. They must be released.
parent ee032e5f
......@@ -114,6 +114,7 @@ struct stream_sys_t
int i_version; /* HTTP protocol version to use */
char *psz_user_agent;
bool b_cache; /* can cache files */
bool b_seekable; /* can seek? */
bool b_meta; /* meta playlist */
bool b_live; /* live stream? or vod? */
......@@ -227,6 +228,7 @@ static hls_stream_t *hls_New(vlc_array_t *hls_stream, int id, uint64_t bw, char
hls->sequence = 0; /* default is 0 */
hls->version = 1; /* default protocol version */
hls->segment = 0;
hls->b_cache = true;
vlc_UrlParse(&hls->url, uri, 0);
/* assume http */
if (hls->url.i_port <= 0)
......@@ -727,7 +729,7 @@ static void parse_AllowCache(stream_t *s, char *p_read)
hls_stream_t *hls = hls_GetLast(p_sys->hls_stream);
assert(hls);
hls->b_cache = (strncmp(answer, "YES", 3) == 0);
hls->b_cache = (strncmp(answer, "NO", 2) != 0);
}
static void parse_Version(stream_t *s, char *p_read)
......@@ -1000,6 +1002,9 @@ static int parse_HTTPLiveStreaming(stream_t *s)
if (hls == NULL) break;
if (get_HTTPLivePlaylist(s, hls) != VLC_SUCCESS)
msg_Err(s, "could not parse m3u8 meta index file." );
/* Can we cache files after playback */
p_sys->b_cache = hls->b_cache;
}
}
......@@ -1303,6 +1308,11 @@ static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read)
vlc_mutex_lock(&segment->lock);
if (segment->data->i_buffer == 0)
{
if (!p_sys->b_cache)
{
block_Release(segment->data);
segment->data = NULL;
}
msg_Dbg(s, "switching to segment %d", p_sys->segment);
p_sys->segment++;
vlc_mutex_unlock(&segment->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment