[mythtv] [PATCH] 4:3/16:9 aspect ratio playback toggle
Mark J. Titorenko
mythtv-dev at titorenko.net
Mon Aug 25 18:02:40 EDT 2003
On Sun, Aug 24, 2003 at 01:00:52PM +0100, Mark J. Titorenko wrote:
[snip]
> Overall, I am incredibly impressed with myth, and I hope to be able to
> contribute to its development. One thing that comes to mind is that
> I'd like a toggle in playback mode to switch from 4:3 to 16:9 so I can
> watch widescreen channels in letterbox on my monitor. Any pointers as
> to how this might be achieved would be appreciated.
I managed to work out where this could (should?) go, so I also
engineered a patch which maps the W key to a 16:9/4:3 toggle during
playback. Works great for me, with the only slight irritation being
that when toggled into 16:9 mode the letterbox bars end up being blue
(until the screen is somehow refreshed anyway - I achieve this by
entering and exiting the EPG).
Does anybody have any suggestions on how to make the blue bars go
black?
Cheers,
Mark.
-------------- next part --------------
diff -u ./NuppelVideoPlayer.cpp new/NuppelVideoPlayer.cpp
--- ./NuppelVideoPlayer.cpp 2003-08-25 16:48:12.000000000 +0100
+++ new/NuppelVideoPlayer.cpp 2003-08-25 16:47:48.000000000 +0100
@@ -167,6 +167,8 @@
lastccrow = 0;
limitKeyRepeat = false;
+
+ letterbox = false;
}
NuppelVideoPlayer::~NuppelVideoPlayer(void)
@@ -2197,6 +2199,21 @@
decoder->setExactSeeks(exactstore);
}
+bool NuppelVideoPlayer::GetLetterbox(void)
+{
+ return letterbox;
+}
+
+void NuppelVideoPlayer::ToggleLetterbox(void)
+{
+ if ( letterbox )
+ videoOutput->AspectChanged( 1.333 );
+ else
+ videoOutput->AspectChanged( 1.777 );
+
+ letterbox = !letterbox;
+}
+
void NuppelVideoPlayer::UpdateSeekAmount(bool up)
{
if (seekamountpos > 0 && !up)
diff -u ./NuppelVideoPlayer.h new/NuppelVideoPlayer.h
--- ./NuppelVideoPlayer.h 2003-08-25 16:48:13.000000000 +0100
+++ new/NuppelVideoPlayer.h 2003-08-25 16:47:48.000000000 +0100
@@ -167,6 +167,9 @@
void ReinitVideo(void);
void ReinitAudio(void);
+ void ToggleLetterbox(void);
+ bool GetLetterbox(void);
+
protected:
void OutputVideoLoop(void);
@@ -419,6 +422,8 @@
bool limitKeyRepeat;
VideoFrame pauseFrame;
+
+ bool letterbox;
};
#endif
diff -u ./tv_play.cpp new/tv_play.cpp
--- ./tv_play.cpp 2003-08-25 16:48:15.000000000 +0100
+++ new/tv_play.cpp 2003-08-25 16:42:26.000000000 +0100
@@ -845,6 +845,7 @@
case Key_BracketLeft: case Key_BracketRight:
case Key_Bar: passThru = 1; break;
+ case Key_W: passThru = 1; break;
}
if (!passThru)
@@ -1010,6 +1011,7 @@
case Key_BracketLeft: case Key_F10: ChangeVolume(false); break;
case Key_BracketRight: case Key_F11: ChangeVolume(true); break;
case Key_Bar: case Key_F9: ToggleMute(); break;
+ case Key_W: ToggleLetterbox(); break;
default:
{
@@ -2048,6 +2050,20 @@
osd->SetSettingsText(text, 5);
}
+void TV::ToggleLetterbox(void)
+{
+ nvp->ToggleLetterbox();
+ bool letterbox = nvp->GetLetterbox();
+ QString text;
+ if (letterbox)
+ text = tr("16:9");
+ else
+ text = tr("4:3");
+
+ if (osd && !browsemode )
+ osd->SetSettingsText(text, 5);
+}
+
void TV::EPGChannelUpdate(QString chanstr)
{
if (chanstr != "")
diff -u ./tv_play.h new/tv_play.h
--- ./tv_play.h 2003-08-25 16:48:15.000000000 +0100
+++ new/tv_play.h 2003-08-25 16:47:48.000000000 +0100
@@ -107,6 +107,7 @@
void ChangeVolume(bool up);
void ToggleMute(void);
+ void ToggleLetterbox(void);
void ChangeContrast(bool up);
void ChangeBrightness(bool up);
void ChangeColour(bool up);
diff -u ./videooutbase.cpp new/videooutbase.cpp
--- ./videooutbase.cpp 2003-08-25 16:48:19.000000000 +0100
+++ new/videooutbase.cpp 2003-08-25 16:47:48.000000000 +0100
@@ -66,6 +66,11 @@
XJ_aspect = aspect;
}
+void VideoOutput::AspectChanged(float aspect)
+{
+ XJ_aspect = aspect;
+}
+
void VideoOutput::EmbedInWidget(unsigned long wid, int x, int y, int w, int h)
{
(void)wid;
diff -u ./videooutbase.h new/videooutbase.h
--- ./videooutbase.h 2003-08-25 16:48:19.000000000 +0100
+++ new/videooutbase.h 2003-08-25 16:47:48.000000000 +0100
@@ -18,6 +18,7 @@
virtual void Show(void) = 0;
virtual void InputChanged(int width, int height, float aspect);
+ virtual void AspectChanged(float aspect);
virtual void EmbedInWidget(unsigned long wid, int x, int y, int w, int h);
virtual void StopEmbedding(void);
diff -u ./videoout_xv.cpp new/videoout_xv.cpp
--- ./videoout_xv.cpp 2003-08-25 16:48:17.000000000 +0100
+++ new/videoout_xv.cpp 2003-08-25 16:47:48.000000000 +0100
@@ -81,6 +81,16 @@
delete data;
}
+void VideoOutputXv::AspectChanged(float aspect)
+{
+ pthread_mutex_lock(&lock);
+
+ VideoOutput::AspectChanged(aspect);
+
+ MoveResize();
+ pthread_mutex_unlock(&lock);
+}
+
void VideoOutputXv::InputChanged(int width, int height, float aspect)
{
pthread_mutex_lock(&lock);
@@ -101,7 +111,7 @@
else
{
DeleteXBuffers();
- CreateShmBuffers();
+ CreateXBuffers();
}
MoveResize();
diff -u ./videoout_xv.h new/videoout_xv.h
--- ./videoout_xv.h 2003-08-25 16:48:17.000000000 +0100
+++ new/videoout_xv.h 2003-08-25 16:47:48.000000000 +0100
@@ -18,6 +18,7 @@
void Show(void);
void InputChanged(int width, int height, float aspect);
+ void AspectChanged(float aspect);
void EmbedInWidget(unsigned long wid, int x, int y, int w, int h);
void StopEmbedding(void);
diff -u ./videoout_xvmc.cpp new/videoout_xvmc.cpp
--- ./videoout_xvmc.cpp 2003-08-25 16:48:19.000000000 +0100
+++ new/videoout_xvmc.cpp 2003-08-25 16:47:48.000000000 +0100
@@ -76,6 +76,20 @@
delete data;
}
+void VideoOutputXvMC::AspectChanged(float aspect)
+{
+ pthread_mutex_lock(&lock);
+
+ VideoOutput::AspectChanged(aspect);
+
+ DeleteXvMCBuffers();
+ CreateXvMCBuffers();
+ XFlush(data->XJ_disp);
+
+ MoveResize();
+ pthread_mutex_unlock(&lock);
+}
+
void VideoOutputXvMC::InputChanged(int width, int height, float aspect)
{
pthread_mutex_lock(&lock);
diff -u ./videoout_xvmc.h new/videoout_xvmc.h
--- ./videoout_xvmc.h 2003-08-25 16:48:19.000000000 +0100
+++ new/videoout_xvmc.h 2003-08-25 16:47:48.000000000 +0100
@@ -17,6 +17,7 @@
void PrepareFrame(VideoFrame *buffer);
void Show(void);
+ void AspectChanged(int width, int height, float aspect);
void InputChanged(int width, int height, float aspect);
void EmbedInWidget(unsigned long wid, int x, int y, int w, int h);
More information about the mythtv-dev
mailing list