2 * Copyright 2012-2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef MMS_PLUGIN_SMIL_H
18 #define MMS_PLUGIN_SMIL_H
20 #include <libxml/parser.h>
21 #include <libxml/tree.h>
23 #include "MsgMmsTypes.h"
24 #include "MmsPluginCodecTypes.h"
26 typedef enum _SMIL_ELEMENT_T {
46 typedef int HMmsSmil; // SmilDoc Handle
48 #define MMS_SMIL_MAX_DOC 1
49 #define MMS_SMIL_COLOR_SIZE 10
50 #define INVALID_HOBJ -1
51 #define SP_NO_COLOR_SET -1
56 * @brief Represents Smil Doc Information. \n
58 typedef struct _MmsSmilDoc {
60 xmlNodePtr pstRootNode;
63 typedef enum _SMIL_ATTRIBUTE_T {
64 ATTRIBUTE_UNKNOWN = -1,
95 ATTRIBUTE_REPEAT_COUNT,
98 char *MmsSmilGetPresentationData(msg_message_id_t msgId);
99 bool MmsSmilParseSmilDoc(MMS_MESSAGE_DATA_S *pMmsMsg, char *pSmilDoc);
100 void MmsSmilGetElement(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node);
101 int MmsSmilGetColorValue(xmlChar *content);
102 int MmsSmilGetTime(char *pValue);
103 int MmsSmilAtoIHexa(char *pInput);
104 #ifndef __SUPPORT_DRM__
105 int MmsSmilGetMediaSrcForNormalMsg(char *szOutbuf, char *szInBuf, MsgMultipart *pPart);
107 int MmsSmilGetMediaSrcForNormalMsg(char *szOutbuf, char *szInBuf, MsgMultipart *pPart, MMS_MEDIA_S *pMedia);
109 int MmsSmilGetElementID(char *pString);
110 int MmsSmilGetAttrID(char *pString);
111 bool MmsSmilGetFontAttrib(char *pString);
112 MmsTextDirection MmsSmilGetFontDirection(char *pString);
113 int MmsSmilGetFontSizeValue(char *pString);
114 MmsSmilFontType MmsSmilGetFontTypeValue(char *pString);
115 bool MmsSmilGetMediaFilePath(MMS_MEDIA_S *pMedia, char *pszTemp, int msgID);
116 bool __MmsGetRealFileName(MmsSmilMediaType mediaType, char *pszSrc, char *pszName, int msgID);
117 /** @fn bool MMSGenerateSmilBuffer(MMS_MESSAGE_DATA_S *pstMsgBody)
118 * @brief Forms Smil Buffer using pstMsgBody. \n
119 * @param[in/out] pstMsgBody is Message handle. \n
120 * @retval TRUE In case of Success. \n
121 * @retval FALSE In case of failure. \n
123 bool MMSGenerateSmilBuffer(MMS_MESSAGE_DATA_S *pstMsgBody);
125 /** @fn HMmsSmil MmsSmilCreateEmptySmilDoc(void)
126 * @brief Creates default Smil Doc based on input gszEmptyRawDoc. \n
127 * @retval Returns Smil Document number. \n
129 HMmsSmil MmsSmilCreateEmptySmilDoc(void);
131 /** @fn HMmsSmil MmsSmilCreateSmilDoc(char *pszRawData)
132 * @brief Creates Smil Doc based on input pszRawData. \n
133 * @param[in] pszRawData is smil buffer. \n
134 * @retval Returns Smil Document number. \n
136 HMmsSmil MmsSmilCreateSmilDoc(char *pszRawData);
138 /** @fn BOOL MmsSmilDestroyDoc(HMmsSmil hSmilDoc)
139 * @brief Destroys Smil Doc. \n
140 * @param[in] hSmilDoc is smil doc number. \n
141 * @retval TRUE In case of Success. \n
142 * @retval FALSE In case of failure. \n
144 bool MmsSmilDestroyDoc(HMmsSmil hSmilDoc);
146 /** @fn static bool IsValidSmilDocNo(int nSmilDocNo)
147 * @brief Form Smil Doc. \n
148 * @param[in] hSmilDoc is smil doc number. \n
149 * @retval Returns Smil Buffer In case of success. \n
150 * @retval Returns NULL In case of failure. \n
152 bool IsValidSmilDocNo(int nSmilDocNo);
154 /** @fn static char * MmsSmilGetRawData( HMmsSmil hSmilDoc )
155 * @brief Form Smil Doc. \n
156 * @param[in] hSmilDoc is smil doc number. \n
157 * @retval Returns Smil Buffer In case of success. \n
158 * @retval Returns NULL In case of failure. \n
160 char *MmsSmilGetRawData(HMmsSmil hSmilDoc);
162 /** @fn static bool MmsSmilAddPage(HMmsSmil hSmilDoc, MMS_PAGE_S *pstSmilPage)
163 * @brief Add Page to Smil Doc. \n
164 * @param[in] hSmilDoc is smil doc number. \n
165 * @param[in] pstSmilPage specifies page information. \n
166 * @retval TRUE In case of Success. \n
167 * @retval FALSE In case of failure. \n
169 bool MmsSmilAddPage(HMmsSmil hSmilDoc, MMS_PAGE_S *pstSmilPage);
171 /** @fn static bool MmsSmilAddRootLayout(HMmsSmil hSmilDoc, MMS_SMIL_ROOTLAYOUT *pstSmilRootLayout)
172 * @brief Add Rootlayout to Smil Doc. \n
173 * @param[in] hSmilDoc is smil doc number. \n
174 * @param[in] pstSmilRootLayout specifies RootLayout information. \n
175 * @retval TRUE In case of Success. \n
176 * @retval FALSE In case of failure. \n
178 bool MmsSmilAddRootLayout(HMmsSmil hSmilDoc, MMS_SMIL_ROOTLAYOUT *pstSmilRootLayout);
180 /** @fn static bool MmsSmilAddRegion(HMmsSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion)
181 * @brief Add Region to Smil Doc. \n
182 * @param[in] hSmilDoc is smil doc number. \n
183 * @param[in] pstSmilRegion specifies Region information. \n
184 * @retval TRUE In case of Success. \n
185 * @retval FALSE In case of failure. \n
187 bool MmsSmilAddRegion(HMmsSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion);
189 /** @fn static bool MmsSmilAddMedia( HMmsSmil hSmilDoc, int nPageNo, MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
190 * @brief Add Media to Smil Doc. \n
191 * @param[in] hSmilDoc is smil doc number. \n
192 * @param[in] nPageNo specifies page number to which media belongs. \n
193 * @param[in] nMediaIdx specifies medi ID. \n
194 * @param[in] pstSmilMedia specifies Media information. \n
195 * @param[in] pszContentID specifies Content ID of media. \n
196 * @retval TRUE In case of Success. \n
197 * @retval FALSE In case of failure. \n
199 bool MmsSmilAddMedia(HMmsSmil hSmilDoc, int nPageNo, int nMediaIdx, MMS_MEDIA_S *pstSmilMedia, char *pszContentID);
201 /** @fn static xmlNode *__MmsCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
202 * @brief Create Text Element. \n
203 * @param[in] pstSmilMedia specifies Media information. \n
204 * @param[in] pszContentID specifies Content ID of media. \n
205 * @retval Text Element node In case of Success. \n
206 * @retval NULL In case of failure. \n
208 xmlNode *__MmsCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID);
210 /** @fn static xmlNode *__MmsCreateMMNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID)
211 * @brief Create Image/Audio/Video Element. \n
212 * @param[in] pstSmilMedia specifies Media information. \n
213 * @param[in] pszContentID specifies Content ID of media. \n
214 * @retval Image/Audio/Video Element node In case of Success. \n
215 * @retval NULL In case of failure. \n
217 xmlNode *__MmsCreateMMNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID);
219 /** @fn static bool __MmsInsertFirstChild(xmlNode *pstParent, xmlNode *pstCurr)
220 * @brief Inserts first child to parent node. \n
221 * @param[in] pstParent specifies Parent node. \n
222 * @param[in] pstCurr specifies Child node. \n
223 * @retval TRUE In case of Success. \n
224 * @retval FALSE In case of failure. \n
226 bool __MmsInsertFirstChild(xmlNode *pParent, xmlNode *pNode);
228 /** @fn static bool __MmsSmilInsertNode(xmlNode *pstParent, xmlNode *pstLeftSibling, xmlNode *pstCurr)
229 * @brief Inserts node. \n
230 * @param[in] pstParent specifies Parent node. \n
231 * @param[in] pstLeftSibling specifies Left Sibling node. \n
232 * @param[in] pstCurr specifies Child node. \n
233 * @retval TRUE In case of Success. \n
234 * @retval FALSE In case of failure. \n
236 bool __MmsSmilInsertNode(xmlNode *pParent, xmlNode *pLeftSibling, xmlNode *pNode);
238 /** @fn static void _MmsSmilSetAttribute(xmlNode *pNode, char *szField, char *szValue)
239 * @brief Sets Attribute. \n
240 * @param[in] pNode specifies node. \n
241 * @param[in] szField specifies attribute field. \n
242 * @param[in] szValue specifies value of field \n
244 void _MmsSmilSetAttribute(xmlNode *pNode, char *szField, char *szValue);
246 /** @fn static char *__MmsSmilFindColorValue(int nValue)
247 * @brief Converts color to RGB. \n
248 * @param[in] nValue specifies color value. \n
249 * @retval RGB value. \n
251 char *__MmsSmilFindColorValue(int nValue);
253 /** @fn static xmlNodePtr UtilxmlStringGetNodeList(xmlNodePtr pstNode, char *pszValue)
254 * @brief Get node based on pszValue. \n
255 * @param[in] pNode specifies node. \n
256 * @param[in] pszName specifies name field. \n
257 * @retval RGB value. \n
259 xmlNodePtr UtilxmlStringGetNodeList(xmlNodePtr pstNode, char *pszName);
262 bool MmsSmilParseSmilDocOnlyLayout(MMS_MESSAGE_DATA_S *pMmsMsg, char *pSmilDoc);
265 #endif//MMS_PLUGIN_SMIL_H