2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FMediaMediaStreamInfo.h
20 * @brief This is the header file for the %MediaStreamInfo class.
22 * This header file contains the declarations of the %MediaStreamInfo class.
25 #ifndef _FMEDIA_MEDIA_STREAM_INFO_H_
26 #define _FMEDIA_MEDIA_STREAM_INFO_H_
28 #include <FBaseObject.h>
29 #include <FBaseColIList.h>
30 #include <FBaseString.h>
31 #include <FBaseByteBuffer.h>
32 #include <FMediaAudioStreamInfo.h>
33 #include <FMediaVideoStreamInfo.h>
35 namespace Tizen { namespace Media
38 * @class MediaStreamInfo
39 * @brief This class provides methods to get media stream information.
43 * The %MediaStreamInfo class provides methods to get media stream information, including:
44 * - Content metadata, such as the title, artist, album title, genre, year, and album art.
45 * - Audio and video stream information.
47 * This class supports multiple stream content that consists of several audio or video tracks.
48 * This class provides a list of AudioStreamInfo and VideoStreamInfo that has the stream information of each audio or video track.
50 * For more detailed information, see %AudioStreamInfo and %VideoStreamInfo classes.
52 * The following example demonstrates how to use the %MediaStreamInfo class.
58 * using namespace Tizen::Base;
59 * using namespace Tizen::Base::Collection;
60 * using namespace Tizen::Media;
62 * class MediaStreamInfoSample
63 * : public Tizen::Media::IPlayerEventListener
69 * virtual void OnPlayerOpened(result r) {}
70 * virtual void OnPlayerEndOfClip(void) {}
71 * virtual void OnPlayerBuffering(int percent) {}
72 * virtual void OnPlayerErrorOccurred(PlayerErrorReason r) {}
73 * virtual void OnPlayerInterrupted() {}
74 * virtual void OnPlayerReleased() {}
75 * virtual void OnPlayerSeekCompleted(result r) {}
76 * virtual void OnPlayerAudioFocusChanged (void) {}
83 * MediaStreamInfoSample::Test(void)
85 * MediaStreamInfo* pStreamInfo = null;
86 * const IList* pInfoList = null;
87 * const AudioStreamInfo* pInfo = null;
88 * String path = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test.aac";
90 * __player.Construct(*this);
91 * __player.OpenFile(path);
94 * // Checks the Player's state
95 * if (__player.GetState() != PLAYER_STATE_PLAYING)
97 * return E_INVALID_STATE;
100 * // Gets the stream information from Player
101 * pStreamInfo = __player.GetCurrentMediaStreamInfoN();
102 * if (pStreamInfo == null)
104 * return GetLastResult();
107 * pInfoList = pStreamInfo->GetAudioStreamInfoList();
108 * if (pInfoList == null)
113 * pInfo = (const AudioStreamInfo*)pInfoList->GetAt(0);
119 * AppLog("AudioStreamInfo: codec:0x%x, bitRate:%d, channel:%d, sampleRate:%d",
120 * pInfo->GetCodecType(), pInfo->GetBitRate(),
121 * pInfo->GetChannelType(), pInfo->GetSampleRate());
128 * delete pStreamInfo;
134 class _OSP_EXPORT_ MediaStreamInfo
135 : public Tizen::Base::Object
139 * This destructor overrides Tizen::Base::Object::~Object().
143 virtual ~MediaStreamInfo(void);
151 * @return The value of the title, @n
152 * else an empty string if the content has no title
154 Tizen::Base::String GetTitle(void) const;
157 * Gets the name of the artist from the content.
161 * @return The artist, @n
162 * else an empty string if the content has no artist name
164 Tizen::Base::String GetArtist(void) const;
167 * Gets the album title.
171 * @return The title of the album, @n
172 * else an empty string if the content has no album
174 Tizen::Base::String GetAlbumTitle(void) const;
181 * @return The genre, @n
182 * else an empty string if the content has no genre
184 Tizen::Base::String GetGenre(void) const;
191 * @return The year, @n
192 * else @c 0 if the content has no year
194 int GetYear(void) const;
197 * Gets the album art.
201 * @return The album art in the content, @n
202 * else @c null if the content has no album art
204 Tizen::Base::ByteBuffer* GetAlbumArtN(void) const;
207 * Gets a list of the audio stream information.
211 * @return A pointer to the list containing the audio stream information @n
212 * The value belongs to the AudioStreamInfo class.
213 * @exception E_SUCCESS The method is successful.
214 * @exception E_INVALID_DATA The stream cannot be parsed successfully.
215 * @exception E_SYSTEM A system error has occurred.
216 * @remarks The specific error code can be accessed using the GetLastResult() method.
218 const Tizen::Base::Collection::IList* GetAudioStreamInfoList(void) const;
221 * Gets a list of the video stream information.
225 * @return A pointer to a list containing the video stream information @n
226 * The value belongs to the VideoStreamInfo class.
227 * @exception E_SUCCESS The method is successful.
228 * @exception E_INVALID_DATA The stream cannot be parsed successfully.
229 * @exception E_SYSTEM A system error has occurred.
230 * @remarks The specific error code can be accessed using the GetLastResult() method.
232 const Tizen::Base::Collection::IList* GetVideoStreamInfoList(void) const;
235 * Copying of objects using this copy constructor is allowed.
239 * @return The copy of this instance
240 * @param[in] rhs An instance of %MediaStreamInfo
242 MediaStreamInfo(const MediaStreamInfo & rhs);
245 * Copying of objects using this copy assignment operator is allowed.
249 * @return The reference of this instance
250 * @param[in] rhs An instance of %MediaStreamInfo
252 MediaStreamInfo & operator =(const MediaStreamInfo & rhs);
255 * Compares the specified instance of Tizen::Base::Object with the calling instance of %MediaStreamInfo.
259 * @return @c true if the value of the specified instance equals the value of the current instance, @n
261 * @param[in] rhs The object to compare with the current instance
263 virtual bool Equals(const Tizen::Base::Object& rhs) const;
266 * Gets the hash value of the current instance.
270 * @return The hash value of the current instance
272 virtual int GetHashCode(void) const;
276 * This default constructor is intentionally declared as private so that only the platform can create an instance.
278 * @param[in] title The value of the title @n
279 * @param[in] artist The value of the artist @n
280 * @param[in] albumTitle The value of the title of the album @n
281 * @param[in] genre The value of the genre @n
282 * @param[in] year The value of the year @n
283 * @param[in] albumArt The value of the album art @n
284 * @param[in] pAudioStream A pointer to an audio stream list @n
285 * @param[in] pVideoStream A pointer to a video stream list @n
286 * @param[in] titleException An exception generated due to the title of audio or video @n
287 * @param[in] audioStreamException The exception generated during audio streaming @n
288 * @param[in] videoStreamException The exception generated during video streaming @n
290 MediaStreamInfo(const Tizen::Base::String& title, const Tizen::Base::String& artist, const Tizen::Base::String& albumTitle, const Tizen::Base::String& genre, int year, Tizen::Base::ByteBuffer* pAlbumArt, Tizen::Base::Collection::IList* pAudioStream, Tizen::Base::Collection::IList* pVideoStream, result audioStreamException, result videoStreamException);
293 class _MediaStreamInfoImpl *__pMediaStreamInfoImpl;
294 friend class _PlayerImpl;