[mythtv] is there any chance to include these changes ?

marek mark_kiddy at wp.pl
Mon Sep 10 09:06:56 UTC 2007


hi group
last days in my free time I'm working on intergrating saa7134-empress 
(saa6752hs) with other v4l2 controls (tuner, inputs etc) but with MPEG 
output.- sth like ivtv-emulation (a big word...). 
for now it basically works from mythfrontend (with some little issues) - 
changing channels, volume etc, mpeg recording (saves lot of cpu power & 
diskspace) but only with these simple changes :

---------------------------------------------------------cut 
here--------------------------------------------------------------
--- mpegrecorder.cpp.old        2007-09-10 07:31:01.000000000 +0200
+++ mpegrecorder.cpp    2007-09-09 15:22:29.000000000 +0200
@@ -406,8 +406,24 @@
     // Set recording volume
     struct v4l2_control ctrl;
     ctrl.id = V4L2_CID_AUDIO_VOLUME;
+   
+    struct v4l2_queryctrl qctrl;
+    // getting volume max/min value
+    qctrl.id = V4L2_CID_AUDIO_VOLUME;
+    if (ioctl(chanfd, VIDIOC_QUERYCTRL, &qctrl) < 0)
+    {
+    //rather impossible
+        VERBOSE(VB_IMPORTANT, LOC_WARN +
+                "Unable to get recording volume parameters(max/min)" + 
ENO + "\n\t\t\t" +
+                "using defaults.");
     ctrl.value = 65536 / 100 *audvolume;
-           
+    } else {
+    ctrl.value=(qctrl.maximum - qctrl.minimum) * audvolume / 100 + 
qctrl.minimum;
+    }
+       
+   
+   
+
     if (ioctl(chanfd, VIDIOC_S_CTRL, &ctrl) < 0)
     {
         VERBOSE(VB_IMPORTANT, LOC_WARN +
@@ -429,14 +445,27 @@
         return false;
 
     SetVBIOptions(chanfd);
-
+    /*modified*/
+    if ((driver == "saa7134") && (chanfd >= 0)) {
+        VERBOSE(VB_IMPORTANT, LOC_WARN + "saa7134 - so we close handle 
(chanfd).");
+        close(chanfd);
+       chanfd =-1;
+       };
+    /*--------*/
     readfd = open(videodevice.ascii(), O_RDWR | O_NONBLOCK);       
+   
     if (readfd < 0)
     {
         VERBOSE(VB_IMPORTANT, LOC_ERR + "Can't open video device." + ENO);
         return false;
     }
-
+    /*modified*/
+    if ((driver == "saa7134") && (chanfd < 0))
+    {
+        VERBOSE(VB_IMPORTANT, LOC_WARN + "saa7134 - so we duplicate 
video device handle (chanfd=readfd).");
+       chanfd = readfd;
+    }
+    /*--------*/
     return true;
 }
 
---------------------------------------------------------cut 
here--------------------------------------------------------------

first part checks volume .maximum & .minimum - I think this is better 
than using only fixed 0-65536 scale (saa7134 has .minimum=-15 
.maximum=15 .step=1) - after applying these volume will always be in range.

second part gives mythfrontend chance to work with this modified driver 
(device can't be opened 2 times simultaneously - duplicate handle works 
ok - no problems at all, tested some days)  - i think it doesn't harm 
ivtv or any other drivers.



*******************************
my second proposition :

another aspect ratio mode - resize 16:9 to 4:3 vertically (removing 
upper and lower black bars from broadcast, only vertical zoom is 
applied, horizontally picture has the same size)
usable on 16:9 analog tv working in 4:3 mode

videooutbase.h patch
---------------------------------------------------------cut 
here--------------------------------------------------------------
--- videooutbase.h.old  2007-09-10 07:36:45.000000000 +0200
+++ videooutbase.h      2007-09-09 19:37:24.000000000 +0200
@@ -56,6 +56,7 @@
     kLetterbox_16_9_Zoom,
     kLetterbox_16_9_Stretch,
     kLetterbox_Fill,
+    kLetterbox_16_9_4_3,
     kLetterbox_END
 };
 
---------------------------------------------------------cut 
here--------------------------------------------------------------
videooutbase.cpp patch
---------------------------------------------------------cut 
here--------------------------------------------------------------
--- videooutbase.cpp.old        2007-09-10 07:41:19.000000000 +0200
+++ videooutbase.cpp    2007-09-09 19:52:50.000000000 +0200
@@ -907,7 +907,17 @@
     }
 
     // Process letterbox zoom modes
-    if ((letterbox == kLetterbox_4_3_Zoom) ||
+    if (letterbox == kLetterbox_16_9_4_3)
+    {
+        // Zoom mode -- Expand by zooming picture vertically (remove 
horizontal bars).
+        // 1/6 of original is 1/8 of new
+        display_video_rect = QRect(
+            display_video_rect.left(),
+            display_video_rect.top()  - (display_video_rect.height() / 6),
+            display_video_rect.width(),
+            display_video_rect.height() * 4 / 3);
+    }
+    else if ((letterbox == kLetterbox_4_3_Zoom) ||
         (letterbox == kLetterbox_16_9_Zoom))
     {
         // Zoom mode -- Expand by 4/3 and overscan.
---------------------------------------------------------cut 
here--------------------------------------------------------------
tv_play.cpp patch:
---------------------------------------------------------cut 
here--------------------------------------------------------------
--- tv_play.cpp.old     2007-09-10 07:44:24.000000000 +0200
+++ tv_play.cpp 2007-09-09 19:43:28.000000000 +0200
@@ -5537,6 +5537,7 @@
         case kLetterbox_4_3_Zoom:     text = tr("4:3 Zoom"); break;
         case kLetterbox_16_9_Zoom:    text = tr("16:9 Zoom"); break;
         case kLetterbox_16_9_Stretch: text = tr("16:9 Stretch"); break;
+        case kLetterbox_16_9_4_3:     text = tr("16:9 Vertical Zoom"); 
break;
         case kLetterbox_Fill:         text = tr("Fill"); break;
         default:                      text = tr("Off"); break;
     }
@@ -6841,6 +6842,10 @@
                                  QString("%1").arg(kLetterbox_16_9_Zoom),
                                  (letterbox == kLetterbox_16_9_Zoom) ? 
1 : 0,
                                  NULL, "ASPECTGROUP");
+    subitem = new OSDGenericTree(item, tr("16:9 Vertical Zoom"), 
"TOGGLEASPECT" +
+                                 QString("%1").arg(kLetterbox_16_9_4_3),
+                                 (letterbox == kLetterbox_16_9_4_3) ? 1 
: 0,
+                                 NULL, "ASPECTGROUP");
     subitem = new OSDGenericTree(item, tr("16:9 Stretch"), "TOGGLEASPECT" +
                                  
QString("%1").arg(kLetterbox_16_9_Stretch),
                                  (letterbox == kLetterbox_16_9_Stretch) 
? 1 : 0,
---------------------------------------------------------cut 
here--------------------------------------------------------------
videoout_quartz.cpp patch :
---------------------------------------------------------cut 
here--------------------------------------------------------------
--- videoout_quartz.cpp.old     2007-09-10 07:38:45.000000000 +0200
+++ videoout_quartz.cpp 2007-09-10 07:47:30.000000000 +0200
@@ -369,6 +369,7 @@
     double hscale, vscale;
     switch (parentData->srcMode)
     {
+        case kLetterbox_16_9_4_3: /* FIXME - i don't know what to do 
here */
         case kLetterbox_4_3_Zoom:
             // height only fills 3/4 of image, zoom up
             hscale = vscale = h * 1.0 / (sh * 0.75);
---------------------------------------------------------cut 
here--------------------------------------------------------------

complete patch in attachment

Regards
Marek Kidawski (Poland)


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff14439.patch
Url: http://mythtv.org/pipermail/mythtv-dev/attachments/20070910/b94e2afe/attachment.diff 


More information about the mythtv-dev mailing list