return ::open(filename, O_RDWR);
}
+int eDVBDemux::openDVR(void)
+{
+ char filename[128];
+ snprintf(filename, 128, "/dev/dvb/adapter%d/dvr%d", adapter, demux);
+ return ::open(filename, O_WRONLY);
+}
+
DEFINE_REF(eDVBDemux)
RESULT eDVBDemux::setSourceFrontend(int fenum)
RESULT getCADemuxID(uint8_t &id) { id = demux; return 0; }
RESULT flush();
RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &conn);
-
+ int openDVR(void);
+
int getRefCount() { return ref; }
private:
int adapter, demux, source;
ePtr<eDVBRegisteredDemux> unused;
- if (m_boxtype == DM800 || m_boxtype == DM500HD || m_boxtype == DM800SE) // dm800 / 500hd
+ if (m_boxtype == DM800) // dm800
{
cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux
for (; i != m_demux.end(); ++i, ++n)
}
}
}
- else if (m_boxtype == DM8000)
+ else if (m_boxtype == DM8000 || m_boxtype == DM500HD || m_boxtype == DM800SE)
{
cap |= capHoldDecodeReference; // this is checked in eDVBChannel::getDemux
for (; i != m_demux.end(); ++i, ++n)
/* (this codepath needs to be improved anyway.) */
#if HAVE_DVB_API_VERSION < 3
m_pvr_fd_dst = open("/dev/pvr", O_WRONLY);
-#else
- m_pvr_fd_dst = open("/dev/misc/pvr", O_WRONLY);
-#endif
if (m_pvr_fd_dst < 0)
{
- eDebug("can't open /dev/misc/pvr - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved.
+ eDebug("can't open /dev/pvr - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved.
+ return -ENODEV;
+ }
+#else
+ ePtr<eDVBAllocatedDemux> &demux = m_demux ? m_demux : m_decoder_demux;
+ if (demux)
+ {
+ m_pvr_fd_dst = demux->get().openDVR();
+ if (m_pvr_fd_dst < 0)
+ {
+ eDebug("can't open /dev/dvb/adapterX/dvrX - you need to buy the new(!) $$$ box! (%m)"); // or wait for the driver to be improved.
+ return -ENODEV;
+ }
+ }
+ else
+ {
+ eDebug("no demux allocated yet.. so its not possible to open the dvr device!!");
return -ENODEV;
}
+#endif
}
m_pvr_thread = new eDVBChannelFilePush();
&& (state == iDVBChannel::state_ok) && (!m_demux))
{
if (m_channel)
- if (m_channel->getDemux(m_demux, (!m_use_decode_demux) ? 0 : iDVBChannel::capDecode))
+ {
+ if (m_pvr_demux_tmp)
+ {
+ m_demux = m_pvr_demux_tmp;
+ m_pvr_demux_tmp = NULL;
+ }
+ else if (m_channel->getDemux(m_demux, (!m_use_decode_demux) ? 0 : iDVBChannel::capDecode))
eDebug("Allocating %s-decoding a demux for now tuned-in channel failed.", m_use_decode_demux ? "" : "non-");
+ }
serviceEvent(eventTuned);
if (m_pvr_channel)
{
m_pvr_channel->setCueSheet(cue);
- if (source)
+
+ if (m_pvr_channel->getDemux(m_pvr_demux_tmp, (!m_use_decode_demux) ? 0 : iDVBChannel::capDecode))
+ eDebug("Allocating %s-decoding a demux for PVR channel failed.", m_use_decode_demux ? "" : "non-");
+ else if (source)
m_pvr_channel->playSource(source, streaminfo_file);
else
m_pvr_channel->playFile(ref.path.c_str());
eUsePtr<iDVBChannel> m_channel;
eUsePtr<iDVBPVRChannel> m_pvr_channel;
ePtr<eDVBResourceManager> m_resourceManager;
- ePtr<iDVBDemux> m_demux;
-
+ ePtr<iDVBDemux> m_demux, m_pvr_demux_tmp;
+
void channelStateChanged(iDVBChannel *);
ePtr<eConnection> m_channelStateChanged_connection;
void channelEvent(iDVBChannel *, int event);