avmedia/source/viewer/mediawindow.cxx |    8 ++++++--
 include/avmedia/mediawindow.hxx       |    2 +-
 svx/source/svdraw/svdomedia.cxx       |    4 +++-
 3 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 47b0a2935bf1b73647326cb1748b48cb0aeeeaa6
Author:     Tünde Tóth <[email protected]>
AuthorDate: Mon May 16 11:37:57 2022 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri May 20 12:08:35 2022 +0200

    tdf#148923 PPTX import: fix incorrect image in media file
    
    Linked media file was imported with incorrect image,
    if the Impress couldn't play the media file.
    
    Regression from commit 9564747d2fd5d2c859a359dd7fa6242c6859c0d7
    (tdf#53970 PPTX: fix import of linked media files).
    
    Change-Id: Ib277a61e83c3794376d2c090b7f742707e779832
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134394
    Tested-by: Jenkins
    Tested-by: László Németh <[email protected]>
    Reviewed-by: László Németh <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134635

diff --git a/avmedia/source/viewer/mediawindow.cxx 
b/avmedia/source/viewer/mediawindow.cxx
index 4ff32f636eb6..0b1ca1b9c11a 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -352,10 +352,10 @@ uno::Reference< media::XPlayer > 
MediaWindow::createPlayer( const OUString& rURL
     return priv::MediaWindowImpl::createPlayer( rURL, rReferer, pMimeType );
 }
 
-
 uno::Reference< graphic::XGraphic > MediaWindow::grabFrame( const OUString& 
rURL,
                                                             const OUString& 
rReferer,
-                                                            const OUString& 
sMimeType )
+                                                            const OUString& 
sMimeType,
+                                                            const 
uno::Reference<graphic::XGraphic>& rGraphic)
 {
     uno::Reference< media::XPlayer >    xPlayer( createPlayer( rURL, rReferer, 
&sMimeType ) );
     uno::Reference< graphic::XGraphic > xRet;
@@ -394,7 +394,11 @@ uno::Reference< graphic::XGraphic > 
MediaWindow::grabFrame( const OUString& rURL
     }
 
     if (xGraphic)
+    {
+        if (rGraphic)
+            xGraphic.reset(new Graphic(rGraphic));
         xRet = xGraphic->GetXGraphic();
+    }
 
     return xRet;
 }
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
index 78e0b1a299a3..328cad72aad8 100644
--- a/include/avmedia/mediawindow.hxx
+++ b/include/avmedia/mediawindow.hxx
@@ -103,7 +103,7 @@ namespace avmedia
         static css::uno::Reference< css::media::XPlayer > createPlayer( const 
OUString& rURL, const OUString& rReferer, const OUString* pMimeType = nullptr );
 
         static css::uno::Reference< css::graphic::XGraphic > grabFrame( const 
OUString& rURL, const OUString& rReferer,
-            const OUString& sMimeType );
+            const OUString& sMimeType, const 
css::uno::Reference<css::graphic::XGraphic>& rGraphic = nullptr);
 
     private:
         MediaWindow(const MediaWindow&) = delete;
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 515bdff11b42..bc030c7d6d3f 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -146,7 +146,9 @@ uno::Reference< graphic::XGraphic > const & 
SdrMediaObj::getSnapshot() const
         OUString aRealURL = m_xImpl->m_MediaProperties.getTempURL();
         if( aRealURL.isEmpty() )
             aRealURL = m_xImpl->m_MediaProperties.getURL();
-        m_xImpl->m_xCachedSnapshot = avmedia::MediaWindow::grabFrame( 
aRealURL, m_xImpl->m_MediaProperties.getReferer(), 
m_xImpl->m_MediaProperties.getMimeType());
+        uno::Reference<graphic::XGraphic> xGraphic
+            = m_xImpl->m_MediaProperties.getGraphic().GetXGraphic();
+        m_xImpl->m_xCachedSnapshot = avmedia::MediaWindow::grabFrame( 
aRealURL, m_xImpl->m_MediaProperties.getReferer(), 
m_xImpl->m_MediaProperties.getMimeType(), xGraphic);
     }
 #endif
     return m_xImpl->m_xCachedSnapshot;

Reply via email to