TizenRT Public API  v2.0 M2
MediaPlayer.h
Go to the documentation of this file.
1 /* ****************************************************************
2  *
3  * Copyright 2018 Samsung Electronics All Rights Reserved.
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 
30 #ifndef __MEDIA_MEDIAPLAYER_H
31 #define __MEDIA_MEDIAPLAYER_H
32 
33 #include <memory>
34 #include <media/InputDataSource.h>
36 
37 namespace media {
43 enum player_error_e : int {
46  PLAYER_ERROR_INVALID_STATE,
47  PLAYER_ERROR_INVALID_OPERATION,
48  PLAYER_ERROR_INVALID_PARAMETER,
49  PLAYER_ERROR_INTERNAL_OPERATION_FAILED,
50  PLAYER_ERROR_FILE_OPEN_FAILED,
51  PLAYER_ERROR_OUT_OF_MEMORY,
52  PLAYER_ERROR_DEVICE_NOT_SUPPORTED,
55 };
56 
57 typedef enum player_error_e player_error_t;
58 const int PLAYER_OK = PLAYER_ERROR_NONE;
59 typedef int player_result_t;
60 
61 class MediaPlayerImpl;
62 
70 {
71 public:
77  MediaPlayer();
78 
84  ~MediaPlayer();
85 
93  player_result_t create();
94 
102  player_result_t destroy();
103 
111  player_result_t prepare();
112 
120  player_result_t unprepare();
121 
130  player_result_t start();
131 
140  player_result_t pause();
141 
150  player_result_t stop();
151 
159  player_result_t getVolume(uint8_t *volume);
160 
168  player_result_t setVolume(uint8_t);
169 
178  player_result_t setDataSource(std::unique_ptr<stream::InputDataSource>);
179 
189  player_result_t setObserver(std::shared_ptr<MediaPlayerObserverInterface>);
190 
199  bool operator==(const MediaPlayer &rhs);
200 
201 private:
202  std::shared_ptr<MediaPlayerImpl> mPMpImpl;
203  uint64_t mId;
204 };
205 } // namespace media
206 #endif
207  // end of MEDIA group
player_result_t setVolume(uint8_t)
Sets the volume adjusted.
player_result_t pause()
Pause playback.
Media MediaPlayerObserverInterface APIs.
player_result_t setDataSource(std::unique_ptr< stream::InputDataSource >)
Sets the DataSource of input data.
player_result_t create()
Create the MediaPlayer for playback.
MediaPlayer()
Constructs an empty MediaPlayer.
player_result_t start()
Start playback.
~MediaPlayer()
Deconstructs an empty MediaPlayer.
player_result_t stop()
Stop playback.
player_result_t destroy()
Destroy MediaPlayer.
player_result_t getVolume(uint8_t *volume)
Gets the current volume.
bool operator==(const MediaPlayer &rhs)
MediaPlayer operator==.
player_result_t setObserver(std::shared_ptr< MediaPlayerObserverInterface >)
Sets the observer of MediaPlayer.
player_error_e
result of call the apis
Definition: MediaPlayer.h:43
player_result_t unprepare()
Releases allocated resources related to the player.
player_result_t prepare()
Allocate and prepare resources related to the player, it should be called before start.