dc33c19b35a49f313792543f8b99b2396212b216
[platform/framework/native/content.git] / src / inc / FCnt_VideoMetadataImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file                FCnt_VideoMetadataImpl.h
19  * @brief               This is the header file for the %_VideoMetadataImpl class.
20  *
21  * This header file contains the declarations of the %_VideoMetadataImpl class.
22  */
23
24 #ifndef _FCNT_INTERNAL_VIDEO_METADATA_IMPL_H_
25 #define _FCNT_INTERNAL_VIDEO_METADATA_IMPL_H_
26
27 #include <unique_ptr.h>
28 #include <FBaseString.h>
29 #include <FGrpBitmap.h>
30
31 namespace Tizen { namespace Content
32 {
33
34 class VideoMetadata;
35
36 struct VideoMeta
37 {
38         VideoMeta()
39                 : width(0)
40                 , height(0)
41                 , framerate(0)
42                 , audioBitrate(0)
43                 , videoBitrate(0)
44                 , duration(0)
45                 , contentPath(L"")
46                 , pGenre(null)
47                 , pComment(null)
48                 , pDescription(null)
49                 , pAlbumArt(null) {}
50
51         int width;
52         int height;
53         int framerate;
54         int audioBitrate;
55         int videoBitrate;
56         long duration;
57         Tizen::Base::String contentPath;
58         Tizen::Base::String* pGenre;
59         Tizen::Base::String* pComment;
60         Tizen::Base::String* pDescription;
61         Tizen::Graphics::Bitmap* pAlbumArt;
62 };
63
64 struct VideoMetaDeleter
65 {
66         void operator()(VideoMeta* pVideoMeta)
67         {
68                 if (pVideoMeta != null)
69                 {
70                         if (pVideoMeta->pGenre != null)
71                         {
72                                 delete pVideoMeta->pGenre;
73                                 pVideoMeta->pGenre = null;
74                         }
75                         if (pVideoMeta->pComment)
76                         {
77                                 delete pVideoMeta->pComment;
78                                 pVideoMeta->pComment = null;
79                         }
80                         if (pVideoMeta->pDescription)
81                         {
82                                 delete pVideoMeta->pDescription;
83                                 pVideoMeta->pDescription = null;
84                         }
85                         if (pVideoMeta->pAlbumArt != null)
86                         {
87                                 delete pVideoMeta->pAlbumArt;
88                                 pVideoMeta->pAlbumArt = null;
89                         }
90
91                         delete pVideoMeta;
92                         pVideoMeta = null;
93                 }
94         }
95 };
96
97 class _VideoMetadataImpl
98         : public Tizen::Base::Object
99 {
100 public:
101         /**
102          * This is the default constructor for this class.
103          *
104          * @since 2.1
105          */
106         _VideoMetadataImpl(void);
107
108         /**
109          * This is the copy constructor for this class.
110          *
111          * @since 2.1
112          */
113         _VideoMetadataImpl(const _VideoMetadataImpl& rhs);
114
115         /**
116          * This is the destructor for this class.
117          *
118          * @since 2.1
119          */
120         virtual ~_VideoMetadataImpl(void);
121
122         /**
123          * @see @ref Tizen::Content::VideoMetadata::GetWidth()
124          */
125         int GetWidth(void) const;
126
127         /**
128          * @see @ref Tizen::Content::VideoMetadata::GetHeight()
129          */
130         int GetHeight(void) const;
131
132         /**
133          * @see @ref Tizen::Content::VideoMetadata::GetDuration()
134          */
135         long GetDuration(void) const;
136
137         /**
138          * @see @ref Tizen::Content::VideoMetadata::GetFramerate()
139          */
140         int GetFramerate(void) const;
141
142         /**
143          * @see @ref Tizen::Content::VideoMetadata::GetAudioBitrate()
144          */
145         int GetAudioBitrate(void) const;
146
147         /**
148          * @see @ref Tizen::Content::VideoMetadata::GetVideoBitrate()
149          */
150         int GetVideoBitrate(void) const;
151
152         /**
153          * @see @ref Tizen::Content::VideoMetadata::GetGenre()
154          */
155         Tizen::Base::String GetGenre(void) const;
156
157         /**
158          * @see @ref Tizen::Content::VideoMetadata::GetComment()
159          */
160         Tizen::Base::String GetComment(void) const;
161
162         /**
163          * @see @ref Tizen::Content::VideoMetadata::GetDescription()
164          */
165         Tizen::Base::String GetDescription(void) const;
166
167         /**
168          * @see @ref Tizen::Content::VideoMetadata::GetAlbumArtN()
169          */
170         Tizen::Graphics::Bitmap* GetAlbumArtN(void) const;
171
172         /**
173          * Gets the Impl instance.
174          *
175          * @since 2.1
176          * @return      The pointer to _VideoMetadataImpl
177          * @param[in] videoMetadata             An instance of VideoMetadata
178          */
179         static _VideoMetadataImpl* GetInstance(VideoMetadata& videoMetadata);
180
181         /**
182          * Gets the Impl instance.
183          *
184          * @since 2.1
185          * @return      The pointer to _VideoMetadataImpl
186          * @param[in] videoMetadata             An instance of VideoMetadata
187          */
188         static const _VideoMetadataImpl* GetInstance(const VideoMetadata& videoMetadata);
189
190         /**
191          * @see @ref Tizen::Content::VideoMetadata::Equals()
192          */
193         virtual bool Equals(const Tizen::Base::Object& rhs) const;
194
195         /**
196          * @see @ref Tizen::Content::VideoMetadata::GetHashCode()
197          */
198         virtual int GetHashCode(void) const;
199
200         /**
201          * @see @ref Tizen::Content::VideoMetadata::operator =()
202          */
203         _VideoMetadataImpl& operator =(const _VideoMetadataImpl& rhs);
204
205 private:
206         result SetVideoMetadata(const VideoMeta* pVideoMeta);
207         VideoMeta* GetVideoMetadata(void) const;
208
209 private:
210         std::unique_ptr<VideoMeta, VideoMetaDeleter> __pVideoMeta;
211
212         friend class _ContentManagerUtilImpl;
213
214 };  // class _VideoMetadataImpl
215
216 }}  // Tizen::Content
217
218 #endif  // _FCNT_INTERNAL_VIDEO_METADATA_IMPL_H_