[mythtv] [PATCH] Specify aspect ratio cycle

Chris Pinkham cpinkham at bc2va.org
Sat Jun 12 16:29:04 EDT 2004


> Not sure I see the difference actually?  At least in my case with DVB, 
> the broadcast stream is 576x768 in both 4:3 and 16:9, the only thing 
> which changes is the marker saying whether it's one aspect or the other.
> 
> I hear what Kenneth is saying about it being expensive to move the OSD, 
> but I can't see then how else it can be done because in the stretch 
> modes the current OSD is barely legible (bits missing).
> 
> It really would be great to have a plan of attack on how this should be 
> fixed.  Perhaps then someone will feel like doing the work...
> 
> Thanks for your help in understanding the issues
> 
> Ed W

Attached is a patch that might help point people in the right direction.
It's not working 100% (or even 50%), but it does move the OSD around some
and resize it during the various zoom modes when using ToggleLetterbox.
If someone wants to look into this they could start with this to get an
idea of one way it might be done.  Not sure if this is the best way, but
thought I'd throw this out there if someone wanted to take a look into this.
This code might even be a bad way to do it, I just looked at this for a few
minutes last night and figured I'd throw this out there.

-- 

Chris

-------------- next part --------------
Index: libs/libmythtv/NuppelVideoPlayer.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp,v
retrieving revision 1.347
diff -u -r1.347 NuppelVideoPlayer.cpp
--- libs/libmythtv/NuppelVideoPlayer.cpp	11 Jun 2004 03:16:53 -0000	1.347
+++ libs/libmythtv/NuppelVideoPlayer.cpp	12 Jun 2004 03:06:42 -0000
@@ -2798,6 +2798,32 @@
 {
     if (videoOutput)
         videoOutput->ToggleLetterbox(letterboxMode);
+
+    if (osd)
+    {
+        int dispx = 0, dispy = 0, dispw = 0, disph = 0;
+        float scaledx = 0, scaledy = 0;
+        float scaledw = 1.0, scaledh = 1.0;
+
+        videoOutput->GetDrawSize(dispx, dispy, dispw, disph);
+        videoOutput->GetScalingInfo(scaledx, scaledy, scaledw, scaledh);
+
+cerr << "scaledx = " << scaledx << ", scaledy = " << scaledy << endl;
+cerr << "scaledw = " << scaledw << ", scaledh = " << scaledh << endl;
+
+//        dispx = (int)(dispx / (scaledx / 640.0));
+//        dispy = (int)(dispy / (scaledy / 480.0));
+
+        dispx = (int)(video_width * scaledx);
+        dispy = (int)(video_height * scaledy);
+        dispw = (int)(video_width / scaledw);
+        disph = (int)(video_height / scaledh);
+
+cerr << "NOW dispx = " << dispx << ", dispy = " << dispy << endl;
+cerr << "NOW dispw = " << dispw << ", disph = " << disph << endl;
+        osd->Reinit(video_width, video_height, frame_interval,
+                    dispx, dispy, dispw, disph);
+    }
 }
 
 void NuppelVideoPlayer::Zoom(int direction)
Index: libs/libmythtv/videooutbase.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videooutbase.cpp,v
retrieving revision 1.50
diff -u -r1.50 videooutbase.cpp
--- libs/libmythtv/videooutbase.cpp	30 Apr 2004 06:54:35 -0000	1.50
+++ libs/libmythtv/videooutbase.cpp	12 Jun 2004 03:06:44 -0000
@@ -277,6 +277,15 @@
     height = imgh;
 }
 
+void VideoOutput::GetScalingInfo(float &xoff, float &yoff,
+                                 float &wscale, float &hscale)
+{
+    wscale = 1.0 * dispwoff / dispw;
+    hscale = 1.0 * disphoff / disph;
+    xoff = 1.0 * dispxoff / dispw;
+    yoff = 1.0 * dispyoff / disph;
+}
+
 void VideoOutput::MoveResize(void)
 {
     int yoff, xoff;
Index: libs/libmythtv/videooutbase.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videooutbase.h,v
retrieving revision 1.35
diff -u -r1.35 videooutbase.h
--- libs/libmythtv/videooutbase.h	4 Jun 2004 02:28:51 -0000	1.35
+++ libs/libmythtv/videooutbase.h	12 Jun 2004 03:06:44 -0000
@@ -122,6 +122,8 @@
     int GetLetterbox(void) { return letterbox; }
     void ToggleLetterbox(int letterboxMode = kLetterbox_Toggle);
 
+    void GetScalingInfo(float &xoff, float &yoff, float &wscale, float &hscale);
+
     int ValidVideoFrames(void);
     int FreeVideoFrames(void);
 


More information about the mythtv-dev mailing list