[mythtv] [PATCH] Capture card volume setting/clipping fix

Colin Cross colin at colincross.com
Mon Mar 15 23:08:50 EST 2004


Here's a patch to allow the configuration of the record volume on the capture card.  Previous behavior was to set it to 65535, now there is a per-capture-card setting in the database.

I didn't take care of adding the field to the database in dbcheck.cpp, but it needs "ALTER capturecard ADD COLUMN volume INT NOT NULL DEFAULT -1" run on the db.

Unfortunately I don't have a backend available to test it on, it compiles OK and the setup part of it works, but I haven't tried recording.  It should cause no change to current behavior if the volume field in the database is set to -1 or 65535.  Can someone check that I haven't missed anything?

---PATCH---
Index: libs/libmythtv/NuppelVideoRecorder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoRecorder.cpp,v
retrieving revision 1.164
diff -u -d -r1.164 NuppelVideoRecorder.cpp
--- libs/libmythtv/NuppelVideoRecorder.cpp	13 Mar 2004 08:57:21 -0000	1.164
+++ libs/libmythtv/NuppelVideoRecorder.cpp	16 Mar 2004 03:56:33 -0000
@@ -270,6 +270,8 @@
         inpixfmt = (VideoFrameType)value;
     else if (opt == "skipbtaudio")
         skip_btaudio = value;
+    else if (opt == "volume")
+        volume = value;
     else
         RecorderBase::SetOption(opt, value);
 }
@@ -1002,7 +1004,7 @@
         return;
     }
 
-    int volume = -1;
+    //int volume = -1;
 
     int channelinput = 0;
  
Index: libs/libmythtv/NuppelVideoRecorder.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoRecorder.h,v
retrieving revision 1.70
diff -u -d -r1.70 NuppelVideoRecorder.h
--- libs/libmythtv/NuppelVideoRecorder.h	13 Mar 2004 08:57:21 -0000	1.70
+++ libs/libmythtv/NuppelVideoRecorder.h	16 Mar 2004 03:56:33 -0000
@@ -269,6 +269,7 @@
     bool skip_btaudio;
 
     bool correct_bttv;
+    int volume;
 };
 
 #endif
Index: libs/libmythtv/tv_rec.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_rec.cpp,v
retrieving revision 1.141
diff -u -d -r1.141 tv_rec.cpp
--- libs/libmythtv/tv_rec.cpp	14 Mar 2004 05:59:47 -0000	1.141
+++ libs/libmythtv/tv_rec.cpp	16 Mar 2004 03:56:33 -0000
@@ -65,11 +65,13 @@
 
     audiosamplerate = -1;
     skip_btaudio = false;
+    volume = -1;
 
     QString inputname, startchannel;
 
     GetDevices(capturecardnum, videodev, vbidev, audiodev, audiosamplerate,
-               inputname, startchannel, cardtype, dvb_options, skip_btaudio);
+               inputname, startchannel, cardtype, dvb_options, skip_btaudio, 
+               volume);
 
     if (cardtype == "DVB")
     {
@@ -595,6 +597,7 @@
     nvr->SetRingBuffer(rbuffer);
 
     nvr->SetOption("skipbtaudio", skip_btaudio);
+    nvr->SetOption("volume", volume);
     nvr->SetOptionsFromProfile(&profile, videodev, audiodev, vbidev, ispip);
  
     nvr->Initialize();
@@ -1010,7 +1013,7 @@
 void TVRec::GetDevices(int cardnum, QString &video, QString &vbi, 
                        QString &audio, int &rate, QString &defaultinput,
                        QString &startchan, QString &type, 
-                       dvb_options_t &dvb_opts, bool &skip_bt)
+                       dvb_options_t &dvb_opts, bool &skip_bt, int &volume)
 {
     video = "";
     vbi = "";
@@ -1027,7 +1030,8 @@
                                "audioratelimit,defaultinput,cardtype,"
                                "dvb_swfilter, dvb_recordts,"
                                "dvb_wait_for_seqstart,dvb_dmx_buf_size,"
-                               "dvb_pkt_buf_size, skipbtaudio, dvb_on_demand "
+                               "dvb_pkt_buf_size, skipbtaudio, dvb_on_demand,"
+			       "volume "
                                "FROM capturecard WHERE cardid = %1;")
                               .arg(cardnum);
 
@@ -1072,6 +1076,7 @@
 
         skip_bt = query.value(11).toInt();
         dvb_opts.dvb_on_demand = query.value(12).toInt();
+	volume = query.value(13).toInt();
     }
 
     thequery = QString("SELECT if(startchan!='', startchan, '3') "
Index: libs/libmythtv/tv_rec.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_rec.h,v
retrieving revision 1.52
diff -u -d -r1.52 tv_rec.h
--- libs/libmythtv/tv_rec.h	10 Feb 2004 22:08:31 -0000	1.52
+++ libs/libmythtv/tv_rec.h	16 Mar 2004 03:56:33 -0000
@@ -151,7 +151,8 @@
 
     void GetDevices(int cardnum, QString &video, QString &vbi, QString &audio,
                     int &rate, QString &defaultinput, QString &startchannel,
-                    QString &type, dvb_options_t &dvb_opts, bool &skip_bt);
+                    QString &type, dvb_options_t &dvb_opts, bool &skip_bt, 
+		    int &volume);
 
     void ConnectDB(int cardnum);
     void DisconnectDB(void);
@@ -204,6 +205,7 @@
     QString videodev, vbidev, audiodev, cardtype;
     int audiosamplerate;
     bool skip_btaudio;
+    int volume;
 
     bool inoverrecord;
     int overrecordseconds;
Index: libs/libmythtv/videosource.h
==================================== 04 03:56:33 -0000
@@ -65,11 +65,13 @@
 
     audiosamplerate = -1;
     skip_btaudio = false;
+    volume = -1;
 
     QString inputname, startchannel;
 
     GetDevices(capturecardnum, videodev, vbidev, audiodev, audiosamplerate,
-               inputname, startchannel, cardtype, dvb_options, skip_btaudio);
+               inputname, startchannel, cardtype, dvb_options, skip_btaudio, 
+               volume);
 
     if (cardtype == "DVB")
     {
@@ -595,6 +597,7 @@
     nvr->SetRingBuffer(rbuffer);
 
     nvr->SetOption("skipbtaudio", skip_btaudio);
+    nvr->SetOption("volume", volume);
     nvr->SetOptionsFromProfile(&profile, videodev, audiodev, vbidev, ispip);
  
     nvr->Initialize();
@@ -1010,7 +1013,7 @@
 void TVRec::GetDevices(int cardnum, QString &video, QString &vbi, 
                        QString &audio, int &rate, QString &defaultinput,
                        QString &startchan, QString &type, 
-                       dvb_options_t &dvb_opts, bool &skip_bt)
+                       dvb_options_t &dvb_opts, bool &skip_bt, int &volume)
 {
     video = "";
     vbi = "";
@@ -1027,7 +1030,8 @@
                                "audioratelimit,defaultinput,cardtype,"
                                "dvb_swfilter, dvb_recordts,"
                                "dvb_wait_for_seqstart,dvb_dmx_buf_size,"
-                               "dvb_pkt_buf_size, skipbtaudio, dvb_on_demand "
+                               "dvb_pkt_buf_size, skipbtaudio, dvb_on_demand,"
+			       "volume "
                                "FROM capturecard WHERE cardid = %1;")
                               .arg(cardnum);
 
@@ -1072,6 +1076,7 @@
 
         skip_bt = query.value(11).toInt();
         dvb_opts.dvb_on_demand = query.value(12).toInt();
+	volume = query.value(13).toInt();
     }
 
     thequery = QString("SELECT if(startchan!='', startchan, '3') "
Index: libs/libmythtv/tv_rec.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_rec.h,v
retrieving revision 1.52
diff -u -d -r1.52 tv_rec.h
--- libs/libmythtv/tv_rec.h	10 Feb 2004 22:08:31 -0000	1.52
+++ libs/libmythtv/tv_rec.h	16 Mar 2004 03:56:33 -0000
@@ -151,7 +151,8 @@
 
     void GetDevices(int cardnum, QString &video, QString &vbi, QString &audio,
                     int &rate, QString &defaultinput, QString &startchannel,
-                    QString &type, dvb_options_t &dvb_opts, bool &skip_bt);
+                    QString &type, dvb_options_t &dvb_opts, bool &skip_bt, 
+		    int &volume);
 
     void ConnectDB(int cardnum);
     void DisconnectDB(void);
@@ -204,6 +205,7 @@
     QString videodev, vbidev, audiodev, cardtype;
     int audiosamplerate;
     bool skip_btaudio;
+    int volume;
 
     bool inoverrecord;
     int overrecordseconds;
Index: libs/libmythtv/videosource.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videosource.h,v
retrieving revision 1.62
diff -u -d -r1.62 videosource.h
--- libs/libmythtv/videosource.h	2 Mar 2004 06:31:52 -0000	1.62
+++ libs/libmythtv/videosource.h	16 Mar 2004 03:56:33 -0000
@@ -398,6 +398,17 @@
    };
 };
 
+class CaptureCardVolume: public LineEditSetting, public CCSetting {
+public:
+    CaptureCardVolume(const CaptureCard& parent):
+        CCSetting(parent, "volume") {
+            setLabel(QObject::tr("Capture card volume"));
+            setValue("65535");
+            setHelpText(QObject::tr("Record volume of the capture card,"
+                        "this has nothing to do with the sound card"));
+    };
+};
+ 
 class DVBCardNum: public SpinBoxSetting, public CCSetting {
 public:
     DVBCardNum(const CaptureCard& parent):
@@ -854,6 +865,7 @@
         addChild(new AudioRateLimit(parent));
         addChild(new SkipBtAudio(parent));
         addChild(input = new TunerCardInput(parent));
+	addChild(new CaptureCardVolume(parent));
 
         connect(device, SIGNAL(valueChanged(const QString&)),
                 input, SLOT(fillSelections(const QString&)));




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


More information about the mythtv-dev mailing list