3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
5 * This file is part of msg-service.
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 * Sangkoo Kim <sangkoo.kim@samsung.com>
9 * Seunghwan Lee <sh.cat.lee@samsung.com>
10 * SoonMin Jung <sm0415.jung@samsung.com>
11 * Jae-Young Lee <jy4710.lee@samsung.com>
12 * KeeBum Kim <keebum.kim@samsung.com>
14 * PROPRIETARY/CONFIDENTIAL
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
34 #include <libxml/parser.h>
35 #include <libxml/tree.h>
37 #include "MsgMmsTypes.h"
38 #include "MmsPluginCodec.h"
40 #ifndef MMS_PLUGIN_SMIL_H
41 #define MMS_PLUGIN_SMIL_H
43 typedef enum _SMIL_ELEMENT_T {
63 typedef int HMmsSmil; // SmilDoc Handle
65 #define MMS_SMIL_MAX_DOC 1
66 #define MMS_SMIL_COLOR_SIZE 10
67 #define INVALID_HOBJ -1
68 #define SP_NO_COLOR_SET -1
73 * @brief Represents Smil Doc Information. \n
75 typedef struct _MmsSmilDoc {
77 xmlNodePtr pstRootNode;
80 typedef enum _SMIL_ATTRIBUTE_T {
81 ATTRIBUTE_UNKNOWN = -1,
107 ATTRIBUTE_TEXTFORMAT,
112 ATTRIBUTE_REPEAT_COUNT,
113 #ifdef MMS_SMIL_ANIMATE
114 ATTRIBUTE_ATTRIBUTE_NAME,
115 ATTRIBUTE_ATTRIBUTE_TYPE,
116 ATTRIBUTE_TARGET_ELEMENT,
125 char *MmsSmilGetPresentationData(MSG_MESSAGE_ID_T msgId);
126 bool MmsSmilParseSmilDoc(MMS_MESSAGE_DATA_S *pMmsMsg, char *pSmilDoc);
127 void MmsSmilGetElement(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node);
128 int MmsSmilGetColorValue(xmlChar *content);
129 int MmsSmilGetTime(char *pValue);
130 int MmsSmilAtoIHexa(char *pInput);
131 #ifndef __SUPPORT_DRM__
132 int MmsSmilGetMediaSrcForNormalMsg(char *szOutbuf, char *szInBuf, MsgMultipart *pPart);
134 int MmsSmilGetMediaSrcForNormalMsg(char *szOutbuf, char *szInBuf, MsgMultipart *pPart, MMS_MEDIA_S *pMedia);
136 int MmsSmilGetElementID(char *pString);
137 int MmsSmilGetAttrID(char *pString);
138 bool MmsSmilGetFontAttrib(char *pString);
139 MmsTextDirection MmsSmilGetFontDirection(char *pString);
140 int MmsSmilGetFontSizeValue(char *pString);
141 MmsSmilFontType MmsSmilGetFontTypeValue(char *pString);
142 bool MmsSmilGetMediaFilePath(MMS_MEDIA_S *pMedia, char *pszTemp, int msgID);
143 bool __MmsGetRealFileName(MmsSmilMediaType mediaType, char *pszSrc, char *pszName, int msgID);
144 /** @fn bool MMSGenerateSmilBuffer(MMS_MESSAGE_DATA_S *pstMsgBody)
145 * @brief Forms Smil Buffer using pstMsgBody. \n
146 * @param[in/out] pstMsgBody is Message handle. \n
147 * @retval TRUE In case of Success. \n
148 * @retval FALSE In case of failure. \n
150 bool MMSGenerateSmilBuffer(MMS_MESSAGE_DATA_S *pstMsgBody);
152 /** @fn HMmsSmil MmsSmilCreateEmptySmilDoc(void)
153 * @brief Creates default Smil Doc based on input gszEmptyRawDoc. \n
154 * @retval Returns Smil Document number. \n
156 HMmsSmil MmsSmilCreateEmptySmilDoc(void);
158 /** @fn HMmsSmil MmsSmilCreateSmilDoc(char *pszRawData)
159 * @brief Creates Smil Doc based on input pszRawData. \n
160 * @param[in] pszRawData is smil buffer. \n
161 * @retval Returns Smil Document number. \n
163 HMmsSmil MmsSmilCreateSmilDoc(char *pszRawData);
165 /** @fn BOOL MmsSmilDestroyDoc(HMmsSmil hSmilDoc)
166 * @brief Destroys Smil Doc. \n
167 * @param[in] hSmilDoc is smil doc number. \n
168 * @retval TRUE In case of Success. \n
169 * @retval FALSE In case of failure. \n
171 bool MmsSmilDestroyDoc(HMmsSmil hSmilDoc);
173 /** @fn static bool IsValidSmilDocNo(int nSmilDocNo)
174 * @brief Form Smil Doc. \n
175 * @param[in] hSmilDoc is smil doc number. \n
176 * @retval Returns Smil Buffer In case of success. \n
177 * @retval Returns NULL In case of failure. \n
179 bool IsValidSmilDocNo(int nSmilDocNo);
181 /** @fn static char * MmsSmilGetRawData( HMmsSmil hSmilDoc )
182 * @brief Form Smil Doc. \n
183 * @param[in] hSmilDoc is smil doc number. \n
184 * @retval Returns Smil Buffer In case of success. \n
185 * @retval Returns NULL In case of failure. \n
187 char *MmsSmilGetRawData(HMmsSmil hSmilDoc);
189 /** @fn static bool MmsSmilAddPage(HMmsSmil hSmilDoc, MMS_PAGE_S *pstSmilPage)
190 * @brief Add Page to Smil Doc. \n
191 * @param[in] hSmilDoc is smil doc number. \n
192 * @param[in] pstSmilPage specifies page information. \n
193 * @retval TRUE In case of Success. \n
194 * @retval FALSE In case of failure. \n
196 bool MmsSmilAddPage(HMmsSmil hSmilDoc, MMS_PAGE_S *pstSmilPage);
198 /** @fn static bool MmsSmilAddRootLayout(HMmsSmil hSmilDoc, MMS_SMIL_ROOTLAYOUT *pstSmilRootLayout)
199 * @brief Add Rootlayout to Smil Doc. \n
200 * @param[in] hSmilDoc is smil doc number. \n
201 * @param[in] pstSmilRootLayout specifies RootLayout information. \n
202 * @retval TRUE In case of Success. \n
203 * @retval FALSE In case of failure. \n
205 bool MmsSmilAddRootLayout(HMmsSmil hSmilDoc, MMS_SMIL_ROOTLAYOUT *pstSmilRootLayout);
207 /** @fn static bool MmsSmilAddRegion(HMmsSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion)
208 * @brief Add Region to Smil Doc. \n
209 * @param[in] hSmilDoc is smil doc number. \n
210 * @param[in] pstSmilRegion specifies Region information. \n
211 * @retval TRUE In case of Success. \n
212 * @retval FALSE In case of failure. \n
214 bool MmsSmilAddRegion(HMmsSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion);
216 /** @fn static bool MmsSmilAddMedia( HMmsSmil hSmilDoc, int nPageNo, MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
217 * @brief Add Media to Smil Doc. \n
218 * @param[in] hSmilDoc is smil doc number. \n
219 * @param[in] nPageNo specifies page number to which media belongs. \n
220 * @param[in] nMediaIdx specifies medi ID. \n
221 * @param[in] pstSmilMedia specifies Media information. \n
222 * @param[in] pszContentID specifies Content ID of media. \n
223 * @retval TRUE In case of Success. \n
224 * @retval FALSE In case of failure. \n
226 bool MmsSmilAddMedia(HMmsSmil hSmilDoc, int nPageNo, int nMediaIdx, MMS_MEDIA_S *pstSmilMedia, char *pszContentID);
228 /** @fn static xmlNode *__MmsCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
229 * @brief Create Text Element. \n
230 * @param[in] pstSmilMedia specifies Media information. \n
231 * @param[in] pszContentID specifies Content ID of media. \n
232 * @retval Text Element node In case of Success. \n
233 * @retval NULL In case of failure. \n
235 xmlNode *__MmsCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID);
237 /** @fn static xmlNode *__MmsCreateMMNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
238 * @brief Create Image/Audio/Video Element. \n
239 * @param[in] pstSmilMedia specifies Media information. \n
240 * @param[in] pszContentID specifies Content ID of media. \n
241 * @retval Image/Audio/Video Element node In case of Success. \n
242 * @retval NULL In case of failure. \n
244 xmlNode *__MmsCreateMMNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID);
246 /** @fn static bool __MmsInsertFirstChild(xmlNode *pstParent, xmlNode *pNode)
247 * @brief Inserts first child to parent node. \n
248 * @param[in] pstParent specifies Parent node. \n
249 * @param[in] pNode specifies Child node. \n
250 * @retval TRUE In case of Success. \n
251 * @retval FALSE In case of failure. \n
253 bool __MmsInsertFirstChild(xmlNode *pParent, xmlNode *pNode);
255 /** @fn static bool __MmsSmilInsertNode(xmlNode *pstParent, xmlNode *pstLeftSibling, xmlNode *pNode)
256 * @brief Inserts node. \n
257 * @param[in] pstParent specifies Parent node. \n
258 * @param[in] pstLeftSibling specifies Left Sibling node. \n
259 * @param[in] pNode specifies Child node. \n
260 * @retval TRUE In case of Success. \n
261 * @retval FALSE In case of failure. \n
263 bool __MmsSmilInsertNode(xmlNode *pParent, xmlNode *pLeftSibling, xmlNode *pNode);
265 /** @fn static void _MmsSmilSetAttribute(xmlNode *pNode, char *szField, char *szValue)
266 * @brief Sets Attribute. \n
267 * @param[in] pNode specifies node. \n
268 * @param[in] szField specifies attribute field. \n
269 * @param[in] szValue specifies value of field \n
271 void _MmsSmilSetAttribute(xmlNode *pNode, char *szField, char *szValue);
273 /** @fn static char *__MmsSmilFindColorValue(int nValue)
274 * @brief Converts color to RGB. \n
275 * @param[in] nValue specifies color value. \n
276 * @retval RGB value. \n
278 char *__MmsSmilFindColorValue(int nValue);
280 /** @fn static xmlNodePtr UtilxmlStringGetNodeList(xmlNodePtr pstNode, char *pszName)
281 * @brief Get node based on pszValue. \n
282 * @param[in] pNode specifies node. \n
283 * @param[in] pszName specifies name field. \n
284 * @retval RGB value. \n
286 xmlNodePtr UtilxmlStringGetNodeList(xmlNodePtr pstNode, char *pszName);
288 #endif//MMS_PLUGIN_SMIL_H