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);
|
2014-11-09 11:51:52 +01:00
|
|
|
static int DebugCallback(CURL *handleP, curl_infotype typeP, char *dataP, size_t sizeP, void *userPtrP);
|
|
|
|
|
|
|
|
enum {
|
2014-11-09 19:32:08 +01:00
|
|
|
eConnectTimeoutMs = 1500, // in milliseconds
|
2014-11-09 11:51:52 +01:00
|
|
|
};
|
2014-12-21 15:31:38 +01:00
|
|
|
enum eCommunicationMode { cmUnicast, cmMulticast };
|
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-12-21 15:31:38 +01:00
|
|
|
eCommunicationMode modeM;
|
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;
|
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:
|
|
|
|
cSatipRtsp(cSatipTunerIf &tunerP);
|
|
|
|
virtual ~cSatipRtsp();
|
|
|
|
|
|
|
|
cString RtspUnescapeString(const char *strP);
|
2014-12-16 21:35:49 +01:00
|
|
|
void Reset(void);
|
2014-11-09 11:51:52 +01:00
|
|
|
bool Options(const char *uriP);
|
|
|
|
bool Setup(const char *uriP, int rtpPortP, int rtcpPortP);
|
|
|
|
bool SetSession(const char *sessionP);
|
|
|
|
bool Describe(const char *uriP);
|
|
|
|
bool Play(const char *uriP);
|
|
|
|
bool Teardown(const char *uriP);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __SATIP_RTSP_H
|