diff options
author | Mark Hung <marklh9@gmail.com> | 2018-10-17 22:17:19 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2018-10-18 14:47:44 +0200 |
commit | a1b9f7e81aa1a105bbac08d310825f367dbfe601 (patch) | |
tree | d5b37233666d02056029f273ec85fc7b16ee3450 /oox | |
parent | c2545303f7c0c18c4b65e50006bcedb5fe31aa4c (diff) |
tdf#120573 export media type for .wav properly.
Only video files were handled before. .wav files had
wrong mime type in [Content Types].xml, used videoFile
tag in slide1.xml, and incorrect type in rel file.
Change-Id: I92bded52eb9f366103a10334c6a92fda9648076e
Reviewed-on: https://gerrit.libreoffice.org/61885
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/drawingml.cxx | 12 | ||||
-rw-r--r-- | oox/source/token/relationship.inc | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 092832844155..8d68fce8072e 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1072,6 +1072,7 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra aExtension = rURL.copy(nLastDot); bool bEmbed = rURL.startsWith("vnd.sun.star.Package:"); + Relationship eMediaType = Relationship::VIDEO; // mime type #if HAVE_FEATURE_AVMEDIA @@ -1095,6 +1096,11 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra 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; + } } OUString aVideoFileRelId; @@ -1122,18 +1128,18 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra .append(static_cast<sal_Int32>(mnImageCounter++)) .append(aExtension) .makeStringAndClear(); - aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::VIDEO), aPath); + aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), aPath); aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), aPath); } else { - aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::VIDEO), rURL); + aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), rURL); aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), rURL); } GetFS()->startElementNS(XML_p, XML_nvPr, FSEND); - GetFS()->singleElementNS(XML_a, XML_videoFile, + GetFS()->singleElementNS(XML_a, eMediaType == Relationship::VIDEO ? XML_videoFile : XML_audioFile, FSNS(XML_r, XML_link), USS(aVideoFileRelId), FSEND); diff --git a/oox/source/token/relationship.inc b/oox/source/token/relationship.inc index 128fe3626de7..9b163038b169 100644 --- a/oox/source/token/relationship.inc +++ b/oox/source/token/relationship.inc @@ -38,6 +38,7 @@ {Relationship::THEME, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}, {Relationship::VBAPROJECT, "http://schemas.microsoft.com/office/2006/relationships/vbaProject"}, {Relationship::VIDEO, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"}, +{Relationship::AUDIO, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"}, {Relationship::VMLDRAWING, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"}, {Relationship::WORDVBADATA, "http://schemas.microsoft.com/office/2006/relationships/wordVbaData"}, {Relationship::WORKSHEET, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"} |