mirror of
https://projects.vdr-developer.org/git/vdr-plugin-streamdev.git
synced 2023-10-10 19:16:51 +02:00
fa578940f7
especially x264 still needs a SIGKILL sometimes - added --remove-destination to cp commands installing plugins - updated Italian translation (thanks to Diego Pierotto) - config option "client may suspend" hidden if not applicable - updated and enhanced README - added support for HTTP method HEAD - rewrite of externremux.sh, including support for various URL parameters, logging and improved shutdown - start externremux script in a separate process group - changed HTTP URL path for externremux from EXTERN to EXT (suggested by Rolf Ahrenberg) - HTTP headers now have to be emitted by externremux script - pass channel related information and URL parameters to externremux script through environment - implement CGI like interface for externremux script Modified Files: Tag: v0_4 CONTRIBUTORS HISTORY Makefile README common.c common.h i18n.c remux/extern.c remux/extern.h server/connection.c server/connection.h server/connectionHTTP.c server/connectionHTTP.h server/connectionIGMP.c server/connectionVTP.c server/livestreamer.c server/livestreamer.h server/menuHTTP.c server/setup.c server/setup.h server/streamer.c server/streamer.h streamdev/externremux.sh streamdev/streamdevhosts.conf
107 lines
2.6 KiB
C++
107 lines
2.6 KiB
C++
/*
|
|
* $Id: streamer.h,v 1.8.2.4 2010/07/19 13:50:14 schmirl Exp $
|
|
*/
|
|
|
|
#ifndef VDR_STREAMDEV_STREAMER_H
|
|
#define VDR_STREAMDEV_STREAMER_H
|
|
|
|
#include <vdr/thread.h>
|
|
#include <vdr/ringbuffer.h>
|
|
#include <vdr/tools.h>
|
|
|
|
class cTBSocket;
|
|
class cStreamdevStreamer;
|
|
class cServerConnection;
|
|
|
|
#ifndef TS_SIZE
|
|
#define TS_SIZE 188
|
|
#endif
|
|
|
|
#define STREAMERBUFSIZE (20000 * TS_SIZE)
|
|
#define WRITERBUFSIZE (5000 * TS_SIZE)
|
|
|
|
// --- cStreamdevBuffer -------------------------------------------------------
|
|
|
|
class cStreamdevBuffer: public cRingBufferLinear {
|
|
public:
|
|
// make public
|
|
void WaitForPut(void) { cRingBuffer::WaitForPut(); }
|
|
// Always write complete TS packets
|
|
// (assumes Count is a multiple of TS_SIZE)
|
|
int PutTS(const uchar *Data, int Count);
|
|
cStreamdevBuffer(int Size, int Margin = 0, bool Statistics = false, const char *Description = NULL);
|
|
};
|
|
|
|
inline int cStreamdevBuffer::PutTS(const uchar *Data, int Count)
|
|
{
|
|
int free = Free();
|
|
if (free < Count)
|
|
Count = free;
|
|
|
|
Count -= Count % TS_SIZE;
|
|
if (Count)
|
|
Count = Put(Data, Count);
|
|
else
|
|
WaitForPut();
|
|
return Count;
|
|
}
|
|
|
|
// --- cStreamdevWriter -------------------------------------------------------
|
|
|
|
class cStreamdevWriter: public cThread {
|
|
private:
|
|
cStreamdevStreamer *m_Streamer;
|
|
cTBSocket *m_Socket;
|
|
|
|
protected:
|
|
virtual void Action(void);
|
|
|
|
public:
|
|
cStreamdevWriter(cTBSocket *Socket, cStreamdevStreamer *Streamer);
|
|
virtual ~cStreamdevWriter();
|
|
};
|
|
|
|
// --- cStreamdevStreamer -----------------------------------------------------
|
|
|
|
class cStreamdevStreamer: public cThread {
|
|
private:
|
|
const cServerConnection *m_Connection;
|
|
cStreamdevWriter *m_Writer;
|
|
cStreamdevBuffer *m_RingBuffer;
|
|
cStreamdevBuffer *m_SendBuffer;
|
|
|
|
protected:
|
|
virtual void Action(void);
|
|
|
|
bool IsRunning(void) const { return m_Writer; }
|
|
|
|
public:
|
|
cStreamdevStreamer(const char *Name, const cServerConnection *Connection = NULL);
|
|
virtual ~cStreamdevStreamer();
|
|
|
|
const cServerConnection* Connection(void) const { return m_Connection; }
|
|
|
|
virtual void Start(cTBSocket *Socket);
|
|
virtual void Stop(void);
|
|
bool Abort(void);
|
|
|
|
void Activate(bool On);
|
|
int Receive(uchar *Data, int Length) { return m_RingBuffer->PutTS(Data, Length); }
|
|
void ReportOverflow(int Bytes) { m_RingBuffer->ReportOverflow(Bytes); }
|
|
|
|
virtual int Put(const uchar *Data, int Count) { return m_SendBuffer->PutTS(Data, Count); }
|
|
virtual uchar *Get(int &Count) { return m_SendBuffer->Get(Count); }
|
|
virtual void Del(int Count) { m_SendBuffer->Del(Count); }
|
|
|
|
virtual void Detach(void) {}
|
|
virtual void Attach(void) {}
|
|
};
|
|
|
|
inline bool cStreamdevStreamer::Abort(void)
|
|
{
|
|
return Active() && !m_Writer->Active();
|
|
}
|
|
|
|
#endif // VDR_STREAMDEV_STREAMER_H
|
|
|