Skip to content

Commit

Permalink
Fix seeking with some http streamed content
Browse files Browse the repository at this point in the history
Do not rely on the URL to determine if we can seek in media. Instead try to seek to the start, if no error occurs: we can seek.
This allows seeking in a youtube stream using AirPlay
  • Loading branch information
jyavenard committed May 6, 2012
1 parent 4b8b3cc commit 357573a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions mythtv/libs/libmythtv/streamingringbuffer.cpp
@@ -1,4 +1,3 @@
#include <QUrl>
#include "mythcorecontext.h"
#include "mythlogging.h"

Expand Down Expand Up @@ -48,19 +47,18 @@ bool StreamingRingBuffer::OpenFile(const QString &lfilename, uint retry_ms)
filename = lfilename;

// TODO check whether local area file
QUrl url(filename);
QString ext = filename.right(3).toLower();
if (url.scheme().toLower() == "http" && (ext == "mp4" || ext == "m4v"))

int res = url_open(&m_context, filename.toAscii(), URL_RDONLY);
if (res >=0 && m_context &&
(!m_context->is_streamed && url_seek(m_context, 0, SEEK_SET) >= 0))
{
m_streamed = false;
m_allowSeeks = true;
m_streamed = false; // yes - counterintuitive
}

LOG(VB_GENERAL, LOG_INFO, LOC + QString("Trying %1 (allow seeks: %2")
.arg(filename).arg(m_allowSeeks));

int res = url_open(&m_context, filename.toAscii(), URL_RDONLY);

rwlock.unlock();

if (res < 0 || !m_context)
Expand Down

0 comments on commit 357573a

Please sign in to comment.