2014-11-09 11:51:52 +01:00
|
|
|
/*
|
|
|
|
* rtsp.h: SAT>IP plugin for the Video Disk Recorder
|
|
|
|
*
|
|
|
|
* See the README file for copyright information and how to reach the author.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SATIP_RTSP_H
|
|
|
|
#define __SATIP_RTSP_H
|
|
|
|
|
|
|
|
#include <curl/curl.h>
|
|
|
|
#include <curl/easy.h>
|
|
|
|
|
|
|
|
#ifndef CURLOPT_RTSPHEADER
|
|
|
|
#error "libcurl is missing required RTSP support"
|
|
|
|
#endif
|
|
|
|
|
2015-03-22 17:51:39 +01:00
|
|
|
#include "common.h"
|
2014-11-09 11:51:52 +01:00
|
|
|
#include "tunerif.h"
|
|
|
|
|
|
|
|
class cSatipRtsp {
|
|
|
|
private:
|
2015-03-22 17:51:39 +01:00
|
|
|
static size_t HeaderCallback(char *ptrP, size_t sizeP, size_t nmembP, void *dataP);
|
|
|
|
static size_t DataCallback(char *ptrP, size_t sizeP, size_t nmembP, void *dataP);
|
2016-12-15 07:49:47 +01:00
|
|
|
static size_t InterleaveCallback(char *ptrP, size_t sizeP, size_t nmembP, void *dataP);
|
2014-11-09 11:51:52 +01:00
|
|
|
static int DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP);
|
|
|
|
|
|
|
|
enum {
|
2016-12-15 07:49:47 +01:00
|
|
|
eConnectTimeoutMs = 1500, // in milliseconds
|
2014-11-09 11:51:52 +01:00
|
|
|
};
|
|
|
|
|
2014-11-16 16:02:30 +01:00
|
|
|
cSatipTunerIf &tunerM;
|
2015-03-22 17:51:39 +01:00
|
|
|
cSatipMemoryBuffer headerBufferM;
|
|
|
|
cSatipMemoryBuffer dataBufferM;
|
2014-11-09 11:51:52 +01:00
|
|
|
CURL *handleM;
|
|
|
|
struct curl_slist *headerListM;
|
2015-03-22 17:51:39 +01:00
|
|
|
cString errorNoMoreM;
|
|
|
|
cString errorOutOfRangeM;
|
|
|
|
cString errorCheckSyntaxM;
|
2016-12-15 07:49:47 +01:00
|
|
|
int modeM;
|
|
|
|
unsigned int interleavedRtpIdM;
|
|
|
|
unsigned int interleavedRtcpIdM;
|
2014-11-09 11:51:52 +01:00
|
|
|
|
2014-12-16 21:35:49 +01:00
|
|
|
void Create(void);
|
|
|
|
void Destroy(void);
|
2015-03-22 17:51:39 +01:00
|
|
|
void ParseHeader(void);
|
|
|
|
void ParseData(void);
|
2014-12-07 19:17:30 +01:00
|
|
|
bool ValidateLatestResponse(long *rcP);
|
2014-11-09 11:51:52 +01:00
|
|
|
|
|
|
|
// to prevent copy constructor and assignment
|
|
|
|
cSatipRtsp(const cSatipRtsp&);
|
|
|
|
cSatipRtsp& operator=(const cSatipRtsp&);
|
|
|
|
|
|
|
|
public:
|
2015-08-16 00:38:03 +02:00
|
|
|
explicit cSatipRtsp(cSatipTunerIf &tunerP);
|
2014-11-09 11:51:52 +01:00
|
|
|
virtual ~cSatipRtsp();
|
|
|
|
|
2016-12-15 07:49:47 +01:00
|
|
|
cString GetActiveMode(void);
|
2014-11-09 11:51:52 +01:00
|
|
|
cString RtspUnescapeString(const char *strP);
|
2014-12-16 21:35:49 +01:00
|
|
|
void Reset(void);
|
2017-07-19 16:47:22 +02:00
|
|
|
bool SetInterface(const char *bindAddrP);
|
2014-11-09 11:51:52 +01:00
|
|
|
bool Options(const char *uriP);
|
2016-06-20 17:14:38 +02:00
|
|
|
bool Setup(const char *uriP, int rtpPortP, int rtcpPortP, bool useTcpP);
|
2014-11-09 11:51:52 +01:00
|
|
|
bool SetSession(const char *sessionP);
|
|
|
|
bool Describe(const char *uriP);
|
|
|
|
bool Play(const char *uriP);
|
|
|
|
bool Teardown(const char *uriP);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __SATIP_RTSP_H
|