[mythtv] [PATCH] Optional disabling of BT878 audio interference

mian mythtv at mian.net.au
Sun Feb 1 21:05:31 EST 2004


This patch adds a checkbox to the V4L capture card setup to disable
adjusting of BT audio, this is required for some budget BT878a based DVB-T
cards which also have composite/s-video inputs.  If an input is used for
external receiver, then the audio volume was always adjusted to 65535,
which breaks the DVB-T function until a reboot is performed.  By checking
the option the volume will never be touched allowing the DVB-T function to
work.  This is required for AverMedia AverTV DVB-T card for one.

Requires manually ALTER TABLE capturecard ADD skipbtaudio DEFAULT 0 as I
didn't want to mess with the SQL upgrading code.
-------------- next part --------------
--- work/mythtv/libs/libmythtv/videosource.h	2004-02-02 12:28:05.521904520 +1030
+++ work-skipbtaudio/mythtv/libs/libmythtv/videosource.h	2004-02-02 11:30:10.882130056 +1030
@@ -387,6 +387,16 @@
     void fillSelections(const QString& device);
 };
 
+class SkipBtAudio: public CheckBoxSetting, public CCSetting {
+public:
+    SkipBtAudio(const CaptureCard& parent):
+    CCSetting(parent, "skipbtaudio") {
+        setLabel(QObject::tr("Do not adjust BT audio volume."));
+        setHelpText(QObject::tr("Check this option for budget BT878 based DVB-T cards "
+                     "such as the AverTV DVB-T that require the audio volume left alone."));
+   };
+};
+
 class DVBCardNum: public SpinBoxSetting, public CCSetting {
 public:
     DVBCardNum(const CaptureCard& parent):
@@ -829,6 +839,7 @@
         addChild(new AudioDevice(parent));
         addChild(new AudioRateLimit(parent));
         addChild(input = new TunerCardInput(parent));
+        addChild(new SkipBtAudio(parent));
 
         connect(device, SIGNAL(valueChanged(const QString&)),
                 input, SLOT(fillSelections(const QString&)));
--- work/mythtv/libs/libmythtv/recorderbase.h	2004-02-02 12:28:05.241947080 +1030
+++ work-skipbtaudio/mythtv/libs/libmythtv/recorderbase.h	2004-02-02 10:44:44.576591496 +1030
@@ -63,6 +63,7 @@
     RingBuffer *ringBuffer;
     bool weMadeBuffer;
 
+    bool skip_btaudio;
     QString codec;
     QString audiodevice;
     QString videodevice;
--- work/mythtv/libs/libmythtv/recorderbase.cpp	2004-02-02 12:28:05.239947384 +1030
+++ work-skipbtaudio/mythtv/libs/libmythtv/recorderbase.cpp	2004-02-02 10:48:01.768613752 +1030
@@ -17,6 +17,7 @@
     videodevice = "/dev/video";
     vbidevice = "/dev/vbi";
 
+    skip_btaudio = false;
     ntsc = 1;
     video_frame_rate = 29.97;
     vbimode = 0;
@@ -98,7 +99,12 @@
 
 void RecorderBase::SetOption(const QString &name, int value)
 {
-    cerr << "Unknown int option: " << name << ": " << value << endl;
+    if (name == "skipbtaudio")
+    {
+        skip_btaudio = value;
+    } else {
+        cerr << "Unknown int option: " << name << ": " << value << endl;
+    }
 }
 
 void RecorderBase::ChannelNameChanged(const QString& new_name)
--- work/mythtv/libs/libmythtv/tv_rec.cpp	2004-02-02 12:28:05.319935224 +1030
+++ work-skipbtaudio/mythtv/libs/libmythtv/tv_rec.cpp	2004-02-02 12:13:23.467997096 +1030
@@ -64,11 +64,12 @@
     QString chanorder = gContext->GetSetting("ChannelOrdering", "channum + 0");
 
     audiosamplerate = -1;
+    skip_btaudio = false;
 
     QString inputname, startchannel;
 
     GetDevices(capturecardnum, videodev, vbidev, audiodev, audiosamplerate,
-               inputname, startchannel, cardtype, dvb_options);
+               inputname, skip_btaudio, startchannel, cardtype, dvb_options);
 
     if (cardtype == "DVB")
     {
@@ -574,7 +575,7 @@
     nvr = new NuppelVideoRecorder(channel);
 
     nvr->SetRingBuffer(rbuffer);
-
+    nvr->SetOption("skipbtaudio", skip_btaudio);
     nvr->SetOptionsFromProfile(&profile, videodev, audiodev, vbidev, ispip);
  
     nvr->Initialize();
@@ -998,7 +999,7 @@
 
 void TVRec::GetDevices(int cardnum, QString &video, QString &vbi, 
                        QString &audio, int &rate, QString &defaultinput,
-                       QString &startchan, QString &type, 
+                       bool &skip_bt, QString &startchan, QString &type, 
                        dvb_options_t &dvb_opts)
 {
     video = "";
@@ -1016,7 +1017,7 @@
                                "audioratelimit,defaultinput,cardtype,"
                                "dvb_swfilter, dvb_recordts,"
                                "dvb_wait_for_seqstart,dvb_dmx_buf_size,"
-                               "dvb_pkt_buf_size "
+                               "dvb_pkt_buf_size,skipbtaudio "
                                "FROM capturecard WHERE cardid = %1;")
                               .arg(cardnum);
 
@@ -1058,6 +1059,8 @@
         dvb_opts.wait_for_seqstart = query.value(8).toInt();
         dvb_opts.dmx_buf_size = query.value(9).toInt();
         dvb_opts.pkt_buf_size = query.value(10).toInt();
+
+        skip_bt = query.value(11).toInt();
     }
 
     thequery = QString("SELECT if(startchan!='', startchan, '3') "
--- work/mythtv/libs/libmythtv/tv_rec.h	2004-02-02 12:28:05.322934768 +1030
+++ work-skipbtaudio/mythtv/libs/libmythtv/tv_rec.h	2004-02-02 11:53:04.500308352 +1030
@@ -149,7 +149,7 @@
                         QString &channelname, QString &chanid);
 
     void GetDevices(int cardnum, QString &video, QString &vbi, QString &audio,
-                    int &rate, QString &defaultinput, QString &startchannel,
+                    int &rate, QString &defaultinput, bool &skip_bt, QString &startchannel,
                     QString &type, dvb_options_t &dvb_opts);
 
     void ConnectDB(int cardnum);
@@ -202,6 +202,7 @@
  
     QString videodev, vbidev, audiodev, cardtype;
     int audiosamplerate;
+    bool skip_btaudio;
 
     bool inoverrecord;
     int overrecordseconds;
--- work/mythtv/libs/libmythtv/NuppelVideoRecorder.cpp	2004-02-02 12:28:04.594045576 +1030
+++ work-skipbtaudio/mythtv/libs/libmythtv/NuppelVideoRecorder.cpp	2004-02-02 12:01:16.705481792 +1030
@@ -273,7 +273,7 @@
 void NuppelVideoRecorder::SetOptionsFromProfile(RecordingProfile *profile,
                                                 const QString &videodev, 
                                                 const QString &audiodev,
-                                                const QString &vbidev, 
+                                                const QString &vbidev,
                                                 int ispip)
 {
     SetOption("videodevice", videodev);
@@ -987,7 +987,7 @@
         perror("VIDIOCGCHAN");
 
     // if channel has a audio then activate it
-    if ((vchan.flags & VIDEO_VC_AUDIO) == VIDEO_VC_AUDIO) {
+    if (!skip_btaudio && (vchan.flags & VIDEO_VC_AUDIO) == VIDEO_VC_AUDIO) {
         //if (!quiet) 
         //    fprintf(stderr, "%s\n", "unmuting tv-audio");
         // audio hack, to enable audio from tvcard, in case we use a tuner
@@ -1015,7 +1015,6 @@
         if (ioctl(fd, VIDIOCSCHAN, &vchan) < 0)
             perror("VIDIOCSCHAN");
     } 
-
     mm.height = h;
     mm.width  = w;
     if (inpixfmt == FMT_YUV422P)


More information about the mythtv-dev mailing list