Repository.mk                             |   12 ++-
 RepositoryModule_host.mk                  |    2 
 avmedia/Library_avmedia.mk                |   31 ++++------
 avmedia/Module_avmedia.mk                 |    5 -
 avmedia/source/avmediadummy.cxx           |   93 ------------------------------
 config_host.mk.in                         |    1 
 configure.ac                              |   13 +---
 oox/CppunitTest_oox_tokenmap.mk           |    2 
 postprocess/Rdb_services.mk               |   14 +---
 sc/Library_sc.mk                          |    2 
 sd/Library_sd.mk                          |    2 
 slideshow/source/engine/slideshowimpl.cxx |    5 +
 slideshow/source/engine/soundplayer.cxx   |    5 +
 svx/Library_svxcore.mk                    |    4 -
 svx/source/svdraw/MediaShellHelpers.cxx   |    9 ++
 svx/source/svdraw/svdomedia.cxx           |   16 ++++-
 svx/source/unodraw/unoshap4.cxx           |    6 +
 sw/Library_sw.mk                          |    2 
 sw/source/uibase/shells/grfshex.cxx       |    9 ++
 19 files changed, 88 insertions(+), 145 deletions(-)

New commits:
commit f9e79a91f15e10ededad0f103c4ffe0ca38fcb31
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Tue May 18 01:11:41 2021 +0200
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Wed Dec 1 16:50:23 2021 +0100

    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 <glo...@fbihome.de>

diff --git a/Repository.mk b/Repository.mk
index 629f95354422..ec763106f30e 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -324,10 +324,12 @@ $(eval $(call 
gb_Helper_register_libraries_for_install,OOOLIBS,ogltrans, \
 
 $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
        acc \
-       $(call gb_Helper_optional,AVMEDIA,avmedia) \
+    avmedia \
+    $(call gb_Helper_optional,AVMEDIA, \
        $(if $(filter MACOSX,$(OS)),\
                avmediaMacAVF \
        ) \
+    ) \
        $(call gb_Helper_optional,SCRIPTING, \
                basctl \
                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, \
-       $(if $(ENABLE_GSTREAMER_1_0),avmediagst) \
-       $(if $(filter WNT,$(OS)),avmediawin) \
+    $(call gb_Helper_optional,AVMEDIA, \
+        $(if $(ENABLE_GSTREAMER_1_0),avmediagst) \
+        $(if $(filter WNT,$(OS)),avmediawin) \
+    ) \
        cached1 \
        collator_data \
        comphelper \
@@ -1108,7 +1112,7 @@ $(eval $(call gb_ExternalExecutable_register_executables,\
 # Resources
 $(eval $(call gb_Helper_register_mos,\
        acc \
-       avmedia \
+    $(call gb_Helper_optional,AVMEDIA,avmedia) \
        $(call gb_Helper_optional,SCRIPTING,basctl) \
        chart \
        cnr \
diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk
index a13278563270..021fdeb92635 100644
--- a/RepositoryModule_host.mk
+++ b/RepositoryModule_host.mk
@@ -25,7 +25,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\
        android \
        animations \
        apple_remote \
-       $(call gb_Helper_optional,AVMEDIA,avmedia) \
+       avmedia \
        basctl \
        basegfx \
        basic \
diff --git a/avmedia/Library_avmedia.mk b/avmedia/Library_avmedia.mk
index b27b9bae8c80..420bbded8178 100644
--- a/avmedia/Library_avmedia.mk
+++ b/avmedia/Library_avmedia.mk
@@ -9,15 +9,16 @@
 
 $(eval $(call gb_Library_Library,avmedia))
 
-$(eval $(call gb_Library_set_componentfile,avmedia,avmedia/util/avmedia))
-
 $(eval $(call gb_Library_set_include,avmedia,\
        $$(INCLUDE) \
        -I$(SRCDIR)/avmedia/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,))
 
@@ -25,35 +26,30 @@ $(eval $(call gb_Library_use_externals,avmedia,\
        boost_headers \
 ))
 
-ifeq ($(USE_AVMEDIA_DUMMY),TRUE)
-$(eval $(call gb_Library_add_exception_objects,avmedia,\
-       avmedia/source/avmediadummy \
+$(eval $(call gb_Library_add_defs,avmedia,\
+    -DAVMEDIA_DLLIMPLEMENTATION \
 ))
 
-
-else
-
-
-$(eval $(call gb_Library_add_defs,avmedia,\
-       -DAVMEDIA_DLLIMPLEMENTATION \
+$(eval $(call gb_Library_add_exception_objects,avmedia,\
+    avmedia/source/framework/mediaitem \
 ))
 
+ifneq (,$(filter AVMEDIA,$(BUILD_TYPE)))
+
 ifeq ($(DISABLE_GUI),)
 $(eval $(call gb_Library_use_externals,avmedia,\
     epoxy \
 ))
-endif
 
+$(eval $(call gb_Library_set_componentfile,avmedia,avmedia/util/avmedia))
 
 $(eval $(call gb_Library_use_libraries,avmedia,\
        comphelper \
        ucbhelper \
        cppu \
        cppuhelper \
-       sal \
        i18nlangtag \
        sfx \
-       svl \
        svt \
        tl \
        utl \
@@ -63,7 +59,6 @@ $(eval $(call gb_Library_use_libraries,avmedia,\
 $(eval $(call gb_Library_add_exception_objects,avmedia,\
        avmedia/source/framework/mediacontrol \
        avmedia/source/framework/MediaControlBase \
-       avmedia/source/framework/mediaitem \
        avmedia/source/framework/mediaplayer \
        avmedia/source/framework/mediatoolbox \
        avmedia/source/framework/soundhandler \
@@ -71,6 +66,8 @@ $(eval $(call gb_Library_add_exception_objects,avmedia,\
        avmedia/source/viewer/mediawindow \
        avmedia/source/viewer/mediawindow_impl \
 ))
-endif
+
+endif # !DISABLE_GUI
+endif # AVMEDIA
 
 # vim: set noet sw=4 ts=4:
diff --git a/avmedia/Module_avmedia.mk b/avmedia/Module_avmedia.mk
index aeb3176544bf..d01201582a78 100644
--- a/avmedia/Module_avmedia.mk
+++ b/avmedia/Module_avmedia.mk
@@ -13,7 +13,8 @@ $(eval $(call gb_Module_add_targets,avmedia,\
        Library_avmedia \
 ))
 
-ifneq ($(USE_AVMEDIA_DUMMY),TRUE)
+ifneq (,$(filter AVMEDIA,$(BUILD_TYPE)))
+
 $(eval $(call gb_Module_add_l10n_targets,avmedia,\
     AllLangMoTarget_avmedia \
 ))
@@ -36,6 +37,6 @@ $(eval $(call gb_Module_add_targets,avmedia,\
 ))
 endif
 
-endif
+endif # AVMEDIA
 
 # vim: set noet sw=4 ts=4:
diff --git a/avmedia/source/avmediadummy.cxx b/avmedia/source/avmediadummy.cxx
deleted file mode 100644
index 823cc6ec9f80..000000000000
--- a/avmedia/source/avmediadummy.cxx
+++ /dev/null
@@ -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: */
diff --git a/config_host.mk.in b/config_host.mk.in
index a931d947f2d3..8b5b6ea6bb29 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -730,7 +730,6 @@ export ZLIB_CFLAGS=$(gb_SPACE)@ZLIB_CFLAGS@
 export ZLIB_LIBS=$(gb_SPACE)@ZLIB_LIBS@
 export ZMF_CFLAGS=$(gb_SPACE)@ZMF_CFLAGS@
 export ZMF_LIBS=$(gb_SPACE)@ZMF_LIBS@
-export USE_AVMEDIA_DUMMY=@USE_AVMEDIA_DUMMY@
 
 # lang-related stuff
 include $(BUILDDIR)/config_$(gb_Side)_lang.mk
diff --git a/configure.ac b/configure.ac
index ce0f76f5c27e..1c1e8c3261db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1381,8 +1381,8 @@ libo_FUZZ_ARG_ENABLE(extension-integration,
 
 AC_ARG_ENABLE(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,
     AS_HELP_STRING([--disable-database-connectivity],
@@ -2944,17 +2944,12 @@ fi
 
 # 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
+    BUILD_TYPE="$BUILD_TYPE AVMEDIA"
     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
 else
-    USE_AVMEDIA_DUMMY='TRUE'
+    test_gstreamer_1_0=no
 fi
-AC_SUBST(USE_AVMEDIA_DUMMY)
 
 # Decide whether to build database connectivity stuff (including Base) or not.
 if test "$enable_database_connectivity" != no; then
diff --git a/oox/CppunitTest_oox_tokenmap.mk b/oox/CppunitTest_oox_tokenmap.mk
index 8019da7a2301..46294ecab965 100644
--- a/oox/CppunitTest_oox_tokenmap.mk
+++ b/oox/CppunitTest_oox_tokenmap.mk
@@ -35,7 +35,7 @@ endif
 endif
 
 $(eval $(call gb_CppunitTest_use_libraries,oox_tokenmap,\
-    avmedia \
+    $(call gb_Helper_optional,AVMEDIA,avmedia) \
     basegfx \
     comphelper \
     cppu \
diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk
index aea72437c4f9..06ce007d4cd7 100644
--- a/postprocess/Rdb_services.mk
+++ b/postprocess/Rdb_services.mk
@@ -158,21 +158,19 @@ $(eval $(call gb_Rdb_add_components,services,\
                lingucomponent/source/spellcheck/macosxspell/MacOSXSpell \
        ) \
        $(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 \
                shell/source/backends/wininetbe/wininetbe1 \
                shell/source/win32/simplemail/smplmail \
                shell/source/win32/syssh \
+               winaccessibility/source/service/winaccessibility \
        ) \
        $(if $(filter-out WNT,$(OS)), \
                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)), \
                ucb/source/ucp/webdav-neon/ucpdav1 \
        ) \
@@ -205,7 +203,7 @@ $(eval $(call gb_Rdb_add_components,services,\
                ucb/source/ucp/gio/ucpgio \
        ) \
        $(if $(ENABLE_GSTREAMER_1_0), \
-               avmedia/source/gstreamer/avmediagstreamer \
+               $(call 
gb_Helper_optional,AVMEDIA,avmedia/source/gstreamer/avmediagstreamer) \
        ) \
        $(if $(ENABLE_KF5), \
                shell/source/backends/kf5be/kf5be1 \
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index ef9c62f42d53..f7b11016707f 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -64,7 +64,7 @@ $(eval $(call gb_Library_use_externals,sc,orcus-parser))
 endif
 
 $(eval $(call gb_Library_use_libraries,sc,\
-    $(call gb_Helper_optional,AVMEDIA,avmedia) \
+    avmedia \
     basegfx \
     comphelper \
     cppu \
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 092dc70da1ef..647f975e1f16 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -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_libraries,sd,\
-       $(call gb_Helper_optional,AVMEDIA,avmedia) \
+       avmedia \
        basegfx \
        canvastools \
        comphelper \
diff --git a/slideshow/source/engine/slideshowimpl.cxx 
b/slideshow/source/engine/slideshowimpl.cxx
index 2cd77518bb19..75b15e5c7e8f 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -18,6 +18,7 @@
  */
 
 
+#include <config_features.h>
 #include <tools/diagnose_ex.h>
 
 #include <cppuhelper/basemutex.hxx>
@@ -2350,6 +2351,9 @@ std::shared_ptr<avmedia::MediaTempFile> 
SlideShowImpl::getMediaTempFile(const OU
 {
     std::shared_ptr<avmedia::MediaTempFile> aRet;
 
+#if !HAVE_FEATURE_AVMEDIA
+    (void)aUrl;
+#else
     if (!mxSBD.is())
         return aRet;
 
@@ -2373,6 +2377,7 @@ std::shared_ptr<avmedia::MediaTempFile> 
SlideShowImpl::getMediaTempFile(const OU
 
         xInStream->closeInput();
     }
+#endif
 
     return aRet;
 }
diff --git a/slideshow/source/engine/soundplayer.cxx 
b/slideshow/source/engine/soundplayer.cxx
index c9386192e8d6..c0ae300c1e78 100644
--- a/slideshow/source/engine/soundplayer.cxx
+++ b/slideshow/source/engine/soundplayer.cxx
@@ -18,6 +18,7 @@
  */
 
 
+#include <config_features.h>
 #include <tools/diagnose_ex.h>
 
 #include <com/sun/star/lang/NoSupportException.hpp>
@@ -90,6 +91,9 @@ namespace slideshow::internal
             ENSURE_OR_THROW( rComponentContext.is(),
                               "SoundPlayer::SoundPlayer(): Invalid component 
context" );
 
+#if !HAVE_FEATURE_AVMEDIA
+            (void) rMediaFileManager;
+#else
             try
             {
                 if 
(rSoundURL.startsWithIgnoreAsciiCase("vnd.sun.star.Package:"))
@@ -107,6 +111,7 @@ namespace slideshow::internal
             catch( uno::Exception& )
             {
             }
+#endif
 
             if( !mxPlayer.is() )
                 throw lang::NoSupportException(
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 0c3adee945c3..0490b04c25be 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -49,7 +49,7 @@ $(eval $(call gb_Library_add_defs,svxcore,\
 ))
 
 $(eval $(call gb_Library_use_libraries,svxcore,\
-    $(call gb_Helper_optional,AVMEDIA,avmedia) \
+    avmedia \
     basegfx \
     sb \
     comphelper \
@@ -257,7 +257,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
     svx/source/sdr/contact/viewobjectcontactofsdrole2obj \
     svx/source/sdr/contact/viewobjectcontactofunocontrol \
     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/viewcontactofsdrcaptionobj \
     svx/source/sdr/contact/viewcontactofvirtobj \
diff --git a/svx/source/svdraw/MediaShellHelpers.cxx 
b/svx/source/svdraw/MediaShellHelpers.cxx
index 752a6882c038..3277f05add98 100644
--- a/svx/source/svdraw/MediaShellHelpers.cxx
+++ b/svx/source/svdraw/MediaShellHelpers.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_features.h>
 #include <svx/MediaShellHelpers.hxx>
 #include <avmedia/mediaitem.hxx>
 #include <sfx2/request.hxx>
@@ -41,6 +42,7 @@ void GetState(const SdrMarkView* pSdrView, SfxItemSet& rSet)
         if (SID_AVMEDIA_TOOLBOX != nWhich)
             continue;
 
+#if HAVE_FEATURE_AVMEDIA
         const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
         bool bDisable = true;
 
@@ -60,12 +62,18 @@ void GetState(const SdrMarkView* pSdrView, SfxItemSet& rSet)
         }
 
         if (bDisable)
+#endif
             rSet.DisableItem(SID_AVMEDIA_TOOLBOX);
     }
 }
 
 const ::avmedia::MediaItem* Execute(const SdrMarkView* pSdrView, SfxRequest 
const& rReq)
 {
+#if !HAVE_FEATURE_AVMEDIA
+    (void)pSdrView;
+    (void)rReq;
+    return nullptr;
+#else
     if (!pSdrView)
         return nullptr;
 
@@ -96,6 +104,7 @@ const ::avmedia::MediaItem* Execute(const SdrMarkView* 
pSdrView, SfxRequest cons
         .executeMediaItem(*pMediaItem);
 
     return pMediaItem;
+#endif
 }
 
 } // end of namespace svx::MediaShellHelpers
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 515bdff11b42..3df53dbf3523 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -44,10 +44,12 @@ using namespace ::com::sun::star;
 struct SdrMediaObj::Impl
 {
     ::avmedia::MediaItem                  m_MediaProperties;
+#if HAVE_FEATURE_AVMEDIA
     // Note: the temp file is read only, until it is deleted!
     // It may be shared between multiple documents in case of copy/paste,
     // hence the shared_ptr.
     std::shared_ptr< ::avmedia::MediaTempFile >  m_pTempFile;
+#endif
     uno::Reference< graphic::XGraphic >   m_xCachedSnapshot;
     OUString m_LastFailedPkgURL;
 };
@@ -62,7 +64,9 @@ SdrMediaObj::SdrMediaObj(SdrModel& rSdrModel, SdrMediaObj 
const & rSource)
 :   SdrRectObj(rSdrModel, rSource)
     ,m_xImpl( new Impl )
 {
+#if HAVE_FEATURE_AVMEDIA
     m_xImpl->m_pTempFile = rSource.m_xImpl->m_pTempFile; // before props
+#endif
     setMediaProperties( rSource.getMediaProperties() );
     m_xImpl->m_xCachedSnapshot = rSource.m_xImpl->m_xCachedSnapshot;
 }
@@ -218,7 +222,7 @@ const OUString& SdrMediaObj::getURL() const
 #if HAVE_FEATURE_AVMEDIA
     return m_xImpl->m_MediaProperties.getURL();
 #else
-static OUString ret;
+    static OUString ret;
     return ret;
 #endif
 }
@@ -236,6 +240,7 @@ const ::avmedia::MediaItem& 
SdrMediaObj::getMediaProperties() const
 
 uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream() const
 {
+#if HAVE_FEATURE_AVMEDIA
     if (!m_xImpl->m_pTempFile)
     {
         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>(),
                 comphelper::getProcessComponentContext());
     return tempFile.openStream();
+#else
+    return nullptr;
+#endif
 }
 
 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())
     {
         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)
     {
         m_xImpl->m_pTempFile = 
std::make_shared<::avmedia::MediaTempFile>(tempFileURL);
-#if HAVE_FEATURE_AVMEDIA
         m_xImpl->m_MediaProperties.setURL(
             m_xImpl->m_LastFailedPkgURL, tempFileURL, "");
-#endif
     }
     m_xImpl->m_LastFailedPkgURL.clear(); // once only
+#endif
 }
 
 /// copy a stream from XStorage to temp file
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 865ce0a3ee5b..4cd322150478 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -785,9 +785,11 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& 
rName, const SfxItemPr
         || (pProperty->nWID == OWN_ATTR_MEDIA_MIMETYPE)
         || (pProperty->nWID == OWN_ATTR_VALUE_GRAPHIC))
     {
+#if HAVE_FEATURE_AVMEDIA
         SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( GetSdrObject() );
         ::avmedia::MediaItem aItem;
         bool bOk = false;
+#endif
 
         switch( pProperty->nWID )
         {
@@ -919,11 +921,13 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& 
rName, const SfxItemPr
             OSL_FAIL("SvxMediaShape::setPropertyValueImpl(), unknown 
argument!");
         }
 
+#if HAVE_FEATURE_AVMEDIA
         if( bOk )
         {
             pMedia->setMediaProperties( aItem );
             return true;
         }
+#endif
     }
     else
     {
@@ -945,7 +949,9 @@ bool SvxMediaShape::getPropertyValueImpl( const OUString& 
rName, const SfxItemPr
         || (pProperty->nWID == OWN_ATTR_VALUE_GRAPHIC))
     {
         SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( GetSdrObject() );
+#if HAVE_FEATURE_AVMEDIA
         const ::avmedia::MediaItem aItem( pMedia->getMediaProperties() );
+#endif
 
         switch( pProperty->nWID )
         {
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 87018ce438b9..6c93c0c0f639 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -51,7 +51,7 @@ $(eval $(call gb_Library_add_defs,sw,\
 ))
 
 $(eval $(call gb_Library_use_libraries,sw,\
-    $(call gb_Helper_optional,AVMEDIA,avmedia) \
+    avmedia \
     basegfx \
     comphelper \
     cppu \
diff --git a/sw/source/uibase/shells/grfshex.cxx 
b/sw/source/uibase/shells/grfshex.cxx
index c3aa1c980505..2fe098dba3a2 100644
--- a/sw/source/uibase/shells/grfshex.cxx
+++ b/sw/source/uibase/shells/grfshex.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_features.h>
 #include <wrtsh.hxx>
 #include <view.hxx>
 #include <textsh.hxx>
@@ -38,10 +39,15 @@ using namespace ::sfx2;
 
 bool SwTextShell::InsertMediaDlg( SfxRequest const & rReq )
 {
+    bool bRet = false;
+
+#if !HAVE_FEATURE_AVMEDIA
+    (void) rReq;
+#else
     OUString     aURL;
     const SfxItemSet*   pReqArgs = rReq.GetArgs();
     vcl::Window&        rWindow = GetView().GetViewFrame()->GetWindow();
-    bool                bAPI = false, bRet = false;
+    bool bAPI = false;
 
     if( pReqArgs )
     {
@@ -115,6 +121,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest const & rReq )
             rWindow.LeaveWait();
         }
     }
+#endif
 
     return bRet;
 }

Reply via email to