Browse Source

Added support for a service interface.

vdr-2.0.x
Rolf Ahrenberg 10 years ago
parent
commit
7a8b2962b2
  1. 3
      HISTORY
  2. 2
      common.h
  3. 8
      device.c
  4. 15
      iptv.c
  5. 22
      iptvservice.h
  6. 2
      statistics.c
  7. 6
      streamer.c

3
HISTORY

@ -159,7 +159,8 @@ VDR Plugin 'iptv' Revision History
- Added support for LDFLAGS.
- 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.
- Fixed some channel switching bugs.
- Added support for a service interface.

2
common.h

@ -30,6 +30,8 @@
#define IPTV_DEVICE_INFO_GENERAL 1
#define IPTV_DEVICE_INFO_PIDS 2
#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_FILTERS_COUNT 10

8
device.c

@ -123,7 +123,7 @@ cIptvDevice *cIptvDevice::GetIptvDevice(int CardIndex)
cString cIptvDevice::GetGeneralInformation(void)
{
//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(),
pIptvStreamer ? *pIptvStreamer->GetInformation() : "",
pIptvStreamer ? *pIptvStreamer->GetStreamerStatistic() : "",
@ -169,6 +169,12 @@ cString cIptvDevice::GetInformation(unsigned int Page)
case IPTV_DEVICE_INFO_FILTERS:
info = GetFiltersInformation();
break;
case IPTV_DEVICE_INFO_PROTOCOL:
info = pIptvStreamer ? *pIptvStreamer->GetInformation() : "";
break;
case IPTV_DEVICE_INFO_BITRATE:
info = pIptvStreamer ? *pIptvStreamer->GetStreamerStatistic() : "";
break;
default:
info = cString::sprintf("%s%s%s",
*GetGeneralInformation(),

15
iptv.c

@ -11,6 +11,7 @@
#include "config.h"
#include "setup.h"
#include "device.h"
#include "iptvservice.h"
#if defined(APIVERSNUM) && APIVERSNUM < 10727
#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)
{
//debug("cPluginIptv::Service()\n");
// Handle custom service requests from other plugins
debug("cPluginIptv::Service()\n");
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;
}

22
iptvservice.h

@ -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

2
statistics.c

@ -148,7 +148,7 @@ cString cIptvStreamerStatistics::GetStreamerStatistic()
long bitrate = elapsed ? (long)(1000.0L * dataBytes / KILOBYTE(1) / elapsed) : 0L;
if (!IptvConfig.GetUseBytes())
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;
return info;
}

6
streamer.c

@ -108,8 +108,8 @@ bool cIptvStreamer::Set(const char* Location, const int Parameter, const int Ind
cString cIptvStreamer::GetInformation(void)
{
//debug("cIptvStreamer::GetInformation()");
cString info("Stream:");
cString info;
if (protocol)
info = cString::sprintf("%s %s", *info, *protocol->GetInformation());
return cString::sprintf("%s\n", *info);
info = protocol->GetInformation();
return info;
}
Loading…
Cancel
Save