[vlc-devel] [vlc-commits] stream_filter/httplive.c: read a HLS m3u8 file in one go, parse later

Soroush Hassani soroush124 at yahoo.com
Fri Feb 11 12:39:18 CET 2011


Hi,
Would httplive module's developers, please, take a look at issue 
in http://mailman.videolan.org/pipermail/vlc/2011-February/019867.html

Thanks



________________________________
From: Jean-Paul Saman <jpsaman at gmail.com>
To: Mailing list for VLC media player developers <vlc-devel at videolan.org>
Sent: Fri, February 11, 2011 2:00:23 PM
Subject: Re: [vlc-devel] [vlc-commits] stream_filter/httplive.c: read a HLS m3u8 
file in one go, parse later

On Fri, Feb 11, 2011 at 10:32 AM, Laurent Aimar <fenrir at elivagar.org> wrote:
> Hi,
>
> On Fri, Feb 11, 2011 at 10:14:07AM +0100, Jean-Paul Saman wrote:
>> +/* Read M3U8 file */
>> +static uint8_t *access_ReadM3U8(stream_t *s, vlc_url_t *url)
>> +{
>> +    stream_sys_t *p_sys = (stream_sys_t *) s->p_sys;
>> +
>> +    /* Download new playlist file from server */
>> +    if (AccessOpen(s, url) != VLC_SUCCESS)
>> +        return NULL;
>> +
>> +    ssize_t size = p_sys->p_access->info.i_size;
>> +    if (size == 0) size = 1024; /* no Content-Length */
>> +
>> +    msg_Err(s, "Stream size is %"PRId64, size);
>> +
>> +    uint8_t *buffer = calloc(1, size);
>> +    if (buffer == NULL)
>> +    {
>> +        AccessClose(s);
>> +        return NULL;
>> +    }
>> +
>> +    size_t length = 0, curlen = 0;
>> +    do
>> +    {
>> +        length = p_sys->p_access->pf_read(p_sys->p_access, buffer + curlen, 
>>size - curlen);
>> +        if ((length <= 0) || (length >= size))
>> +            break;
>> +        curlen += length;
>> +        if (curlen >= size)
>> +        {
>> +            uint8_t *tmp = realloc(*buffer, size + 1024);
>> +            if (tmp == NULL)
>> +                break;
>> +            size += 1024;
>> +            *buffer = tmp;
>> +        }
>> +    } while (vlc_object_alive(s));
>> +
>> +    AccessClose(s);
>> +    return buffer;
>> +}
>  Is there a specific reason for using access_t? If you open a stream_t 
directly
> it should simplify the code (here and when reading the data segment too).

I have no idea how that works. AFAIK you cannot reopen an input with a
different URL.

Kind Regards,

Jean-Paul Saman
_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
http://mailman.videolan.org/listinfo/vlc-devel



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110211/a49e9e2f/attachment.html>


More information about the vlc-devel mailing list