mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Modified protocol parsing.
This commit is contained in:
parent
41d459dbf6
commit
ae75f0dffd
14
device.c
14
device.c
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: device.c,v 1.2 2007/09/12 18:55:31 rahrenbe Exp $
|
* $Id: device.c,v 1.3 2007/09/12 21:14:51 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -64,24 +64,24 @@ cIptvDevice *cIptvDevice::Get(unsigned int DeviceIndex)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, int *Protocol)
|
cString cIptvDevice::GetChannelSettings(const char *Param, int *IpPort, cString *Protocol)
|
||||||
{
|
{
|
||||||
unsigned int a, b, c, d;
|
unsigned int a, b, c, d;
|
||||||
|
|
||||||
debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex);
|
debug("cIptvDevice::GetChannelSettings(%d)\n", deviceIndex);
|
||||||
if (sscanf(Param, "IPTV-UDP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) {
|
if (sscanf(Param, "IPTV-UDP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) {
|
||||||
debug("UDP channel detected\n");
|
debug("UDP channel detected\n");
|
||||||
Protocol = (int*)(cIptvStreamer::PROTOCOL_UDP);
|
*Protocol = cString("udp", true);
|
||||||
return cString::sprintf("%u.%u.%u.%u", a, b, c, d);
|
return cString::sprintf("%u.%u.%u.%u", a, b, c, d);
|
||||||
}
|
}
|
||||||
else if (sscanf(Param, "IPTV-RTSP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) {
|
else if (sscanf(Param, "IPTV-RTSP-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) {
|
||||||
debug("RTSP channel detected\n");
|
debug("RTSP channel detected\n");
|
||||||
Protocol = (int*)(cIptvStreamer::PROTOCOL_RTSP);
|
*Protocol = cString("rtsp", true);
|
||||||
return cString::sprintf("%u.%u.%u.%u", a, b, c, d);
|
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-%u.%u.%u.%u-%u", &a, &b, &c, &d, IpPort) == 5) {
|
||||||
debug("HTTP channel detected\n");
|
debug("HTTP channel detected\n");
|
||||||
Protocol = (int*)cIptvStreamer::PROTOCOL_HTTP;
|
*Protocol = cString("http", true);
|
||||||
return cString::sprintf("%u.%u.%u.%u", a, b, c, d);
|
return cString::sprintf("%u.%u.%u.%u", a, b, c, d);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -120,8 +120,8 @@ bool cIptvDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *N
|
|||||||
|
|
||||||
bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
|
bool cIptvDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
|
||||||
{
|
{
|
||||||
int port, protocol;
|
int port;
|
||||||
cString addr;
|
cString protocol, addr;
|
||||||
|
|
||||||
debug("cIptvDevice::SetChannelDevice(%d)\n", deviceIndex);
|
debug("cIptvDevice::SetChannelDevice(%d)\n", deviceIndex);
|
||||||
addr = GetChannelSettings(Channel->Param(), &port, &protocol);
|
addr = GetChannelSettings(Channel->Param(), &port, &protocol);
|
||||||
|
4
device.h
4
device.h
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: device.h,v 1.1 2007/09/12 17:28:59 rahrenbe Exp $
|
* $Id: device.h,v 1.2 2007/09/12 21:14:51 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_DEVICE_H
|
#ifndef __IPTV_DEVICE_H
|
||||||
@ -36,7 +36,7 @@ public:
|
|||||||
|
|
||||||
// for channel parsing
|
// for channel parsing
|
||||||
private:
|
private:
|
||||||
cString GetChannelSettings(const char *Param, int *IpPort, int *Protocol);
|
cString GetChannelSettings(const char *Param, int *IpPort, cString *Protocol);
|
||||||
bool ProvidesIptv(const char *Param) const;
|
bool ProvidesIptv(const char *Param) const;
|
||||||
|
|
||||||
// for channel selection
|
// for channel selection
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: streamer.c,v 1.6 2007/09/12 18:58:39 ajhseppa Exp $
|
* $Id: streamer.c,v 1.7 2007/09/12 21:14:51 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -22,7 +22,6 @@
|
|||||||
cIptvStreamer::cIptvStreamer(cRingBufferLinear* BufferPtr, cMutex* Mutex)
|
cIptvStreamer::cIptvStreamer(cRingBufferLinear* BufferPtr, cMutex* Mutex)
|
||||||
: cThread("IPTV streamer"),
|
: cThread("IPTV streamer"),
|
||||||
dataPort(1234),
|
dataPort(1234),
|
||||||
dataProtocol(PROTOCOL_UDP),
|
|
||||||
pRingBuffer(BufferPtr),
|
pRingBuffer(BufferPtr),
|
||||||
bufferSize(TS_SIZE * 7),
|
bufferSize(TS_SIZE * 7),
|
||||||
mutex(Mutex),
|
mutex(Mutex),
|
||||||
@ -193,9 +192,9 @@ bool cIptvStreamer::Deactivate()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIptvStreamer::SetStream(const char* address, const int port, const int protocol)
|
bool cIptvStreamer::SetStream(const char* address, const int port, const char* protocol)
|
||||||
{
|
{
|
||||||
debug("cIptvStreamer::SetChannel(): channel = %s:%d (%d)\n", address, port, protocol);
|
debug("cIptvStreamer::SetChannel(): %s://%s:%d\n", protocol, address, port);
|
||||||
|
|
||||||
// De-activate the reception if it is running currently. Otherwise the
|
// De-activate the reception if it is running currently. Otherwise the
|
||||||
// reception stream is overwritten and cannot be un-set after this
|
// reception stream is overwritten and cannot be un-set after this
|
||||||
|
10
streamer.h
10
streamer.h
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: streamer.h,v 1.2 2007/09/12 18:33:56 ajhseppa Exp $
|
* $Id: streamer.h,v 1.3 2007/09/12 21:14:51 rahrenbe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __IPTV_STREAMER_H
|
#ifndef __IPTV_STREAMER_H
|
||||||
@ -19,7 +19,6 @@ private:
|
|||||||
char stream[256];
|
char stream[256];
|
||||||
int socketDesc;
|
int socketDesc;
|
||||||
int dataPort;
|
int dataPort;
|
||||||
int dataProtocol;
|
|
||||||
struct sockaddr_in sa;
|
struct sockaddr_in sa;
|
||||||
cRingBufferLinear* pRingBuffer;
|
cRingBufferLinear* pRingBuffer;
|
||||||
unsigned char* pReceiveBuffer;
|
unsigned char* pReceiveBuffer;
|
||||||
@ -32,16 +31,11 @@ private:
|
|||||||
void CloseSocket();
|
void CloseSocket();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {
|
|
||||||
PROTOCOL_UDP,
|
|
||||||
PROTOCOL_RTSP,
|
|
||||||
PROTOCOL_HTTP
|
|
||||||
};
|
|
||||||
cIptvStreamer();
|
cIptvStreamer();
|
||||||
cIptvStreamer(cRingBufferLinear* BufferPtr, cMutex* Mutex);
|
cIptvStreamer(cRingBufferLinear* BufferPtr, cMutex* Mutex);
|
||||||
virtual ~cIptvStreamer();
|
virtual ~cIptvStreamer();
|
||||||
virtual void Action();
|
virtual void Action();
|
||||||
bool SetStream(const char* address, const int port, const int protocol);
|
bool SetStream(const char* address, const int port, const char* protocol);
|
||||||
bool Activate();
|
bool Activate();
|
||||||
bool Deactivate();
|
bool Deactivate();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user