From 262aa2c2e540c803196d53779fb72226a8efeb5f Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 17 Apr 2014 22:09:44 +0300 Subject: More generic way to disable avmedia Introduce a configure option --disable-avmedia. For non-desktop, avmedia is always disabled (for now), and for desktop enabled by default. Add AVMEDIA to BUILD_TYPE when enabled. Don't build avmedia when disabled. Add HAVE_FEATURE_AVMEDIA to . Bypass avmedia-related code when disabled. Change-Id: I919c6e199bff87d9f142d55dff6373f0ed217f39 --- Repository.mk | 2 +- RepositoryModule_host.mk | 2 +- config_host/config_features.h.in | 6 +++++ configure.ac | 27 +++++++++++++++++++--- cui/Library_cui.mk | 2 +- postprocess/Rdb_services.mk | 4 ++-- sc/Library_sc.mk | 2 +- sd/Library_sd.mk | 2 +- sfx2/Library_sfx.mk | 1 + sfx2/source/bastyp/dummytypes.cxx | 18 +++++++++++++++ slideshow/Library_slideshow.mk | 2 +- svx/Library_svxcore.mk | 2 +- svx/source/gallery2/galtheme.cxx | 5 +++- .../sdr/contact/viewobjectcontactofsdrmediaobj.cxx | 2 +- svx/source/svdraw/svdobj.cxx | 2 +- svx/source/unodraw/unopage.cxx | 2 +- sw/Library_sw.mk | 2 +- sw/source/core/uibase/dochdl/swdtflvr.cxx | 8 +++++++ sw/source/core/uibase/shells/textdrw.cxx | 4 ++++ sw/source/core/uibase/shells/textsh.cxx | 2 +- sw/source/core/uibase/uiview/view.cxx | 2 +- sw/source/core/uibase/uiview/view0.cxx | 4 ++++ 22 files changed, 84 insertions(+), 19 deletions(-) create mode 100644 sfx2/source/bastyp/dummytypes.cxx diff --git a/Repository.mk b/Repository.mk index e3715d5d97fe..dd1928fb1e9c 100644 --- a/Repository.mk +++ b/Repository.mk @@ -211,7 +211,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,math, \ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ acc \ - avmedia \ + $(call gb_Helper_optional,AVMEDIA,avmedia) \ $(if $(DISABLE_SCRIPTING),,basctl) \ $(if $(DISABLE_SCRIPTING),,basprov) \ basegfx \ diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk index 6e3b90bd9074..9b18d63628b9 100644 --- a/RepositoryModule_host.mk +++ b/RepositoryModule_host.mk @@ -16,7 +16,7 @@ $(eval $(call gb_Module_add_moduledirs,libreoffice,\ android \ animations \ apple_remote \ - avmedia \ + $(call gb_Helper_optional,AVMEDIA,avmedia) \ basctl \ basebmp \ basegfx \ diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in index 6a46e1c3dc09..612ceca03394 100644 --- a/config_host/config_features.h.in +++ b/config_host/config_features.h.in @@ -43,6 +43,12 @@ #define HAVE_FEATURE_X11 0 +/* AVMEDIA - Whether to have functionality to display and manipulate + * embedded AV media in documents + */ + +#define HAVE_FEATURE_AVMEDIA 0 + /* EXTENSIONS - Whether we have any extension mechanism at all * * Primarily intended for non-desktop platforms where supporting diff --git a/configure.ac b/configure.ac index eaa46b5c4e68..4e83ed6b5d92 100644 --- a/configure.ac +++ b/configure.ac @@ -764,6 +764,11 @@ AC_ARG_ENABLE(export, only for exporrt linked in. Work in progress, use only if you are hacking on it.]) ) +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.]) +) + AC_ARG_ENABLE(database-connectivity, AS_HELP_STRING([--disable-database-connectivity], [Disable various database connectivity. Work in progress, use only if you are hacking on it.]) @@ -2338,6 +2343,22 @@ else fi AC_SUBST(DISABLE_EXPORT) +# Whether to build "avmedia" functionality or not. +# We probably don't want it for non-desktop. + +if test -z "$enable_avmedia"; then + if test $_os != iOS -a $_os != Android; then + enable_avmedia=yes + fi +fi + +if test "$enable_avmedia" = yes; then + BUILD_TYPE="$BUILD_TYPE AVMEDIA" + AC_DEFINE(HAVE_FEATURE_AVMEDIA) +else + SCPDEFS="$SCPDEFS -DDISABLE_AVMEDIA" +fi + dnl Decide whether to build database connectivity stuff (including dnl Base) or not. We probably don't want to on non-desktop OSes. @@ -10201,7 +10222,7 @@ ENABLE_GSTREAMER="" if test "$build_gstreamer" = "yes"; then AC_MSG_CHECKING([whether to enable the new GStreamer 1.0 avmedia backend]) - if test "x$enable_gstreamer" != "xno"; then + if test "$enable_avmedia" = yes -a "$enable_gstreamer" != no; then ENABLE_GSTREAMER="TRUE" AC_MSG_RESULT([yes]) PKG_CHECK_MODULES( GSTREAMER, gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0 ) @@ -10219,7 +10240,7 @@ ENABLE_GSTREAMER_0_10="" if test "$build_gstreamer_0_10" = "yes"; then AC_MSG_CHECKING([whether to enable the GStreamer avmedia backend]) - if test "x$enable_gstreamer_0_10" != "xno"; then + if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then ENABLE_GSTREAMER_0_10="TRUE" AC_MSG_RESULT([yes]) PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [ @@ -10242,7 +10263,7 @@ dnl =================================================================== ENABLE_VLC="" AC_MSG_CHECKING([whether to enable the VLC avmedia backend]) -if test $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then +if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then ENABLE_VLC="TRUE" AC_MSG_RESULT([yes]) else diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 28f4b64290c0..1ac0ed757ea0 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -32,7 +32,7 @@ $(eval $(call gb_Library_use_custom_headers,cui,\ $(eval $(call gb_Library_use_sdk_api,cui)) $(eval $(call gb_Library_use_libraries,cui,\ - avmedia \ + $(call gb_Helper_optional,AVMEDIA,avmedia) \ basegfx \ comphelper \ cppu \ diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk index cffd75b8cc6e..3e9424c8c26f 100644 --- a/postprocess/Rdb_services.mk +++ b/postprocess/Rdb_services.mk @@ -11,7 +11,7 @@ $(eval $(call gb_Rdb_Rdb_install,services)) $(eval $(call gb_Rdb_add_components,services,\ animations/source/animcore/animcore \ - avmedia/util/avmedia \ + $(call gb_Helper_optional,AVMEDIA,avmedia/util/avmedia) \ chart2/source/controller/chartcontroller \ chart2/source/chartcore \ canvas/source/factory/canvasfactory \ @@ -122,7 +122,7 @@ $(eval $(call gb_Rdb_add_components,services,\ $(if $(filter MACOSX,$(OS)), \ $(if $(filter-out X86_64,$(CPUNAME)), \ $(if $(filter TRUE,$(ENABLE_MACOSX_SANDBOX)),, \ - avmedia/source/quicktime/avmediaQuickTime \ + $(call gb_Helper_optional,AVMEDIA,avmedia/source/quicktime/avmediaQuickTime) \ ) \ ) \ lingucomponent/source/spellcheck/macosxspell/MacOSXSpell \ diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index b4b74259de9e..3063b56a052c 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -60,7 +60,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ endif $(eval $(call gb_Library_use_libraries,sc,\ - avmedia \ + $(call gb_Helper_optional,AVMEDIA,avmedia) \ basegfx \ comphelper \ cppu \ diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index deae271cd836..7ce290582147 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -65,7 +65,7 @@ $(eval $(call gb_Library_use_custom_headers,sd,\ $(eval $(call gb_Library_use_sdk_api,sd)) $(eval $(call gb_Library_use_libraries,sd,\ - avmedia \ + $(call gb_Helper_optional,AVMEDIA,avmedia) \ basegfx \ canvastools \ comphelper \ diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index f4eafa2f9483..9ff7a3775849 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -119,6 +119,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/appl/workwin \ sfx2/source/appl/xpackcreator \ sfx2/source/bastyp/bitset \ + sfx2/source/bastyp/dummytypes \ sfx2/source/bastyp/fltfnc \ sfx2/source/bastyp/fltlst \ sfx2/source/bastyp/frmhtml \ diff --git a/sfx2/source/bastyp/dummytypes.cxx b/sfx2/source/bastyp/dummytypes.cxx new file mode 100644 index 000000000000..e1ae0ad996cc --- /dev/null +++ b/sfx2/source/bastyp/dummytypes.cxx @@ -0,0 +1,18 @@ +// -*- Mode: ObjC; 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/. + +#include + +#include +#include + +#if !HAVE_FEATURE_AVMEDIA +SAL_DLLPUBLIC_EXPORT TypeId avmedia::MediaItem::StaticType() { return 0; } +#endif + +// vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk index fb5e93deb3f6..ccd3e9964a9d 100644 --- a/slideshow/Library_slideshow.mk +++ b/slideshow/Library_slideshow.mk @@ -32,7 +32,7 @@ $(eval $(call gb_Library_use_external,slideshow,boost_headers)) $(eval $(call gb_Library_use_sdk_api,slideshow)) $(eval $(call gb_Library_use_libraries,slideshow,\ - avmedia \ + $(call gb_Helper_optional,AVMEDIA,avmedia) \ basegfx \ canvastools \ comphelper \ diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 8826d9f879d5..2b2d1945df64 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -50,7 +50,7 @@ $(eval $(call gb_Library_add_defs,svxcore,\ )) $(eval $(call gb_Library_use_libraries,svxcore,\ - avmedia \ + $(call gb_Helper_optional,AVMEDIA,avmedia) \ basegfx \ sb \ comphelper \ diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 50ec15a2178a..7352b101ef49 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + #include "sal/config.h" #include @@ -1111,9 +1113,10 @@ bool GalleryTheme::InsertURL( const INetURLObject& rURL, sal_uIntPtr nInsertPos else pNewObj = (SgaObject*) new SgaObjectBmp( aGraphic, rURL, aFormat ); } +#if HAVE_FEATURE_AVMEDIA else if( ::avmedia::MediaWindow::isMediaURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), ""/*TODO?*/ ) ) pNewObj = (SgaObject*) new SgaObjectSound( rURL ); - +#endif if( pNewObj && InsertObject( *pNewObj, nInsertPos ) ) bRet = true; diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx index 5fa946bb6b5d..81ccab37f8e7 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx @@ -38,7 +38,7 @@ ViewObjectContactOfSdrMediaObj::ViewObjectContactOfSdrMediaObj( ObjectContact& r ViewObjectContactOfSdrObj( rObjectContact, rViewContact ), mpMediaWindow( NULL ) { -#if HAVE_FEATURE_DESKTOP +#if HAVE_FEATURE_AVMEDIA Window* pWindow = getWindow(); if( pWindow ) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 9b82f1089f4c..a2441761d1f3 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -3396,7 +3396,7 @@ SdrObject* SdrObjFactory::MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, S case sal_uInt16(OBJ_PAGE ): pObj=new SdrPageObj; break; case sal_uInt16(OBJ_UNO ): pObj=new SdrUnoObj(OUString()); break; case sal_uInt16(OBJ_CUSTOMSHAPE ): pObj=new SdrObjCustomShape(); break; -#if HAVE_FEATURE_DESKTOP +#if HAVE_FEATURE_AVMEDIA case sal_uInt16(OBJ_MEDIA ): pObj=new SdrMediaObj(); break; #endif case sal_uInt16(OBJ_TABLE ): pObj=new ::sdr::table::SdrTableObj(pModel); break; diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 52c1fc9752a4..cf8b8242dc2d 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -538,7 +538,7 @@ void SvxDrawPage::GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, rInventor = SdrInventor; rType = OBJ_TABLE; } -#if HAVE_FEATURE_DESKTOP +#if HAVE_FEATURE_AVMEDIA else if ( aName == "com.sun.star.presentation.MediaShape" ) { rInventor = SdrInventor; diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 6f91e282ba26..1f7d55a98d9b 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -45,7 +45,7 @@ $(eval $(call gb_Library_add_defs,sw,\ )) $(eval $(call gb_Library_use_libraries,sw,\ - avmedia \ + $(call gb_Helper_optional,AVMEDIA,avmedia) \ basegfx \ comphelper \ cppu \ diff --git a/sw/source/core/uibase/dochdl/swdtflvr.cxx b/sw/source/core/uibase/dochdl/swdtflvr.cxx index 4e53bfacc219..c8f1cd5b2e6f 100644 --- a/sw/source/core/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/core/uibase/dochdl/swdtflvr.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + #include #include #include @@ -2511,6 +2513,7 @@ bool SwTransferable::_PasteFileName( TransferableDataHelper& rData, OUString sFile, sDesc; if( rData.GetString( nFmt, sFile ) && !sFile.isEmpty() ) { +#if HAVE_FEATURE_AVMEDIA INetURLObject aMediaURL; aMediaURL.SetSmartURL( sFile ); @@ -2523,6 +2526,11 @@ bool SwTransferable::_PasteFileName( TransferableDataHelper& rData, SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L ); } +#else + if (false) + { + } +#endif else { sal_Bool bIsURLFile = SwTransferable::_CheckForURLOrLNKFile( rData, sFile, &sDesc ); diff --git a/sw/source/core/uibase/shells/textdrw.cxx b/sw/source/core/uibase/shells/textdrw.cxx index acc239b544b4..d6931e32e151 100644 --- a/sw/source/core/uibase/shells/textdrw.cxx +++ b/sw/source/core/uibase/shells/textdrw.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + #include #include #include @@ -102,12 +104,14 @@ void SwBaseShell::InsertURLButton(const OUString& rURL, const OUString& rTarget, aTmp.setValue( &eButtonType, ::getCppuType((const form::FormButtonType*)0)); xPropSet->setPropertyValue( "ButtonType", aTmp ); +#if HAVE_FEATURE_AVMEDIA if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) ) { // #105638# OJ aTmp <<= sal_True; xPropSet->setPropertyValue("DispatchURLInternal", aTmp ); } +#endif } if (rSh.IsObjSelected()) diff --git a/sw/source/core/uibase/shells/textsh.cxx b/sw/source/core/uibase/shells/textsh.cxx index 8db56d3e13e5..a19bd352d24c 100644 --- a/sw/source/core/uibase/shells/textsh.cxx +++ b/sw/source/core/uibase/shells/textsh.cxx @@ -226,7 +226,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) rReq.Done(); break; -#if HAVE_FEATURE_DESKTOP +#if HAVE_FEATURE_AVMEDIA case SID_INSERT_AVMEDIA: rReq.SetReturnValue(SfxBoolItem(nSlot, InsertMediaDlg( rReq ))); break; diff --git a/sw/source/core/uibase/uiview/view.cxx b/sw/source/core/uibase/uiview/view.cxx index a95267130f63..92128722cab8 100644 --- a/sw/source/core/uibase/uiview/view.cxx +++ b/sw/source/core/uibase/uiview/view.cxx @@ -337,7 +337,7 @@ void SwView::SelectShell() m_pShell = new SwBezierShell( *this ); rDispatcher.Push( *m_pShell ); } -#if HAVE_FEATURE_DESKTOP +#if HAVE_FEATURE_AVMEDIA else if( m_nSelectionType & nsSelectionType::SEL_MEDIA ) { eShellMode = SHELL_MODE_MEDIA; diff --git a/sw/source/core/uibase/uiview/view0.cxx b/sw/source/core/uibase/uiview/view0.cxx index 5363d04bebf9..a36b077cd1da 100644 --- a/sw/source/core/uibase/uiview/view0.cxx +++ b/sw/source/core/uibase/uiview/view0.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + #include "hintids.hxx" #include #include @@ -98,7 +100,9 @@ SFX_IMPL_INTERFACE( SwView, SfxViewShell, SW_RES(RID_TOOLS_TOOLBOX) ) SFX_CHILDWINDOW_REGISTRATION(SID_HYPERLINK_DIALOG); SFX_CHILDWINDOW_REGISTRATION(FN_WORDCOUNT_DIALOG); SFX_CHILDWINDOW_REGISTRATION(GalleryChildWindow::GetChildWindowId()); +#if HAVE_FEATURE_AVMEDIA SFX_CHILDWINDOW_REGISTRATION(::avmedia::MediaPlayer::GetChildWindowId()); +#endif SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD_DATA_ONLY); SFX_FEATURED_CHILDWINDOW_REGISTRATION(FN_SYNC_LABELS, CHILDWIN_LABEL ); SFX_FEATURED_CHILDWINDOW_REGISTRATION(FN_MAILMERGE_CHILDWINDOW, CHILDWIN_MAILMERGE); -- cgit v1.2.3