mirror of
https://github.com/rofafor/vdr-plugin-iptv.git
synced 2023-10-10 13:37:03 +02:00
Added support for a service interface.
This commit is contained in:
parent
626d0402c2
commit
7a8b2962b2
3
HISTORY
3
HISTORY
@ -159,7 +159,8 @@ VDR Plugin 'iptv' Revision History
|
|||||||
- Added support for LDFLAGS.
|
- Added support for LDFLAGS.
|
||||||
- Added cppcheck target into Makefile.
|
- Added cppcheck target into Makefile.
|
||||||
|
|
||||||
2012-04-01: Version 0.5.1
|
2012-xx-xx: Version 0.5.1
|
||||||
|
|
||||||
- Updated for vdr-1.7.27.
|
- Updated for vdr-1.7.27.
|
||||||
- Fixed some channel switching bugs.
|
- Fixed some channel switching bugs.
|
||||||
|
- Added support for a service interface.
|
||||||
|
2
common.h
2
common.h
@ -30,6 +30,8 @@
|
|||||||
#define IPTV_DEVICE_INFO_GENERAL 1
|
#define IPTV_DEVICE_INFO_GENERAL 1
|
||||||
#define IPTV_DEVICE_INFO_PIDS 2
|
#define IPTV_DEVICE_INFO_PIDS 2
|
||||||
#define IPTV_DEVICE_INFO_FILTERS 3
|
#define IPTV_DEVICE_INFO_FILTERS 3
|
||||||
|
#define IPTV_DEVICE_INFO_PROTOCOL 4
|
||||||
|
#define IPTV_DEVICE_INFO_BITRATE 5
|
||||||
|
|
||||||
#define IPTV_STATS_ACTIVE_PIDS_COUNT 10
|
#define IPTV_STATS_ACTIVE_PIDS_COUNT 10
|
||||||
#define IPTV_STATS_ACTIVE_FILTERS_COUNT 10
|
#define IPTV_STATS_ACTIVE_FILTERS_COUNT 10
|
||||||
|
8
device.c
8
device.c
@ -123,7 +123,7 @@ cIptvDevice *cIptvDevice::GetIptvDevice(int CardIndex)
|
|||||||
cString cIptvDevice::GetGeneralInformation(void)
|
cString cIptvDevice::GetGeneralInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvDevice::GetGeneralInformation(%d)\n", deviceIndex);
|
//debug("cIptvDevice::GetGeneralInformation(%d)\n", deviceIndex);
|
||||||
return cString::sprintf("IPTV device: %d\nCardIndex: %d\n%s%s%sChannel: %s",
|
return cString::sprintf("IPTV device: %d\nCardIndex: %d\nStream: %s\nStream bitrate: %s\n%sChannel: %s",
|
||||||
deviceIndex, CardIndex(),
|
deviceIndex, CardIndex(),
|
||||||
pIptvStreamer ? *pIptvStreamer->GetInformation() : "",
|
pIptvStreamer ? *pIptvStreamer->GetInformation() : "",
|
||||||
pIptvStreamer ? *pIptvStreamer->GetStreamerStatistic() : "",
|
pIptvStreamer ? *pIptvStreamer->GetStreamerStatistic() : "",
|
||||||
@ -169,6 +169,12 @@ cString cIptvDevice::GetInformation(unsigned int Page)
|
|||||||
case IPTV_DEVICE_INFO_FILTERS:
|
case IPTV_DEVICE_INFO_FILTERS:
|
||||||
info = GetFiltersInformation();
|
info = GetFiltersInformation();
|
||||||
break;
|
break;
|
||||||
|
case IPTV_DEVICE_INFO_PROTOCOL:
|
||||||
|
info = pIptvStreamer ? *pIptvStreamer->GetInformation() : "";
|
||||||
|
break;
|
||||||
|
case IPTV_DEVICE_INFO_BITRATE:
|
||||||
|
info = pIptvStreamer ? *pIptvStreamer->GetStreamerStatistic() : "";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
info = cString::sprintf("%s%s%s",
|
info = cString::sprintf("%s%s%s",
|
||||||
*GetGeneralInformation(),
|
*GetGeneralInformation(),
|
||||||
|
15
iptv.c
15
iptv.c
@ -11,6 +11,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
#include "iptvservice.h"
|
||||||
|
|
||||||
#if defined(APIVERSNUM) && APIVERSNUM < 10727
|
#if defined(APIVERSNUM) && APIVERSNUM < 10727
|
||||||
#error "VDR-1.7.27 API version or greater is required!"
|
#error "VDR-1.7.27 API version or greater is required!"
|
||||||
@ -200,8 +201,18 @@ bool cPluginIptv::SetupParse(const char *Name, const char *Value)
|
|||||||
|
|
||||||
bool cPluginIptv::Service(const char *Id, void *Data)
|
bool cPluginIptv::Service(const char *Id, void *Data)
|
||||||
{
|
{
|
||||||
//debug("cPluginIptv::Service()\n");
|
debug("cPluginIptv::Service()\n");
|
||||||
// Handle custom service requests from other plugins
|
if (strcmp(Id,"IptvService-v1.0") == 0) {
|
||||||
|
if (Data) {
|
||||||
|
IptvService_v1_0 *data = (IptvService_v1_0*)Data;
|
||||||
|
cIptvDevice *dev = cIptvDevice::GetIptvDevice(data->cardIndex);
|
||||||
|
if (!dev)
|
||||||
|
return false;
|
||||||
|
data->protocol = dev->GetInformation(IPTV_DEVICE_INFO_PROTOCOL);
|
||||||
|
data->bitrate = dev->GetInformation(IPTV_DEVICE_INFO_BITRATE);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
iptvservice.h
Normal file
22
iptvservice.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* iptvservice.h: IPTV plugin for the Video Disk Recorder
|
||||||
|
*
|
||||||
|
* See the README file for copyright information and how to reach the author.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __IPTVSERVICE_H
|
||||||
|
#define __IPTVSERVICE_H
|
||||||
|
|
||||||
|
#include <vdr/tools.h>
|
||||||
|
|
||||||
|
#define stIptv ('I' << 24)
|
||||||
|
|
||||||
|
struct IptvService_v1_0 {
|
||||||
|
unsigned int cardIndex;
|
||||||
|
cString protocol;
|
||||||
|
cString bitrate;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__IPTVSERVICE_H
|
||||||
|
|
@ -148,7 +148,7 @@ cString cIptvStreamerStatistics::GetStreamerStatistic()
|
|||||||
long bitrate = elapsed ? (long)(1000.0L * dataBytes / KILOBYTE(1) / elapsed) : 0L;
|
long bitrate = elapsed ? (long)(1000.0L * dataBytes / KILOBYTE(1) / elapsed) : 0L;
|
||||||
if (!IptvConfig.GetUseBytes())
|
if (!IptvConfig.GetUseBytes())
|
||||||
bitrate *= 8;
|
bitrate *= 8;
|
||||||
cString info = cString::sprintf("Stream bitrate: %ld k%s/s\n", bitrate, IptvConfig.GetUseBytes() ? "B" : "bit");
|
cString info = cString::sprintf("%ld k%s/s", bitrate, IptvConfig.GetUseBytes() ? "B" : "bit");
|
||||||
dataBytes = 0;
|
dataBytes = 0;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,8 @@ bool cIptvStreamer::Set(const char* Location, const int Parameter, const int Ind
|
|||||||
cString cIptvStreamer::GetInformation(void)
|
cString cIptvStreamer::GetInformation(void)
|
||||||
{
|
{
|
||||||
//debug("cIptvStreamer::GetInformation()");
|
//debug("cIptvStreamer::GetInformation()");
|
||||||
cString info("Stream:");
|
cString info;
|
||||||
if (protocol)
|
if (protocol)
|
||||||
info = cString::sprintf("%s %s", *info, *protocol->GetInformation());
|
info = protocol->GetInformation();
|
||||||
return cString::sprintf("%s\n", *info);
|
return info;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user