Reworked channel parameter field.

This commit is contained in:
Rolf Ahrenberg 2007-09-16 13:11:19 +00:00
parent 2751ba9d7f
commit b95e93408f
3 changed files with 29 additions and 16 deletions

6
README
View File

@ -37,8 +37,7 @@ make plugins
Channels.conf example:
TV1;IPTV:1:IPTV-UDP-192.168.0.1-1234:P:27500:512:650:2321:0:17:8438:4097:0
TV2;IPTV:2:IPTV-UDP-192.168.0.2-1234:P:27500:513:660:2321:0:33:8438:4097:0
TV1;IPTV:1:IPTV|UDP|192.168.0.1|1234:P:27500:512:650:2321:0:17:8438:4097:0
^ ^ ^ ^ ^ ^
| | | | | Source type ("P")
| | | | IP Port Number
@ -47,6 +46,9 @@ TV2;IPTV:2:IPTV-UDP-192.168.0.2-1234:P:27500:513:660:2321:0:33:8438:4097:0
| Plugin ID ("IPTV")
Unique enumeration
TV2;IPTV:2:IPTV|HTTP|127.0.0.1/TS/2|8080:P:27500:513:660:2321:0:33:8438:4097:0
TV3;IPTV:2:IPTV|FILE|/media/video.ts|8080:P:27500:513:660:2321:0:33:8438:4097:0
Notes:
- Remember to open IGMP in the firewall for multicast streams

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: device.c,v 1.18 2007/09/16 12:18:15 ajhseppa Exp $
* $Id: device.c,v 1.19 2007/09/16 13:11:19 rahrenbe Exp $
*/
#include "common.h"
@ -32,9 +32,9 @@ cIptvDevice::cIptvDevice(unsigned int Index)
tsBufferPrefill -= (tsBufferPrefill % TS_SIZE);
//debug("Buffer=%d Prefill=%d\n", MEGABYTE(IptvConfig.GetBufferSizeMB()), tsBufferPrefill);
pUdpProtocol = new cIptvProtocolUdp();
//pRtspProtocol = new cIptvProtocolRtsp();
pHttpProtocol = new cIptvProtocolHttp();
pFileProtocol = new cIptvProtocolFile();
//pRtspProtocol = new cIptvProtocolRtsp();
pIptvStreamer = new cIptvStreamer(tsBuffer, &mutex);
StartSectionHandler();
}
@ -78,21 +78,32 @@ cIptvDevice *cIptvDevice::Get(unsigned int DeviceIndex)
cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cIptvProtocolIf* *Protocol)
{
unsigned int a, b, c, d;
debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex);
if (sscanf(Param, "IPTV-UDP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) {
char *loc = NULL;
if (sscanf(Param, "IPTV|UDP|%a[^|]|%u", &loc, IpPort) == 5) {
cString addr(loc, true);
free(loc);
*Protocol = pUdpProtocol;
return cString::sprintf("%u.%u.%u.%u", a, b, c, d);
return addr;
}
//else if (sscanf(Param, "IPTV-RTSP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) {
// *Protocol = pRtspProtocol;
// return cString::sprintf("%u.%u.%u.%u", a, b, c, d);
// }
else if (sscanf(Param, "IPTV-HTTP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) {
else if (sscanf(Param, "IPTV|HTTP|%a[^|]|%u", &loc, IpPort) == 5) {
cString addr(loc, true);
free(loc);
*Protocol = pHttpProtocol;
return cString::sprintf("%u.%u.%u.%u", a, b, c, d);
return addr;
}
//else if (sscanf(Param, "IPTV|FILE|%a[^|]|%u", &loc, IpPort) == 5) {
// cString addr(loc, true);
// free(loc);
// *Protocol = pFileProtocol;
// return addr;
// }
//else if (sscanf(Param, "IPTV|RTSP|%a[^|]|%u", &loc, IpPort) == 5) {
// cString addr(loc, true);
// free(loc);
// *Protocol = pRtspProtocol;
// return addr;
// }
return NULL;
}

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: device.h,v 1.8 2007/09/16 12:18:15 ajhseppa Exp $
* $Id: device.h,v 1.9 2007/09/16 13:11:19 rahrenbe Exp $
*/
#ifndef __IPTV_DEVICE_H
@ -32,9 +32,9 @@ private:
cRingBufferLinear *tsBuffer;
int tsBufferPrefill;
cIptvProtocolUdp *pUdpProtocol;
//cIptvProtocolRtsp *pRtspProtocol;
cIptvProtocolHttp *pHttpProtocol;
cIptvProtocolFile *pFileProtocol;
//cIptvProtocolRtsp *pRtspProtocol;
cIptvStreamer *pIptvStreamer;
cMutex mutex;