summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorThorsten Behrens <Thorsten.Behrens@CIB.de>2017-10-28 02:28:18 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-10-30 08:21:55 +0100
commit08a43cc97ccf88faa9d3a04afc3aacd2c885a2d1 (patch)
tree11f416701d1be0a962c7653ea86060f30f708b56 /avmedia
parent8d994f83568073eb79ab987069f740c3c940405e (diff)
related: tdf#103884 remove gltf/collada feature
Change-Id: Icd26ad96c0337844ef1463dabfbe791caa00dd2d Reviewed-on: https://gerrit.libreoffice.org/43972 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/Library_avmedia.mk23
-rw-r--r--avmedia/Library_avmediaogl.mk45
-rw-r--r--avmedia/Module_avmedia.mk5
-rw-r--r--avmedia/source/framework/collada_headers.hxx29
-rw-r--r--avmedia/source/framework/modeltools.cxx326
-rw-r--r--avmedia/source/inc/mediamisc.hxx4
-rw-r--r--avmedia/source/opengl/avmediaogl.component15
-rw-r--r--avmedia/source/opengl/oglframegrabber.cxx69
-rw-r--r--avmedia/source/opengl/oglframegrabber.hxx48
-rw-r--r--avmedia/source/opengl/oglmanager.cxx59
-rw-r--r--avmedia/source/opengl/oglmanager.hxx43
-rw-r--r--avmedia/source/opengl/oglplayer.cxx369
-rw-r--r--avmedia/source/opengl/oglplayer.hxx82
-rw-r--r--avmedia/source/opengl/ogluno.cxx45
-rw-r--r--avmedia/source/opengl/oglwindow.cxx371
-rw-r--r--avmedia/source/opengl/oglwindow.hxx82
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx24
17 files changed, 0 insertions, 1639 deletions
diff --git a/avmedia/Library_avmedia.mk b/avmedia/Library_avmedia.mk
index 3f32ce786145..ff206228a0c5 100644
--- a/avmedia/Library_avmedia.mk
+++ b/avmedia/Library_avmedia.mk
@@ -60,29 +60,6 @@ $(eval $(call gb_Library_use_libraries,avmedia,\
vcl \
))
-ifeq ($(ENABLE_GLTF),TRUE)
-$(eval $(call gb_Library_add_exception_objects,avmedia,\
- avmedia/source/framework/modeltools \
-))
-endif
-
-ifeq ($(ENABLE_COLLADA),TRUE)
-
-ifeq ($(OS),LINUX)
-$(eval $(call gb_Library_add_libs,avmedia,\
- -lrt \
-))
-endif
-
-$(eval $(call gb_Library_use_externals,avmedia,\
- collada2gltf \
- libxml2 \
- opencollada_parser \
- libpng \
-))
-
-endif
-
$(eval $(call gb_Library_add_exception_objects,avmedia,\
avmedia/source/framework/mediacontrol \
avmedia/source/framework/MediaControlBase \
diff --git a/avmedia/Library_avmediaogl.mk b/avmedia/Library_avmediaogl.mk
deleted file mode 100644
index eae3efab1e64..000000000000
--- a/avmedia/Library_avmediaogl.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# 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/.
-#
-
-$(eval $(call gb_Library_Library,avmediaogl))
-
-$(eval $(call gb_Library_set_componentfile,avmediaogl,avmedia/source/opengl/avmediaogl))
-
-$(eval $(call gb_Library_use_sdk_api,avmediaogl))
-
-$(eval $(call gb_Library_use_externals,avmediaogl, \
- boost_headers \
- libgltf \
- epoxy \
- glm_headers \
-))
-
-$(eval $(call gb_Library_use_libraries,avmediaogl,\
- comphelper \
- cppu \
- cppuhelper \
- sal \
- salhelper \
- tl \
- vcl \
-))
-
-$(eval $(call gb_Library_set_include,avmediaogl,\
- $$(INCLUDE) \
-))
-
-$(eval $(call gb_Library_add_exception_objects,avmediaogl,\
- avmedia/source/opengl/oglframegrabber \
- avmedia/source/opengl/oglmanager \
- avmedia/source/opengl/oglplayer \
- avmedia/source/opengl/ogluno \
- avmedia/source/opengl/oglwindow \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/avmedia/Module_avmedia.mk b/avmedia/Module_avmedia.mk
index 8e1bd011d5e8..20d2dcfec843 100644
--- a/avmedia/Module_avmedia.mk
+++ b/avmedia/Module_avmedia.mk
@@ -58,11 +58,6 @@ $(eval $(call gb_Module_add_targets,avmedia,\
))
endif
-ifeq ($(ENABLE_GLTF),TRUE)
-$(eval $(call gb_Module_add_targets,avmedia,\
- Library_avmediaogl \
-))
-endif
endif
# vim: set noet sw=4 ts=4:
diff --git a/avmedia/source/framework/collada_headers.hxx b/avmedia/source/framework/collada_headers.hxx
deleted file mode 100644
index 6ef8238124a1..000000000000
--- a/avmedia/source/framework/collada_headers.hxx
+++ /dev/null
@@ -1,29 +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/.
- */
-
-#ifndef INCLUDED_AVMEDIA_SOURCE_FRAMEWORK_COLLADA_HEADERS_HXX
-#define INCLUDED_AVMEDIA_SOURCE_FRAMEWORK_COLLADA_HEADERS_HXX
-
-#include <sal/config.h>
-
-#if defined __GNUC__ || defined __clang__
-#pragma GCC system_header
-#elif defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-
-#include <COLLADA2GLTFWriter.h>
-
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
deleted file mode 100644
index 76d947954a3c..000000000000
--- a/avmedia/source/framework/modeltools.cxx
+++ /dev/null
@@ -1,326 +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/.
- */
-
-#include <avmedia/modeltools.hxx>
-#include <avmedia/mediaitem.hxx>
-#include <mediamisc.hxx>
-
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/document/XStorageBasedDocument.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
-#include <osl/file.hxx>
-#include <comphelper/processfactory.hxx>
-#include <tools/urlobj.hxx>
-#include <ucbhelper/content.hxx>
-#include <unotools/tempfile.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-
-#include <boost/property_tree/ptree.hpp>
-#include <boost/property_tree/json_parser.hpp>
-#include <boost/optional.hpp>
-#include <boost/exception/diagnostic_information.hpp>
-
-#include <config_features.h>
-
-#if HAVE_FEATURE_COLLADA
-#include "collada_headers.hxx"
-#include <GLTFAsset.h>
-#endif
-
-#include <string>
-#include <vector>
-
-using namespace ::com::sun::star;
-using namespace boost::property_tree;
-
-namespace avmedia {
-
-#if HAVE_FEATURE_COLLADA
-
-static void lcl_UnzipKmz(const OUString& rSourceURL, const OUString& rOutputFolderURL, OUString& o_rDaeFileURL)
-{
- o_rDaeFileURL.clear();
- uno::Reference<packages::zip::XZipFileAccess2> xNameAccess =
- packages::zip::ZipFileAccess::createWithURL(comphelper::getProcessComponentContext(), rSourceURL);
- uno::Sequence< OUString > aNames = xNameAccess->getElementNames();
- for( sal_Int32 i = 0; i < aNames.getLength(); ++i )
- {
- const OUString sCopy = rOutputFolderURL + "/" + aNames[i];
- if( aNames[i].endsWithIgnoreAsciiCase(".dae") )
- o_rDaeFileURL = sCopy;
-
- uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName(aNames[i]), uno::UNO_QUERY);
-
- ::ucbhelper::Content aCopyContent(sCopy,
- uno::Reference<ucb::XCommandEnvironment>(),
- comphelper::getProcessComponentContext());
-
- aCopyContent.writeStream(xInputStream, true);
- }
-}
-
-
-bool KmzDae2Gltf(const OUString& rSourceURL, OUString& o_rOutput)
-{
- o_rOutput.clear();
- const bool bIsDAE = rSourceURL.endsWithIgnoreAsciiCase(".dae");
- const bool bIsKMZ = rSourceURL.endsWithIgnoreAsciiCase(".kmz");
- if( !bIsDAE && !bIsKMZ )
- {
- SAL_WARN("avmedia.opengl", "KmzDae2Gltf converter got a file with wrong extension " << rSourceURL);
- return false;
- }
-
- // Create a temporary folder for conversion
- OUString sOutput;
- osl::FileBase::getFileURLFromSystemPath(::utl::TempFile::CreateTempName(), sOutput);
- // remove .tmp extension
- sOutput = sOutput.copy(0, sOutput.getLength()-4);
-
- std::shared_ptr <GLTF::GLTFAsset> asset(new GLTF::GLTFAsset());
- asset->setBundleOutputPath(OUStringToOString( sOutput, RTL_TEXTENCODING_UTF8 ).getStr());
-
- // If *.dae file is not in the local file system, then copy it to a temp folder for the conversion
- OUString sInput = rSourceURL;
- const INetURLObject aSourceURLObj(rSourceURL);
- if( aSourceURLObj.GetProtocol() != INetProtocol::File )
- {
- try
- {
- ::ucbhelper::Content aSourceContent(rSourceURL,
- uno::Reference<ucb::XCommandEnvironment>(),
- comphelper::getProcessComponentContext());
-
- const OUString sTarget = sOutput + "/" + GetFilename(rSourceURL);
- ::ucbhelper::Content aTempContent(sTarget,
- uno::Reference<ucb::XCommandEnvironment>(),
- comphelper::getProcessComponentContext());
-
- aTempContent.writeStream(aSourceContent.openStream(), true);
- sInput = sTarget;
- }
- catch (const uno::Exception&)
- {
- SAL_WARN("avmedia.opengl", "Exception while trying to copy source file to the temp folder for conversion: " << sInput);
- return false;
- }
- }
-
- asset->setInputFilePath(OUStringToOString( sInput, RTL_TEXTENCODING_UTF8 ).getStr());
-
- if (bIsKMZ)
- {
- OUString sDaeFilePath;
- lcl_UnzipKmz(sInput, sOutput, sDaeFilePath);
- if ( sDaeFilePath.isEmpty() )
- {
- SAL_WARN("avmedia.opengl", "Cannot find the file in kmz: " << rSourceURL);
- return false;
- }
-
- asset->setInputFilePath(OUStringToOString( sDaeFilePath, RTL_TEXTENCODING_UTF8 ).getStr());
- }
-
- GLTF::COLLADA2GLTFWriter writer(asset);
- writer.write();
- // Path to the .json file created by COLLADA2GLTFWriter
- o_rOutput = sOutput + "/" + GetFilename(sOutput) + ".json";
- return true;
-}
-#endif // HAVE_FEATURE_COLLADA
-
-
-static void lcl_EmbedExternals(const OUString& rSourceURL, const uno::Reference<embed::XStorage>& xSubStorage, ::ucbhelper::Content& rContent)
-{
- // Create a temp file with which json parser can work.
- OUString sTempFileURL;
- const ::osl::FileBase::RC aErr =
- ::osl::FileBase::createTempFile(nullptr, nullptr, &sTempFileURL);
- if (aErr != ::osl::FileBase::E_None)
- {
- SAL_WARN("avmedia.opengl", "Cannot create temp file");
- return;
- }
- try
- {
- // Write json content to the temp file
- ::ucbhelper::Content aTempContent(sTempFileURL,
- uno::Reference<ucb::XCommandEnvironment>(),
- comphelper::getProcessComponentContext());
- aTempContent.writeStream(rContent.openStream(), true);
- }
- catch (uno::Exception const& e)
- {
- SAL_WARN("avmedia.opengl", e);
- return;
- }
-
- // Convert URL to a file path for loading
- const INetURLObject aURLObj(sTempFileURL);
- std::string sUrl = OUStringToOString( aURLObj.getFSysPath(FSysStyle::Detect), RTL_TEXTENCODING_UTF8 ).getStr();
-
- // Parse json, read externals' URI and modify this relative URI's so they remain valid in the new context.
- std::vector<std::string> vExternals;
- ptree aTree;
- try
- {
- json_parser::read_json( sUrl, aTree );
-
- // Buffers for geometry and animations
- for( ptree::value_type &rVal : aTree.get_child("buffers") )
- {
- const std::string sBufferUri(rVal.second.get<std::string>("path"));
- vExternals.push_back(sBufferUri);
- // Change path: make it contain only a file name
- aTree.put("buffers." + rVal.first + ".path.",sBufferUri.substr(sBufferUri.find_last_of('/')+1));
- }
- // Images for textures
- boost::optional< ptree& > aImages = aTree.get_child_optional("images");
- if( aImages )
- {
- for( ptree::value_type &rVal : aImages.get() )
- {
- const std::string sImageUri(rVal.second.get<std::string>("path"));
- if( !sImageUri.empty() )
- {
- vExternals.push_back(sImageUri);
- // Change path: make it contain only a file name
- aTree.put("images." + rVal.first + ".path.",sImageUri.substr(sImageUri.find_last_of('/')+1));
- }
- }
- }
- // Shaders (contains names only)
- for( ptree::value_type &rVal : aTree.get_child("programs") )
- {
- vExternals.push_back(rVal.second.get<std::string>("fragmentShader") + ".glsl");
- vExternals.push_back(rVal.second.get<std::string>("vertexShader") + ".glsl");
- }
-
- // Write out modified json
- json_parser::write_json( sUrl, aTree );
- }
- catch ( boost::exception const& e )
- {
- SAL_WARN("avmedia.opengl", "Exception while parsing *.json file " << boost::diagnostic_information(e));
- return;
- }
-
- // Reload json with modified path to external resources
- rContent = ::ucbhelper::Content(sTempFileURL,
- uno::Reference<ucb::XCommandEnvironment>(),
- comphelper::getProcessComponentContext());
-
- // Store all external files next to the json file
- for( std::vector<std::string>::iterator aCIter = vExternals.begin(); aCIter != vExternals.end(); ++aCIter )
- {
- const OUString sAbsURL = INetURLObject::GetAbsURL(rSourceURL,OUString::createFromAscii(aCIter->c_str()));
-
- ::ucbhelper::Content aContent(sAbsURL,
- uno::Reference<ucb::XCommandEnvironment>(),
- comphelper::getProcessComponentContext());
-
- uno::Reference<io::XStream> const xStream(
- CreateStream(xSubStorage, GetFilename(sAbsURL)), uno::UNO_SET_THROW);
- uno::Reference<io::XOutputStream> const xOutStream(
- xStream->getOutputStream(), uno::UNO_SET_THROW);
-
- if (!aContent.openStream(xOutStream))
- {
- SAL_WARN("avmedia.opengl", "openStream to storage failed");
- return;
- }
- }
-}
-
-
-bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
- const OUString& rSourceURL, OUString& o_rEmbeddedURL)
-{
- OUString sSource = rSourceURL;
-
-#if HAVE_FEATURE_COLLADA
- if( !rSourceURL.endsWithIgnoreAsciiCase(".json") )
- KmzDae2Gltf(rSourceURL, sSource);
-#endif
-
- try
- {
- ::ucbhelper::Content aSourceContent(sSource,
- uno::Reference<ucb::XCommandEnvironment>(),
- comphelper::getProcessComponentContext());
-
- // Base storage
- uno::Reference<document::XStorageBasedDocument> const xSBD(xModel,
- uno::UNO_QUERY_THROW);
- uno::Reference<embed::XStorage> const xStorage(
- xSBD->getDocumentStorage(), uno::UNO_QUERY_THROW);
-
- // Model storage
- const OUString sModel("Models");
- uno::Reference<embed::XStorage> const xModelStorage(
- xStorage->openStorageElement(sModel, embed::ElementModes::WRITE));
-
- // Own storage of the corresponding model
- const OUString sFilename(GetFilename(sSource));
- const OUString sGLTFDir(sFilename.copy(0,sFilename.lastIndexOf('.')));
- uno::Reference<embed::XStorage> const xSubStorage(
- xModelStorage->openStorageElement(sGLTFDir, embed::ElementModes::WRITE));
-
- // Embed external resources
- lcl_EmbedExternals(sSource, xSubStorage, aSourceContent);
-
- // Save model file (.json)
- uno::Reference<io::XStream> const xStream(
- CreateStream(xSubStorage, sFilename), uno::UNO_SET_THROW);
- uno::Reference<io::XOutputStream> const xOutStream(
- xStream->getOutputStream(), uno::UNO_SET_THROW);
-
- if (!aSourceContent.openStream(xOutStream))
- {
- SAL_WARN("avmedia.opengl", "openStream to storage failed");
- return false;
- }
-
- const uno::Reference<embed::XTransactedObject> xSubTransaction(xSubStorage, uno::UNO_QUERY);
- if (xSubTransaction.is())
- {
- xSubTransaction->commit();
- }
- const uno::Reference<embed::XTransactedObject> xModelTransaction(xModelStorage, uno::UNO_QUERY);
- if (xModelTransaction.is())
- {
- xModelTransaction->commit();
- }
- const uno::Reference<embed::XTransactedObject> xTransaction(xStorage, uno::UNO_QUERY);
- if (xTransaction.is())
- {
- xTransaction->commit();
- }
-
- o_rEmbeddedURL = "vnd.sun.star.Package:" + sModel + "/" + sGLTFDir + "/" + sFilename;
- return true;
- }
- catch (uno::Exception const&)
- {
- SAL_WARN("avmedia.opengl", "Exception while trying to embed model");
- }
- return false;
-}
-
-
-bool IsModel(const OUString& rMimeType)
-{
- return rMimeType == AVMEDIA_MIMETYPE_JSON;
-}
-
-} // namespace avmedia
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx
index cdb640aa1575..46d513fa4817 100644
--- a/avmedia/source/inc/mediamisc.hxx
+++ b/avmedia/source/inc/mediamisc.hxx
@@ -41,10 +41,6 @@
// Mime types
#define AVMEDIA_MIMETYPE_COMMON "application/vnd.sun.star.media"
-#if HAVE_FEATURE_GLTF
-#define AVMEDIA_MIMETYPE_JSON "model/vnd.gltf+json"
-#endif
-
namespace avmedia
{
const std::locale& GetResLocale();
diff --git a/avmedia/source/opengl/avmediaogl.component b/avmedia/source/opengl/avmediaogl.component
deleted file mode 100644
index f3cd138ea1d0..000000000000
--- a/avmedia/source/opengl/avmediaogl.component
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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/.
- *
--->
-<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="avmediaogl" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.avmedia.Manager_OpenGL">
- <service name="com.sun.star.media.Manager_OpenGL"/>
- </implementation>
-</component>
diff --git a/avmedia/source/opengl/oglframegrabber.cxx b/avmedia/source/opengl/oglframegrabber.cxx
deleted file mode 100644
index 52fa7a4da83a..000000000000
--- a/avmedia/source/opengl/oglframegrabber.cxx
+++ /dev/null
@@ -1,69 +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/.
- */
-
-#include "oglframegrabber.hxx"
-
-#include <cppuhelper/supportsservice.hxx>
-#include <vcl/bitmapex.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/salbtype.hxx>
-#include <vcl/bitmapaccess.hxx>
-
-#include <vcl/opengl/OpenGLHelper.hxx>
-
-#include <memory>
-
-using namespace com::sun::star;
-using namespace libgltf;
-
-namespace avmedia { namespace ogl {
-
-OGLFrameGrabber::OGLFrameGrabber( glTFHandle& rHandle )
- : FrameGrabber_BASE()
- , m_rHandle( rHandle )
-{
-}
-
-OGLFrameGrabber::~OGLFrameGrabber()
-{
-}
-
-uno::Reference< css::graphic::XGraphic > SAL_CALL OGLFrameGrabber::grabFrame( double /*fMediaTime*/ )
-{
- std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[m_rHandle.viewport.width * m_rHandle.viewport.height * 4]);
- glTFHandle* pHandle = &m_rHandle;
- int nRet = gltf_renderer_get_bitmap(&pHandle, 1, reinterpret_cast<char*>(pBuffer.get()), GL_BGRA);
- if( nRet != 0 )
- {
- SAL_WARN("avmedia.opengl", "Error occurred while rendering to bitmap! Error code: " << nRet);
- return uno::Reference< css::graphic::XGraphic >();
- }
- BitmapEx aBitmap = OpenGLHelper::ConvertBGRABufferToBitmapEx(pBuffer.get(), m_rHandle.viewport.width, m_rHandle.viewport.height);
- return Graphic( aBitmap ).GetXGraphic();
-}
-
-OUString SAL_CALL OGLFrameGrabber::getImplementationName()
-{
- return OUString("com.sun.star.comp.avmedia.FrameGrabber_OpenGL");
-}
-
-sal_Bool SAL_CALL OGLFrameGrabber::supportsService( const OUString& rServiceName )
-{
- return cppu::supportsService(this, rServiceName);
-}
-
-uno::Sequence< OUString > SAL_CALL OGLFrameGrabber::getSupportedServiceNames()
-{
- return { "com.sun.star.media.FrameGrabber_OpenGL" };
-}
-
-} // namespace ogl
-} // namespace avmedia
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/opengl/oglframegrabber.hxx b/avmedia/source/opengl/oglframegrabber.hxx
deleted file mode 100644
index fd2c52865d48..000000000000
--- a/avmedia/source/opengl/oglframegrabber.hxx
+++ /dev/null
@@ -1,48 +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/.
- */
-
-#ifndef INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLFRAMEGRABBER_HXX
-#define INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLFRAMEGRABBER_HXX
-
-#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/media/XFrameGrabber.hpp>
-
-#include <libgltf.h>
-
-namespace avmedia { namespace ogl {
-
-typedef ::cppu::WeakImplHelper< css::media::XFrameGrabber,
- css::lang::XServiceInfo > FrameGrabber_BASE;
-
-class OGLFrameGrabber : public FrameGrabber_BASE
-{
-public:
-
- explicit OGLFrameGrabber( libgltf::glTFHandle& rHandle );
- virtual ~OGLFrameGrabber() override;
-
- // XFrameGrabber
- virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) override;
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName() override;
- virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-
-private:
- libgltf::glTFHandle& m_rHandle;
-};
-
-} // namespace ogl
-} // namespace avmedia
-
-#endif // INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLFRAMEGRABBER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/opengl/oglmanager.cxx b/avmedia/source/opengl/oglmanager.cxx
deleted file mode 100644
index 0f7cfddc77d4..000000000000
--- a/avmedia/source/opengl/oglmanager.cxx
+++ /dev/null
@@ -1,59 +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/.
- */
-
-#include "oglmanager.hxx"
-#include "oglframegrabber.hxx"
-#include "oglplayer.hxx"
-
-#include <cppuhelper/supportsservice.hxx>
-
-using namespace com::sun::star;
-
-namespace avmedia { namespace ogl {
-
-OGLManager::OGLManager()
-{
-}
-
-OGLManager::~OGLManager()
-{
-}
-
-uno::Reference< media::XPlayer > SAL_CALL OGLManager::createPlayer( const OUString& rURL )
-{
- OGLPlayer* pPlayer( new OGLPlayer() );
- if( pPlayer->create(rURL) )
- return uno::Reference< media::XPlayer >(pPlayer);
- else
- {
- delete pPlayer;
- SAL_WARN("avmedia.opengl", "Can't create player for OpenGL model: " + rURL);
- return uno::Reference< media::XPlayer >();
- }
-}
-
-OUString SAL_CALL OGLManager::getImplementationName()
-{
- return OUString("com.sun.star.comp.avmedia.Manager_OpenGL");
-}
-
-sal_Bool SAL_CALL OGLManager::supportsService( const OUString& rServiceName )
-{
- return cppu::supportsService(this, rServiceName);
-}
-
-uno::Sequence< OUString > SAL_CALL OGLManager::getSupportedServiceNames()
-{
- return { "com.sun.star.media.Manager_OpenGL" };
-}
-
-} // namespace ogl
-} // namespace avmedia
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/opengl/oglmanager.hxx b/avmedia/source/opengl/oglmanager.hxx
deleted file mode 100644
index 945139f2313a..000000000000
--- a/avmedia/source/opengl/oglmanager.hxx
+++ /dev/null
@@ -1,43 +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/.
- */
-
-#ifndef INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLMANAGER_HXX
-#define INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLMANAGER_HXX
-
-#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/media/XManager.hpp>
-
-namespace avmedia { namespace ogl {
-
-class OGLManager : public ::cppu::WeakImplHelper< css::media::XManager, css::lang::XServiceInfo >
-{
-public:
-
- explicit OGLManager();
- virtual ~OGLManager() override;
-
- // XManager
- virtual css::uno::Reference< css::media::XPlayer > SAL_CALL createPlayer( const OUString& rURL ) override;
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName() override;
- virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-private:
-
-};
-
-} // namespace ogl
-} // namespace avmedia
-
-#endif // INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLMANAGER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
deleted file mode 100644
index b691680f15e6..000000000000
--- a/avmedia/source/opengl/oglplayer.cxx
+++ /dev/null
@@ -1,369 +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/.
- */
-
-#include "oglplayer.hxx"
-#include "oglframegrabber.hxx"
-#include "oglwindow.hxx"
-
-#include <cppuhelper/supportsservice.hxx>
-#include <tools/stream.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/graphicfilter.hxx>
-#include <tools/urlobj.hxx>
-#include <vcl/opengl/OpenGLHelper.hxx>
-
-#include <cassert>
-
-using namespace com::sun::star;
-using namespace libgltf;
-
-namespace avmedia { namespace ogl {
-
-OGLPlayer::OGLPlayer()
- : Player_BASE(m_aMutex)
- , m_pHandle(nullptr)
- , m_xContext(OpenGLContext::Create())
- , m_pOGLWindow(nullptr)
- , m_bIsRendering(false)
-{
-}
-
-OGLPlayer::~OGLPlayer()
-{
- osl::MutexGuard aGuard(m_aMutex);
- if( m_pHandle )
- {
- m_xContext->makeCurrent();
- gltf_renderer_release(m_pHandle);
- m_xContext->dispose();
- }
- releaseInputFiles();
-}
-
-static bool lcl_LoadFile( glTFFile* io_pFile, const OUString& rURL)
-{
- SvFileStream aStream( rURL, StreamMode::READ );
- if( !aStream.IsOpen() )
- return false;
-
- const sal_Int64 nBytes = aStream.remainingSize();
- char* pBuffer = new char[nBytes];
- aStream.ReadBytes(pBuffer, nBytes);
- aStream.Close();
-
- io_pFile->buffer = pBuffer;
- io_pFile->size = nBytes;
-
- return true;
-}
-
-bool OGLPlayer::create( const OUString& rURL )
-{
- osl::MutexGuard aGuard(m_aMutex);
-
- m_sURL = rURL;
-
- // Convert URL to a system path
- const INetURLObject aURLObj(m_sURL);
- const std::string sFilePath = OUStringToOString( aURLObj.getFSysPath(FSysStyle::Detect), RTL_TEXTENCODING_UTF8 ).getStr();
-
- // Load *.json file and init renderer
- m_pHandle = gltf_renderer_init(sFilePath, m_vInputFiles);
-
- if( !m_pHandle )
- {
- SAL_WARN("avmedia.opengl", "gltf_renderer_init returned an invalid glTFHandle");
- return false;
- }
-
- // Load external resources
- for(glTFFile & rFile : m_vInputFiles)
- {
- if( !rFile.filename.empty() )
- {
- const OUString sFilesURL =
- INetURLObject::GetAbsURL(m_sURL,OStringToOUString(OString(rFile.filename.c_str()),RTL_TEXTENCODING_UTF8));
- if( rFile.type == GLTF_IMAGE )
- {
- // Load images as bitmaps
- GraphicFilter aFilter;
- Graphic aGraphic;
- if( aFilter.ImportGraphic(aGraphic, INetURLObject(sFilesURL)) != ERRCODE_NONE )
- {
- rFile.buffer = nullptr;
- rFile.imagewidth = 0;
- rFile.imageheight = 0;
- SAL_WARN("avmedia.opengl", "Can't load texture file: " + sFilesURL);
- return false;
- }
- BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
- rFile.buffer = new char[4 * aBitmapEx.GetSizePixel().Width() * aBitmapEx.GetSizePixel().Height()];
- OpenGLHelper::ConvertBitmapExToRGBATextureBuffer(aBitmapEx, reinterpret_cast<sal_uInt8*>(rFile.buffer), true);
- rFile.imagewidth = aBitmapEx.GetSizePixel().Width();
- rFile.imageheight = aBitmapEx.GetSizePixel().Height();
- }
- else if( rFile.type == GLTF_BINARY || rFile.type == GLTF_GLSL )
- {
- if( !lcl_LoadFile(&rFile, sFilesURL) )
- {
- rFile.buffer = nullptr;
- rFile.size = 0;
- SAL_WARN("avmedia.opengl", "Can't load glTF file: " + sFilesURL);
- return false;
- }
- }
- }
- }
-
- // Set timer
- m_aTimer.SetTimeout(8); // is 125fps enough for anyone ?
- m_aTimer.SetPriority(TaskPriority::HIGH_IDLE);
- m_aTimer.SetInvokeHandler(LINK(this,OGLPlayer,TimerHandler));
-
- return true;
-}
-
-void OGLPlayer::releaseInputFiles()
-{
- for (size_t i = 0; i < m_vInputFiles.size() && m_vInputFiles[i].buffer; ++i)
- {
- delete [] m_vInputFiles[i].buffer;
- m_vInputFiles[i].buffer = nullptr;
- }
- m_vInputFiles.clear();
-}
-
-void SAL_CALL OGLPlayer::start()
-{
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pHandle);
-
- if(!m_pOGLWindow)
- return;
-
- gltf_animation_resume(m_pHandle);
- m_aTimer.Start();
- m_bIsRendering = true;
-}
-
-void SAL_CALL OGLPlayer::stop()
-{
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pHandle);
- m_aTimer.Stop();
- gltf_animation_stop(m_pHandle);
- m_bIsRendering = false;
-}
-
-sal_Bool SAL_CALL OGLPlayer::isPlaying()
-{
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pHandle);
- // Here isPlaying means model is rendered in the window and
- // able to interact with the user (e.g. moving camera)
- if( getDuration() > 0.0 )
- return gltf_animation_is_playing(m_pHandle);
- else
- return m_bIsRendering;
-}
-
-double SAL_CALL OGLPlayer::getDuration()
-{
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pHandle);
- return gltf_animation_get_duration(m_pHandle);
-}
-
-void SAL_CALL OGLPlayer::setMediaTime( double fTime )
-{
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pHandle);
- gltf_animation_set_time(m_pHandle, fTime);
-}
-
-double SAL_CALL OGLPlayer::getMediaTime()
-{
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pHandle);
- return gltf_animation_get_time(m_pHandle);
-}
-
-void SAL_CALL OGLPlayer::setPlaybackLoop( sal_Bool bSet )
-{
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pHandle);
- gltf_animation_set_looping(m_pHandle, bSet);
-}
-
-sal_Bool SAL_CALL OGLPlayer::isPlaybackLoop()
-{
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pHandle);
- return gltf_animation_get_looping(m_pHandle);
-}
-
-void SAL_CALL OGLPlayer::setVolumeDB( sal_Int16 /*nVolumDB*/ )
-{
- // OpenGL models have no sound.
-}
-
-sal_Int16 SAL_CALL OGLPlayer::getVolumeDB()
-{
- // OpenGL models have no sound.
- return 0;
-}
-
-void SAL_CALL OGLPlayer::setMute( sal_Bool /*bSet*/ )
-{
- // OpenGL models have no sound.
-}
-
-sal_Bool SAL_CALL OGLPlayer::isMute()
-{
- // OpenGL models have no sound.
- return false;
-}
-
-awt::Size SAL_CALL OGLPlayer::getPreferredPlayerWindowSize()
-{
- return awt::Size( 480, 360 );
-}
-
-static bool lcl_CheckOpenGLRequirements()
-{
- return OpenGLHelper::getGLVersion() >= 3.0;
-}
-
-uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& rArguments )
-{
- osl::MutexGuard aGuard( m_aMutex );
-
- assert( rArguments.getLength() >= 3 );
- assert(m_pHandle);
-
- sal_IntPtr pIntPtr = 0;
- rArguments[ 2 ] >>= pIntPtr;
- SystemChildWindow *pChildWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr );
-
- if( !pChildWindow )
- {
- SAL_WARN("avmedia.opengl", "Failed to get the SystemChildWindow for rendering!");
- return uno::Reference< media::XPlayerWindow >();
- }
- assert(pChildWindow->GetParent());
-
- if( !m_xContext->init(pChildWindow) )
- {
- SAL_WARN("avmedia.opengl", "Context initialization failed");
- return uno::Reference< media::XPlayerWindow >();
- }
-
- if( !m_xContext->supportMultiSampling() )
- {
- SAL_WARN("avmedia.opengl", "Context does not support multisampling!");
- return uno::Reference< media::XPlayerWindow >();
- }
-
- if( !lcl_CheckOpenGLRequirements() )
- {
- SAL_WARN("avmedia.opengl", "Your platform does not have the minimal OpenGL requiremenets!");
- return uno::Reference< media::XPlayerWindow >();
- }
-
- Size aSize = pChildWindow->GetSizePixel();
- m_xContext->setWinSize(aSize);
- m_pHandle->viewport.x = 0;
- m_pHandle->viewport.y = 0;
- m_pHandle->viewport.width = aSize.Width();
- m_pHandle->viewport.height = aSize.Height();
-
- // TODO: Use the error codes to print a readable error message
- int nRet = gltf_renderer_set_content(m_pHandle, m_vInputFiles);
- releaseInputFiles();
- if( nRet != 0 )
- {
- SAL_WARN("avmedia.opengl", "Error occurred while setting up the scene! Error code: " << nRet);
- return uno::Reference< media::XPlayerWindow >();
- }
- // The background color is white by default, but we need to separate the
- // OpenGL window from the main window so set background color to grey
- glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
- m_pOGLWindow = new OGLWindow(*m_pHandle, m_xContext, *pChildWindow->GetParent());
- return uno::Reference< media::XPlayerWindow >( m_pOGLWindow );
-}
-
-uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
-{
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pHandle);
-
- if( !m_xContext->init() )
- {
- SAL_WARN("avmedia.opengl", "Offscreen context initialization failed");
- return uno::Reference< media::XFrameGrabber >();
- }
-
- if( !m_xContext->supportMultiSampling() )
- {
- SAL_WARN("avmedia.opengl", "Context does not support multisampling!");
- return uno::Reference< media::XFrameGrabber >();
- }
-
- if( !lcl_CheckOpenGLRequirements() )
- {
- SAL_WARN("avmedia.opengl", "Your platform does not have the minimal OpenGL requiremenets!");
- return uno::Reference< media::XFrameGrabber >();
- }
-
- m_pHandle->viewport.x = 0;
- m_pHandle->viewport.y = 0;
- m_pHandle->viewport.width = getPreferredPlayerWindowSize().Width;
- m_pHandle->viewport.height = getPreferredPlayerWindowSize().Height;
-
- int nRet = gltf_renderer_set_content(m_pHandle, m_vInputFiles);
- releaseInputFiles();
- if( nRet != 0 )
- {
- SAL_WARN("avmedia.opengl", "Error occurred while setting up the scene! Error code: " << nRet);
- return uno::Reference< media::XFrameGrabber >();
- }
- glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
- OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( *m_pHandle );
- return uno::Reference< media::XFrameGrabber >( pFrameGrabber );
-}
-
-OUString SAL_CALL OGLPlayer::getImplementationName()
-{
- return OUString("com.sun.star.comp.avmedia.Player_OpenGL");
-}
-
-sal_Bool SAL_CALL OGLPlayer::supportsService( const OUString& rServiceName )
-{
- return cppu::supportsService(this, rServiceName);
-}
-
-uno::Sequence< OUString > SAL_CALL OGLPlayer::getSupportedServiceNames()
-{
- return { "com.sun.star.media.Player_OpenGL" };
-}
-
-IMPL_LINK(OGLPlayer,TimerHandler,Timer*,pTimer,void)
-{
- if (pTimer == &m_aTimer)
- {
- osl::MutexGuard aGuard(m_aMutex);
- assert(m_pOGLWindow);
- m_pOGLWindow->update();
- }
-}
-
-} // namespace ogl
-} // namespace avmedia
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/opengl/oglplayer.hxx b/avmedia/source/opengl/oglplayer.hxx
deleted file mode 100644
index a74aae4707f9..000000000000
--- a/avmedia/source/opengl/oglplayer.hxx
+++ /dev/null
@@ -1,82 +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/.
- */
-
-#ifndef INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLPLAYER_HXX
-#define INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLPLAYER_HXX
-
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/media/XPlayer.hpp>
-
-#include <libgltf.h>
-
-#include <vcl/opengl/OpenGLContext.hxx>
-#include <vcl/timer.hxx>
-
-#include <vector>
-
-namespace avmedia { namespace ogl {
-
-class OGLWindow;
-
-typedef ::cppu::WeakComponentImplHelper< css::media::XPlayer, css::lang::XServiceInfo > Player_BASE;
-
-class OGLPlayer : public cppu::BaseMutex,
- public Player_BASE
-{
-public:
-
- OGLPlayer();
- virtual ~OGLPlayer() override;
-
- bool create( const OUString& rURL );
- void releaseInputFiles();
-
- // XPlayer
- virtual void SAL_CALL start() override;
- virtual void SAL_CALL stop() override;
- virtual sal_Bool SAL_CALL isPlaying() override;
- virtual double SAL_CALL getDuration() override;
- virtual void SAL_CALL setMediaTime( double fTime ) override;
- virtual double SAL_CALL getMediaTime() override;
- virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) override;
- virtual sal_Bool SAL_CALL isPlaybackLoop() override;
- virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) override;
- virtual sal_Int16 SAL_CALL getVolumeDB() override;
- virtual void SAL_CALL setMute( sal_Bool bSet ) override;
- virtual sal_Bool SAL_CALL isMute() override;
- virtual css::awt::Size SAL_CALL getPreferredPlayerWindowSize() override;
- virtual css::uno::Reference< css::media::XPlayerWindow > SAL_CALL createPlayerWindow( const css::uno::Sequence< css::uno::Any >& rArguments ) override;
- virtual css::uno::Reference< css::media::XFrameGrabber > SAL_CALL createFrameGrabber() override;
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName() override;
- virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-
-private:
- DECL_LINK( TimerHandler, Timer*, void );
-
- OUString m_sURL;
-
- libgltf::glTFHandle* m_pHandle;
- std::vector<libgltf::glTFFile> m_vInputFiles;
-
- rtl::Reference<OpenGLContext> m_xContext;
- AutoTimer m_aTimer;
- OGLWindow* m_pOGLWindow;
- bool m_bIsRendering;
-};
-
-} // namespace ogl
-} // namespace avmedia
-
-#endif // INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLPLAYER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/opengl/ogluno.cxx b/avmedia/source/opengl/ogluno.cxx
deleted file mode 100644
index c8add21c1bec..000000000000
--- a/avmedia/source/opengl/ogluno.cxx
+++ /dev/null
@@ -1,45 +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/.
- */
-
-#include "oglmanager.hxx"
-
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace ::com::sun::star;
-
-static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& /*rxFact*/ )
-{
- return uno::Reference< uno::XInterface >( *new ::avmedia::ogl::OGLManager );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmediaogl_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* )
-{
- uno::Reference< lang::XSingleServiceFactory > xFactory;
- void* pRet = nullptr;
-
- if( rtl_str_compare( pImplName, "com.sun.star.comp.avmedia.Manager_OpenGL" ) == 0 )
- {
- xFactory.set( ::cppu::createSingleFactory(
- static_cast< lang::XMultiServiceFactory* >( pServiceManager ),
- "com.sun.star.comp.avmedia.Manager_OpenGL",
- create_MediaPlayer, uno::Sequence< OUString >{ "com.sun.star.media.Manager_OpenGL" } ) );
- }
-
- if( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
deleted file mode 100644
index ae550ff37f84..000000000000
--- a/avmedia/source/opengl/oglwindow.cxx
+++ /dev/null
@@ -1,371 +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/.
- */
-
-#include "oglwindow.hxx"
-#include <cppuhelper/supportsservice.hxx>
-
-using namespace com::sun::star;
-using namespace libgltf;
-
-namespace avmedia { namespace ogl {
-
-OGLWindow::OGLWindow( glTFHandle& rHandle, const rtl::Reference<OpenGLContext> &rContext, vcl::Window& rEventHandlerParent )
- : m_rHandle( rHandle )
- , m_xContext( rContext )
- , m_rEventHandler( rEventHandlerParent )
- , m_bVisible ( false )
- , m_aLastMousePos(Point(0,0))
- , m_bIsOrbitMode( false )
-{
-}
-
-OGLWindow::~OGLWindow()
-{
- dispose();
-}
-
-void SAL_CALL OGLWindow::update()
-{
- m_xContext->makeCurrent();
- int nRet = gltf_prepare_renderer(&m_rHandle);
- if( nRet != 0 )
- {
- SAL_WARN("avmedia.opengl", "Error occurred while preparing for rendering! Error code: " << nRet);
- return;
- }
- gltf_renderer(&m_rHandle);
- gltf_complete_renderer(&m_rHandle);
- m_xContext->swapBuffers();
-}
-
-sal_Bool SAL_CALL OGLWindow::setZoomLevel( css::media::ZoomLevel /*eZoomLevel*/ )
-{
- return false;
-}
-
-css::media::ZoomLevel SAL_CALL OGLWindow::getZoomLevel()
-{
- return media::ZoomLevel_ORIGINAL;
-}
-
-void SAL_CALL OGLWindow::setPointerType( sal_Int32 )
-{
-}
-
-OUString SAL_CALL OGLWindow::getImplementationName()
-{
- return OUString("com.sun.star.comp.avmedia.Window_OpenGL");
-}
-
-sal_Bool SAL_CALL OGLWindow::supportsService( const OUString& rServiceName )
-{
- return cppu::supportsService(this, rServiceName);
-}
-
-uno::Sequence< OUString > SAL_CALL OGLWindow::getSupportedServiceNames()
-{
- return { "com.sun.star.media.Window_OpenGL" };
-}
-
-void SAL_CALL OGLWindow::dispose()
-{
- assert(m_rEventHandler.GetParent());
- m_rEventHandler.GetParent()->RemoveEventListener( LINK(this, OGLWindow, FocusGrabber));
- m_rEventHandler.RemoveEventListener( LINK(this, OGLWindow, CameraHandler));
-}
-
-void SAL_CALL OGLWindow::addEventListener( const uno::Reference< lang::XEventListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::removeEventListener( const uno::Reference< lang::XEventListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 /*nFlags*/ )
-{
- if( m_rHandle.viewport.x != nX || m_rHandle.viewport.x != nY ||
- m_rHandle.viewport.width != nWidth || m_rHandle.viewport.height != nHeight )
- {
- m_xContext->setWinSize(Size(nWidth,nHeight));
- m_rHandle.viewport.x = nX;
- m_rHandle.viewport.y = nY;
- m_rHandle.viewport.width = nWidth;
- m_rHandle.viewport.height = nHeight;
- }
-}
-
-awt::Rectangle SAL_CALL OGLWindow::getPosSize()
-{
- return awt::Rectangle(m_rHandle.viewport.x, m_rHandle.viewport.y,
- m_rHandle.viewport.width, m_rHandle.viewport.height);
-}
-
-void SAL_CALL OGLWindow::setVisible( sal_Bool bSet )
-{
- assert(m_rEventHandler.GetParent());
- if( bSet && !m_bVisible )
- {
- m_rEventHandler.GetParent()->AddEventListener( LINK(this, OGLWindow, FocusGrabber));
- m_rEventHandler.AddEventListener( LINK(this, OGLWindow, CameraHandler));
- m_rEventHandler.GrabFocus();
- }
- else if( !bSet )
- {
- m_rEventHandler.GetParent()->RemoveEventListener( LINK(this, OGLWindow, FocusGrabber));
- m_rEventHandler.RemoveEventListener( LINK(this, OGLWindow, CameraHandler));
- }
- m_bVisible = bSet;
-}
-
-void SAL_CALL OGLWindow::setEnable( sal_Bool )
-{
-}
-
-void SAL_CALL OGLWindow::setFocus()
-{
-}
-
-void SAL_CALL OGLWindow::addWindowListener( const uno::Reference< awt::XWindowListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::removeWindowListener( const uno::Reference< awt::XWindowListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::addFocusListener( const uno::Reference< awt::XFocusListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::removeFocusListener( const uno::Reference< awt::XFocusListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::addKeyListener( const uno::Reference< awt::XKeyListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::removeKeyListener( const uno::Reference< awt::XKeyListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::addMouseListener( const uno::Reference< awt::XMouseListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::removeMouseListener( const uno::Reference< awt::XMouseListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::addPaintListener( const uno::Reference< awt::XPaintListener >& )
-{
-}
-
-void SAL_CALL OGLWindow::removePaintListener( const uno::Reference< awt::XPaintListener >& )
-{
-}
-
-IMPL_LINK(OGLWindow, FocusGrabber, VclWindowEvent&, rEvent, void)
-{
- if( rEvent.GetId() == VclEventId::WindowMouseMove )
- {
- MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
- if(pMouseEvt)
- {
- const Point& rMousePos = pMouseEvt->GetPosPixel();
- const tools::Rectangle aWinRect(m_rEventHandler.GetPosPixel(),m_rEventHandler.GetSizePixel());
- // Grab focus to the OpenGL window when mouse pointer is over it
- if( aWinRect.IsInside(rMousePos) )
- {
- if ( !m_rEventHandler.HasFocus() )
- {
- m_rEventHandler.GrabFocus();
- }
- }
- // Move focus to the document when mouse is not over the OpenGL window
- else if ( m_rEventHandler.HasFocus() )
- {
- m_rEventHandler.GrabFocusToDocument();
- }
- }
- }
-}
-
-IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent&, rEvent, void)
-{
- if( rEvent.GetId() == VclEventId::WindowKeyInput )
- {
- KeyEvent* pKeyEvt = static_cast<KeyEvent*>(rEvent.GetData());
- if(pKeyEvt)
- {
- const sal_uInt16 nCode = pKeyEvt->GetKeyCode().GetCode();
- if (nCode == KEY_Q || nCode == KEY_E ||
- nCode == KEY_A || nCode == KEY_D ||
- nCode == KEY_W || nCode == KEY_S )
- {
- // Calculate movement
- glm::vec3 vMoveBy;
- {
- glm::vec3 vEye;
- glm::vec3 vView;
- glm::vec3 vUp;
- gltf_get_camera_pos(&m_rHandle, &vEye,&vView,&vUp);
- float fModelSize =(float)gltf_get_model_size(&m_rHandle);
-
- glm::vec3 vMove = vView-vEye;
- vMove = glm::normalize(vMove);
- vMove *= 25.0f;
- glm::vec3 vStrafe = glm::cross(vMove, vUp);
- vStrafe = glm::normalize(vStrafe);
- vStrafe *= 25.0f;
- glm::vec3 vMup = vUp * 25.0f;
-
- if( !m_bIsOrbitMode )
- {
- if(nCode == KEY_E)vMoveBy += vMup*(0.0005f*fModelSize);
- if(nCode == KEY_Q)vMoveBy -= vMup*(0.0005f*fModelSize);
- if(nCode == KEY_W)vMoveBy += vMove*(0.0005f*fModelSize);
- if(nCode == KEY_S)vMoveBy -= vMove*(0.0005f*fModelSize);
- if(nCode == KEY_A)vMoveBy -= vStrafe*(0.0005f*fModelSize);
- if(nCode == KEY_D)vMoveBy += vStrafe*(0.0005f*fModelSize);
- }
- else
- {
- bool bZoomIn = false;
- bool bZoomOut = false;
- if(nCode == KEY_E)
- {
- vMoveBy += vMove*(0.0005f*fModelSize);
- bZoomIn = true;
- }
- if(nCode == KEY_Q)
- {
- vMoveBy -= vMove*(0.0005f*fModelSize);
- bZoomOut = true;
- }
-
- // Limit zooming in orbit mode
- float fCameraDistFromModelGlobe = glm::length(vEye + vMoveBy - vView) - fModelSize / 2.0f;
- if ((fCameraDistFromModelGlobe < 0.5 * fModelSize && bZoomIn ) ||
- (fCameraDistFromModelGlobe > 2 * fModelSize && bZoomOut ))
- {
- vMoveBy = glm::vec3(0.0);
- }
- }
- }
- gltf_renderer_move_camera(&m_rHandle, vMoveBy.x, vMoveBy.y, vMoveBy.z, 0.0001);
-
- if( m_bIsOrbitMode )
- {
- long nDeltaX = 0;
- long nDeltaY = 0;
- if (nCode == KEY_W)
- {
- nDeltaY -= 1;
- }
- if (nCode == KEY_S)
- {
- nDeltaY += 1;
- }
- if (nCode == KEY_A)
- {
- nDeltaX -= 1;
- }
- if (nCode == KEY_D)
- {
- nDeltaX += 1;
- }
- float fSensitivity = 50.0;
- gltf_renderer_rotate_model(&m_rHandle, nDeltaX*fSensitivity, nDeltaY*fSensitivity, 0.0);
- }
- }
- else if(nCode == KEY_M)
- {
- if(m_bIsOrbitMode)
- {
- gltf_orbit_mode_stop(&m_rHandle);
- m_bIsOrbitMode = false;
- }
- else
- {
- gltf_orbit_mode_start(&m_rHandle);
- m_bIsOrbitMode = true;
- }
- }
- else if(nCode == KEY_F)
- {
- gltf_render_FPS_enable(&m_rHandle);
- }
- }
- }
- else if( rEvent.GetId() == VclEventId::WindowMouseButtonDown )
- {
- MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
- if(pMouseEvt && pMouseEvt->IsLeft() && pMouseEvt->GetClicks() == 1)
- {
- m_aLastMousePos = pMouseEvt->GetPosPixel();
- }
- }
- else if( rEvent.GetId() == VclEventId::WindowMouseMove )
- {
- if ( !m_rEventHandler.HasFocus() )
- {
- m_rEventHandler.GrabFocus();
- }
- MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
- if(pMouseEvt && pMouseEvt->IsLeft() && m_aLastMousePos != Point(0,0))
- {
- const Point& aCurPos = pMouseEvt->GetPosPixel();
- float fSensitivity = std::min(m_rHandle.viewport.width, m_rHandle.viewport.height);
- if (fSensitivity == 0.0)
- fSensitivity = 1.0;
- else
- fSensitivity = 540.0 / fSensitivity;
-
-
- long nDeltaX = m_aLastMousePos.X()-aCurPos.X();
- long nDeltaY = m_aLastMousePos.Y()-aCurPos.Y();
- if( m_bIsOrbitMode )
- {
- fSensitivity *= 5;
- gltf_renderer_rotate_model(&m_rHandle, (float)nDeltaX*fSensitivity, (float)nDeltaY*fSensitivity, 0.0);
- }
- else
- {
- // Filter out too small deltas to avoid rewrite rotation parameter with 0
- // before rotation is done
- if( nDeltaX != 0 || nDeltaY != 0 )
- gltf_renderer_rotate_camera(&m_rHandle, (float)nDeltaX*fSensitivity, (float)nDeltaY*fSensitivity, 0.0);
- }
- m_aLastMousePos = aCurPos;
- }
- }
- else if( rEvent.GetId() == VclEventId::WindowMouseButtonUp )
- {
- MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rEvent.GetData());
- if(pMouseEvt && pMouseEvt->IsLeft() && pMouseEvt->GetClicks() == 1)
- {
- m_aLastMousePos = Point(0,0);
- }
- }
-}
-
-} // namespace ogl
-} // namespace avmedia
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/opengl/oglwindow.hxx b/avmedia/source/opengl/oglwindow.hxx
deleted file mode 100644
index 5bb405979e37..000000000000
--- a/avmedia/source/opengl/oglwindow.hxx
+++ /dev/null
@@ -1,82 +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/.
- */
-
-#ifndef INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLWINDOW_HXX
-#define INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLWINDOW_HXX
-
-#include "oglplayer.hxx"
-
-#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/media/XPlayerWindow.hpp>
-#include <com/sun/star/media/ZoomLevel.hpp>
-
-#include <libgltf.h>
-
-#include <vcl/opengl/OpenGLContext.hxx>
-#include <vcl/syschild.hxx>
-
-namespace avmedia { namespace ogl {
-
-class OGLWindow : public ::cppu::WeakImplHelper< css::media::XPlayerWindow, css::lang::XServiceInfo >
-{
-public:
- OGLWindow( libgltf::glTFHandle& rHandle, const rtl::Reference<OpenGLContext> & rContext, vcl::Window& rEventHandlerParent );
- virtual ~OGLWindow() override;
-
- virtual void SAL_CALL update() override;
- virtual sal_Bool SAL_CALL setZoomLevel( css::media::ZoomLevel ZoomLevel ) override;
- virtual css::media::ZoomLevel SAL_CALL getZoomLevel() override;
- virtual void SAL_CALL setPointerType( sal_Int32 SystemPointerType ) override;
-
- virtual OUString SAL_CALL getImplementationName() override;
- virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-
- virtual void SAL_CALL dispose() final override;
- virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
- virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
-
- virtual void SAL_CALL setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) override;
- virtual css::awt::Rectangle SAL_CALL getPosSize() override;
- virtual void SAL_CALL setVisible( sal_Bool Visible ) override;
- virtual void SAL_CALL setEnable( sal_Bool Enable ) override;
- virtual void SAL_CALL setFocus() override;
- virtual void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override;
- virtual void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override;
- virtual void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override;
- virtual void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override;
- virtual void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override;
- virtual void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override;
- virtual void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
- virtual void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
- virtual void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
- virtual void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
- virtual void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
- virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
-
-private:
- DECL_LINK( FocusGrabber, VclWindowEvent&, void );
- DECL_LINK( CameraHandler, VclWindowEvent&, void );
-
- libgltf::glTFHandle& m_rHandle;
- rtl::Reference<OpenGLContext> m_xContext;
- vcl::Window& m_rEventHandler;
-
- bool m_bVisible;
- Point m_aLastMousePos;
- bool m_bIsOrbitMode;
-};
-
-} // namespace ogl
-} // namespace avmedia
-
-#endif // INCLUDED_AVMEDIA_SOURCE_OPENGL_OGLWINDOW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 004d56f1f7d6..f5d77615fb1e 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -69,13 +69,6 @@ MediaChildWindow::MediaChildWindow(vcl::Window* pParent)
{
}
-#if HAVE_FEATURE_GLTF
-MediaChildWindow::MediaChildWindow(vcl::Window* pParent, SystemWindowData* pData)
- : SystemChildWindow(pParent, WB_CLIPCHILDREN, pData)
-{
-}
-#endif
-
void MediaChildWindow::MouseMove( const MouseEvent& rMEvt )
{
const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
@@ -223,14 +216,6 @@ uno::Reference<media::XPlayer> MediaWindowImpl::createPlayer(const OUString& rUR
xPlayer = createPlayer(rURL, aServiceName, xContext);
}
}
-#if HAVE_FEATURE_GLTF
-#if HAVE_FEATURE_OPENGL
- else if ( *pMimeType == AVMEDIA_MIMETYPE_JSON )
- {
- xPlayer = createPlayer(rURL, AVMEDIA_OPENGL_MANAGER_SERVICE_NAME, xContext);
- }
-#endif
-#endif
return xPlayer;
}
@@ -442,15 +427,6 @@ void MediaWindowImpl::onURLChanged()
mpChildWindow.disposeAndClear();
mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this));
}
-#if HAVE_FEATURE_GLTF
- else if (m_sMimeType == AVMEDIA_MIMETYPE_JSON)
- {
- SystemWindowData aWinData = OpenGLContext::Create()->generateWinData(this, false);
- mpChildWindow.disposeAndClear();
- mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this,&aWinData));
- mbEventTransparent = false;
- }
-#endif
if (!mpChildWindow)
return;
mpChildWindow->SetHelpId(HID_AVMEDIA_PLAYERWINDOW);