diff options
Diffstat (limited to 'avmedia/source/win/framegrabber.cxx')
-rw-r--r-- | avmedia/source/win/framegrabber.cxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/avmedia/source/win/framegrabber.cxx b/avmedia/source/win/framegrabber.cxx index 42e30219caf3..84e9d1b187e8 100644 --- a/avmedia/source/win/framegrabber.cxx +++ b/avmedia/source/win/framegrabber.cxx @@ -38,9 +38,10 @@ #include <vcl/graph.hxx> #include <vcl/dibtools.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <systools/win32/oleauto.hxx> constexpr OUStringLiteral AVMEDIA_WIN_FRAMEGRABBER_IMPLEMENTATIONNAME = u"com.sun.star.comp.avmedia.FrameGrabber_DirectX"; -constexpr OUStringLiteral AVMEDIA_WIN_FRAMEGRABBER_SERVICENAME = u"com.sun.star.media.FrameGrabber_DirectX"; +constexpr OUString AVMEDIA_WIN_FRAMEGRABBER_SERVICENAME = u"com.sun.star.media.FrameGrabber_DirectX"_ustr; using namespace ::com::sun::star; @@ -62,22 +63,15 @@ sal::systools::COMReference<IMediaDet> implCreateMediaDet( const OUString& rURL { sal::systools::COMReference<IMediaDet> pDet; - if( SUCCEEDED(pDet.TryCoCreateInstance(CLSID_MediaDet, nullptr, CLSCTX_INPROC_SERVER)) ) + if( SUCCEEDED(pDet.CoCreateInstance(CLSID_MediaDet, nullptr, CLSCTX_INPROC_SERVER)) ) { OUString aLocalStr; if( osl::FileBase::getSystemPathFromFileURL( rURL, aLocalStr ) == osl::FileBase::E_None ) { - BSTR bstrFilename = SysAllocString(o3tl::toW(aLocalStr.getStr())); - if( !SUCCEEDED( pDet->put_Filename( bstrFilename ) ) ) - { - // Shouldn't we free this string unconditionally, not only in case of failure? - // I cannot find information why do we pass a newly allocated BSTR to the put_Filename - // and if it frees the string internally - SysFreeString(bstrFilename); + if( !SUCCEEDED( pDet->put_Filename(sal::systools::BStr(aLocalStr)) ) ) pDet.clear(); - } } } |