diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
index bedd20d..87314ea 100644
a
|
b
|
int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, |
920 | 920 | |
921 | 921 | InitByteContext(); |
922 | 922 | |
| 923 | if (ringBuffer->IsStream() && !ringBuffer->StartFromBeginning()) |
| 924 | return -1; |
| 925 | |
923 | 926 | int err = av_open_input_stream(&ic, ic->pb, filename, fmt, ¶ms); |
924 | 927 | if (err < 0) |
925 | 928 | { |
… |
… |
int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo, |
931 | 934 | int ret = FindStreamInfo(); |
932 | 935 | |
933 | 936 | // Reset DVD/bluray ringbuffers |
934 | | if (!ringBuffer->StartFromBeginning()) |
| 937 | if (ringBuffer->IsDisc() && !ringBuffer->StartFromBeginning()) |
935 | 938 | return -1; |
936 | 939 | ringBuffer->IgnoreWaitStates(false); |
937 | 940 | |
diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp
index feaf411..405a304 100644
a
|
b
|
RingBuffer *RingBuffer::Create( |
114 | 114 | bool is_dvd = false; |
115 | 115 | bool is_bd = false; |
116 | 116 | |
117 | | if (lfilename.startsWith("http://")) |
| 117 | if (lfilename.startsWith("http://") || |
| 118 | lfilename.contains(QRegExp("^rtmp.?://"))) |
118 | 119 | { |
119 | 120 | return new StreamingRingBuffer(lfilename); |
120 | 121 | } |
… |
… |
void RingBuffer::IgnoreLiveEOF(bool ignore) |
1413 | 1414 | rwlock.unlock(); |
1414 | 1415 | } |
1415 | 1416 | |
| 1417 | const StreamingRingBuffer *RingBuffer::Stream(void) const |
| 1418 | { |
| 1419 | return dynamic_cast<const StreamingRingBuffer*>(this); |
| 1420 | } |
| 1421 | |
1416 | 1422 | const DVDRingBuffer *RingBuffer::DVD(void) const |
1417 | 1423 | { |
1418 | 1424 | return dynamic_cast<const DVDRingBuffer*>(this); |
… |
… |
BDRingBuffer *RingBuffer::BD(void) |
1433 | 1439 | return dynamic_cast<BDRingBuffer*>(this); |
1434 | 1440 | } |
1435 | 1441 | |
| 1442 | StreamingRingBuffer *RingBuffer::Stream(void) |
| 1443 | { |
| 1444 | return dynamic_cast<StreamingRingBuffer*>(this); |
| 1445 | } |
| 1446 | |
1436 | 1447 | /* vim: set expandtab tabstop=4 shiftwidth=4: */ |
diff --git a/mythtv/libs/libmythtv/ringbuffer.h b/mythtv/libs/libmythtv/ringbuffer.h
index 69a5c0b..157b452 100644
a
|
b
|
extern "C" { |
27 | 27 | class ThreadedFileWriter; |
28 | 28 | class DVDRingBuffer; |
29 | 29 | class BDRingBuffer; |
| 30 | class StreamingRingBuffer; |
30 | 31 | class LiveTVChain; |
31 | 32 | class RemoteFile; |
32 | 33 | |
… |
… |
class MTV_PUBLIC RingBuffer : protected QThread |
69 | 70 | bool IsDisc(void) const { return IsDVD() || IsBD(); } |
70 | 71 | bool IsDVD(void) const { return DVD() != NULL; } |
71 | 72 | bool IsBD(void) const { return BD() != NULL; } |
| 73 | bool IsStream(void) const { return Stream() != NULL; } |
| 74 | const StreamingRingBuffer *Stream(void) const; |
72 | 75 | const DVDRingBuffer *DVD(void) const; |
73 | 76 | const BDRingBuffer *BD(void) const; |
74 | 77 | DVDRingBuffer *DVD(void); |
75 | 78 | BDRingBuffer *BD(void); |
| 79 | StreamingRingBuffer *Stream(void); |
76 | 80 | virtual bool StartFromBeginning(void) { return true; } |
77 | 81 | virtual void IgnoreWaitStates(bool ignore) { } |
78 | 82 | virtual bool IsInDiscMenuOrStillFrame(void) const { return false; } |
diff --git a/mythtv/libs/libmythtv/streamingringbuffer.cpp b/mythtv/libs/libmythtv/streamingringbuffer.cpp
index ac5d557..94d885c 100644
a
|
b
|
bool StreamingRingBuffer::OpenFile(const QString &lfilename, uint retry_ms) |
44 | 44 | return true; |
45 | 45 | } |
46 | 46 | |
| 47 | bool StreamingRingBuffer::StartFromBeginning(void) |
| 48 | { |
| 49 | if (m_context) |
| 50 | { |
| 51 | url_close(m_context); |
| 52 | m_context = NULL; |
| 53 | } |
| 54 | |
| 55 | return OpenFile(filename); |
| 56 | } |
| 57 | |
47 | 58 | long long StreamingRingBuffer::Seek(long long pos, int whence, bool has_lock) |
48 | 59 | { |
| 60 | if (m_context) |
| 61 | { |
| 62 | if (url_seek(m_context, pos, whence) < 0) |
| 63 | { |
| 64 | ateof = true; |
| 65 | return 0; |
| 66 | } |
| 67 | return pos; |
| 68 | } |
49 | 69 | return 0; |
50 | 70 | } |
51 | 71 | |
52 | 72 | int StreamingRingBuffer::safe_read(void *data, uint sz) |
53 | 73 | { |
54 | 74 | if (m_context) |
55 | | return url_read(m_context, (unsigned char*)data, sz); |
| 75 | return url_read_complete(m_context, (unsigned char*)data, sz); |
56 | 76 | return 0; |
57 | 77 | } |
58 | 78 | |
diff --git a/mythtv/libs/libmythtv/streamingringbuffer.h b/mythtv/libs/libmythtv/streamingringbuffer.h
index 69e3f14..48f09b2 100644
a
|
b
|
class StreamingRingBuffer : public RingBuffer |
20 | 20 | virtual long long Seek(long long pos, int whence, bool has_lock); |
21 | 21 | virtual long long GetRealFileSize(void); |
22 | 22 | virtual bool IsStreamed(void) { return true; } |
| 23 | bool StartFromBeginning(void); |
23 | 24 | |
24 | 25 | protected: |
25 | 26 | virtual int safe_read(void *data, uint sz); |
diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
index 2d32c3b..1cdfd2b 100644
a
|
b
|
static int internal_play_media(const QString &mrl, const QString &plot, |
784 | 784 | QFile checkFile(mrl); |
785 | 785 | if ((!checkFile.exists() && !mrl.startsWith("dvd:") |
786 | 786 | && !mrl.startsWith("bd:") |
787 | | && !mrl.startsWith("myth:"))) |
| 787 | && !mrl.startsWith("myth:") |
| 788 | && !mrl.startsWith("http:") |
| 789 | && !mrl.contains(QRegExp("^rtmp.?://")))) |
788 | 790 | { |
789 | 791 | QString errorText = QObject::tr("Failed to open \n '%1' in %2 \n" |
790 | 792 | "Check if the video exists") |