avmedia/source/framework/mediaitem.cxx | 4 ++- comphelper/source/misc/graphicmimetype.cxx | 1 oox/inc/drawingml/graphicproperties.hxx | 1 oox/source/drawingml/fillproperties.cxx | 5 ++++ oox/source/drawingml/graphicshapecontext.cxx | 6 ++++ oox/source/export/drawingml.cxx | 33 --------------------------- oox/source/token/properties.txt | 1 svx/source/unodraw/unoshap4.cxx | 7 +++++ 8 files changed, 24 insertions(+), 34 deletions(-)
New commits: commit b3e0324dcc240a08ba75ce7916e5e1b5dee82295 Author: Karthik Godha <[email protected]> AuthorDate: Sun Dec 28 20:50:43 2025 +0530 Commit: Michael Stahl <[email protected]> CommitDate: Fri Jan 2 13:38:03 2026 +0100 tdf#170153: PPTX->PPTX handle ".bin" media file Media files are exported based on file extensions. ".bin" file extension is not handled. Change-Id: Ib7af829e6a5bd042c59edcef9d09b6c5d4fb80a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196267 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Michael Stahl <[email protected]> diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx index fbabb684383e..c9377784f889 100644 --- a/avmedia/source/framework/mediaitem.cxx +++ b/avmedia/source/framework/mediaitem.cxx @@ -244,7 +244,9 @@ bool MediaItem::setURL(const OUString& rURL, const OUString& rTempURL, const OUS m_pImpl->m_URL = rURL; m_pImpl->m_TempFileURL = rTempURL; m_pImpl->m_Referer = rReferer; - setMimeType(::comphelper::GuessMediaMimeType(GetFilename(rURL))); + OUString sMimeType(::comphelper::GuessMediaMimeType(GetFilename(rURL))); + if (!sMimeType.isEmpty()) + setMimeType(sMimeType); } return bChanged; } diff --git a/comphelper/source/misc/graphicmimetype.cxx b/comphelper/source/misc/graphicmimetype.cxx index a9bc0e504ea5..493da0ee6887 100644 --- a/comphelper/source/misc/graphicmimetype.cxx +++ b/comphelper/source/misc/graphicmimetype.cxx @@ -184,6 +184,7 @@ static auto GetMediaMimes() -> std::map<OString, OString> const& { "mov", "video/quicktime" }, { "wmv", "video/x-ms-wmv" }, { "avi", "video/x-msvideo" }, + { "flv", "video/x-flv" }, { "m4a", "audio/mp4" }, { "aac", "audio/aac" }, { "mp3", "audio/mpeg" }, // https://bugs.chromium.org/p/chromium/issues/detail?id=227004 diff --git a/oox/inc/drawingml/graphicproperties.hxx b/oox/inc/drawingml/graphicproperties.hxx index 15ccedb99a2e..cea92cd0e954 100644 --- a/oox/inc/drawingml/graphicproperties.hxx +++ b/oox/inc/drawingml/graphicproperties.hxx @@ -37,6 +37,7 @@ struct GraphicProperties { BlipFillProperties maBlipProps; ///< Properties for the graphic. OUString m_sMediaPackageURL; ///< Audio/Video URL. + OUString m_sMediaMimeType; bool mbIsCustomShape = false; bool mbIsExtruded = false; css::uno::Reference<css::io::XInputStream> m_xMediaStream; ///< Audio/Video input stream. diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index b75dfed5aac8..6a8786218e40 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -918,6 +918,11 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe if (m_xMediaStream.is()) rPropMap.setProperty(PROP_PrivateStream, m_xMediaStream); } + // Media Type + if (!m_sMediaMimeType.isEmpty()) + { + rPropMap.setProperty(PROP_MediaMimeType, m_sMediaMimeType); + } } bool ArtisticEffectProperties::isEmpty() const diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index 45dbc656e6bb..da7b40603cdf 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -87,6 +87,7 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( sal_Int32 aElementToken, { mpShapePtr->getGraphicProperties().m_xMediaStream = std::move(xMediaStream); mpShapePtr->getGraphicProperties().m_sMediaPackageURL = lcl_GetMediaReference(path); + mpShapePtr->getGraphicProperties().m_sMediaMimeType = "audio/unknown"; } } break; @@ -113,6 +114,11 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( sal_Int32 aElementToken, mpShapePtr->getGraphicProperties().m_sMediaPackageURL = getFilter().getAbsoluteUrl(rPath); } + + if (getBaseToken(aElementToken) == XML_audioFile) + mpShapePtr->getGraphicProperties().m_sMediaMimeType = "audio/unknown"; + else + mpShapePtr->getGraphicProperties().m_sMediaMimeType = "video/unknown"; } break; } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index f12ca0a97751..8877ab0a8914 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1685,39 +1685,6 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra { eMediaType = Relationship::AUDIO; } - else - if (aMimeType == "application/vnd.sun.star.media") - { - // try to set something better - // TODO fix the importer to actually set the mimetype on import - if (aExtension.equalsIgnoreAsciiCase(".avi")) - aMimeType = "video/x-msvideo"; - else if (aExtension.equalsIgnoreAsciiCase(".flv")) - aMimeType = "video/x-flv"; - else if (aExtension.equalsIgnoreAsciiCase(".mp4")) - aMimeType = "video/mp4"; - else if (aExtension.equalsIgnoreAsciiCase(".mov")) - aMimeType = "video/quicktime"; - else if (aExtension.equalsIgnoreAsciiCase(".ogv")) - aMimeType = "video/ogg"; - else if (aExtension.equalsIgnoreAsciiCase(".wmv")) - aMimeType = "video/x-ms-wmv"; - else if (aExtension.equalsIgnoreAsciiCase(".wav")) - { - aMimeType = "audio/x-wav"; - eMediaType = Relationship::AUDIO; - } - else if (aExtension.equalsIgnoreAsciiCase(".m4a")) - { - aMimeType = "audio/mp4"; - eMediaType = Relationship::AUDIO; - } - else if (aExtension.equalsIgnoreAsciiCase(".mp3")) - { - aMimeType = "audio/mp3"; - eMediaType = Relationship::AUDIO; - } - } OUString aVideoFileRelId; OUString aMediaRelId; diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 2336a620889d..e05a780bccaf 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -366,6 +366,7 @@ MarkPosition MaxFieldCount MaxTextLen MediaType +MediaMimeType MediaURL Metal MetalType diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 54ba90c804eb..f63648ebaf40 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -32,6 +32,7 @@ #include <comphelper/classids.hxx> #include <comphelper/DirectoryHelper.hxx> #include <comphelper/embeddedobjectcontainer.hxx> +#include <comphelper/mediamimetype.hxx> #include <comphelper/propertysequence.hxx> #include <comphelper/propertyvalue.hxx> #include <cppuhelper/exc_hlp.hxx> @@ -904,6 +905,12 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr if( rValue >>= sMimeType ) { bOk = true; + + if (aItem.getMimeType() != AVMEDIA_MIMETYPE_COMMON + && (sMimeType == "audio/unknown" || sMimeType == "video/unknown")) + { + break; + } aItem.setMimeType( sMimeType ); } }
