[mythtv] OSD resize

Chris Pinkham cpinkham at bc2va.org
Sat Aug 28 15:02:16 EDT 2004


> Hi all,
> 
> I know this has been mentioned a few times before, but I've been hacking
> at the osd code and just can't figure out if it is possible to keep the
> OSD a constant size relative to the screen whn you zoom the video.
> 
> Does anyone know if it can be done?
> 
> Thanks, Paul

It's possible but nobody has spent the time to sit down and work it out
yet.  The attached patch might help you get started in the right direction
and show you it's possible.  This is just something I tried one day to
see if I could get it to display in the proper size/location but I didn't
spend enough time on it to work out the formulas correctly.

-- 

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