Permalink
Browse files

Fix remote screenshots during TV playback

Got home from work and tried while playback was running.  Seems there are two
separate event paths (makes sense) depending on whether or not the player is
running.

Tweaked the playback case as well to match the non-playback.  All is now
working for the remote screenshots on my setup.
  • Loading branch information...
Beirdo committed Jun 11, 2011
1 parent 28f0fdb commit 6be90d3ca5fdf0fe66a8d6380887d70785d297e2
@@ -3875,10 +3875,10 @@ bool MythPlayer::IsEmbedding(void)
return false;
}
-bool MythPlayer::GetScreenShot(int width, int height)
+bool MythPlayer::GetScreenShot(int width, int height, QString filename)
{
if (videoOutput)
- return videoOutput->GetScreenShot(width, height);
+ return videoOutput->GetScreenShot(width, height, filename);
return false;
}
@@ -189,7 +189,7 @@ class MTV_PUBLIC MythPlayer
bool UsingNullVideo(void) const { return using_null_videoout; }
bool HasTVChainNext(void) const;
bool CanSupportDoubleRate(void);
- bool GetScreenShot(int width = 0, int height = 0);
+ bool GetScreenShot(int width = 0, int height = 0, QString filename = "");
// Non-const gets
VideoOutput *getVideoOutput(void) { return videoOutput; }
@@ -8138,15 +8138,25 @@ void TV::customEvent(QEvent *e)
if (message == ACTION_SCREENSHOT)
{
PlayerContext *mctx = GetPlayerWriteLock(0, __FILE__, __LINE__);
- bool extra = me->ExtraDataCount() == 2;
- int width = extra ? me->ExtraData(0).toInt() : 0;
- int height = extra ? me->ExtraData(1).toInt() : 0;
- if (mctx && mctx->player && mctx->player->GetScreenShot(width, height))
+ int width = 0;
+ int height = 0;
+ QString filename;
+
+ if (me->ExtraDataCount() >= 2)
+ {
+ width = me->ExtraData(0).toInt();
+ height = me->ExtraData(1).toInt();
+
+ if (me->ExtraDataCount() == 3)
+ filename = me->ExtraData(2);
+ }
+ if (mctx && mctx->player &&
+ mctx->player->GetScreenShot(width, height, filename))
{
}
else
{
- GetMythMainWindow()->ScreenShot(width, height);
+ GetMythMainWindow()->ScreenShot(width, height, filename);
}
ReturnPlayerLock(mctx);
}
@@ -1258,9 +1258,9 @@ void VideoOutputVDPAU::ParseOptions(void)
}
}
-bool VideoOutputVDPAU::GetScreenShot(int width, int height)
+bool VideoOutputVDPAU::GetScreenShot(int width, int height, QString filename)
{
if (m_render)
- return m_render->GetScreenShot(width, height);
+ return m_render->GetScreenShot(width, height, filename);
return false;
}
@@ -62,7 +62,8 @@ class VideoOutputVDPAU : public VideoOutput
virtual bool hasHWAcceleration(void) const
{ return codec_is_vdpau(video_codec_id); }
virtual MythPainter* GetOSDPainter(void) { return (MythPainter*)m_osd_painter; }
- virtual bool GetScreenShot(int width = 0, int height = 0);
+ virtual bool GetScreenShot(int width = 0, int height = 0,
+ QString filename = "");
virtual bool CanVisualise(AudioPlayer *audio, MythRender *render)
{ return VideoOutput::CanVisualise(audio, m_render); }
@@ -238,7 +238,8 @@ class VideoOutput
virtual QString GetOSDRenderer(void) const;
virtual MythPainter *GetOSDPainter(void) { return (MythPainter*)osd_painter; }
- virtual bool GetScreenShot(int width = 0, int height = 0) { return false; }
+ virtual bool GetScreenShot(int width = 0, int height = 0,
+ QString filename = "") { return false; }
QString GetFilters(void) const;
/// \brief translates caption/dvd button rectangle into 'screen' space
@@ -2236,23 +2236,19 @@ void MythMainWindow::customEvent(QEvent *ce)
}
else if (message.startsWith(ACTION_SCREENSHOT))
{
+ int width = 0;
+ int height = 0;
+ QString filename;
+
if (me->ExtraDataCount() >= 2)
{
- int width = me->ExtraData(0).toInt();
- int height = me->ExtraData(1).toInt();
+ width = me->ExtraData(0).toInt();
+ height = me->ExtraData(1).toInt();
if (me->ExtraDataCount() == 3)
- {
- QString filename = me->ExtraData(2);
- ScreenShot(width, height, filename);
- }
- else
- ScreenShot(width, height);
- }
- else
- {
- ScreenShot();
+ filename = me->ExtraData(2);
}
+ ScreenShot(width, height, filename);
}
}
else if ((MythEvent::Type)(ce->type()) == MythEvent::MythUserMessage)
@@ -475,7 +475,7 @@ void MythRenderVDPAU::MoveResizeWin(QRect &rect)
m_display->MoveResizeWin(m_window, rect);
}
-bool MythRenderVDPAU::GetScreenShot(int width, int height)
+bool MythRenderVDPAU::GetScreenShot(int width, int height, QString filename)
{
LOCK_RENDER
CHECK_STATUS(false)
@@ -516,8 +516,9 @@ bool MythRenderVDPAU::GetScreenShot(int width, int height)
if (height <= 0)
height = img.height();
- img = img.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
- success = window->SaveScreenShot(img);
+ img = img.scaled(width, height, Qt::KeepAspectRatio,
+ Qt::SmoothTransformation);
+ success = window->SaveScreenShot(img, filename);
}
delete [] buffer;
return success;
@@ -73,7 +73,7 @@ class MUI_PUBLIC MythRenderVDPAU : public MythRender
void DrawDisplayRect(const QRect &rect, bool use_colorkey = false);
void MoveResizeWin(QRect &rect);
void CheckOutputSurfaces(void);
- bool GetScreenShot(int width = 0, int height = 0);
+ bool GetScreenShot(int width = 0, int height = 0, QString filename = "");
uint CreateOutputSurface(const QSize &size,
VdpRGBAFormat fmt = VDP_RGBA_FORMAT_B8G8R8A8,

0 comments on commit 6be90d3

Please sign in to comment.