Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] [PATCH] dxr3-plugin (0.1.7a) with multiple DXR3 cards + bug in DXR3 setup menu



Hi Folks,

the DXR3 plugin does a great job, but it is hard-wired for the first DXR3
card in the system. If you have multiple cards, it won't work. Therefore
I've prepared a small patch that allows to choose the dxr3-card number to
use through the setup.conf file or through the OSD.

I'm not (yet) sure about the coding conventions in the vdr project,
therefore I probably missed them.

I think that the dxr3 plugin has a bug concerning the digital audio flag. 
It is always written as "true" to the config file. The bug lies in 
dxr3configdata.h:16:

int SetUseDigitalOut(int value){UseDigitalOut = value;return true;};

should be:

int SetUseDigitalOut(int value){UseDigitalOut = value;return value;}

The patch fixes this bug, too.


Ciao,

Tobias

-- 
Tobias Haustein

E-Mail tobias.haustein@aixmail.de


-- Attached file included as plaintext by Listar --

diff -Naur dxr3-0.1.7a/dxr3.c dxr3-0.1.7a-th/dxr3.c
--- dxr3-0.1.7a/dxr3.c	2003-03-23 22:11:57.000000000 +0100
+++ dxr3-0.1.7a-th/dxr3.c	2003-04-11 02:08:50.000000000 +0200
@@ -19,6 +19,7 @@
 class cMenuSetupDxr3 : public cMenuSetupPage {
 private:
   int newUseDigitalOut;
+  int newDxr3Card;
 protected:
   virtual void Store(void);
 public:
@@ -29,11 +30,14 @@
 {
   newUseDigitalOut = cDxr3ConfigData::Instance().GetUseDigitalOut();
   Add(new cMenuEditBoolItem(tr("Digital audio output"), &newUseDigitalOut));
+  newDxr3Card = cDxr3ConfigData::Instance().GetDxr3Card();
+  Add(new cMenuEditIntItem(tr("DXR3 card"), &newDxr3Card));
 }
 
 void cMenuSetupDxr3::Store(void)
 {
   SetupStore("UseDigitalOut", cDxr3ConfigData::Instance().SetUseDigitalOut(newUseDigitalOut));
+  SetupStore("Dxr3Card",      cDxr3ConfigData::Instance().SetDxr3Card(newDxr3Card));
 }
 
 //--- cPluginDxr3 ----------------------------------------------------------
@@ -92,10 +96,10 @@
 
 bool cPluginDxr3::SetupParse(const char *Name, const char *Value) {
   // Parse your own setup parameters and store their values.
-  if (!strcasecmp(Name, "UseDigitalOut")) cDxr3ConfigData::Instance().SetUseDigitalOut(atoi(Value));
-  else
-     return false;
-  return true;
+  if (!strcasecmp(Name, "UseDigitalOut")) { cDxr3ConfigData::Instance().SetUseDigitalOut(atoi(Value)); return true; }
+  if (!strcasecmp(Name, "Dxr3Card"))      { cDxr3ConfigData::Instance().SetDxr3Card(atoi(Value));      return true; }
+  
+  return false;
 }
 
 VDRPLUGINCREATOR(cPluginDxr3); // Don't touch this!
diff -Naur dxr3-0.1.7a/dxr3abstractiondevice.c dxr3-0.1.7a-th/dxr3abstractiondevice.c
--- dxr3-0.1.7a/dxr3abstractiondevice.c	2003-03-23 13:36:44.000000000 +0100
+++ dxr3-0.1.7a-th/dxr3abstractiondevice.c	2003-04-11 02:20:27.000000000 +0200
@@ -14,6 +14,7 @@
 #include <time.h>
 #include <pthread.h>
 #include "dxr3abstractiondevice.h"
+#include "dxr3configdata.h"
 #include "dxr3syncbuffer.h"
 #include "dxr3diag.h"
 #include "em8300.h"
@@ -51,12 +52,20 @@
 }
 
 
+static string dxr3DeviceName( const string& suffix )
+{
+    char buf[40];
+    sprintf( buf, "/dev/em8300%.3s-%d", suffix.c_str(), cDxr3ConfigData::Instance().GetDxr3Card() );
+    return buf;
+}
+
+
 cDxr3AbsDevice::cDxr3AbsDevice() {
     DXR3_DIAG << "cDxr3AbsDevice::cDxr3AbsDevice\n";
-    assert((m_fdControl = open("/dev/em8300", O_WRONLY | O_SYNC)) >= 0);
-    assert((m_fdVideo = open("/dev/em8300_mv", O_WRONLY | O_SYNC)) >= 0);
-    assert((m_fdAudio = open("/dev/em8300_ma", O_WRONLY | O_SYNC)) >= 0);
-    assert((m_fdSpu = open("/dev/em8300_sp", O_WRONLY | O_SYNC)) >= 0);
+    assert((m_fdControl = open(dxr3DeviceName( "" ).c_str(), O_WRONLY | O_SYNC)) >= 0);
+    assert((m_fdVideo = open(dxr3DeviceName( "_mv" ).c_str(), O_WRONLY | O_SYNC)) >= 0);
+    assert((m_fdAudio = open(dxr3DeviceName( "_ma" ).c_str(), O_WRONLY | O_SYNC)) >= 0);
+    assert((m_fdSpu = open(dxr3DeviceName( "_sp" ).c_str(), O_WRONLY | O_SYNC)) >= 0);
 
     m_pClock = new cDxr3SysClock(m_fdControl, m_fdVideo, m_fdSpu);
     SetChannelCount(1);
@@ -472,7 +481,7 @@
             usleep(300000);
                     
             close(m_fdAudio);
-            m_fdAudio = open("/dev/em8300_ma", O_WRONLY | O_SYNC);
+            m_fdAudio = open(dxr3DeviceName( "_ma" ).c_str(), O_WRONLY | O_SYNC);
             uint32_t audioDataRatetemp = m_audioDataRate;
             uint32_t audioSampleSizetemp = m_audioSampleSize;
             m_audioDataRate = m_audioSampleSize = 0;
@@ -489,10 +498,10 @@
     Lock();
 
     if (bExternalReleased) {
-        m_fdControl = open("/dev/em8300", O_WRONLY | O_SYNC);
-        m_fdVideo = open("/dev/em8300_mv", O_WRONLY | O_SYNC);
-        m_fdAudio = open("/dev/em8300_ma", O_WRONLY | O_SYNC);
-        m_fdSpu = open("/dev/em8300_sp", O_WRONLY | O_SYNC);
+        m_fdControl = open(dxr3DeviceName( "" ).c_str(), O_WRONLY | O_SYNC);
+        m_fdVideo = open(dxr3DeviceName( "_mv" ).c_str(), O_WRONLY | O_SYNC);
+        m_fdAudio = open(dxr3DeviceName( "_ma" ).c_str(), O_WRONLY | O_SYNC);
+        m_fdSpu = open(dxr3DeviceName( "_sp" ).c_str(), O_WRONLY | O_SYNC);
 
         if (m_fdControl < 0 || m_fdVideo < 0 || m_fdAudio < 0 || m_fdSpu <0) {
             ExternalReleaseDevices();
@@ -610,10 +619,10 @@
         delete pAudioClose;
         delete pSpuClose;
 
-        m_fdControl = open("/dev/em8300", O_WRONLY | O_SYNC);
-        m_fdVideo = open("/dev/em8300_mv", O_WRONLY | O_SYNC);
-        m_fdAudio = open("/dev/em8300_ma", O_WRONLY | O_SYNC);
-        m_fdSpu = open("/dev/em8300_sp", O_WRONLY | O_SYNC);
+        m_fdControl = open(dxr3DeviceName( "" ).c_str(), O_WRONLY | O_SYNC);
+        m_fdVideo = open(dxr3DeviceName( "_mv" ).c_str(), O_WRONLY | O_SYNC);
+        m_fdAudio = open(dxr3DeviceName( "_ma" ).c_str(), O_WRONLY | O_SYNC);
+        m_fdSpu = open(dxr3DeviceName( "_so" ).c_str(), O_WRONLY | O_SYNC);
         count++;
     } while ( (m_fdControl < 0 || m_fdVideo < 0 || m_fdAudio < 0 || m_fdSpu < 0) || (count < 2));    
 }
diff -Naur dxr3-0.1.7a/dxr3configdata.c dxr3-0.1.7a-th/dxr3configdata.c
--- dxr3-0.1.7a/dxr3configdata.c	2003-03-23 13:36:44.000000000 +0100
+++ dxr3-0.1.7a-th/dxr3configdata.c	2003-04-11 02:07:35.000000000 +0200
@@ -19,6 +19,7 @@
 
 cDxr3ConfigData::cDxr3ConfigData() {
     UseDigitalOut = 0;
+    Dxr3Card = 0;
 //    m_pInstance = NULL;
 }
 
diff -Naur dxr3-0.1.7a/dxr3configdata.h dxr3-0.1.7a-th/dxr3configdata.h
--- dxr3-0.1.7a/dxr3configdata.h	2003-03-23 13:36:44.000000000 +0100
+++ dxr3-0.1.7a-th/dxr3configdata.h	2003-04-11 02:07:09.000000000 +0200
@@ -13,7 +13,9 @@
 public:
     static cDxr3ConfigData& Instance(void);
     int GetUseDigitalOut() {return UseDigitalOut;};
-    int SetUseDigitalOut(int value){UseDigitalOut = value;return true;};
+    int SetUseDigitalOut(int value){return UseDigitalOut = value;};
+    int GetDxr3Card() {return Dxr3Card;};
+    int SetDxr3Card(int value){return Dxr3Card = value;};
 
     ~cDxr3ConfigData();
 
@@ -23,6 +25,7 @@
     static cDxr3ConfigData* m_pInstance;
 
     int UseDigitalOut;
+    int Dxr3Card;
 };
 
 #endif // __DXR3CONFIGDATA_H



-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index