[Libreoffice-commits] core.git: avmedia/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 10 07:31:52 UTC 2019


 avmedia/source/win/player.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 37fe8619728b2179e6c1d3f25eeee85755dcd40a
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Wed Oct 9 22:52:16 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Oct 10 09:31:17 2019 +0200

    tdf#128057: convert file URIs to system path for IGraphBuilder::RenderFile
    
    It seems to handle file URIs incorrectly, failing when the characters in the
    URI are URI-encoded like %23 for #.
    
    Change-Id: Ibc1e27ce38d65781cdb8278c4787aafa00092754
    Reviewed-on: https://gerrit.libreoffice.org/80567
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx
index 32ad54b9b7d4..4ca27603ce99 100644
--- a/avmedia/source/win/player.cxx
+++ b/avmedia/source/win/player.cxx
@@ -28,6 +28,7 @@
 #include "window.hxx"
 #include <cppuhelper/supportsservice.hxx>
 #include <o3tl/char16_t2wchar_t.hxx>
+#include <osl/file.hxx>
 
 #define AVMEDIA_WIN_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_DirectX"
 #define AVMEDIA_WIN_PLAYER_SERVICENAME "com.sun.star.media.Player_DirectX"
@@ -142,7 +143,13 @@ bool Player::create( const OUString& rURL )
         // It disables the desktop composition as soon as RenderFile is called
         // also causes some other problems: video rendering is not reliable
 
-        if( SUCCEEDED( hR = mpGB->RenderFile( o3tl::toW(rURL.getStr()), nullptr ) ) &&
+        // tdf#128057: IGraphBuilder::RenderFile seems to fail to handle file URIs properly when
+        // they contain encoded characters like "%23"; so pass system path in that case instead.
+        OUString aFile(rURL);
+        if (aFile.startsWithIgnoreAsciiCase("file:"))
+            osl::FileBase::getSystemPathFromFileURL(rURL, aFile);
+
+        if( SUCCEEDED( hR = mpGB->RenderFile( o3tl::toW(aFile.getStr()), nullptr ) ) &&
             SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaControl, reinterpret_cast<void**>(&mpMC) ) ) &&
             SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaEventEx, reinterpret_cast<void**>(&mpME) ) ) &&
             SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaSeeking, reinterpret_cast<void**>(&mpMS) ) ) &&


More information about the Libreoffice-commits mailing list