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
1=== modified file 'handler/texthandler.cpp'
2--- handler/texthandler.cpp 2015-11-17 17:23:54 +0000
3+++ handler/texthandler.cpp 2015-11-25 18:00:57 +0000
4@@ -1,8 +1,9 @@
5 /*
6- * Copyright (C) 2012-2013 Canonical, Ltd.
7+ * Copyright (C) 2012-2015 Canonical, Ltd.
8 *
9 * Authors:
10 * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
11+ * Tiago Salem Herrmann <tiago.herrmann@canonical.com>
12 *
13 * This file is part of telephony-service.
14 *
15@@ -32,12 +33,16 @@
16
17 #define SMIL_TEXT_REGION "<region id=\"Text\" width=\"100%\" height=\"100%\" fit=\"scroll\" />"
18 #define SMIL_IMAGE_REGION "<region id=\"Image\" width=\"100%\" height=\"100%\" fit=\"meet\" />"
19+#define SMIL_AUDIO_REGION "<region id=\"Audio\" width=\"100%\" height=\"100%\" fit=\"meet\" />"
20 #define SMIL_TEXT_PART "<par dur=\"3s\">\
21 <text src=\"cid:%1\" region=\"Text\" />\
22 </par>"
23 #define SMIL_IMAGE_PART "<par dur=\"5000ms\">\
24 <img src=\"cid:%1\" region=\"Image\" />\
25 </par>"
26+#define SMIL_AUDIO_PART "<par>\
27+ <audio src=\"cid:%1\" region=\"Audio\" />\
28+ </par>"
29
30 #define SMIL_FILE "<smil>\
31 <head>\
32@@ -148,7 +153,7 @@
33 Tp::MessagePartList message;
34 Tp::MessagePart header;
35 QString smil, regions, parts;
36- bool hasImage = false, hasText = false, isMMS = false;
37+ bool hasImage = false, hasText = false, hasAudio = false, isMMS = false;
38
39 AccountEntry *account = TelepathyHelper::instance()->accountForId(pendingMessage.accountId);
40 if (!account) {
41@@ -207,6 +212,11 @@
42 fileData = attachmentFile.readAll();
43 }
44 }
45+ } else if (attachment.contentType.startsWith("audio/")) {
46+ if (isMMS) {
47+ hasAudio = true;
48+ parts += QString(SMIL_AUDIO_PART).arg(attachment.id);
49+ }
50 } else if (attachment.contentType.startsWith("text/plain")) {
51 if (isMMS) {
52 hasText = true;
53@@ -230,6 +240,10 @@
54 attachmentFile.remove();
55 }
56
57+ if (hasAudio) {
58+ regions += QString(SMIL_AUDIO_REGION);
59+ }
60+
61 if (hasText) {
62 regions += QString(SMIL_TEXT_REGION);
63 }

Subscribers

People subscribed via source and target branches