|
1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html" |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * The subtitle class represents information about a track's subtitle |
|
17 * |
|
18 */ |
|
19 |
|
20 #include <smfsubtitle.h> |
|
21 #include <smfsubtitle_p.h> |
|
22 |
|
23 /** |
|
24 * Constructor with default argument |
|
25 */ |
|
26 SmfSubtitle::SmfSubtitle( ) |
|
27 { |
|
28 d = new SmfSubtitlePrivate; |
|
29 } |
|
30 |
|
31 /** |
|
32 * Copy Constructor |
|
33 * @param aOther The reference object |
|
34 */ |
|
35 SmfSubtitle::SmfSubtitle( const SmfSubtitle &aOther ) |
|
36 :d(aOther.d) |
|
37 { |
|
38 } |
|
39 |
|
40 /** |
|
41 * Overloaded = operator |
|
42 * @param aOther The reference object |
|
43 * @return The target reference value |
|
44 */ |
|
45 SmfSubtitle& SmfSubtitle::operator=( const SmfSubtitle &aOther ) |
|
46 { |
|
47 d->m_subtitle = aOther.d->m_subtitle; |
|
48 d->m_language = aOther.d->m_language; |
|
49 d->m_frameRate = aOther.d->m_frameRate; |
|
50 d->m_duration = aOther.d->m_duration; |
|
51 d->m_releaseYr = aOther.d->m_releaseYr; |
|
52 d->m_subtitleId = aOther.d->m_subtitleId; |
|
53 return *this; |
|
54 } |
|
55 |
|
56 /** |
|
57 * Destructor |
|
58 */ |
|
59 SmfSubtitle::~SmfSubtitle( ) |
|
60 { |
|
61 } |
|
62 |
|
63 /** |
|
64 * Method to get the subtitle as a bytearray |
|
65 * @return The subtitle content |
|
66 */ |
|
67 QByteArray SmfSubtitle::subtitle( ) const |
|
68 { |
|
69 return d->m_subtitle; |
|
70 } |
|
71 |
|
72 /** |
|
73 * Method to get the language |
|
74 * @return The language |
|
75 */ |
|
76 QString SmfSubtitle::language( ) const |
|
77 { |
|
78 return d->m_language; |
|
79 } |
|
80 |
|
81 /** |
|
82 * Method to get the frame rate |
|
83 * @return the frame rate |
|
84 */ |
|
85 double SmfSubtitle::frameRate( ) const |
|
86 { |
|
87 return d->m_frameRate; |
|
88 } |
|
89 |
|
90 /** |
|
91 * Method to get the duration |
|
92 * @return the duration |
|
93 */ |
|
94 double SmfSubtitle::duration( ) const |
|
95 { |
|
96 return d->m_duration; |
|
97 } |
|
98 |
|
99 /** |
|
100 * Method to get the release year |
|
101 * @return The release year |
|
102 */ |
|
103 QDateTime SmfSubtitle::releaseYear( ) const |
|
104 { |
|
105 return d->m_releaseYr; |
|
106 } |
|
107 |
|
108 /** |
|
109 * Method to get the id of the subtitle |
|
110 * @return The ID value |
|
111 */ |
|
112 QString SmfSubtitle::id( ) const |
|
113 { |
|
114 return d->m_subtitleId; |
|
115 } |
|
116 |
|
117 /** |
|
118 * Method to set the subtitle as a bytearray |
|
119 * @param aSubtitle The subtitle content |
|
120 */ |
|
121 void SmfSubtitle::setSubtitle( const QByteArray &aSubtitle ) |
|
122 { |
|
123 d->m_subtitle = aSubtitle; |
|
124 } |
|
125 |
|
126 /** |
|
127 * Method to set the language |
|
128 * @param aLang The language |
|
129 */ |
|
130 void SmfSubtitle::setLanguage( const QString &aLang ) |
|
131 { |
|
132 d->m_language = aLang; |
|
133 } |
|
134 |
|
135 /** |
|
136 * Method to set the frame rate |
|
137 * @param aFramerate the frame rate |
|
138 */ |
|
139 void SmfSubtitle::setFrameRate( const double &aFramerate ) |
|
140 { |
|
141 d->m_frameRate = aFramerate; |
|
142 } |
|
143 |
|
144 /** |
|
145 * Method to set the duration |
|
146 * @param aDuration the duration |
|
147 */ |
|
148 void SmfSubtitle::setDuration( const double &aDuration ) |
|
149 { |
|
150 d->m_duration = aDuration; |
|
151 } |
|
152 |
|
153 /** |
|
154 * Method to set the release year |
|
155 * @param aRelYear The release year |
|
156 */ |
|
157 void SmfSubtitle::setReleaseYear( const QDateTime &aRelYear ) |
|
158 { |
|
159 d->m_releaseYr = aRelYear; |
|
160 } |
|
161 |
|
162 /** |
|
163 * Method to set the id of the subtitle |
|
164 * @param aId The ID value |
|
165 */ |
|
166 void SmfSubtitle::setId( const QString &aId ) |
|
167 { |
|
168 d->m_subtitleId = aId; |
|
169 } |
|
170 |
|
171 |
|
172 /** |
|
173 * Method for Externalization. Writes the SmfSubtitle object to |
|
174 * the stream and returns a reference to the stream. |
|
175 * @param aDataStream Stream to be written |
|
176 * @param aSubtitle The SmfSubtitle object to be externalized |
|
177 * @return reference to the written stream |
|
178 */ |
|
179 QDataStream &operator<<( QDataStream &aDataStream, |
|
180 const SmfSubtitle &aSubtitle ) |
|
181 { |
|
182 // Serialize m_subtitle |
|
183 aDataStream<<aSubtitle.d->m_subtitle; |
|
184 |
|
185 // Serialize m_language |
|
186 aDataStream<<aSubtitle.d->m_language; |
|
187 |
|
188 // Serialize m_frameRate |
|
189 aDataStream<<aSubtitle.d->m_frameRate; |
|
190 |
|
191 // Serialize m_duration |
|
192 aDataStream<<aSubtitle.d->m_duration; |
|
193 |
|
194 // Serialize m_releaseYr |
|
195 aDataStream<<aSubtitle.d->m_releaseYr; |
|
196 |
|
197 // Serialize m_subtitleId |
|
198 aDataStream<<aSubtitle.d->m_subtitleId; |
|
199 |
|
200 return aDataStream; |
|
201 } |
|
202 |
|
203 /** |
|
204 * Method for Internalization. Reads a SmfSubtitle object from |
|
205 * the stream and returns a reference to the stream. |
|
206 * @param aDataStream Stream to be read |
|
207 * @param aSubtitle The SmfSubtitle object to be internalized |
|
208 * @return reference to the stream |
|
209 */ |
|
210 QDataStream &operator>>( QDataStream &aDataStream, |
|
211 SmfSubtitle &aSubtitle) |
|
212 { |
|
213 // Deserialize m_subtitle |
|
214 aDataStream>>aSubtitle.d->m_subtitle; |
|
215 |
|
216 // Deserialize m_language |
|
217 aDataStream>>aSubtitle.d->m_language; |
|
218 |
|
219 // Deserialize m_frameRate |
|
220 aDataStream>>aSubtitle.d->m_frameRate; |
|
221 |
|
222 // Deserialize m_duration |
|
223 aDataStream>>aSubtitle.d->m_duration; |
|
224 |
|
225 // Deserialize m_releaseYr |
|
226 aDataStream>>aSubtitle.d->m_releaseYr; |
|
227 |
|
228 // Deserialize m_subtitleId |
|
229 aDataStream>>aSubtitle.d->m_subtitleId; |
|
230 |
|
231 return aDataStream; |
|
232 } |
|
233 |