Merge lp:~boiko/telephony-service/mms_audio_support into lp:telephony-service

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 1146
Merged at revision: 1160
Proposed branch: lp:~boiko/telephony-service/mms_audio_support
Merge into: lp:telephony-service
Diff against target: 63 lines (+16/-2)
1 file modified
handler/texthandler.cpp (+16/-2)
To merge this branch: bzr merge lp:~boiko/telephony-service/mms_audio_support
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+278624@code.launchpad.net

Commit message

Enable audio support for mms.

Description of the change

Enable audio support for mms.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'handler/texthandler.cpp'
--- handler/texthandler.cpp 2015-11-17 17:23:54 +0000
+++ handler/texthandler.cpp 2015-11-25 18:00:57 +0000
@@ -1,8 +1,9 @@
1/*1/*
2 * Copyright (C) 2012-2013 Canonical, Ltd.2 * Copyright (C) 2012-2015 Canonical, Ltd.
3 *3 *
4 * Authors:4 * Authors:
5 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>5 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
6 * Tiago Salem Herrmann <tiago.herrmann@canonical.com>
6 *7 *
7 * This file is part of telephony-service.8 * This file is part of telephony-service.
8 *9 *
@@ -32,12 +33,16 @@
3233
33#define SMIL_TEXT_REGION "<region id=\"Text\" width=\"100%\" height=\"100%\" fit=\"scroll\" />"34#define SMIL_TEXT_REGION "<region id=\"Text\" width=\"100%\" height=\"100%\" fit=\"scroll\" />"
34#define SMIL_IMAGE_REGION "<region id=\"Image\" width=\"100%\" height=\"100%\" fit=\"meet\" />"35#define SMIL_IMAGE_REGION "<region id=\"Image\" width=\"100%\" height=\"100%\" fit=\"meet\" />"
36#define SMIL_AUDIO_REGION "<region id=\"Audio\" width=\"100%\" height=\"100%\" fit=\"meet\" />"
35#define SMIL_TEXT_PART "<par dur=\"3s\">\37#define SMIL_TEXT_PART "<par dur=\"3s\">\
36 <text src=\"cid:%1\" region=\"Text\" />\38 <text src=\"cid:%1\" region=\"Text\" />\
37 </par>"39 </par>"
38#define SMIL_IMAGE_PART "<par dur=\"5000ms\">\40#define SMIL_IMAGE_PART "<par dur=\"5000ms\">\
39 <img src=\"cid:%1\" region=\"Image\" />\41 <img src=\"cid:%1\" region=\"Image\" />\
40 </par>"42 </par>"
43#define SMIL_AUDIO_PART "<par>\
44 <audio src=\"cid:%1\" region=\"Audio\" />\
45 </par>"
4146
42#define SMIL_FILE "<smil>\47#define SMIL_FILE "<smil>\
43 <head>\48 <head>\
@@ -148,7 +153,7 @@
148 Tp::MessagePartList message;153 Tp::MessagePartList message;
149 Tp::MessagePart header;154 Tp::MessagePart header;
150 QString smil, regions, parts;155 QString smil, regions, parts;
151 bool hasImage = false, hasText = false, isMMS = false;156 bool hasImage = false, hasText = false, hasAudio = false, isMMS = false;
152157
153 AccountEntry *account = TelepathyHelper::instance()->accountForId(pendingMessage.accountId);158 AccountEntry *account = TelepathyHelper::instance()->accountForId(pendingMessage.accountId);
154 if (!account) {159 if (!account) {
@@ -207,6 +212,11 @@
207 fileData = attachmentFile.readAll();212 fileData = attachmentFile.readAll();
208 }213 }
209 }214 }
215 } else if (attachment.contentType.startsWith("audio/")) {
216 if (isMMS) {
217 hasAudio = true;
218 parts += QString(SMIL_AUDIO_PART).arg(attachment.id);
219 }
210 } else if (attachment.contentType.startsWith("text/plain")) {220 } else if (attachment.contentType.startsWith("text/plain")) {
211 if (isMMS) {221 if (isMMS) {
212 hasText = true;222 hasText = true;
@@ -230,6 +240,10 @@
230 attachmentFile.remove();240 attachmentFile.remove();
231 }241 }
232242
243 if (hasAudio) {
244 regions += QString(SMIL_AUDIO_REGION);
245 }
246
233 if (hasText) {247 if (hasText) {
234 regions += QString(SMIL_TEXT_REGION);248 regions += QString(SMIL_TEXT_REGION);
235 }249 }

Subscribers

People subscribed via source and target branches