summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2019-01-20 20:33:26 +0800
committerMark Hung <marklh9@gmail.com>2019-02-04 01:03:00 +0100
commit8a1321362a0229a25869e4e3d0422a5a51c5b5be (patch)
tree3afb0f5d5469adb70e8a5d6ea246413c7312b2e8 /avmedia
parent04160a24e34beb6802cea356b947ed9d8d382d19 (diff)
tdf#44223 oox: import embedded media stream.
- Handle cTn and tgtEl of MediaNodeContext. - Setting the audio source of XAudio. - Embed the media in TimeNodeTargetElementContext. - Embed the media in SoundActionContext. - Allow avmedia::EmbedMedia to embed media from a XInputStream. Change-Id: I164ac50f97f2036db4bfa2f99adedff0bba382e2 Reviewed-on: https://gerrit.libreoffice.org/67208 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/framework/mediaitem.cxx25
1 files changed, 16 insertions, 9 deletions
diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx
index 851e501e18cb..6f960f49f3bc 100644
--- a/avmedia/source/framework/mediaitem.cxx
+++ b/avmedia/source/framework/mediaitem.cxx
@@ -415,14 +415,10 @@ CreateStream(uno::Reference<embed::XStorage> const& xStorage,
bool EmbedMedia(uno::Reference<frame::XModel> const& xModel,
- OUString const& rSourceURL, OUString & o_rEmbeddedURL)
+ OUString const& rSourceURL, OUString & o_rEmbeddedURL, uno::Reference<io::XInputStream> const& xInputStream)
{
try
{
- ::ucbhelper::Content sourceContent(rSourceURL,
- uno::Reference<ucb::XCommandEnvironment>(),
- comphelper::getProcessComponentContext());
-
uno::Reference<document::XStorageBasedDocument> const xSBD(xModel,
uno::UNO_QUERY_THROW);
uno::Reference<embed::XStorage> const xStorage(
@@ -439,10 +435,22 @@ bool EmbedMedia(uno::Reference<frame::XModel> const& xModel,
uno::Reference<io::XOutputStream> const xOutStream(
xStream->getOutputStream(), uno::UNO_SET_THROW);
- if (!sourceContent.openStream(xOutStream)) // copy file to storage
+ if (xInputStream.is())
{
- SAL_INFO("avmedia", "openStream to storage failed");
- return false;
+ // Throw Exception if failed.
+ ::comphelper::OStorageHelper::CopyInputToOutput(xInputStream, xOutStream);
+ }
+ else
+ {
+ ::ucbhelper::Content sourceContent(rSourceURL,
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext());
+
+ if (!sourceContent.openStream(xOutStream)) // copy file to storage
+ {
+ SAL_INFO("avmedia", "openStream to storage failed");
+ return false;
+ }
}
uno::Reference<embed::XTransactedObject> const xSubTransaction(
@@ -467,7 +475,6 @@ bool EmbedMedia(uno::Reference<frame::XModel> const& xModel,
return false;
}
-
} // namespace avmedia
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */