Ticket #192: mythtv-dbox2-200508021716.patch.text

File mythtv-dbox2-200508021716.patch.text, 16.2 KB (added by mythtv@…, 19 years ago)

[mythtv] [PATCH] DBOX2 Feed Implementation 2005-08-02

Line 
1Index: configure
2===================================================================
3--- configure   (revision 6975)
4+++ configure   (working copy)
5@@ -47,6 +47,7 @@
6 lirc="yes"
7 joystick_menu="yes"
8 firewire_cable_box="yes"
9+dbox2_dvb_box="yes"
10 x11="yes"
11 xrandr="yes"
12 xv="yes"
13@@ -163,6 +164,7 @@
14 echo "  --disable-lirc           disable lirc support (Infrared Remotes)"
15 echo "  --disable-joystick-menu  disable joystick menu"
16 echo "  --disable-firewire       disable support for FireWire cable boxes"
17+echo "  --disable-dbox2          disable support for Nokia DBOX2 DVB boxes (or compatibles)"
18 echo "  --disable-v4l            disable Video4Linux support"
19 echo "  --disable-ivtv           disable ivtv support (PVR-x50) req. v4l support"
20 #echo "  --enable-ivtv-sys-header use ivtv system headers instead of myth headers"
21@@ -724,6 +726,10 @@
22   ;;
23   --disable-firewire) firewire_cable_box="no"
24   ;;
25+  --enable-dbox2) dbox2_dvb_box="yes"
26+  ;;
27+  --disable-dbox2) dbox2_dvb_box="no"
28+  ;;
29   --enable-dvb) dvb="yes"
30   ;;
31   --disable-dvb) dvb="no"
32@@ -2540,6 +2546,11 @@
33   echo "CONFIG_FIREWIRE_LIBS=-lraw1394 -liec61883 -lavc1394" >> $MYTH_CONFIG_MAK
34 fi
35 
36+if test x"$dbox2_dvb_box" = x"yes" ; then
37+  CCONFIG="$CCONFIG using_dbox2"
38+  CONFIG_DEFINES="$CONFIG_DEFINES USING_DBOX2"
39+fi
40+
41 if test x"$lirc" = x"yes" ; then
42   CCONFIG="$CCONFIG using_lirc"
43   echo "CONFIG_LIRC_LIBS=-llirc_client" >> $MYTH_CONFIG_MAK
44Index: docs/mythtv-HOWTO.sgml
45===================================================================
46--- docs/mythtv-HOWTO.sgml      (revision 6975)
47+++ docs/mythtv-HOWTO.sgml      (working copy)
48@@ -471,6 +471,10 @@
49 <sect3>Firewire.
50 <p>You may use the Firewire output of the DCT6200 or the SA3250.
51 
52+<sect3>DBoxII or other devices running Neutrino
53+<p>You may use the Ethernet port of an DBoxII or a similar device to capture
54+MPEG2. Your set top box has to be running the Neutrino GUI.
55+
56 <sect3>USB Capture Devices.
57 <p>The Plextor ConvertX PVR devices are supported through Linux drivers
58 available from <url
59@@ -6467,7 +6471,27 @@
60 
61 <tt>growisofs -Z /dev/scd0 -dvd-video DVD</tt>
62 
63+<sect1>Using the DBoxII within MythTV
64+<p>The configuration of the DBoxII for use within MythTV is tricky
65+(as of May 16 2005), that's why it's covered here. Your DBoxII has to be
66+running linux and the Neutrino GUI instead of the stock BetaNova firmware.
67+For further information, please refer to <url url="http://www.tuxbox.org" name="http://www.tuxbox.org">. Additionally, you need to enable the SPTS mode in
68+Neutrino.
69 
70+1.) Add a new "Capture Card" in the setup. The "Card type" is "DBOX2 Input",
71+the other values have to be adjusted according to your setup.
72+The default values, except for the "DBOX2 host ip", should work fine.
73+2.) Define a new video source. It doesn't need to be configured,
74+you just need to define it. MythTV grabs the EPG from the DBoxII.
75+3.) Connect the DBoxII to the newly defined input source in "input connections".
76+4.) Since channel scanning is not implemented yet, you need to define channels
77+in the "Channel Editor". Make sure that you use the same value for
78+"Channel Name" as on the DBoxII. You can get a list of available
79+channels from the web interface of Neutrino at http://ip-of-your-box:80/.
80+Associate the channel with your new video source and repeat when needed.
81+
82+You may leave the Setup now and proceed as usual.
83+
84 <sect1>Migrating from XMLTV to DataDirect <label id="MigratingtoDD">
85 <!-- Mostly from a post by Bruce Markey -->
86 <p>DataDirect will use different information for your video sources and
87Index: libs/libmythtv/libmythtv.pro
88===================================================================
89--- libs/libmythtv/libmythtv.pro        (revision 6975)
90+++ libs/libmythtv/libmythtv.pro        (working copy)
91@@ -241,6 +241,10 @@
92     using_firewire:SOURCES += firewirerecorder.cpp firewirechannel.cpp
93     using_firewire:DEFINES += USING_FIREWIRE
94 
95+    # Support for set top boxes (Nokia DBox2 etc.)
96+    using_dbox2:SOURCES += dbox2recorder.cpp dbox2channel.cpp dbox2epg.cpp
97+    using_dbox2:HEADERS += dbox2recorder.h dbox2channel.h dbox2epg.h
98+
99     # Support for PVR-150/250/350/500, etc. on Linux
100     using_ivtv:HEADERS += mpegrecorder.h
101     using_ivtv:SOURCES += mpegrecorder.cpp
102Index: libs/libmythtv/videosource.cpp
103===================================================================
104--- libs/libmythtv/videosource.cpp      (revision 6975)
105+++ libs/libmythtv/videosource.cpp      (working copy)
106@@ -1188,6 +1188,51 @@
107     CaptureCard& parent;
108 };
109 
110+class DBOX2Port: public LineEditSetting, public CCSetting {
111+    public:
112+      DBOX2Port(const CaptureCard& parent):
113+      CCSetting(parent, "dbox2_port") {
114+            setValue("31338");
115+            setLabel(QObject::tr("DBOX2 Streaming Port"));
116+            setHelpText(QObject::tr("DBOX2 streaming port on your DBOX2."));
117+        }
118+};
119+
120+class DBOX2HttpPort: public LineEditSetting, public CCSetting {
121+  public:
122+      DBOX2HttpPort(const CaptureCard& parent):
123+      CCSetting(parent, "dbox2_httpport") {
124+            setValue("80");
125+            setLabel(QObject::tr("DBOX2 HTTP Port"));
126+            setHelpText(QObject::tr("DBOX2 http port on your DBOX2."));
127+        }
128+};
129+class DBOX2Host: public LineEditSetting, public CCSetting {
130+   public:
131+       DBOX2Host(const CaptureCard& parent):
132+       CCSetting(parent, "dbox2_host") {
133+           setValue("dbox");
134+           setLabel(QObject::tr("DBOX2 Host IP"));
135+           setHelpText(QObject::tr("DBOX2 Host IP is the remote device."));
136+       }
137+};
138+
139+class DBOX2ConfigurationGroup: public VerticalConfigurationGroup {
140+public:
141+   DBOX2ConfigurationGroup(CaptureCard& a_parent):
142+       parent(a_parent) {
143+       setUseLabel(false);
144+       addChild(new DBOX2Port(parent));
145+       addChild(new DBOX2HttpPort(parent));
146+       addChild(new DBOX2Host(parent));
147+   };
148+  private:
149+     CaptureCard& parent;
150+ };
151+
152+
153+
154+
155 class V4LConfigurationGroup: public VerticalConfigurationGroup
156 {
157   public:
158@@ -1273,6 +1318,7 @@
159     addTarget("HDTV", new pcHDTVConfigurationGroup(parent));
160     addTarget("MPEG", new MPEGConfigurationGroup(parent));
161     addTarget("FIREWIRE", new FirewireConfigurationGroup(parent));
162+    addTarget("DBOX2", new DBOX2ConfigurationGroup(parent));
163 }
164 
165 void CaptureCardGroup::triggerChanged(const QString& value)
166@@ -1296,7 +1342,7 @@
167 {
168     MSqlQuery query(MSqlQuery::InitCon());
169     query.prepare("SELECT cardtype, videodevice, cardid, "
170-                  " firewire_port, firewire_node "
171+                  " firewire_port, firewire_node, dbox2_port, dbox2_host, dbox2_httpport "
172                   " FROM capturecard WHERE hostname = :HOSTNAME ;");
173     query.bindValue(":HOSTNAME", gContext->GetHostName());
174 
175@@ -1313,6 +1359,13 @@
176                              query.value(4).toString() + "]",
177                              query.value(2).toString());
178             }
179+            else if(query.value(0).toString() == "DBOX2") {
180+                     setting->addSelection("[ " + query.value(0).toString() + " " +
181+                                          "Host IP: " + query.value(6).toString() +  ", " +
182+                                          "Streaming-Port: " + query.value(5).toString() + ", " +
183+                                          "Http-Port: " + query.value(7).toString() +
184+                                          "] ", query.value(2).toString());
185+           }
186             else
187             {
188                 setting->addSelection(
189@@ -1353,6 +1406,7 @@
190     setting->addSelection(QObject::tr("FireWire Input"),
191                           "FIREWIRE");
192     setting->addSelection(QObject::tr("USB Mpeg-4 Encoder (Plextor ConvertX, etc)"), "GO7007");
193+    setting->addSelection(QObject::tr("DBOX2 Input"), "DBOX2");
194 }
195 
196 class CardID: public SelectLabelSetting, public CISetting {
197@@ -1903,7 +1957,7 @@
198     MSqlQuery capturecards(MSqlQuery::InitCon());
199     
200     capturecards.prepare("SELECT cardid, videodevice, cardtype, "
201-                         "       dvb_diseqc_type, firewire_port, firewire_node "
202+                         "       dvb_diseqc_type, firewire_port, firewire_node, dbox2_port, dbox2_host, dbox2_httpport "
203                          "FROM capturecard "
204                          "WHERE hostname = :HOSTNAME");
205     capturecards.bindValue(":HOSTNAME", gContext->GetHostName());
206@@ -1962,6 +2016,29 @@
207                     addSelection(label, index);
208                 }
209             }
210+            else if(capturecards.value(2).toString() == "DBOX2")
211+            {
212+                inputs = QStringList("MPEG2TS");
213+                for (QStringList::iterator i = inputs.begin();
214+                     i != inputs.end(); ++i)
215+                {
216+                    CardInput* cardinput = new CardInput();
217+                    cardinput->loadByInput(cardid, *i);   
218+                    cardinputs.push_back(cardinput);
219+                    QString index = QString::number(cardinputs.size()-1);
220+
221+                    QString label;
222+                    label = QString("%1 (%2) -> %3")
223+                        .arg("[ " + capturecards.value(2).toString() +
224+                             "IP: " + capturecards.value(7).toString() +
225+                             ", Port: " + capturecards.value(6).toString() +
226+                             ", HttpPort: " + capturecards.value(8).toString() +
227+                             " ]")
228+                        .arg(*i)
229+                        .arg(cardinput->getSourceName());
230+                    addSelection(label, index);
231+                }
232+            }
233             else
234             {
235                 inputs = VideoDevice::probeInputs(videodevice);
236Index: libs/libmythtv/dbcheck.cpp
237===================================================================
238--- libs/libmythtv/dbcheck.cpp  (revision 6975)
239+++ libs/libmythtv/dbcheck.cpp  (working copy)
240@@ -10,7 +10,7 @@
241 #include "mythdbcon.h"
242 
243 /// This is the DB schema version expected by the running MythTV instance.
244-const QString currentDatabaseVersion = "1089";
245+const QString currentDatabaseVersion = "1090";
246 
247 static bool UpdateDBVersionNumber(const QString &newnumber);
248 static bool performActualUpdate(const QString updates[], QString version,
249@@ -1977,6 +1977,20 @@
250             return false;
251     }
252 
253+    if (dbver == "1089")
254+    {
255+        const QString updates[] = {
256+           "INSERT INTO profilegroups SET name = 'DBOX2 Input', cardtype = 'DBOX2', is_default = 1;",
257+           "ALTER TABLE capturecard ADD COLUMN dbox2_port INT UNSIGNED NOT NULL DEFAULT 31338;",
258+           "ALTER TABLE capturecard ADD COLUMN dbox2_httpport INT UNSIGNED NOT NULL DEFAULT 80;",
259+           "ALTER TABLE capturecard ADD COLUMN dbox2_host varchar(32) NULL;",
260+           ""
261+       };
262+
263+        if (!performActualUpdate(updates, "1090", dbver))
264+            return false;
265+    }
266+
267 // Drop xvmc_buffer_settings at some point
268 // Drop dead DVB tables eventually, too   
269     
270Index: libs/libmythtv/tv_rec.cpp
271===================================================================
272--- libs/libmythtv/tv_rec.cpp   (revision 6975)
273+++ libs/libmythtv/tv_rec.cpp   (working copy)
274@@ -53,6 +53,11 @@
275 #include "firewirechannel.h"
276 #endif
277 
278+#ifdef USING_DBOX2
279+#include "dbox2recorder.h"
280+#include "dbox2channel.h"
281+#endif
282+
283 const int TVRec::kRequestBufferSize = 256*1000;
284 
285 /** \class TVRec
286@@ -128,7 +133,7 @@
287     GetDevices(m_capturecardnum, videodev, vbidev,
288                audiodev, audiosamplerate,
289                inputname, startchannel, cardtype, dvb_options,
290-               firewire_options, skip_btaudio);
291+               firewire_options, dbox2_options, skip_btaudio);
292 
293     if (cardtype == "DVB")
294     {
295@@ -173,6 +178,23 @@
296         return false;
297 #endif
298     }
299+    else if (cardtype == "DBOX2")
300+    {
301+#ifdef USING_DBOX2
302+        channel = new DBox2Channel(this, &dbox2_options, m_capturecardnum);
303+        channel->Open();
304+        if (inputname.isEmpty())
305+            channel->SetChannelByString(startchannel);
306+        else
307+            channel->SwitchToInput(inputname, startchannel);
308+#else
309+        VERBOSE(VB_IMPORTANT, "ERROR: DBOX2 Input configured, "
310+                              "but no DBOX2 support compiled in!");
311+        VERBOSE(VB_IMPORTANT, "Remove the card from configuration, "
312+                              "or recompile MythTV.");
313+        exit(-20);
314+#endif
315+    }
316     else if ((cardtype == "MPEG") && (videodev.lower().left(5) == "file:"))
317     {
318         // No need to initialize channel..
319@@ -834,6 +856,23 @@
320         errored = true;
321 #endif
322     }
323+    else if (cardtype == "DBOX2")
324+    {
325+#ifdef USING_DBOX2
326+        VERBOSE(VB_GENERAL,QString("TVRec::SetupRecorder() Initializing DBOX2 on Host: %1, Streaming-Port: %2, Http-Port: %3")
327+                                  .arg(dbox2_options.host)
328+                                  .arg(dbox2_options.port)
329+                                 .arg(dbox2_options.httpport));
330+        recorder = new DBox2Recorder(dynamic_cast<DBox2Channel*>(channel), m_capturecardnum);
331+        recorder->SetRingBuffer(rbuffer);
332+        recorder->SetOptionsFromProfile(&profile, videodev, audiodev, vbidev, ispip);
333+        recorder->SetOption("port", dbox2_options.port);
334+        recorder->SetOption("host", dbox2_options.host);
335+        recorder->SetOption("httpport", dbox2_options.httpport);
336+        recorder->Initialize();
337+#endif
338+        return;
339+    }
340     else if (cardtype == "DVB")
341     {
342 #ifdef USING_DVB
343@@ -1307,7 +1346,7 @@
344 void TVRec::GetDevices(int cardnum, QString &video, QString &vbi,
345                        QString &audio, int &rate, QString &defaultinput,
346                        QString &startchan, QString &type,
347-                       dvb_options_t &dvb_opts, firewire_options_t &firewire_opts,
348+                       dvb_options_t &dvb_opts, firewire_options_t &firewire_opts, dbox2_options_t &dbox2_opts,
349                        bool &skip_bt)
350 {
351     video = "";
352@@ -1328,7 +1367,7 @@
353                   "dvb_wait_for_seqstart,dvb_dmx_buf_size,"
354                   "dvb_pkt_buf_size, skipbtaudio, dvb_on_demand,"
355                   "firewire_port, firewire_node, firewire_speed,"
356-                  "firewire_model, firewire_connection "
357+                  "firewire_model, firewire_connection, dbox2_port, dbox2_host, dbox2_httpport "
358                   "FROM capturecard WHERE cardid = :CARDID ;");
359     query.bindValue(":CARDID", cardnum);
360 
361@@ -1377,6 +1416,13 @@
362         if (test != QString::null)
363             firewire_opts.model = QString::fromUtf8(test);
364         firewire_opts.connection = query.value(17).toInt();
365+
366+        dbox2_opts.port = query.value(18).toInt();
367+        dbox2_opts.httpport = query.value(20).toInt();
368+        test = query.value(19).toString();
369+        if (test != QString::null)
370+           dbox2_opts.host = QString::fromUtf8(test);
371+
372     }
373 
374     query.prepare("SELECT if(startchan!='', startchan, '3') "
375Index: libs/libmythtv/tv_rec.h
376===================================================================
377--- libs/libmythtv/tv_rec.h     (revision 6975)
378+++ libs/libmythtv/tv_rec.h     (working copy)
379@@ -51,6 +51,13 @@
380     QString model;
381 } firewire_options_t;
382 
383+typedef struct _dbox2_options_t
384+{
385+    int port;
386+    int httpport;
387+    QString host;
388+} dbox2_options_t;
389+
390 class TVRec
391 {
392   public:
393@@ -188,7 +195,8 @@
394     void GetDevices(int cardnum, QString &video, QString &vbi, QString &audio,
395                     int &rate, QString &defaultinput, QString &startchannel,
396                     QString &type, dvb_options_t &dvb_opts,
397-                    firewire_options_t &firewire_opts, bool &skip_bt);
398+                   firewire_options_t &firewire_opts, dbox2_options_t &dbox2_opts,
399+                    bool &skip_bt);
400 
401     void SetupRecorder(class RecordingProfile& profile);
402     void TeardownRecorder(bool killFile = false);
403@@ -240,11 +248,12 @@
404     QString liveTVRingBufLoc;
405     QString recprefix;
406 
407-    // Configuration variables from setup rutines
408+    // Configuration variables from setup routines
409     int     m_capturecardnum;
410     bool    ispip;
411     dvb_options_t dvb_options;
412     firewire_options_t firewire_options;
413+    dbox2_options_t dbox2_options;
414 
415     // State variables
416     QMutex  stateChangeLock;
417Index: libs/libmythtv/siparser.h
418===================================================================
419--- libs/libmythtv/siparser.h   (revision 6975)
420+++ libs/libmythtv/siparser.h   (working copy)
421@@ -75,7 +75,7 @@
422  *  Argentenia has also has announced their Digital TV Standard will be
423  *  ATSC over DVB-T
424  *
425- *  Impliemntation of OpenCable or other MPEG-TS based standards (DirecTV?)
426+ *  Implementation of OpenCable or other MPEG-TS based standards (DirecTV?)
427  *  is also possible with this class if their specs are ever known.
428  *
429  */