[mythtv-users] HLS Streaming Problem

Chris Notley mythtv at notleyc.fastmail.fm
Wed Oct 24 11:45:16 UTC 2012


On Tue, Oct 23, 2012, at 10:11 PM, Jean-Yves Avenard wrote:
> On 23 October 2012 22:26, Chris Notley <mythtv at notleyc.fastmail.fm>
> wrote:
> > I think this was my original misunderstanding, I'd interpreted HTTP
> > streaming in a generic sense, having understood that the 'network
> > recorder' type had not previously supported HTTP streams.
> 
> That's what I thought..
> 
> If the URL on the playlist you give to the encoder contains a link to
> a MPEG http download (not HLS), it will use the IPTV recorder.
> If that URL points to a HTTP Live Streaming, it will use the HLS
> recorder.
> 
> Myth download the first kilobyte to determine the type of content. If
> it's not HLS, then it assumes it's IPTV.

That's not what I'm seeing - looking at iptvfeederwrapper.cpp, the
section that determines the IPTV type appears to be:

    if (IPTVFeederRTSP::IsRTSP(url))
    {
        tmp_feeder = new IPTVFeederRTSP();
    }
    else if (IPTVFeederUDP::IsUDP(url))
    {
        tmp_feeder = new IPTVFeederUDP();
    }
    else if (IPTVFeederRTP::IsRTP(url))
    {
        tmp_feeder = new IPTVFeederRTP();
    }
    else if (IPTVFeederFile::IsFile(url))
    {
        tmp_feeder = new IPTVFeederFile();
    }
    else if (IPTVFeederHLS::IsHLS(url))
    {
        tmp_feeder = new IPTVFeederHLS();
    }
    else
    {
        LOG(VB_RECORD, LOG_ERR, LOC +
            QString("Init() -- unhandled url (%1)").arg(url));

        return false;
    }

Looking at the feeder files, the only one able to match a URL starting
'http://' is IPTVFeederHLS::IsHLS and looking in iptvfeederhls.cpp, this
calls HLSRingBuffer::TestForHTTPLiveStreaming, which eventually calls
the following:

    bool HLSRingBuffer::IsHTTPLiveStreaming(QByteArray *s)
    {
        if (!s || s->size() < 7)
            return false;
    
        if (!s->startsWith((const char*)"#EXTM3U"))
            return false;
    
        QTextStream stream(s);
        /* Parse stream and search for
         * EXT-X-TARGETDURATION or EXT-X-STREAM-INF tag, see
         *
         http://tools.ietf.org/html/draft-pantos-http-live-streaming-04#page-8
         */
        while (1)
        {
            QString line = stream.readLine();
            if (line.isNull())
                break;
            LOG(VB_PLAYBACK, LOG_DEBUG, LOC +
                QString("IsHTTPLiveStreaming: %1").arg(line));
            if (line.startsWith(QLatin1String("#EXT-X-TARGETDURATION")) 
            ||
                line.startsWith(QLatin1String("#EXT-X-MEDIA-SEQUENCE")) 
                ||
                line.startsWith(QLatin1String("#EXT-X-KEY"))            
                ||
                line.startsWith(QLatin1String("#EXT-X-ALLOW-CACHE"))    
                ||
                line.startsWith(QLatin1String("#EXT-X-ENDLIST"))        
                ||
                line.startsWith(QLatin1String("#EXT-X-STREAM-INF"))     
                ||
                line.startsWith(QLatin1String("#EXT-X-DISCONTINUITY"))  
                ||
                line.startsWith(QLatin1String("#EXT-X-VERSION")))
            {
                return true;
            }
        }
        return false;
    }

Once it's got this far, it appears to either need a real HLS, or will
just exit stating 'unhandled url'.  I'd initially (and naively) tried
adding one of the above HLS entries to my m3u file, which made it look
like an HLS entry, but it clearly wasn't.

It appears as though I will need to stick with the VLC/UDP streaming
option (http://www.mythtv.org/wiki/Dreambox-NetworkRecorder) for the
moment..

Thanks for everyone's help!
Chris

> 
> JY
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://www.mythtv.org/mailman/listinfo/mythtv-users


More information about the mythtv-users mailing list