Skip to content

Commit

Permalink
Content Service: Generate screenshots at the requested size.
Browse files Browse the repository at this point in the history
This is an artifact from way back in 2007/8 when lots of MythXML
preview generation calls were causing BE deadlocks.  Since we believe
we have vanquished the deadlocks and because this API is now
beuing used by third party applications that need high quality imagery,
generate the images at the requested dimensions.

Has the side effect of making the item detail screen in mythweb
look WAY better (not to mention the backend web setup landing page,
and my own third party apps).
  • Loading branch information
Robert McNamara committed Nov 10, 2011
1 parent 177f8a6 commit 49b1272
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions mythtv/programs/mythbackend/services/content.cpp
Expand Up @@ -396,8 +396,8 @@ QFileInfo Content::GetAlbumArt( int nId, int nWidth, int nHeight )

QFileInfo Content::GetPreviewImage( int nChanId,
const QDateTime &dtStartTime,
int nWidth,
int nHeight,
int nWidth,
int nHeight,
int nSecsIn )
{
if (!dtStartTime.isValid())
Expand Down Expand Up @@ -524,13 +524,19 @@ QFileInfo Content::GetPreviewImage( int nChanId,
return QFileInfo( sNewFileName );
}

QImage img = pImage->scaled( nWidth, nHeight, Qt::IgnoreAspectRatio,
Qt::SmoothTransformation);
PreviewGenerator *previewgen = new PreviewGenerator( &pginfo,
QString(),
PreviewGenerator::kLocal);
previewgen->SetPreviewTimeAsSeconds( nSecsIn );
previewgen->SetOutputFilename ( sNewFileName );
previewgen->SetOutputSize (QSize(nWidth,nHeight));

QByteArray fname = sNewFileName.toAscii();
img.save( fname.constData(), "PNG" );
bool ok = previewgen->Run();

previewgen->deleteLater();

makeFileAccessible(fname.constData());
if (!ok)
return QFileInfo();

delete pImage;

Expand Down

0 comments on commit 49b1272

Please sign in to comment.