mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 11:37:42 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fb40846171 | ||
|
b19be5b5c5 | ||
|
1a304e9dc2 | ||
|
5ff54d27a3 | ||
|
276370afbb | ||
|
f2081c4f00 | ||
|
388543a58d |
6
HISTORY
6
HISTORY
@@ -40,3 +40,9 @@ VDR Plugin 'satip' Revision History
|
||||
- Refactored the section filtering.
|
||||
- Added Catalan translation (Thanks to Gabriel Bonich).
|
||||
|
||||
2014-04-12: Version 0.2.3
|
||||
|
||||
- Added Spanish translation (Thanks to Gabriel Bonich).
|
||||
- Fixed parameters of the OPTIONS command.
|
||||
- Added a device identication into the user agent string.
|
||||
- Removed unnecessary PLAY commands and header callbacks.
|
||||
|
11
README
11
README
@@ -14,7 +14,7 @@ See the file COPYING for more information.
|
||||
|
||||
Requirements:
|
||||
|
||||
- Libcurl - the multiprotocol file transfer library with RTSP support
|
||||
- Libcurl >= 7.36.0 - the multiprotocol file transfer library with RTSP support
|
||||
http://curl.haxx.se/libcurl/
|
||||
|
||||
- PugiXML - Light-weight, simple and fast XML parser for C++
|
||||
@@ -23,7 +23,7 @@ Requirements:
|
||||
TinyXML - a simple, small, C++ XML parser
|
||||
http://www.grinninglizard.com/tinyxml/
|
||||
|
||||
- VDR-2.1.4+ for scrambled channels
|
||||
- VDR >= 2.1.4 for scrambled channels
|
||||
|
||||
Description:
|
||||
|
||||
@@ -108,13 +108,6 @@ Notes:
|
||||
direct access to any DVB card devices. The integrated CAM slot in
|
||||
Octopus Net devices isn't supported.
|
||||
|
||||
- The 100% compliance against SAT>IP specification 1.2 requires a
|
||||
patched VDR providing channel configuration for pilot, T2 system id,
|
||||
and SISO/MISO values.
|
||||
|
||||
- If you're using Triax TSS400, you'll need the libcurl from 2013-03-20
|
||||
or newer.
|
||||
|
||||
Acknowledgements:
|
||||
|
||||
- Big thanks to Digital Devices GmbH for providing the Octopus Net
|
||||
|
8
device.c
8
device.c
@@ -184,7 +184,7 @@ int cSatipDevice::SignalQuality(void) const
|
||||
|
||||
bool cSatipDevice::ProvidesSource(int sourceP) const
|
||||
{
|
||||
debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
||||
return (!SatipConfig.IsOperatingModeOff() && !!cSatipDiscover::GetInstance()->GetServer(sourceP));
|
||||
}
|
||||
|
||||
@@ -381,6 +381,12 @@ unsigned int cSatipDevice::CheckData(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cSatipDevice::GetId(void)
|
||||
{
|
||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
||||
return deviceIndexM;
|
||||
}
|
||||
|
||||
uchar *cSatipDevice::GetData(int *availableP)
|
||||
{
|
||||
//debug("cSatipDevice::%s(%u)", __FUNCTION__, deviceIndexM);
|
||||
|
1
device.h
1
device.h
@@ -107,6 +107,7 @@ public:
|
||||
public:
|
||||
virtual void WriteData(u_char *bufferP, int lengthP);
|
||||
virtual unsigned int CheckData(void);
|
||||
virtual int GetId(void);
|
||||
};
|
||||
|
||||
#endif // __SATIP_DEVICE_H
|
||||
|
@@ -14,6 +14,7 @@ public:
|
||||
virtual ~cSatipDeviceIf() {}
|
||||
virtual void WriteData(u_char *bufferP, int lengthP) = 0;
|
||||
virtual unsigned int CheckData(void) = 0;
|
||||
virtual int GetId(void) = 0;
|
||||
|
||||
private:
|
||||
cSatipDeviceIf(const cSatipDeviceIf&);
|
||||
|
2
param.c
2
param.c
@@ -158,7 +158,7 @@ cString GetTransponderUrlParameters(const cChannel *channelP)
|
||||
freq /= 1000L;
|
||||
#define ST(s) if (strchr(s, type) && (strchr(s, '0' + dtp.System() + 1) || strchr(s, '*')))
|
||||
#define STBUFLEFT (sizeof(buffer) - (q - buffer))
|
||||
q += snprintf(q, STBUFLEFT, "freq=%s", *dtoa(freq, "%.3f"));
|
||||
q += snprintf(q, STBUFLEFT, "freq=%s", *dtoa(freq, "%lg"));
|
||||
ST(" S *") q += snprintf(q, STBUFLEFT, "&src=%d", ((src > 0) && (src <= 255)) ? src : 1);
|
||||
ST("CS *") q += snprintf(q, STBUFLEFT, "&sr=%d", channelP->Srate());
|
||||
ST(" S *") q += snprintf(q, STBUFLEFT, "&pol=%c", tolower(dtp.Polarization()));
|
||||
|
14
po/ca_ES.po
14
po/ca_ES.po
@@ -5,10 +5,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-satip 0.2.2\n"
|
||||
"Project-Id-Version: vdr-satip 0.2.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-04-05 04:05+0200\n"
|
||||
"PO-Revision-Date: 2014-04-05 04:05+0200\n"
|
||||
"POT-Creation-Date: 2014-04-12 04:12+0200\n"
|
||||
"PO-Revision-Date: 2014-04-12 04:12+0200\n"
|
||||
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
|
||||
"Language-Team: Catalan <vdr@linuxtv.org>\n"
|
||||
"Language: ca\n"
|
||||
@@ -90,7 +90,7 @@ msgid ""
|
||||
"normal - devices are working within normal parameters\n"
|
||||
"high - devices are working at the highest priority"
|
||||
msgstr ""
|
||||
"Defineig la manera de operar de tots els SAT>IP Tuners:\n"
|
||||
"Defineig la manera de operar els Disposituis SAT>IP:\n"
|
||||
"\n"
|
||||
"Apagat - Dispositius desactivats\n"
|
||||
"Baix - Dispositius treballan a baixa prioritat\n"
|
||||
@@ -98,7 +98,7 @@ msgstr ""
|
||||
"Alta - Dispositius treballan a prioritat Alta"
|
||||
|
||||
msgid "Enable EPG scanning"
|
||||
msgstr "Activa Escaneig EPG"
|
||||
msgstr "Activa Escanneig EPG"
|
||||
|
||||
msgid ""
|
||||
"Define whether the EPG background scanning shall be used.\n"
|
||||
@@ -120,9 +120,9 @@ msgid ""
|
||||
"\n"
|
||||
"Certain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."
|
||||
msgstr ""
|
||||
"Definir el nombre de seccions filtres per deshabilitat.\n"
|
||||
"Defineix el numero de filtres de secció que seran deshabilitats.\n"
|
||||
"\n"
|
||||
"Certs filtres de secció podrien causar un comportament no desitjat a VDR, com sincronitzar malament el temps. Per la llista negre els filtres aquí dades de la secció útil es pot deixar intacte per VDR per processar."
|
||||
"Alguns filtres de secció podrien provocar un comportament no desitjat a VDR, com sincronitzar malament l'hora. Posant aquests filtres a la llista negra, aqui, la secció de dades útil pot ser deixada intacta pel seu procès en el VDR."
|
||||
|
||||
msgid "Filter"
|
||||
msgstr "Filtra"
|
||||
|
@@ -5,10 +5,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-satip 0.2.2\n"
|
||||
"Project-Id-Version: vdr-satip 0.2.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-04-05 04:05+0200\n"
|
||||
"PO-Revision-Date: 2014-04-05 04:05+0200\n"
|
||||
"POT-Creation-Date: 2014-04-12 04:12+0200\n"
|
||||
"PO-Revision-Date: 2014-04-12 04:12+0200\n"
|
||||
"Last-Translator: Frank Neumann <fnu@yavdr.org>\n"
|
||||
"Language-Team: German <vdr@linuxtv.org>\n"
|
||||
"Language: de\n"
|
||||
|
137
po/es_ES.po
Normal file
137
po/es_ES.po
Normal file
@@ -0,0 +1,137 @@
|
||||
# VDR plugin language source file.
|
||||
# Copyright (C) 2007-2014 Rolf Ahrenberg
|
||||
# This file is distributed under the same license as the satip package.
|
||||
# Gabriel Bonich, 2014
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-satip 0.2.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-04-12 04:12+0200\n"
|
||||
"PO-Revision-Date: 2014-04-12 04:12+0200\n"
|
||||
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
|
||||
"Language-Team: Spanish <vdr@linuxtv.org>\n"
|
||||
"Language: es\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
msgid "PAT (0x00)"
|
||||
msgstr "PAT (0x00)"
|
||||
|
||||
msgid "NIT (0x40)"
|
||||
msgstr "NIT (0x40)"
|
||||
|
||||
msgid "SDT (0x42)"
|
||||
msgstr "SDT (0x42)"
|
||||
|
||||
msgid "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||
msgstr "EIT (0x4E/0x4F/0x5X/0x6X)"
|
||||
|
||||
msgid "TDT (0x70)"
|
||||
msgstr "TDT (0x70)"
|
||||
|
||||
msgid "SAT>IP Devices"
|
||||
msgstr "SAT>IP Dispositivos"
|
||||
|
||||
msgid "SAT>IP Device"
|
||||
msgstr "SAT>IP Dispositivo"
|
||||
|
||||
msgid "Address"
|
||||
msgstr "Dirección"
|
||||
|
||||
msgid "Model"
|
||||
msgstr "Modelo"
|
||||
|
||||
msgid "Description"
|
||||
msgstr "Descripción"
|
||||
|
||||
msgid "Creation date"
|
||||
msgstr "Fecha creación"
|
||||
|
||||
msgid "SAT>IP Information"
|
||||
msgstr "SAT>IP Información"
|
||||
|
||||
msgid "General"
|
||||
msgstr "General"
|
||||
|
||||
msgid "Pids"
|
||||
msgstr "Pids"
|
||||
|
||||
msgid "Filters"
|
||||
msgstr "Filtros"
|
||||
|
||||
msgid "Bits/bytes"
|
||||
msgstr "Bits/Bytes"
|
||||
|
||||
msgid "SAT>IP information not available!"
|
||||
msgstr "SAT>IP Información no disponible!"
|
||||
|
||||
msgid "off"
|
||||
msgstr "Apagado"
|
||||
|
||||
msgid "low"
|
||||
msgstr "Bajo"
|
||||
|
||||
msgid "normal"
|
||||
msgstr "Normal"
|
||||
|
||||
msgid "high"
|
||||
msgstr "Alto"
|
||||
|
||||
msgid "Operating mode"
|
||||
msgstr "Modo de operación"
|
||||
|
||||
msgid ""
|
||||
"Define the used operating mode for all SAT>IP devices:\n"
|
||||
"\n"
|
||||
"off - devices are disabled\n"
|
||||
"low - devices are working at the lowest priority\n"
|
||||
"normal - devices are working within normal parameters\n"
|
||||
"high - devices are working at the highest priority"
|
||||
msgstr ""
|
||||
"Define la manera que trabajan los Dispositivos SAT>IP:\n"
|
||||
"\n"
|
||||
"Apagat - Dispositivos desactivados\n"
|
||||
"Baix - Dispositivos trabajando con prioridad Baja\n"
|
||||
"Normal - Dispositivos trabajando con prioridad Normal\n"
|
||||
"Alta - Dispositivos trabajando con prioridad Alta"
|
||||
|
||||
msgid "Enable EPG scanning"
|
||||
msgstr "Activa Escaneo EPG"
|
||||
|
||||
msgid ""
|
||||
"Define whether the EPG background scanning shall be used.\n"
|
||||
"\n"
|
||||
"This setting disables the automatic EIT scanning functionality for all SAT>IP devices."
|
||||
msgstr ""
|
||||
"Definir si se utilitzará el analisí en segundo plano del EPG.\n"
|
||||
"\n"
|
||||
"Esta configuración desactiva la funcionalidad del escaneo EIT automática para todos los Dispositivos SAT>IP."
|
||||
|
||||
msgid "Disabled filters"
|
||||
msgstr "Desactiva filtros"
|
||||
|
||||
msgid "none"
|
||||
msgstr "no"
|
||||
|
||||
msgid ""
|
||||
"Define number of section filters to be disabled.\n"
|
||||
"\n"
|
||||
"Certain section filters might cause some unwanted behaviour to VDR such as time being falsely synchronized. By black-listing the filters here useful section data can be left intact for VDR to process."
|
||||
msgstr ""
|
||||
"Define el numero de filtros de sección que seran deshabilitados.\n"
|
||||
"\n"
|
||||
"Algunos filtros de sección podrian causar un comportamiento no deseado a VDR, como sincronizar mal la hora. Poniendo estos filtros en la lista negra, aqui, la sección de datos útiles se puede dejar intacta para su proceso con el VDR."
|
||||
|
||||
msgid "Filter"
|
||||
msgstr "Filtra"
|
||||
|
||||
msgid "Define an ill-behaving filter to be blacklisted."
|
||||
msgstr "Define un filtro para poner en la lista negra."
|
||||
|
||||
msgid "Active SAT>IP devices:"
|
||||
msgstr "Dispositivos SAT>IP activos:"
|
||||
|
||||
msgid "Help"
|
||||
msgstr "Ayuda"
|
@@ -5,10 +5,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: vdr-satip 0.2.2\n"
|
||||
"Project-Id-Version: vdr-satip 0.2.3\n"
|
||||
"Report-Msgid-Bugs-To: <see README>\n"
|
||||
"POT-Creation-Date: 2014-04-05 04:05+0200\n"
|
||||
"PO-Revision-Date: 2014-04-05 04:05+0200\n"
|
||||
"POT-Creation-Date: 2014-04-12 04:12+0200\n"
|
||||
"PO-Revision-Date: 2014-04-12 04:12+0200\n"
|
||||
"Last-Translator: Rolf Ahrenberg\n"
|
||||
"Language-Team: Finnish <vdr@linuxtv.org>\n"
|
||||
"Language: fi\n"
|
||||
|
6
satip.c
6
satip.c
@@ -13,6 +13,10 @@
|
||||
#include "discover.h"
|
||||
#include "setup.h"
|
||||
|
||||
#if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM < 0x072400
|
||||
#warning "CURL version >= 0.7.36 is recommended"
|
||||
#endif
|
||||
|
||||
#if defined(APIVERSNUM) && APIVERSNUM < 20000
|
||||
#error "VDR-2.0.0 API version or greater is required!"
|
||||
#endif
|
||||
@@ -21,7 +25,7 @@
|
||||
#define GITVERSION ""
|
||||
#endif
|
||||
|
||||
const char VERSION[] = "0.2.2" GITVERSION;
|
||||
const char VERSION[] = "0.2.3" GITVERSION;
|
||||
static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
|
||||
|
||||
class cPluginSatip : public cPlugin {
|
||||
|
89
tuner.c
89
tuner.c
@@ -37,20 +37,20 @@ cSatipTuner::cSatipTuner(cSatipDeviceIf &deviceP, unsigned int packetLenP)
|
||||
pidUpdatedM(false),
|
||||
pidsM()
|
||||
{
|
||||
debug("cSatipTuner::%s(%d)", __FUNCTION__, packetBufferLenM);
|
||||
debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, packetBufferLenM, deviceM->GetId());
|
||||
// Allocate packet buffer
|
||||
packetBufferM = MALLOC(unsigned char, packetBufferLenM);
|
||||
if (packetBufferM)
|
||||
memset(packetBufferM, 0, packetBufferLenM);
|
||||
else
|
||||
error("MALLOC() failed for packet buffer");
|
||||
error("MALLOC() failed for packet buffer [device %d]", deviceM->GetId());
|
||||
// Start thread
|
||||
Start();
|
||||
}
|
||||
|
||||
cSatipTuner::~cSatipTuner()
|
||||
{
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
// Stop thread
|
||||
sleepM.Signal();
|
||||
if (Running())
|
||||
@@ -96,7 +96,7 @@ size_t cSatipTuner::HeaderCallback(void *ptrP, size_t sizeP, size_t nmembP, void
|
||||
|
||||
void cSatipTuner::Action(void)
|
||||
{
|
||||
debug("cSatipTuner::%s(): entering", __FUNCTION__);
|
||||
debug("cSatipTuner::%s(): entering [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
cTimeMs timeout(eReConnectTimeoutMs);
|
||||
// Increase priority
|
||||
SetPriority(-1);
|
||||
@@ -137,12 +137,12 @@ void cSatipTuner::Action(void)
|
||||
sleepM.Wait(10); // to avoid busy loop and reduce cpu load
|
||||
}
|
||||
}
|
||||
debug("cSatipTuner::%s(): exiting", __FUNCTION__);
|
||||
debug("cSatipTuner::%s(): exiting [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
}
|
||||
|
||||
bool cSatipTuner::Open(void)
|
||||
{
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
if (Connect()) {
|
||||
openedM = true;
|
||||
return true;
|
||||
@@ -152,7 +152,7 @@ bool cSatipTuner::Open(void)
|
||||
|
||||
bool cSatipTuner::Close(void)
|
||||
{
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
openedM = false;
|
||||
Disconnect();
|
||||
return true;
|
||||
@@ -161,7 +161,7 @@ bool cSatipTuner::Close(void)
|
||||
bool cSatipTuner::Connect(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
|
||||
// Initialize the curl session
|
||||
if (!handleM)
|
||||
@@ -173,7 +173,7 @@ bool cSatipTuner::Connect(void)
|
||||
|
||||
// Just retune
|
||||
if (tunedM && (streamIdM >= 0)) {
|
||||
debug("cSatipTuner::%s(): retune", __FUNCTION__);
|
||||
debug("cSatipTuner::%s(): retune [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY);
|
||||
@@ -191,11 +191,6 @@ bool cSatipTuner::Connect(void)
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_VERBOSE, 1L);
|
||||
#endif
|
||||
|
||||
// Set callback
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_HEADERFUNCTION, cSatipTuner::HeaderCallback);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_WRITEHEADER, this);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_WRITEDATA, this);
|
||||
|
||||
// No progress meter and no signaling
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_NOPROGRESS, 1L);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_NOSIGNAL, 1L);
|
||||
@@ -205,7 +200,7 @@ bool cSatipTuner::Connect(void)
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_CONNECTTIMEOUT_MS, (long)eConnectTimeoutMs);
|
||||
|
||||
// Set user-agent
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s", PLUGIN_NAME_I18N, VERSION));
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s (device %d)", PLUGIN_NAME_I18N, VERSION, deviceM->GetId()));
|
||||
|
||||
// Set URL
|
||||
char *p = curl_easy_unescape(handleM, *streamAddrM, 0, NULL);
|
||||
@@ -223,35 +218,46 @@ bool cSatipTuner::Connect(void)
|
||||
rtcpSocketM->Close();
|
||||
}
|
||||
if ((rtpSocketM->Port() <= 0) || (rtcpSocketM->Port() <= 0)) {
|
||||
error("Cannot open required ports!");
|
||||
error("Cannot open required RTP/RTCP ports [device %d]", deviceM->GetId());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Request server options: "&pids=all" for the whole mux
|
||||
// Request server options
|
||||
keepAliveM.Set(timeoutM);
|
||||
uri = cString::sprintf("rtsp://%s/?%s&pids=0", *streamAddrM, *streamParamM);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_OPTIONS);
|
||||
SATIP_CURL_EASY_PERFORM(handleM);
|
||||
if (!ValidateLatestResponse())
|
||||
return false;
|
||||
|
||||
// Setup media stream
|
||||
// Setup media stream: "&pids=all" for the whole mux
|
||||
uri = cString::sprintf("rtsp://%s/?%s", *streamAddrM, *streamParamM);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
transport = cString::sprintf("RTP/AVP;unicast;client_port=%d-%d", rtpSocketM->Port(), rtcpSocketM->Port());
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_TRANSPORT, *transport);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_SETUP);
|
||||
// Set header callback for catching the session and timeout
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_HEADERFUNCTION, cSatipTuner::HeaderCallback);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_WRITEHEADER, this);
|
||||
SATIP_CURL_EASY_PERFORM(handleM);
|
||||
// Session id is now known - disable header parsing
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_HEADERFUNCTION, NULL);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_WRITEHEADER, NULL);
|
||||
//SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_SESSION_ID, *sessionM);
|
||||
if (!ValidateLatestResponse())
|
||||
return false;
|
||||
|
||||
// Start playing
|
||||
uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
//SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_SESSION_ID, *sessionM);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY);
|
||||
SATIP_CURL_EASY_PERFORM(handleM);
|
||||
if (!ValidateLatestResponse())
|
||||
return false;
|
||||
if (pidsM.Size()) {
|
||||
uri = cString::sprintf("rtsp://%s/stream=%d?pids=", *streamAddrM, streamIdM);
|
||||
for (int i = 0; i < pidsM.Size(); ++i)
|
||||
uri = cString::sprintf("%s%d%s", *uri, pidsM[i], (i == (pidsM.Size() - 1)) ? "" : ",");
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_STREAM_URI, *uri);
|
||||
SATIP_CURL_EASY_SETOPT(handleM, CURLOPT_RTSP_REQUEST, (long)CURL_RTSPREQ_PLAY);
|
||||
SATIP_CURL_EASY_PERFORM(handleM);
|
||||
if (!ValidateLatestResponse())
|
||||
return false;
|
||||
}
|
||||
|
||||
tunedM = true;
|
||||
if (nextServerM) {
|
||||
@@ -268,7 +274,7 @@ bool cSatipTuner::Connect(void)
|
||||
bool cSatipTuner::Disconnect(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
|
||||
// Terminate curl session
|
||||
if (handleM) {
|
||||
@@ -305,13 +311,14 @@ bool cSatipTuner::Disconnect(void)
|
||||
cSatipDiscover::GetInstance()->UseServer(currentServerM, false);
|
||||
tunedM = false;
|
||||
timeoutM = eMinKeepAliveIntervalMs;
|
||||
pidUpdatedM = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cSatipTuner::ValidateLatestResponse(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
if (handleM) {
|
||||
long rc = 0;
|
||||
CURLcode res = CURLE_OK;
|
||||
@@ -319,7 +326,7 @@ bool cSatipTuner::ValidateLatestResponse(void)
|
||||
if (rc == 200)
|
||||
return true;
|
||||
else if (rc != 0)
|
||||
error("Tuner detected invalid status code: %ld", rc);
|
||||
error("Tuner detected invalid status code %ld [device %d]", rc, deviceM->GetId());
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -327,7 +334,7 @@ bool cSatipTuner::ValidateLatestResponse(void)
|
||||
|
||||
void cSatipTuner::ParseReceptionParameters(const char *paramP)
|
||||
{
|
||||
//debug("cSatipTuner::%s(%s)", __FUNCTION__, paramP);
|
||||
//debug("cSatipTuner::%s(%s) [device %d]", __FUNCTION__, paramP, deviceM->GetId());
|
||||
// DVB-S2:
|
||||
// ver=<major>.<minor>;src=<srcID>;tuner=<feID>,<level>,<lock>,<quality>,<frequency>,<polarisation>,<system>,<type>,<pilots>,<roll_off>,<symbol_rate>,<fec_inner>;pids=<pid0>,...,<pidn>
|
||||
// DVB-T2:
|
||||
@@ -374,21 +381,21 @@ void cSatipTuner::ParseReceptionParameters(const char *paramP)
|
||||
void cSatipTuner::SetStreamId(int streamIdP)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("cSatipTuner::%s(%d)", __FUNCTION__, streamIdP);
|
||||
debug("cSatipTuner::%s(%d) [device %d]", __FUNCTION__, streamIdP, deviceM->GetId());
|
||||
streamIdM = streamIdP;
|
||||
}
|
||||
|
||||
void cSatipTuner::SetSessionTimeout(const char *sessionP, int timeoutP)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
debug("cSatipTuner::%s(%s, %d)", __FUNCTION__, sessionP, timeoutP);
|
||||
debug("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, sessionP, timeoutP, deviceM->GetId());
|
||||
sessionM = sessionP;
|
||||
timeoutM = (timeoutP > eMinKeepAliveIntervalMs) ? timeoutP : eMinKeepAliveIntervalMs;
|
||||
}
|
||||
|
||||
bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const int indexP)
|
||||
{
|
||||
debug("cSatipTuner::%s(%s, %d)", __FUNCTION__, parameterP, indexP);
|
||||
debug("cSatipTuner::%s(%s, %d) [device %d]", __FUNCTION__, parameterP, indexP, deviceM->GetId());
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
nextServerM = cSatipDiscover::GetInstance()->GetServer(serverP);
|
||||
if (nextServerM && !isempty(nextServerM->Address()) && !isempty(parameterP)) {
|
||||
@@ -403,7 +410,7 @@ bool cSatipTuner::SetSource(cSatipServer *serverP, const char *parameterP, const
|
||||
|
||||
bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
//debug("cSatipTuner::%s(%d, %d, %d)", __FUNCTION__, pidP, typeP, onP);
|
||||
//debug("cSatipTuner::%s(%d, %d, %d) [device %d]", __FUNCTION__, pidP, typeP, onP, deviceM->GetId());
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
bool found = false;
|
||||
for (int i = 0; i < pidsM.Size(); ++i) {
|
||||
@@ -428,7 +435,7 @@ bool cSatipTuner::UpdatePids(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
if (pidUpdateCacheM.TimedOut() && pidUpdatedM && pidsM.Size() && tunedM && handleM && !isempty(*streamAddrM) && (streamIdM > 0)) {
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
CURLcode res = CURLE_OK;
|
||||
//cString uri = cString::sprintf("rtsp://%s/stream=%d?%spids=%d", *streamAddrM, streamIdM, onP ? "add" : "del", pidP);
|
||||
cString uri = cString::sprintf("rtsp://%s/stream=%d?pids=", *streamAddrM, streamIdM);
|
||||
@@ -454,7 +461,7 @@ bool cSatipTuner::KeepAlive(void)
|
||||
{
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
if (tunedM && handleM && keepAliveM.TimedOut()) {
|
||||
debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
CURLcode res = CURLE_OK;
|
||||
cString uri = cString::sprintf("rtsp://%s/stream=%d", *streamAddrM, streamIdM);
|
||||
|
||||
@@ -474,30 +481,30 @@ bool cSatipTuner::KeepAlive(void)
|
||||
|
||||
int cSatipTuner::SignalStrength(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return signalStrengthM;
|
||||
}
|
||||
|
||||
int cSatipTuner::SignalQuality(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return signalQualityM;
|
||||
}
|
||||
|
||||
bool cSatipTuner::HasLock(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return tunedM && hasLockM;
|
||||
}
|
||||
|
||||
cString cSatipTuner::GetSignalStatus(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return cString::sprintf("lock=%d strength=%d quality=%d", HasLock(), SignalStrength(), SignalQuality());
|
||||
}
|
||||
|
||||
cString cSatipTuner::GetInformation(void)
|
||||
{
|
||||
//debug("cSatipTuner::%s()", __FUNCTION__);
|
||||
//debug("cSatipTuner::%s() [device %d]", __FUNCTION__, deviceM->GetId());
|
||||
return tunedM ? cString::sprintf("rtsp://%s/?%s [stream=%d]", *streamAddrM, *streamParamM, streamIdM) : "connection failed";
|
||||
}
|
||||
|
Reference in New Issue
Block a user