/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column:100 -*- */ /* * 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 .
*/
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;
rtl::Reference<avmedia::PlayerListener> m_xPlayerListener;
OUString m_LastFailedPkgURL;
};
SdrMediaObj::SdrMediaObj(SdrModel& rSdrModel)
: SdrRectObj(rSdrModel)
,m_xImpl( new Impl )
{
}
// We have an explicit graphic for this media object, then go with that instead of // generating our own one.
m_xImpl->m_xCachedSnapshot = aGraphic.GetXGraphic(); return m_xImpl->m_xCachedSnapshot;
}
if (bSuccess)
{
m_xImpl->m_pTempFile = std::make_shared<::avmedia::MediaTempFile>(tempFileURL);
m_xImpl->m_MediaProperties.setURL(
m_xImpl->m_LastFailedPkgURL, tempFileURL, u""_ustr);
}
m_xImpl->m_LastFailedPkgURL.clear(); // once only #endif
}
/// copy a stream from XStorage to temp file #if HAVE_FEATURE_AVMEDIA staticbool lcl_HandlePackageURL(
OUString const & rURL, const SdrModel& rModel,
OUString & o_rTempFileURL)
{
::comphelper::LifecycleProxy sourceProxy;
uno::Reference<io::XInputStream> xInStream; try {
xInStream = rModel.GetDocumentStream(rURL, sourceProxy);
} catch (container::NoSuchElementException const&)
{
SAL_INFO("svx", "not found: '" << rURL << "'"); returnfalse;
} catch (uno::Exception const&)
{
TOOLS_WARN_EXCEPTION("svx", ""); returnfalse;
} if (!xInStream.is())
{
SAL_WARN("svx", "no stream?"); returnfalse;
} // Make sure the temporary copy has the same file name extension as the original media file // (like .mp4). That seems to be important for some AVFoundation APIs. For random extension-less // file names, they don't seem to even bother looking inside the file.
sal_Int32 nLastDot = rURL.lastIndexOf('.');
sal_Int32 nLastSlash = rURL.lastIndexOf('/');
OUString sDesiredExtension; if (nLastDot > nLastSlash && nLastDot+1 < rURL.getLength())
sDesiredExtension = rURL.copy(nLastDot); return ::avmedia::CreateMediaTempFile(xInStream, o_rTempFileURL, sDesiredExtension);
} #endif
// use only a subset of MediaItem properties for own properties if( AVMediaSetMask::MIME_TYPE & nMaskSet )
m_xImpl->m_MediaProperties.setMimeType( rNewProperties.getMimeType() );
if (nMaskSet & AVMediaSetMask::GRAPHIC)
{
m_xImpl->m_MediaProperties.setGraphic(rNewProperties.getGraphic());
}
if (nMaskSet & AVMediaSetMask::CROP)
{
m_xImpl->m_MediaProperties.setCrop(rNewProperties.getCrop());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.