media-plugins/vdr-devstatus: fix for >vdr-2.3
authorMartin Dummer <martin.dummer@gmx.net>
Sat, 9 Nov 2019 10:32:24 +0000 (11:32 +0100)
committerJoonas Niilola <juippis@gentoo.org>
Wed, 20 Nov 2019 14:39:31 +0000 (16:39 +0200)
add misc patches to make the plugin work together
with >media-video/vdr-2.3

Package-Manager: Portage-2.3.78, Repoman-2.3.17
Signed-off-by: Martin Dummer <martin.dummer@gmx.net>
Closes: https://github.com/gentoo/gentoo/pull/13592
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-channelswitch.patch [new file with mode: 0644]
media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-dvb-adapter-frontend.patch [new file with mode: 0644]
media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-memoryleak.patch [new file with mode: 0644]
media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-recordingfound.patch [new file with mode: 0644]
media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-vdr2.3.patch [new file with mode: 0644]
media-plugins/vdr-devstatus/metadata.xml
media-plugins/vdr-devstatus/vdr-devstatus-0.4.1-r1.ebuild [new file with mode: 0644]

diff --git a/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-channelswitch.patch b/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-channelswitch.patch
new file mode 100644 (file)
index 0000000..fbba371
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/devstatus.c
++++ b/devstatus.c
+@@ -122,7 +122,7 @@
+ #else
+     virtual void Recording(const cDevice *Device, const char *Name);
+ #endif
+-    virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber);
++    virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView);
+ };
+ cList<cRecObj> CurrentRecordings;
+@@ -660,7 +660,7 @@
+     }
+ }
+-void cDevStatusMonitor::ChannelSwitch(const cDevice *Device, int ChannelNumber) {
++void cDevStatusMonitor::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView) {
+       if (!ChannelNumber) return;
+       update=1;
+ }
diff --git a/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-dvb-adapter-frontend.patch b/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-dvb-adapter-frontend.patch
new file mode 100644 (file)
index 0000000..05572a2
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/devstatus.c
++++ b/devstatus.c
+@@ -161,6 +161,10 @@
+ private:
+ public:
+      void deviceinfoAsString(cDevice *d) {
++        cDvbDevice *dvb = dynamic_cast<cDvbDevice *>(d);
++        if (dvb == NULL)
++           return;
++
+         struct dvb_frontend_info m_FrontendInfo;
+         int m_Frontend;
+         // fe_status_t status;
+@@ -170,7 +174,7 @@
+         char* output = NULL;
+         #define FRONTEND_DEVICE "/dev/dvb/adapter%d/frontend%d"
+-        cString dev = cString::sprintf(FRONTEND_DEVICE, d->CardIndex(), 0);
++        cString dev = cString::sprintf(FRONTEND_DEVICE, dvb->Adapter(), dvb->Frontend());
+         m_Frontend = open(dev, O_RDONLY | O_NONBLOCK);
+         if (m_Frontend < 0) {
+            return;
diff --git a/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-memoryleak.patch b/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-memoryleak.patch
new file mode 100644 (file)
index 0000000..86977aa
--- /dev/null
@@ -0,0 +1,74 @@
+--- a/devstatus.c
++++ b/devstatus.c
+@@ -561,8 +561,8 @@
+ cString cPluginDevstatus::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) {
+   // Process SVDRP commands this plugin implements
+   if(strcasecmp(Command, "DEVSTAT") == 0) {
+-    char* output = NULL;
+-    asprintf(&output, "%s:\n", tr("List of DVB devices"));
++    cString output;
++    output = cString::sprintf("%s:\n", tr("List of DVB devices"));
+     for (int i = 0; i < cDevice::NumDevices(); i++) {
+       cDevice *d = cDevice::GetDevice(i);
+       char* devName = NULL;
+@@ -570,7 +570,7 @@
+       if (d->HasDecoder() || d->IsPrimaryDevice())
+         asprintf(&devInfo, " (%s%s%s)", d->HasDecoder() ? tr("device with decoder") : "", (d->HasDecoder() && d->IsPrimaryDevice()) ? ", " : "", d->IsPrimaryDevice() ? tr("primary device") : "");
+       asprintf(&devName, "--- %s %d%s ---", tr("Device"), i+1, devInfo ? devInfo : "");
+-      asprintf(&output, "%s  %s:\n", output , devName); // add device output and there info's
++      output = cString::sprintf("%s  %s:\n", *output , devName); // add device output and there info's
+       free(devName);
+       if (devInfo)
+         free(devInfo);
+@@ -582,30 +582,29 @@
+           Name = strdup(r->name);
+           char* itemText = NULL;
+           asprintf(&itemText, "%s %s", DAYDATETIME(r->timer->StartTime()), Name);
+-          asprintf(&output, "%s    %s\n", output , itemText);
++          output = cString::sprintf("%s    %s\n", *output , itemText);
+           free(itemText);
+         }
+         Count++;
+       }
+     }
+     if (Count == 0)
+-      asprintf(&output, "%s    %s\n", output, tr("currently no recordings"));
++      output = cString::sprintf("%s    %s\n", *output, tr("currently no recordings"));
+     if (i < cDevice::NumDevices())
+-      asprintf(&output, "%s\n", output);
++      output = cString::sprintf("%s\n", *output);
+     }
+     // we use the default reply code here
+-    // return cString::sprintf("%s", output);
+     return output;
+   }
+   if(strcasecmp(Command, "RECNUMBER") == 0) {
+-    char* output = NULL;
+-    asprintf(&output, "%s:\n", tr("Number of concurrent recordings"));
++    cString output;
++    output = cString::sprintf("%s:\n", tr("Number of concurrent recordings"));
+     for (int i = 0; i < cDevice::NumDevices(); i++) {
+       cDevice *d = cDevice::GetDevice(i);
+       char* devName = NULL;
+       asprintf(&devName, "%s %d", tr("Device"), i+1);
+-      asprintf(&output, "%s %s:", output , devName); // add device output and there info's
++      output = cString::sprintf("%s %s:", *output , devName); // add device output and there info's
+       free(devName);
+     int Count = 0;
+     for (cRecObj *r = CurrentRecordings.First(); r; r = CurrentRecordings.Next(r)){ // add recordings to the output
+@@ -613,12 +612,11 @@
+         Count++;
+       }
+     }
+-    asprintf(&output, "%s %i\n", output, Count);
++    output = cString::sprintf("%s %i\n", *output, Count);
+     if (i < cDevice::NumDevices())
+-      asprintf(&output, "%s\n", output);
++      output = cString::sprintf("%s\n", *output);
+     }
+     // we use the default reply code here
+-    // return cString::sprintf("%s", output);
+     return output;
+   }
diff --git a/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-recordingfound.patch b/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-recordingfound.patch
new file mode 100644 (file)
index 0000000..9842104
--- /dev/null
@@ -0,0 +1,17 @@
+Index: b/devstatus.c
+===================================================================
+--- a/devstatus.c
++++ b/devstatus.c
+@@ -351,7 +351,11 @@
+                     recordingFound = recording;
+             if (!recordingFound)
+                 return osContinue;
+-            cReplayControl::SetRecording(recordingFound->FileName(), recordingFound->Title());
++            #if VDRVERSNUM < 10728
++               cReplayControl::SetRecording(recordingFound->FileName(), recordingFound->Title());
++            #else
++               cReplayControl::SetRecording(recordingFound->FileName());
++            #endif
+             return osReplay;
+     }
diff --git a/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-vdr2.3.patch b/media-plugins/vdr-devstatus/files/vdr-devstatus-0.4.1-vdr2.3.patch
new file mode 100644 (file)
index 0000000..88c0a09
--- /dev/null
@@ -0,0 +1,99 @@
+--- a/devstatus.c
++++ b/devstatus.c
+@@ -55,8 +55,14 @@
+    int channelNo;
+    cChannel *channel = NULL;
++#if VDRVERSNUM < 20300
+    for (channelNo = 1; channelNo <= Channels.MaxNumber(); channelNo++) {
+       if( (channel = Channels.GetByNumber(channelNo)) ) {
++#else
++   LOCK_CHANNELS_READ;
++   for (channelNo = 1; channelNo <= Channels->MaxNumber(); channelNo++) {
++      if( (channel = (cChannel*) Channels->GetByNumber(channelNo)) ) {
++#endif
+          if (d->IsTunedToTransponder(channel)) {
+            return channel;
+          }
+@@ -78,8 +84,14 @@
+    cChannel *resChannel = NULL;
+    int oldQRG = getTunedFrequency(device);
+             
++#if VDRVERSNUM < 20300
+    for (channelNo = 1; channelNo <= Channels.MaxNumber(); channelNo++) {
+       if( (channel = Channels.GetByNumber(channelNo)) ) {
++#else
++   LOCK_CHANNELS_READ;
++   for (channelNo = 1; channelNo <= Channels->MaxNumber(); channelNo++) {
++      if( (channel = (cChannel*) Channels->GetByNumber(channelNo)) ) {
++#endif
+           if( device->ProvidesSource( channel->Source() ) ) { // same source (DVB-T, -S, ...)
+              if( !ISTRANSPONDER(channel->Frequency(),oldQRG) ) {  //not the same transponder
+                if( channel->Frequency()*direction > oldQRG*direction ) {  
+@@ -152,7 +164,11 @@
+   int GetChannelNr()  { return ChannelNr; }
+   bool IsChannel() { return ChannelNr != 0; }
+   bool HasDevice() { return DeviceNr >= 0; }
++#if VDRVERSNUM < 20300
+   cChannel* GetChannel()  { return Channels.GetByNumber(ChannelNr); }
++#else
++  cChannel* GetChannel()  { LOCK_CHANNELS_READ; return (cChannel*) Channels->GetByNumber(ChannelNr); }
++#endif
+   cDevice* GetDevice() { return cDevice::GetDevice(DeviceNr); };
+ };
+@@ -279,8 +295,15 @@
+                  int channelNo;
+                  cChannel *channel = NULL;
+        
++#if VDRVERSNUM < 20300
+                  for (channelNo = 1; channelNo <= Channels.MaxNumber(); channelNo++) {
+                     if( (channel = Channels.GetByNumber(channelNo)) ) {
++#else
++                 LOCK_CHANNELS_READ;
++                 for (channelNo = 1; channelNo <= Channels->MaxNumber(); channelNo++) {
++                    if( (channel = (cChannel*) Channels->GetByNumber(channelNo)) ) {
++
++#endif
+                        if (d->IsTunedToTransponder(channel)) {
+                             bool currentLive = channelNo == d->CurrentChannel() 
+                                                && (i == cDevice::ActualDevice()->CardIndex());
+@@ -350,7 +373,12 @@
+     eOSState Play(char* file) {
+             // Play the selected recording 
+             cRecording* recordingFound = NULL;
++#if VDRVERSNUM < 20300
+             for(cRecording* recording = Recordings.First(); recording; recording = Recordings.Next(recording))
++#else
++            LOCK_RECORDINGS_READ;
++            for(cRecording* recording = (cRecording*) Recordings->First(); recording; recording = (cRecording*) Recordings->Next(recording))
++#endif
+                 if (strstr(recording->Title(), file))
+                     recordingFound = recording;
+             if (!recordingFound)
+@@ -405,7 +433,12 @@
+                     ri = (cMenuRecItem*)Get(Current());
+                     if (ri->Selectable()) {
+                         if (ri->IsChannel()) {
++#if VDRVERSNUM < 20300
+                             Channels.SwitchTo(ri->GetChannelNr());
++#else
++                            LOCK_CHANNELS_READ;
++                            Channels->SwitchTo(ri->GetChannelNr());
++#endif
+                             Write(); //repaint; maybe 'Live' has changed
+                             return osContinue;
+                         } else
+@@ -635,7 +668,12 @@
+ #endif
+     if (Name) {
+         // insert new timers currently recording in TimersRecording
++#if VDRVERSNUM < 20300
+         for (cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti))
++#else
++        LOCK_TIMERS_READ;
++        for (cTimer *ti = (cTimer*) Timers->First(); ti; ti = (cTimer*) Timers->Next(ti))
++#endif
+             if (ti->Recording()) {
+                 // check if this is a new entry
+                 bool bFound = false;
index d83af69d923fd754d07c808a0d8dbed57993ef6d..b97ab2647da7825e40500079685df5a55fae94c1 100644 (file)
@@ -1,8 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
-<pkgmetadata>
-  <maintainer type="project">
-    <email>vdr@gentoo.org</email>
-    <name>Gentoo VDR Project</name>
-  </maintainer>
+       <pkgmetadata>
+               <maintainer type="person">
+                       <email>martin.dummer@gmx.net</email>
+                       <name>Martin Dummer</name>
+               </maintainer>
+               <maintainer type="project">
+                       <email>proxy-maint@gentoo.org</email>
+                       <name>Proxy Maintainers</name>
+               </maintainer>
+               <maintainer type="project">
+                       <email>vdr@gentoo.org</email>
+                       <name>Gentoo VDR Project</name>
+               </maintainer>
 </pkgmetadata>
diff --git a/media-plugins/vdr-devstatus/vdr-devstatus-0.4.1-r1.ebuild b/media-plugins/vdr-devstatus/vdr-devstatus-0.4.1-r1.ebuild
new file mode 100644 (file)
index 0000000..a51ba83
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit vdr-plugin-2
+
+DESCRIPTION="VDR plugin: display the usage status of the available DVB devices"
+HOMEPAGE="http://www.u32.de/vdr.html"
+SRC_URI="http://www.u32.de/download/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="media-video/vdr"
+RDEPEND="${DEPEND}"
+
+QA_FLAGS_IGNORED="
+       usr/lib/vdr/plugins/libvdr-.*
+       usr/lib64/vdr/plugins/libvdr-.*"
+PATCHES=(
+       "${FILESDIR}/${P}-recordingfound.patch"
+       "${FILESDIR}/${P}-channelswitch.patch"
+       "${FILESDIR}/${P}-dvb-adapter-frontend.patch"
+       "${FILESDIR}/${P}-memoryleak.patch"
+       "${FILESDIR}/${P}-vdr2.3.patch"
+)
+
+src_prepare() {
+       # remove untranslated .po files
+       rm "${S}"/po/{ca_ES,cs_CZ,da_DK,el_GR,et_EE,hr_HR,hu_HU,nl_NL,nn_NO,pl_PL,pt_PT,ro_RO,sl_SI,sv_SE,tr_TR}.po \
+               || die "failed to remove untranslated .po files"
+
+       vdr-plugin-2_src_prepare
+}