2004-12-30 23:43:55 +01:00
|
|
|
#ifndef VDR_STREAMDEV_LIVESTREAMER_H
|
|
|
|
#define VDR_STREAMDEV_LIVESTREAMER_H
|
|
|
|
|
|
|
|
#include <vdr/config.h>
|
2014-08-09 23:04:45 +02:00
|
|
|
#include <vdr/status.h>
|
2004-12-30 23:43:55 +01:00
|
|
|
#include <vdr/receiver.h>
|
|
|
|
|
|
|
|
#include "server/streamer.h"
|
2014-06-07 00:24:27 +02:00
|
|
|
#include "server/streamdev-server.h"
|
2004-12-30 23:43:55 +01:00
|
|
|
#include "common.h"
|
|
|
|
|
2012-12-16 12:40:44 +01:00
|
|
|
#define LIVEBUFSIZE (20000 * TS_SIZE)
|
|
|
|
|
2007-04-24 13:13:05 +02:00
|
|
|
class cStreamdevPatFilter;
|
2007-04-23 17:44:55 +02:00
|
|
|
class cStreamdevLiveReceiver;
|
2004-12-30 23:43:55 +01:00
|
|
|
|
2005-02-10 23:24:26 +01:00
|
|
|
// --- cStreamdevLiveStreamer -------------------------------------------------
|
|
|
|
|
2014-08-09 23:04:45 +02:00
|
|
|
class cStreamdevLiveStreamer: public cStreamdevStreamer, public cMainThreadHookSubscriber
|
|
|
|
#if VDRVERSNUM >= 20104
|
|
|
|
, public cStatus
|
|
|
|
#endif
|
|
|
|
{
|
2004-12-30 23:43:55 +01:00
|
|
|
private:
|
|
|
|
int m_Priority;
|
2005-02-08 14:59:16 +01:00
|
|
|
int m_Pids[MAXRECEIVEPIDS + 1];
|
|
|
|
int m_NumPids;
|
2014-08-31 00:20:35 +02:00
|
|
|
int m_Caids[MAXCAIDS + 1];
|
2004-12-30 23:43:55 +01:00
|
|
|
const cChannel *m_Channel;
|
|
|
|
cDevice *m_Device;
|
|
|
|
cStreamdevLiveReceiver *m_Receiver;
|
2012-12-16 12:40:44 +01:00
|
|
|
cStreamdevBuffer *m_ReceiveBuffer;
|
2007-04-24 13:13:05 +02:00
|
|
|
cStreamdevPatFilter *m_PatFilter;
|
2014-06-07 00:24:27 +02:00
|
|
|
bool m_SwitchLive;
|
2004-12-30 23:43:55 +01:00
|
|
|
|
2014-06-23 23:28:36 +02:00
|
|
|
void StartReceiver(bool Force = false);
|
2007-04-24 13:13:05 +02:00
|
|
|
bool HasPid(int Pid);
|
|
|
|
|
2014-06-07 00:24:27 +02:00
|
|
|
/* Test if device is in use as the transfer mode receiver device
|
|
|
|
or a FF card, displaying live TV from internal tuner */
|
|
|
|
static bool UsedByLiveTV(cDevice *device);
|
|
|
|
|
|
|
|
/* Find a suitable device and tune it to the requested channel. */
|
|
|
|
cDevice *SwitchDevice(const cChannel *Channel, int Priority);
|
|
|
|
|
2014-08-10 15:57:16 +02:00
|
|
|
bool SetChannel(eStreamType StreamType, const int* Apid = NULL, const int* Dpid = NULL);
|
2014-06-07 00:24:27 +02:00
|
|
|
|
2012-12-16 12:40:44 +01:00
|
|
|
protected:
|
|
|
|
virtual uchar* GetFromReceiver(int &Count) { return m_ReceiveBuffer->Get(Count); }
|
|
|
|
virtual void DelFromReceiver(int Count) { m_ReceiveBuffer->Del(Count); }
|
|
|
|
|
|
|
|
virtual int Put(const uchar *Data, int Count);
|
2014-05-18 15:24:24 +02:00
|
|
|
virtual void Action(void);
|
2012-12-16 12:40:44 +01:00
|
|
|
|
2014-08-09 23:04:45 +02:00
|
|
|
virtual void ChannelChange(const cChannel *Channel);
|
|
|
|
|
2004-12-30 23:43:55 +01:00
|
|
|
public:
|
2014-06-07 00:24:27 +02:00
|
|
|
cStreamdevLiveStreamer(const cServerConnection *Connection, const cChannel *Channel, int Priority, eStreamType StreamType, const int* Apid = NULL, const int* Dpid = NULL);
|
2004-12-30 23:43:55 +01:00
|
|
|
virtual ~cStreamdevLiveStreamer();
|
|
|
|
|
|
|
|
bool SetPid(int Pid, bool On);
|
2007-04-24 13:13:05 +02:00
|
|
|
bool SetPids(int Pid, const int *Pids1 = NULL, const int *Pids2 = NULL, const int *Pids3 = NULL);
|
2010-12-02 09:57:17 +01:00
|
|
|
void SetPriority(int Priority);
|
2011-07-06 09:13:50 +02:00
|
|
|
void GetSignal(int *DevNum, int *Strength, int *Quality) const;
|
2012-12-16 13:29:15 +01:00
|
|
|
virtual cString ToText() const;
|
2004-12-30 23:43:55 +01:00
|
|
|
|
2016-03-21 00:28:02 +01:00
|
|
|
#if APIVERSNUM >= 20300
|
|
|
|
void Receive(const uchar *Data, int Length);
|
|
|
|
#else
|
2012-12-16 12:40:44 +01:00
|
|
|
void Receive(uchar *Data, int Length);
|
2016-03-21 00:28:02 +01:00
|
|
|
#endif
|
2012-12-16 13:21:19 +01:00
|
|
|
virtual bool IsReceiving(void) const;
|
|
|
|
|
2005-03-12 13:54:19 +01:00
|
|
|
virtual void Attach(void);
|
|
|
|
virtual void Detach(void);
|
2004-12-30 23:43:55 +01:00
|
|
|
|
2014-06-07 00:24:27 +02:00
|
|
|
cDevice *GetDevice() const { return m_Device; }
|
|
|
|
|
|
|
|
/* Test if a call to GetDevice would return a usable device. */
|
|
|
|
static bool ProvidesChannel(const cChannel *Channel, int Priority);
|
|
|
|
|
|
|
|
/* Do things which must be done in VDR's main loop */
|
|
|
|
void MainThreadHook();
|
|
|
|
|
2004-12-30 23:43:55 +01:00
|
|
|
// Statistical purposes:
|
2005-02-08 18:22:35 +01:00
|
|
|
virtual std::string Report(void);
|
2004-12-30 23:43:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VDR_STREAMDEV_LIVESTREAMER_H
|