break;
}
case eDVBServicePMTHandler::eventEOF:
+ {
m_event((iPlayableService*)this, evEnd);
+ break;
+ }
}
}
if (m_timeshift_active)
updateDecoder();
break;
+ case eDVBServicePMTHandler::eventEOF:
+ switchToLive();
+ break;
}
}
to start recording from the data demux. */
r = m_service_handler.tune((eServiceReferenceDVB&)m_reference, m_is_pvr);
m_event(this, evStart);
+ m_event((iPlayableService*)this, evSeekableStatusChanged);
return 0;
}
RESULT eDVBServicePlay::pause(ePtr<iPauseableService> &ptr)
{
+ /* note: we check for timeshift to be enabled,
+ not neccessary active. if you pause when timeshift
+ is not active, you should activate it when unpausing */
if ((!m_is_pvr) && (!m_timeshift_enabled))
{
ptr = 0;
RESULT eDVBServicePlay::seek(ePtr<iSeekableService> &ptr)
{
- if (m_is_pvr || m_timeshift_enabled)
+ if (m_is_pvr || m_timeshift_active)
{
ptr = this;
return 0;
RESULT eDVBServicePlay::pause()
{
- if (m_timeshift_enabled && !m_timeshift_active)
- {
- switchToTimeshift();
- return 0;
- }
if (!m_is_paused && m_decoder)
{
m_is_paused = 1;
ePtr<iDVBPVRChannel> pvr_channel;
- if (m_service_handler.getPVRChannel(pvr_channel))
+ if ((m_timeshift_enabled ? m_service_handler_timeshift : m_service_handler).getPVRChannel(pvr_channel))
return -1;
return pvr_channel->seekTo(m_decode_demux, 0, to);
ePtr<iDVBPVRChannel> pvr_channel;
- if (m_service_handler.getPVRChannel(pvr_channel))
+ if ((m_timeshift_enabled ? m_service_handler_timeshift : m_service_handler).getPVRChannel(pvr_channel))
return -1;
to *= direction;
if (!m_decode_demux)
return -1;
- if (m_service_handler.getPVRChannel(pvr_channel))
+ if ((m_timeshift_enabled ? m_service_handler_timeshift : m_service_handler).getPVRChannel(pvr_channel))
return -1;
return pvr_channel->getCurrentPosition(m_decode_demux, pos, 1);
RESULT eDVBServicePlay::getName(std::string &name)
{
+ if (m_is_pvr)
+ {
+ ePtr<iStaticServiceInformation> i = new eStaticServiceDVBPVRInformation(m_reference);
+ return i->getName(m_reference, name);
+ }
if (m_dvb_service)
{
m_dvb_service->getName(m_reference, name);
case sAudioPID: if (program.audioStreams.empty()) return -1; return program.audioStreams[m_current_audio_stream].pid;
case sPCRPID: return program.pcrPid;
case sPMTPID: return program.pmtPid;
- case sTXTPID: return -1;
+ case sTXTPID: return program.textPid;
case sSID: return ((const eServiceReferenceDVB&)m_reference).getServiceID().get();
case sONID: return ((const eServiceReferenceDVB&)m_reference).getOriginalNetworkID().get();
case sTSID: return ((const eServiceReferenceDVB&)m_reference).getTransportStreamID().get();
if (m_timeshift_fd < 0)
{
- delete m_record;
+ m_record = 0;
return -4;
}
m_timeshift_enabled = 0;
m_record->stop();
- delete m_record;
+ m_record = 0;
close(m_timeshift_fd);
remove(m_timeshift_file.c_str());
- eDebug("timeshift disabled");
return 0;
}
+int eDVBServicePlay::isTimeshiftActive()
+{
+ return m_timeshift_enabled && m_timeshift_active;
+}
+
+RESULT eDVBServicePlay::activateTimeshift()
+{
+ if (!m_timeshift_enabled)
+ return -1;
+
+ if (!m_timeshift_active)
+ {
+ switchToTimeshift();
+ return 0;
+ }
+
+ return -2;
+}
+
void eDVBServicePlay::updateTimeshiftPids()
{
if (!m_record)
void eDVBServicePlay::switchToLive()
{
- eDebug("SwitchToLive");
if (!m_timeshift_active)
return;
m_service_handler_timeshift.free();
m_timeshift_active = 0;
+ m_event((iPlayableService*)this, evSeekableStatusChanged);
+
updateDecoder();
}
void eDVBServicePlay::switchToTimeshift()
{
- eDebug("SwitchToTimeshift");
if (m_timeshift_active)
return;
m_decoder = 0;
m_timeshift_active = 1;
+
+ m_event((iPlayableService*)this, evSeekableStatusChanged);
eServiceReferenceDVB r = (eServiceReferenceDVB&)m_reference;
r.path = m_timeshift_file;
- eDebug("ok, re-tuning to %s", r.toString().c_str());
m_service_handler_timeshift.tune(r, 1); /* use the decoder demux for everything */
}