Permalink
Browse files

Fix seeking with some http streamed content

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 357573abd6a7757931d90f25014211044f4a87eb
Showing with 5 additions and 7 deletions.
  1. +5 −7 mythtv/libs/libmythtv/streamingringbuffer.cpp
@@ -1,4 +1,3 @@
#include <QUrl>
#include "mythcorecontext.h"
#include "mythlogging.h"
@@ -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)

0 comments on commit 357573a

Please sign in to comment.