1
0
mirror of https://github.com/rofafor/vdr-plugin-iptv.git synced 2023-10-10 13:37:03 +02:00
vdr-plugin-iptv/protocolcurl.h

72 lines
1.8 KiB
C
Raw Normal View History

/*
* protocolcurl.h: IPTV plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
*/
#ifndef __IPTV_PROTOCOLCURL_H
#define __IPTV_PROTOCOLCURL_H
#include <curl/curl.h>
#include <curl/easy.h>
#include <vdr/ringbuffer.h>
#include <vdr/thread.h>
#include <vdr/tools.h>
#include "protocolif.h"
class cIptvProtocolCurl : public cIptvProtocolIf {
private:
enum eModeType {
eModeUnknown = 0,
eModeHttp,
eModeHttps,
eModeRtsp,
eModeFile,
eModeCount
};
enum {
eConnectTimeoutS = 5, // in seconds
eMaxDownloadSpeedMBits = 20 // in megabits per second
};
static size_t WriteCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
static size_t WriteRtspCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
static size_t DescribeCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
static size_t HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void *dataP);
cString streamUrlM;
int streamParamM;
cMutex mutexM;
CURL *handleM;
CURLM *multiM;
struct curl_slist *headerListM;
cRingBufferLinear *ringBufferM;
cString rtspControlM;
eModeType modeM;
bool connectedM;
bool pausedM;
bool Connect(void);
bool Disconnect(void);
bool PutData(unsigned char *dataP, int lenP);
void DelData(int lenP);
void ClearData(void);
unsigned char *GetData(unsigned int *lenP);
public:
cIptvProtocolCurl();
virtual ~cIptvProtocolCurl();
2013-02-23 14:31:11 +01:00
int Read(unsigned char* bufferAddrP, unsigned int bufferLenP);
bool Set(const char* locationP, const int parameterP, const int indexP);
bool Open(void);
bool Close(void);
cString GetInformation(void);
void SetRtspControl(const char *controlP);
};
#endif // __IPTV_PROTOCOLCURL_H