Skip to content

Commit

Permalink
Mac OS X embedded playback, and paused-playback over EPG, fixes, from…
Browse files Browse the repository at this point in the history
… trunk.

Mostly closes #6211.


git-svn-id: http://svn.mythtv.org/svn/branches/release-0-23-fixes@25294 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information
NigelPearson committed Jul 8, 2010
1 parent 954b370 commit ce01b25
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 24 deletions.
136 changes: 114 additions & 22 deletions mythtv/libs/libmythtv/videoout_quartz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ class VideoOutputQuartzView

virtual void EmbedChanged(bool embedded);

virtual void HideForGUI(void);
virtual void ShowAfterGUI(void);

protected:
virtual bool Begin(void);
virtual void End(void);
Expand Down Expand Up @@ -486,6 +489,20 @@ void VideoOutputQuartzView::EmbedChanged(bool embedded)
(void)embedded;
}

/// Subclasses that block the main window should hide
/// their output so that the GUI behind is fully visible.
void VideoOutputQuartzView::HideForGUI(void)
{
// do nothing in default version
}

/// Subclasses that block the main window should re-enable their
/// output after the user has finished interacing with the GUI.
void VideoOutputQuartzView::ShowAfterGUI(void)
{
// do nothing in default version
}

/**
* This view subclass implements full-size video display in the main window.
*/
Expand All @@ -497,7 +514,7 @@ class VoqvMainWindow : public VideoOutputQuartzView
{
alpha = fminf(1.0, fmaxf(0.0, alphaBlend));
applyMoveResize = true;
name = "Main window: ";
name = (char *) "Main window: ";
};

~VoqvMainWindow()
Expand Down Expand Up @@ -565,6 +582,19 @@ class VoqvMainWindow : public VideoOutputQuartzView
Begin();
}
};

void HideForGUI(void)
{
VERBOSE(VB_PLAYBACK, "VOQV::HideForGUI() main window");
End();
}


void ShowAfterGUI(void)
{
VERBOSE(VB_PLAYBACK, "VOQV::ShowAfterGUI() main window");
Begin();
}
};

/**
Expand All @@ -577,7 +607,7 @@ class VoqvEmbedded : public VideoOutputQuartzView
: VideoOutputQuartzView(pData)
{
m_desired = QRect(x, y, w, h);
name = "Embedded window: ";
name = (char *) "Embedded window: ";
};

~VoqvEmbedded()
Expand All @@ -604,11 +634,42 @@ class VoqvEmbedded : public VideoOutputQuartzView
GetPortBounds(thePort, &portBounds);
InvalWindowRect(parentData->window, &portBounds);

// The main class handles masking and resizing, since we set m_desired
viewLock.unlock();
return true;
};

// Simple scaler setup that just uses m_desired to fill embed area:
bool Begin(void)
{
viewLock.lock();
if (DecompressSequenceBeginS(&theCodec, parentData->imgDesc,
NULL, 0, thePort, NULL, NULL, NULL,
srcCopy, theMask, 0,
codecNormalQuality, bestSpeedCodec))
{
VERBOSE(VB_IMPORTANT,
QString("VOQV::Begin(%1) - DecompressSequenceBeginS failed")
.arg(name));
viewLock.unlock();
return false;
}

// Turn off gamma correction unless requested
if (!parentData->correctGamma)
QTSetPixMapHandleRequestedGammaLevel(GetPortPixMap(thePort),
kQTUseSourceGammaLevel);

SetDSequenceFlags(theCodec,
codecDSequenceFlushInsteadOfDirtying,
codecDSequenceFlushInsteadOfDirtying);
viewLock.unlock();

// set transformation matrix
Transform(m_desired);

return true;
}

void EndPort(void)
{
viewLock.lock();
Expand All @@ -627,7 +688,7 @@ class VoqvFullscreen : public VideoOutputQuartzView
: VideoOutputQuartzView(pData)
{
applyMoveResize = true;
name = "Full screen: ";
name = (char *) "Full screen: ";
};

~VoqvFullscreen()
Expand Down Expand Up @@ -711,6 +772,20 @@ class VoqvFullscreen : public VideoOutputQuartzView
Begin();
}
};

void HideForGUI(void)
{
VERBOSE(VB_PLAYBACK, "VOQV::HideForGUI() full screen");
End();
EndPort();
}

void ShowAfterGUI(void)
{
VERBOSE(VB_PLAYBACK, "VOQV::ShowAfterGUI() full screen");
BeginPort();
Begin();
}
};

/**
Expand All @@ -722,7 +797,7 @@ class VoqvDock : public VideoOutputQuartzView
VoqvDock(QuartzData *pData)
: VideoOutputQuartzView(pData)
{
name = "Dock icon: ";
name = (char *) "Dock icon: ";
};

~VoqvDock()
Expand Down Expand Up @@ -766,7 +841,7 @@ class VoqvFloater : public VideoOutputQuartzView
{
alpha = fminf(1.0, fmaxf(0.0, alphaBlend));
resizing = false;
name = "Floating window: ";
name = (char *) "Floating window: ";
};

~VoqvFloater()
Expand Down Expand Up @@ -904,21 +979,6 @@ class VoqvFloater : public VideoOutputQuartzView
UnregisterToolboxObjectClass(myClass);
viewLock.unlock();
};

// We hide the window during embedding.
void EmbedChanged(bool embedded)
{
if (embedded)
{
End();
HideWindow(window);
}
else
{
ShowWindow(window);
Begin();
}
};
};

// The event callback for the floating window above
Expand Down Expand Up @@ -1004,7 +1064,7 @@ class VoqvDesktop : public VideoOutputQuartzView
VoqvDesktop(QuartzData *pData)
: VideoOutputQuartzView(pData)
{
name = "Desktop: ";
name = (char *) "Desktop: ";
};

~VoqvDesktop()
Expand Down Expand Up @@ -1173,6 +1233,12 @@ void VideoOutputQuartz::MoveResize(void)
}
}

void VideoOutputQuartz::ToggleAspectOverride(AspectOverrideMode aspectMode)
{
VideoOutput::ToggleAspectOverride(aspectMode);
MoveResize();
}

bool VideoOutputQuartz::InputChanged(const QSize &input_size,
float aspect,
MythCodecID av_codec_id,
Expand Down Expand Up @@ -1607,6 +1673,8 @@ void VideoOutputQuartz::EmbedInWidget(int x, int y, int w, int h)
return;

VideoOutput::EmbedInWidget(x, y, w, h);
// Base class has now calculated Aspect/Fill,
// but currently we ignore it, and just scale into the whole embed area.

data->pixelLock.lock();

Expand Down Expand Up @@ -1792,6 +1860,30 @@ void VideoOutputQuartz::ProcessFrame(VideoFrame *frame, OSD *osd,
frame->width, frame->height);
}

/// Subclassed so we can hide the QuickTime drawn layer and show the GUI
void VideoOutputQuartz::ResizeForGui(void)
{
data->pixelLock.lock();
vector<VideoOutputQuartzView*>::iterator it = data->views.begin();
for (; it != data->views.end(); ++it)
(*it)->HideForGUI();
data->pixelLock.unlock();

VideoOutput::ResizeForGui();
}

/// Subclassed so we can redisplay the QuickTime layer after ResizeForGui()
void VideoOutputQuartz::ResizeForVideo(uint width, uint height)
{
VideoOutput::ResizeForVideo(width, height);

data->pixelLock.lock();
vector<VideoOutputQuartzView*>::iterator it = data->views.begin();
for (; it != data->views.end(); ++it)
(*it)->ShowAfterGUI();
data->pixelLock.unlock();
}

QStringList VideoOutputQuartz::GetAllowedRenderers(
MythCodecID myth_codec_id, const QSize &video_dim)
{
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/videoout_quartz.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class VideoOutputQuartz : public VideoOutput
void Show(FrameScanType);

void SetVideoFrameRate(float playback_fps);
void ToggleAspectOverride(AspectOverrideMode aspectMode);
bool InputChanged(const QSize &input_size,
float aspect,
MythCodecID av_codec_id,
Expand All @@ -45,6 +46,9 @@ class VideoOutputQuartz : public VideoOutput

void SetDVDVDecoder(DVDV *dvdvdec);

void ResizeForGui(void);
void ResizeForVideo(uint width = 0, uint height = 0);

static QStringList GetAllowedRenderers(MythCodecID myth_codec_id,
const QSize &video_dim);

Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/videooutbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class VideoOutput
virtual void ResizeDisplayWindow(const QRect&, bool);
virtual void EmbedInWidget(int x, int y, int w, int h);
virtual void StopEmbedding(void);
void ResizeForGui(void);
void ResizeForVideo(uint width = 0, uint height = 0);
virtual void ResizeForGui(void);
virtual void ResizeForVideo(uint width = 0, uint height = 0);
virtual void MoveResizeWindow(QRect new_rect) = 0;

virtual void MoveResize(void);
Expand Down

0 comments on commit ce01b25

Please sign in to comment.