Fix --disable-avmedia for DESKTOP build

Probably additional bits can be removed, but this now passes.

Change-Id: I366bec43cfd6fb02e914c85c711b3b19586d534d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126161
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
This commit is contained in:
Jan-Marek Glogowski
2021-05-18 01:11:41 +02:00
parent b8084b0dee
commit f9e79a91f1
19 changed files with 89 additions and 146 deletions

View File

@@ -324,10 +324,12 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ogltrans, \
$(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
acc \ acc \
$(call gb_Helper_optional,AVMEDIA,avmedia) \ avmedia \
$(call gb_Helper_optional,AVMEDIA, \
$(if $(filter MACOSX,$(OS)),\ $(if $(filter MACOSX,$(OS)),\
avmediaMacAVF \ avmediaMacAVF \
) \ ) \
) \
$(call gb_Helper_optional,SCRIPTING, \ $(call gb_Helper_optional,SCRIPTING, \
basctl \ basctl \
basprov \ basprov \
@@ -593,8 +595,10 @@ $(eval $(call gb_Helper_register_libraries_for_install,PRIVATELIBS_URE,ure, \
)) ))
$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
$(if $(ENABLE_GSTREAMER_1_0),avmediagst) \ $(call gb_Helper_optional,AVMEDIA, \
$(if $(filter WNT,$(OS)),avmediawin) \ $(if $(ENABLE_GSTREAMER_1_0),avmediagst) \
$(if $(filter WNT,$(OS)),avmediawin) \
) \
cached1 \ cached1 \
collator_data \ collator_data \
comphelper \ comphelper \
@@ -1108,7 +1112,7 @@ $(eval $(call gb_ExternalExecutable_register_executables,\
# Resources # Resources
$(eval $(call gb_Helper_register_mos,\ $(eval $(call gb_Helper_register_mos,\
acc \ acc \
avmedia \ $(call gb_Helper_optional,AVMEDIA,avmedia) \
$(call gb_Helper_optional,SCRIPTING,basctl) \ $(call gb_Helper_optional,SCRIPTING,basctl) \
chart \ chart \
cnr \ cnr \

View File

@@ -25,7 +25,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
android \ android \
animations \ animations \
apple_remote \ apple_remote \
$(call gb_Helper_optional,AVMEDIA,avmedia) \ avmedia \
basctl \ basctl \
basegfx \ basegfx \
basic \ basic \

View File

@@ -9,15 +9,16 @@
$(eval $(call gb_Library_Library,avmedia)) $(eval $(call gb_Library_Library,avmedia))
$(eval $(call gb_Library_set_componentfile,avmedia,avmedia/util/avmedia))
$(eval $(call gb_Library_set_include,avmedia,\ $(eval $(call gb_Library_set_include,avmedia,\
$$(INCLUDE) \ $$(INCLUDE) \
-I$(SRCDIR)/avmedia/inc \ -I$(SRCDIR)/avmedia/inc \
-I$(SRCDIR)/avmedia/source/inc \ -I$(SRCDIR)/avmedia/source/inc \
)) ))
$(eval $(call gb_Library_set_componentfile,avmedia,avmedia/util/avmedia)) $(eval $(call gb_Library_use_libraries,avmedia,\
sal \
svl \
))
$(eval $(call gb_Library_use_sdk_api,avmedia,)) $(eval $(call gb_Library_use_sdk_api,avmedia,))
@@ -25,35 +26,30 @@ $(eval $(call gb_Library_use_externals,avmedia,\
boost_headers \ boost_headers \
)) ))
ifeq ($(USE_AVMEDIA_DUMMY),TRUE)
$(eval $(call gb_Library_add_exception_objects,avmedia,\
avmedia/source/avmediadummy \
))
else
$(eval $(call gb_Library_add_defs,avmedia,\ $(eval $(call gb_Library_add_defs,avmedia,\
-DAVMEDIA_DLLIMPLEMENTATION \ -DAVMEDIA_DLLIMPLEMENTATION \
)) ))
$(eval $(call gb_Library_add_exception_objects,avmedia,\
avmedia/source/framework/mediaitem \
))
ifneq (,$(filter AVMEDIA,$(BUILD_TYPE)))
ifeq ($(DISABLE_GUI),) ifeq ($(DISABLE_GUI),)
$(eval $(call gb_Library_use_externals,avmedia,\ $(eval $(call gb_Library_use_externals,avmedia,\
epoxy \ epoxy \
)) ))
endif
$(eval $(call gb_Library_set_componentfile,avmedia,avmedia/util/avmedia))
$(eval $(call gb_Library_use_libraries,avmedia,\ $(eval $(call gb_Library_use_libraries,avmedia,\
comphelper \ comphelper \
ucbhelper \ ucbhelper \
cppu \ cppu \
cppuhelper \ cppuhelper \
sal \
i18nlangtag \ i18nlangtag \
sfx \ sfx \
svl \
svt \ svt \
tl \ tl \
utl \ utl \
@@ -63,7 +59,6 @@ $(eval $(call gb_Library_use_libraries,avmedia,\
$(eval $(call gb_Library_add_exception_objects,avmedia,\ $(eval $(call gb_Library_add_exception_objects,avmedia,\
avmedia/source/framework/mediacontrol \ avmedia/source/framework/mediacontrol \
avmedia/source/framework/MediaControlBase \ avmedia/source/framework/MediaControlBase \
avmedia/source/framework/mediaitem \
avmedia/source/framework/mediaplayer \ avmedia/source/framework/mediaplayer \
avmedia/source/framework/mediatoolbox \ avmedia/source/framework/mediatoolbox \
avmedia/source/framework/soundhandler \ avmedia/source/framework/soundhandler \
@@ -71,6 +66,8 @@ $(eval $(call gb_Library_add_exception_objects,avmedia,\
avmedia/source/viewer/mediawindow \ avmedia/source/viewer/mediawindow \
avmedia/source/viewer/mediawindow_impl \ avmedia/source/viewer/mediawindow_impl \
)) ))
endif
endif # !DISABLE_GUI
endif # AVMEDIA
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:

View File

@@ -13,7 +13,8 @@ $(eval $(call gb_Module_add_targets,avmedia,\
Library_avmedia \ Library_avmedia \
)) ))
ifneq ($(USE_AVMEDIA_DUMMY),TRUE) ifneq (,$(filter AVMEDIA,$(BUILD_TYPE)))
$(eval $(call gb_Module_add_l10n_targets,avmedia,\ $(eval $(call gb_Module_add_l10n_targets,avmedia,\
AllLangMoTarget_avmedia \ AllLangMoTarget_avmedia \
)) ))
@@ -36,6 +37,6 @@ $(eval $(call gb_Module_add_targets,avmedia,\
)) ))
endif endif
endif endif # AVMEDIA
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:

View File

@@ -1,93 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <avmedia/mediaitem.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
using namespace ::com::sun::star;
namespace avmedia
{
MediaItem::MediaItem( sal_uInt16 i_nWhich, AVMediaSetMask )
: SfxPoolItem( i_nWhich )
{
}
MediaItem::MediaItem( const MediaItem& rItem )
: SfxPoolItem( rItem )
{
}
MediaItem::~MediaItem()
{
}
struct MediaItem::Impl
{
};
bool MediaItem::QueryValue( css::uno::Any&, sal_uInt8 ) const
{
return false;
}
bool MediaItem::GetPresentation( SfxItemPresentation, MapUnit, MapUnit, OUString&, const IntlWrapper& ) const
{
return false;
}
bool MediaItem::PutValue( const css::uno::Any&, sal_uInt8 )
{
return false;
}
AVMediaSetMask MediaItem::getMaskSet() const
{
(void) this; // Silence loplugin:staticmethods
return AVMediaSetMask::NONE;
}
SfxPoolItem* MediaItem::CreateDefault()
{
return new MediaItem;
}
MediaItem* MediaItem::Clone( SfxItemPool*) const
{
return nullptr;
}
bool MediaItem::operator==( const SfxPoolItem& rItem ) const
{
assert(SfxPoolItem::operator==(rItem)); (void)rItem;
return false;
}
} // namespace avmedia
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_framework_SoundHandler_get_implementation(css::uno::XComponentContext*,
css::uno::Sequence<css::uno::Any> const &)
{
return nullptr;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -730,7 +730,6 @@ export ZLIB_CFLAGS=$(gb_SPACE)@ZLIB_CFLAGS@
export ZLIB_LIBS=$(gb_SPACE)@ZLIB_LIBS@ export ZLIB_LIBS=$(gb_SPACE)@ZLIB_LIBS@
export ZMF_CFLAGS=$(gb_SPACE)@ZMF_CFLAGS@ export ZMF_CFLAGS=$(gb_SPACE)@ZMF_CFLAGS@
export ZMF_LIBS=$(gb_SPACE)@ZMF_LIBS@ export ZMF_LIBS=$(gb_SPACE)@ZMF_LIBS@
export USE_AVMEDIA_DUMMY=@USE_AVMEDIA_DUMMY@
# lang-related stuff # lang-related stuff
include $(BUILDDIR)/config_$(gb_Side)_lang.mk include $(BUILDDIR)/config_$(gb_Side)_lang.mk

View File

@@ -1381,8 +1381,8 @@ libo_FUZZ_ARG_ENABLE(extension-integration,
AC_ARG_ENABLE(avmedia, AC_ARG_ENABLE(avmedia,
AS_HELP_STRING([--disable-avmedia], AS_HELP_STRING([--disable-avmedia],
[Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]) [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
) ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
AC_ARG_ENABLE(database-connectivity, AC_ARG_ENABLE(database-connectivity,
AS_HELP_STRING([--disable-database-connectivity], AS_HELP_STRING([--disable-database-connectivity],
@@ -2944,17 +2944,12 @@ fi
# Whether to build "avmedia" functionality or not. # Whether to build "avmedia" functionality or not.
if test -z "$enable_avmedia"; then
enable_avmedia=yes
fi
BUILD_TYPE="$BUILD_TYPE AVMEDIA"
if test "$enable_avmedia" = yes; then if test "$enable_avmedia" = yes; then
BUILD_TYPE="$BUILD_TYPE AVMEDIA"
AC_DEFINE(HAVE_FEATURE_AVMEDIA) AC_DEFINE(HAVE_FEATURE_AVMEDIA)
else else
USE_AVMEDIA_DUMMY='TRUE' test_gstreamer_1_0=no
fi fi
AC_SUBST(USE_AVMEDIA_DUMMY)
# Decide whether to build database connectivity stuff (including Base) or not. # Decide whether to build database connectivity stuff (including Base) or not.
if test "$enable_database_connectivity" != no; then if test "$enable_database_connectivity" != no; then

View File

@@ -35,7 +35,7 @@ endif
endif endif
$(eval $(call gb_CppunitTest_use_libraries,oox_tokenmap,\ $(eval $(call gb_CppunitTest_use_libraries,oox_tokenmap,\
avmedia \ $(call gb_Helper_optional,AVMEDIA,avmedia) \
basegfx \ basegfx \
comphelper \ comphelper \
cppu \ cppu \

View File

@@ -158,21 +158,19 @@ $(eval $(call gb_Rdb_add_components,services,\
lingucomponent/source/spellcheck/macosxspell/MacOSXSpell \ lingucomponent/source/spellcheck/macosxspell/MacOSXSpell \
) \ ) \
$(if $(filter WNT,$(OS)), \ $(if $(filter WNT,$(OS)), \
avmedia/source/win/avmediawin \ $(call gb_Helper_optional,AVMEDIA,avmedia/source/win/avmediawin) \
embeddedobj/source/msole/emboleobj.windows \
embedserv/util/emser \
extensions/source/ole/oleautobridge \
fpicker/source/win32/fps \ fpicker/source/win32/fps \
shell/source/backends/wininetbe/wininetbe1 \ shell/source/backends/wininetbe/wininetbe1 \
shell/source/win32/simplemail/smplmail \ shell/source/win32/simplemail/smplmail \
shell/source/win32/syssh \ shell/source/win32/syssh \
winaccessibility/source/service/winaccessibility \
) \ ) \
$(if $(filter-out WNT,$(OS)), \ $(if $(filter-out WNT,$(OS)), \
embeddedobj/source/msole/emboleobj \ embeddedobj/source/msole/emboleobj \
) \ ) \
$(if $(filter WNT,$(OS)), \
embeddedobj/source/msole/emboleobj.windows \
embedserv/util/emser \
extensions/source/ole/oleautobridge \
winaccessibility/source/service/winaccessibility \
) \
$(if $(filter neon,$(WITH_WEBDAV)), \ $(if $(filter neon,$(WITH_WEBDAV)), \
ucb/source/ucp/webdav-neon/ucpdav1 \ ucb/source/ucp/webdav-neon/ucpdav1 \
) \ ) \
@@ -205,7 +203,7 @@ $(eval $(call gb_Rdb_add_components,services,\
ucb/source/ucp/gio/ucpgio \ ucb/source/ucp/gio/ucpgio \
) \ ) \
$(if $(ENABLE_GSTREAMER_1_0), \ $(if $(ENABLE_GSTREAMER_1_0), \
avmedia/source/gstreamer/avmediagstreamer \ $(call gb_Helper_optional,AVMEDIA,avmedia/source/gstreamer/avmediagstreamer) \
) \ ) \
$(if $(ENABLE_KF5), \ $(if $(ENABLE_KF5), \
shell/source/backends/kf5be/kf5be1 \ shell/source/backends/kf5be/kf5be1 \

View File

@@ -64,7 +64,7 @@ $(eval $(call gb_Library_use_externals,sc,orcus-parser))
endif endif
$(eval $(call gb_Library_use_libraries,sc,\ $(eval $(call gb_Library_use_libraries,sc,\
$(call gb_Helper_optional,AVMEDIA,avmedia) \ avmedia \
basegfx \ basegfx \
comphelper \ comphelper \
cppu \ cppu \

View File

@@ -67,7 +67,7 @@ $(eval $(call gb_Library_use_custom_headers,sd,\
$(eval $(call gb_Library_use_sdk_api,sd)) $(eval $(call gb_Library_use_sdk_api,sd))
$(eval $(call gb_Library_use_libraries,sd,\ $(eval $(call gb_Library_use_libraries,sd,\
$(call gb_Helper_optional,AVMEDIA,avmedia) \ avmedia \
basegfx \ basegfx \
canvastools \ canvastools \
comphelper \ comphelper \

View File

@@ -18,6 +18,7 @@
*/ */
#include <config_features.h>
#include <tools/diagnose_ex.h> #include <tools/diagnose_ex.h>
#include <cppuhelper/basemutex.hxx> #include <cppuhelper/basemutex.hxx>
@@ -2350,6 +2351,9 @@ std::shared_ptr<avmedia::MediaTempFile> SlideShowImpl::getMediaTempFile(const OU
{ {
std::shared_ptr<avmedia::MediaTempFile> aRet; std::shared_ptr<avmedia::MediaTempFile> aRet;
#if !HAVE_FEATURE_AVMEDIA
(void)aUrl;
#else
if (!mxSBD.is()) if (!mxSBD.is())
return aRet; return aRet;
@@ -2373,6 +2377,7 @@ std::shared_ptr<avmedia::MediaTempFile> SlideShowImpl::getMediaTempFile(const OU
xInStream->closeInput(); xInStream->closeInput();
} }
#endif
return aRet; return aRet;
} }

View File

@@ -18,6 +18,7 @@
*/ */
#include <config_features.h>
#include <tools/diagnose_ex.h> #include <tools/diagnose_ex.h>
#include <com/sun/star/lang/NoSupportException.hpp> #include <com/sun/star/lang/NoSupportException.hpp>
@@ -90,6 +91,9 @@ namespace slideshow::internal
ENSURE_OR_THROW( rComponentContext.is(), ENSURE_OR_THROW( rComponentContext.is(),
"SoundPlayer::SoundPlayer(): Invalid component context" ); "SoundPlayer::SoundPlayer(): Invalid component context" );
#if !HAVE_FEATURE_AVMEDIA
(void) rMediaFileManager;
#else
try try
{ {
if (rSoundURL.startsWithIgnoreAsciiCase("vnd.sun.star.Package:")) if (rSoundURL.startsWithIgnoreAsciiCase("vnd.sun.star.Package:"))
@@ -107,6 +111,7 @@ namespace slideshow::internal
catch( uno::Exception& ) catch( uno::Exception& )
{ {
} }
#endif
if( !mxPlayer.is() ) if( !mxPlayer.is() )
throw lang::NoSupportException( throw lang::NoSupportException(

View File

@@ -49,7 +49,7 @@ $(eval $(call gb_Library_add_defs,svxcore,\
)) ))
$(eval $(call gb_Library_use_libraries,svxcore,\ $(eval $(call gb_Library_use_libraries,svxcore,\
$(call gb_Helper_optional,AVMEDIA,avmedia) \ avmedia \
basegfx \ basegfx \
sb \ sb \
comphelper \ comphelper \
@@ -257,7 +257,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/sdr/contact/viewobjectcontactofsdrole2obj \ svx/source/sdr/contact/viewobjectcontactofsdrole2obj \
svx/source/sdr/contact/viewobjectcontactofunocontrol \ svx/source/sdr/contact/viewobjectcontactofunocontrol \
svx/source/sdr/contact/viewobjectcontactofgraphic \ svx/source/sdr/contact/viewobjectcontactofgraphic \
svx/source/sdr/contact/sdrmediawindow \ $(call gb_Helper_optional,AVMEDIA,svx/source/sdr/contact/sdrmediawindow) \
svx/source/sdr/contact/viewobjectcontactofsdrmediaobj \ svx/source/sdr/contact/viewobjectcontactofsdrmediaobj \
svx/source/sdr/contact/viewcontactofsdrcaptionobj \ svx/source/sdr/contact/viewcontactofsdrcaptionobj \
svx/source/sdr/contact/viewcontactofvirtobj \ svx/source/sdr/contact/viewcontactofvirtobj \

View File

@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <config_features.h>
#include <svx/MediaShellHelpers.hxx> #include <svx/MediaShellHelpers.hxx>
#include <avmedia/mediaitem.hxx> #include <avmedia/mediaitem.hxx>
#include <sfx2/request.hxx> #include <sfx2/request.hxx>
@@ -41,6 +42,7 @@ void GetState(const SdrMarkView* pSdrView, SfxItemSet& rSet)
if (SID_AVMEDIA_TOOLBOX != nWhich) if (SID_AVMEDIA_TOOLBOX != nWhich)
continue; continue;
#if HAVE_FEATURE_AVMEDIA
const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
bool bDisable = true; bool bDisable = true;
@@ -60,12 +62,18 @@ void GetState(const SdrMarkView* pSdrView, SfxItemSet& rSet)
} }
if (bDisable) if (bDisable)
#endif
rSet.DisableItem(SID_AVMEDIA_TOOLBOX); rSet.DisableItem(SID_AVMEDIA_TOOLBOX);
} }
} }
const ::avmedia::MediaItem* Execute(const SdrMarkView* pSdrView, SfxRequest const& rReq) const ::avmedia::MediaItem* Execute(const SdrMarkView* pSdrView, SfxRequest const& rReq)
{ {
#if !HAVE_FEATURE_AVMEDIA
(void)pSdrView;
(void)rReq;
return nullptr;
#else
if (!pSdrView) if (!pSdrView)
return nullptr; return nullptr;
@@ -96,6 +104,7 @@ const ::avmedia::MediaItem* Execute(const SdrMarkView* pSdrView, SfxRequest cons
.executeMediaItem(*pMediaItem); .executeMediaItem(*pMediaItem);
return pMediaItem; return pMediaItem;
#endif
} }
} // end of namespace svx::MediaShellHelpers } // end of namespace svx::MediaShellHelpers

View File

@@ -44,10 +44,12 @@ using namespace ::com::sun::star;
struct SdrMediaObj::Impl struct SdrMediaObj::Impl
{ {
::avmedia::MediaItem m_MediaProperties; ::avmedia::MediaItem m_MediaProperties;
#if HAVE_FEATURE_AVMEDIA
// Note: the temp file is read only, until it is deleted! // Note: the temp file is read only, until it is deleted!
// It may be shared between multiple documents in case of copy/paste, // It may be shared between multiple documents in case of copy/paste,
// hence the shared_ptr. // hence the shared_ptr.
std::shared_ptr< ::avmedia::MediaTempFile > m_pTempFile; std::shared_ptr< ::avmedia::MediaTempFile > m_pTempFile;
#endif
uno::Reference< graphic::XGraphic > m_xCachedSnapshot; uno::Reference< graphic::XGraphic > m_xCachedSnapshot;
OUString m_LastFailedPkgURL; OUString m_LastFailedPkgURL;
}; };
@@ -62,7 +64,9 @@ SdrMediaObj::SdrMediaObj(SdrModel& rSdrModel, SdrMediaObj const & rSource)
: SdrRectObj(rSdrModel, rSource) : SdrRectObj(rSdrModel, rSource)
,m_xImpl( new Impl ) ,m_xImpl( new Impl )
{ {
#if HAVE_FEATURE_AVMEDIA
m_xImpl->m_pTempFile = rSource.m_xImpl->m_pTempFile; // before props m_xImpl->m_pTempFile = rSource.m_xImpl->m_pTempFile; // before props
#endif
setMediaProperties( rSource.getMediaProperties() ); setMediaProperties( rSource.getMediaProperties() );
m_xImpl->m_xCachedSnapshot = rSource.m_xImpl->m_xCachedSnapshot; m_xImpl->m_xCachedSnapshot = rSource.m_xImpl->m_xCachedSnapshot;
} }
@@ -218,7 +222,7 @@ const OUString& SdrMediaObj::getURL() const
#if HAVE_FEATURE_AVMEDIA #if HAVE_FEATURE_AVMEDIA
return m_xImpl->m_MediaProperties.getURL(); return m_xImpl->m_MediaProperties.getURL();
#else #else
static OUString ret; static OUString ret;
return ret; return ret;
#endif #endif
} }
@@ -236,6 +240,7 @@ const ::avmedia::MediaItem& SdrMediaObj::getMediaProperties() const
uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream() const uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream() const
{ {
#if HAVE_FEATURE_AVMEDIA
if (!m_xImpl->m_pTempFile) if (!m_xImpl->m_pTempFile)
{ {
SAL_WARN("svx", "this is only intended for embedded media"); SAL_WARN("svx", "this is only intended for embedded media");
@@ -245,10 +250,16 @@ uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream() const
uno::Reference<ucb::XCommandEnvironment>(), uno::Reference<ucb::XCommandEnvironment>(),
comphelper::getProcessComponentContext()); comphelper::getProcessComponentContext());
return tempFile.openStream(); return tempFile.openStream();
#else
return nullptr;
#endif
} }
void SdrMediaObj::SetInputStream(uno::Reference<io::XInputStream> const& xStream) void SdrMediaObj::SetInputStream(uno::Reference<io::XInputStream> const& xStream)
{ {
#if !HAVE_FEATURE_AVMEDIA
(void) xStream;
#else
if (m_xImpl->m_pTempFile || m_xImpl->m_LastFailedPkgURL.isEmpty()) if (m_xImpl->m_pTempFile || m_xImpl->m_LastFailedPkgURL.isEmpty())
{ {
SAL_WARN("svx", "this is only intended for embedded media"); SAL_WARN("svx", "this is only intended for embedded media");
@@ -265,12 +276,11 @@ void SdrMediaObj::SetInputStream(uno::Reference<io::XInputStream> const& xStream
if (bSuccess) if (bSuccess)
{ {
m_xImpl->m_pTempFile = std::make_shared<::avmedia::MediaTempFile>(tempFileURL); m_xImpl->m_pTempFile = std::make_shared<::avmedia::MediaTempFile>(tempFileURL);
#if HAVE_FEATURE_AVMEDIA
m_xImpl->m_MediaProperties.setURL( m_xImpl->m_MediaProperties.setURL(
m_xImpl->m_LastFailedPkgURL, tempFileURL, ""); m_xImpl->m_LastFailedPkgURL, tempFileURL, "");
#endif
} }
m_xImpl->m_LastFailedPkgURL.clear(); // once only m_xImpl->m_LastFailedPkgURL.clear(); // once only
#endif
} }
/// copy a stream from XStorage to temp file /// copy a stream from XStorage to temp file

View File

@@ -785,9 +785,11 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr
|| (pProperty->nWID == OWN_ATTR_MEDIA_MIMETYPE) || (pProperty->nWID == OWN_ATTR_MEDIA_MIMETYPE)
|| (pProperty->nWID == OWN_ATTR_VALUE_GRAPHIC)) || (pProperty->nWID == OWN_ATTR_VALUE_GRAPHIC))
{ {
#if HAVE_FEATURE_AVMEDIA
SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( GetSdrObject() ); SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( GetSdrObject() );
::avmedia::MediaItem aItem; ::avmedia::MediaItem aItem;
bool bOk = false; bool bOk = false;
#endif
switch( pProperty->nWID ) switch( pProperty->nWID )
{ {
@@ -919,11 +921,13 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr
OSL_FAIL("SvxMediaShape::setPropertyValueImpl(), unknown argument!"); OSL_FAIL("SvxMediaShape::setPropertyValueImpl(), unknown argument!");
} }
#if HAVE_FEATURE_AVMEDIA
if( bOk ) if( bOk )
{ {
pMedia->setMediaProperties( aItem ); pMedia->setMediaProperties( aItem );
return true; return true;
} }
#endif
} }
else else
{ {
@@ -945,7 +949,9 @@ bool SvxMediaShape::getPropertyValueImpl( const OUString& rName, const SfxItemPr
|| (pProperty->nWID == OWN_ATTR_VALUE_GRAPHIC)) || (pProperty->nWID == OWN_ATTR_VALUE_GRAPHIC))
{ {
SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( GetSdrObject() ); SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( GetSdrObject() );
#if HAVE_FEATURE_AVMEDIA
const ::avmedia::MediaItem aItem( pMedia->getMediaProperties() ); const ::avmedia::MediaItem aItem( pMedia->getMediaProperties() );
#endif
switch( pProperty->nWID ) switch( pProperty->nWID )
{ {

View File

@@ -51,7 +51,7 @@ $(eval $(call gb_Library_add_defs,sw,\
)) ))
$(eval $(call gb_Library_use_libraries,sw,\ $(eval $(call gb_Library_use_libraries,sw,\
$(call gb_Helper_optional,AVMEDIA,avmedia) \ avmedia \
basegfx \ basegfx \
comphelper \ comphelper \
cppu \ cppu \

View File

@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <config_features.h>
#include <wrtsh.hxx> #include <wrtsh.hxx>
#include <view.hxx> #include <view.hxx>
#include <textsh.hxx> #include <textsh.hxx>
@@ -38,10 +39,15 @@ using namespace ::sfx2;
bool SwTextShell::InsertMediaDlg( SfxRequest const & rReq ) bool SwTextShell::InsertMediaDlg( SfxRequest const & rReq )
{ {
bool bRet = false;
#if !HAVE_FEATURE_AVMEDIA
(void) rReq;
#else
OUString aURL; OUString aURL;
const SfxItemSet* pReqArgs = rReq.GetArgs(); const SfxItemSet* pReqArgs = rReq.GetArgs();
vcl::Window& rWindow = GetView().GetViewFrame()->GetWindow(); vcl::Window& rWindow = GetView().GetViewFrame()->GetWindow();
bool bAPI = false, bRet = false; bool bAPI = false;
if( pReqArgs ) if( pReqArgs )
{ {
@@ -115,6 +121,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest const & rReq )
rWindow.LeaveWait(); rWindow.LeaveWait();
} }
} }
#endif
return bRet; return bRet;
} }