[ACR-978] add new error return at _set_subtitle_path
[platform/core/api/player.git] / include / player.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 #ifndef __TIZEN_MEDIA_PLAYER_H__
18 #define __TIZEN_MEDIA_PLAYER_H__
19
20 #include <tizen.h>
21 #include <sound_manager.h>
22 #include <media_packet.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #define PLAYER_ERROR_CLASS          TIZEN_ERROR_PLAYER | 0x20
29
30 /* This is for custom defined player error. */
31 #define PLAYER_CUSTOM_ERROR_CLASS   TIZEN_ERROR_PLAYER | 0x1000
32
33 /**
34  * @file player.h
35  * @brief This file contains the media player API.
36  */
37
38 /**
39  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
40  * @{
41  */
42
43 /**
44  * @brief The media player's type handle.
45  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
46  */
47 typedef struct player_s *player_h;
48
49 /**
50  * @brief Enumeration for media player state.
51  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
52  */
53 typedef enum {
54         PLAYER_STATE_NONE,          /**< Player is not created */
55         PLAYER_STATE_IDLE,          /**< Player is created, but not prepared */
56         PLAYER_STATE_READY,         /**< Player is ready to play media */
57         PLAYER_STATE_PLAYING,       /**< Player is playing media */
58         PLAYER_STATE_PAUSED,        /**< Player is paused while playing media */
59 } player_state_e;
60
61 /**
62  * @brief Enumeration for media player's error codes.
63  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
64  */
65 typedef enum {
66         PLAYER_ERROR_NONE               = TIZEN_ERROR_NONE,                             /**< Successful */
67         PLAYER_ERROR_OUT_OF_MEMORY      = TIZEN_ERROR_OUT_OF_MEMORY,                    /**< Out of memory */
68         PLAYER_ERROR_INVALID_PARAMETER  = TIZEN_ERROR_INVALID_PARAMETER,                /**< Invalid parameter */
69         PLAYER_ERROR_NO_SUCH_FILE       = TIZEN_ERROR_NO_SUCH_FILE,                     /**< No such file or directory */
70         PLAYER_ERROR_INVALID_OPERATION  = TIZEN_ERROR_INVALID_OPERATION,                /**< Invalid operation */
71         PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE    = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE,  /**< No space left on the device */
72         PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE    = TIZEN_ERROR_NOT_SUPPORTED,    /**< Not supported Feature */
73         PLAYER_ERROR_SEEK_FAILED        = PLAYER_ERROR_CLASS | 0x01,                    /**< Seek operation failure */
74         PLAYER_ERROR_INVALID_STATE      = PLAYER_ERROR_CLASS | 0x02,                    /**< Invalid state */
75         PLAYER_ERROR_NOT_SUPPORTED_FILE = PLAYER_ERROR_CLASS | 0x03,                    /**< File format not supported */
76         PLAYER_ERROR_INVALID_URI        = PLAYER_ERROR_CLASS | 0x04,                    /**< Invalid URI */
77         PLAYER_ERROR_SOUND_POLICY       = PLAYER_ERROR_CLASS | 0x05,                    /**< Sound policy error */
78         PLAYER_ERROR_CONNECTION_FAILED  = PLAYER_ERROR_CLASS | 0x06,                    /**< Streaming connection failed */
79         PLAYER_ERROR_VIDEO_CAPTURE_FAILED   = PLAYER_ERROR_CLASS | 0x07,                /**< Video capture failed */
80         PLAYER_ERROR_DRM_EXPIRED        = PLAYER_ERROR_CLASS | 0x08,                    /**< Expired license */
81         PLAYER_ERROR_DRM_NO_LICENSE     = PLAYER_ERROR_CLASS | 0x09,                    /**< No license */
82         PLAYER_ERROR_DRM_FUTURE_USE     = PLAYER_ERROR_CLASS | 0x0a,                    /**< License for future use */
83         PLAYER_ERROR_DRM_NOT_PERMITTED  = PLAYER_ERROR_CLASS | 0x0b,                    /**< Format not permitted */
84         PLAYER_ERROR_RESOURCE_LIMIT     = PLAYER_ERROR_CLASS | 0x0c,                    /**< Resource limit */
85         PLAYER_ERROR_PERMISSION_DENIED  = TIZEN_ERROR_PERMISSION_DENIED,                /**< Permission denied */
86         PLAYER_ERROR_SERVICE_DISCONNECTED = PLAYER_ERROR_CLASS | 0x0d,                  /**< Socket connection lost (Since 3.0) */
87         PLAYER_ERROR_BUFFER_SPACE         = TIZEN_ERROR_BUFFER_SPACE,                   /**< No buffer space available (Since 3.0) */
88         PLAYER_ERROR_NOT_SUPPORTED_AUDIO_CODEC = PLAYER_ERROR_CLASS | 0x0e,             /**< Not supported audio codec but video can be played (Since 4.0) */
89         PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC = PLAYER_ERROR_CLASS | 0x0f,             /**< Not supported video codec but audio can be played (Since 4.0) */
90         PLAYER_ERROR_NOT_SUPPORTED_SUBTITLE = PLAYER_ERROR_CLASS | 0x10,                /**< Not supported subtitle format (Since 4.0) */
91 } player_error_e;
92
93 /**
94  * @brief Enumeration for media player's interruption type.
95  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
96  */
97 typedef enum {
98         PLAYER_INTERRUPTED_COMPLETED = 0,           /**< Interrupt completed (Deprecated since 3.0)*/
99         PLAYER_INTERRUPTED_BY_MEDIA,                /**< Interrupted by a non-resumable media application (Deprecated since 3.0)*/
100         PLAYER_INTERRUPTED_BY_CALL,                 /**< Interrupted by an incoming call (Deprecated since 3.0)*/
101         PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG,       /**< Interrupted by unplugging headphones (Deprecated since 3.0)*/
102         PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT,    /**< Interrupted by a resource conflict and the player handle will be unprepared */
103         PLAYER_INTERRUPTED_BY_ALARM,                /**< Interrupted by an alarm (Deprecated since 3.0)*/
104         PLAYER_INTERRUPTED_BY_EMERGENCY,            /**< Interrupted by an emergency (Deprecated since 3.0)*/
105         PLAYER_INTERRUPTED_BY_NOTIFICATION,         /**< Interrupted by a notification (Deprecated since 3.0)*/
106 } player_interrupted_code_e;
107
108 /**
109  * @brief Enumeration for progressive download message type.
110  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
111  */
112 typedef enum {
113         PLAYER_PD_STARTED = 0,              /**< Progressive download is started */
114         PLAYER_PD_COMPLETED,                /**< Progressive download is completed */
115 } player_pd_message_type_e;
116
117 /**
118  * @brief Enumeration for display type.
119  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
120  */
121 typedef enum {
122         PLAYER_DISPLAY_TYPE_OVERLAY = 0,        /**< Overlay surface display */
123         PLAYER_DISPLAY_TYPE_OBSOLETE_EVAS_WNONE = 1,
124                                             /**< Obsolete. Acts as #PLAYER_DISPLAY_TYPE_NONE on Wearable,
125                                                  #PLAYER_DISPLAY_TYPE_EVAS in all other cases.
126                                                  This symbol was added for backward compatibility reasons.
127                                                  It should not be used. (Deprecated since 4.0) */
128
129         PLAYER_DISPLAY_TYPE_OBSOLETE_NONE_WEVAS = 2,
130                                             /**< Obsolete. Acts as #PLAYER_DISPLAY_TYPE_EVAS on Wearable 3.0 and later,
131                                                  #PLAYER_DISPLAY_TYPE_NONE in all other cases.
132                                                  This symbol was added for backward compatibility reasons.
133                                                  It should not be used. (Deprecated since 4.0) */
134
135         PLAYER_DISPLAY_TYPE_EVAS = 3,           /**< Evas image object surface display (Since 4.0) */
136         PLAYER_DISPLAY_TYPE_NONE = 4,           /**< This disposes of buffers (Since 4.0) */
137 } player_display_type_e;
138
139 /**
140  * @brief Enumeration for audio latency mode.
141  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
142  */
143 typedef enum {
144         AUDIO_LATENCY_MODE_LOW = 0,     /**< Low audio latency mode */
145         AUDIO_LATENCY_MODE_MID,         /**< Middle audio latency mode */
146         AUDIO_LATENCY_MODE_HIGH,        /**< High audio latency mode */
147 } audio_latency_mode_e;
148
149 /**
150  * @brief Enumeration for stream type.
151  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
152  */
153 typedef enum {
154         PLAYER_STREAM_TYPE_DEFAULT,     /**< Container type */
155         PLAYER_STREAM_TYPE_AUDIO,       /**< Audio element stream type */
156         PLAYER_STREAM_TYPE_VIDEO,       /**< Video element stream type */
157         PLAYER_STREAM_TYPE_TEXT,        /**< Text type */
158 } player_stream_type_e;
159
160 /**
161  * @brief Enumeration of media stream buffer status
162  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
163  */
164 typedef enum {
165         PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN,
166         PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW,
167 } player_media_stream_buffer_status_e;
168
169 /**
170  * @brief The player display handle.
171  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
172  */
173 typedef void* player_display_h;
174
175 #ifndef GET_DISPLAY
176 /**
177  * @brief Definition for a display handle from evas object.
178  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
179  */
180 #define GET_DISPLAY(x) (void*)(x)
181 #endif
182
183 /**
184  * @}
185  */
186
187 /**
188  * @addtogroup CAPI_MEDIA_PLAYER_DISPLAY_MODULE
189  * @{
190  */
191
192 /**
193  * @brief Enumeration for display rotation type.
194  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
195  */
196 typedef enum {
197         PLAYER_DISPLAY_ROTATION_NONE,   /**< Display is not rotated */
198         PLAYER_DISPLAY_ROTATION_90,     /**< Display is rotated 90 degrees */
199         PLAYER_DISPLAY_ROTATION_180,    /**< Display is rotated 180 degrees */
200         PLAYER_DISPLAY_ROTATION_270,    /**< Display is rotated 270 degrees */
201 } player_display_rotation_e;
202
203 /**
204  * @brief Enumeration for display mode.
205  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
206  */
207 typedef enum {
208         PLAYER_DISPLAY_MODE_LETTER_BOX = 0,     /**< Letter box */
209         PLAYER_DISPLAY_MODE_ORIGIN_SIZE,        /**< Origin size */
210         PLAYER_DISPLAY_MODE_FULL_SCREEN,        /**< Full-screen */
211         PLAYER_DISPLAY_MODE_CROPPED_FULL,       /**< Cropped full-screen */
212         PLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER,   /**< Origin size (if surface size is larger than video size(width/height)) or Letter box (if video size(width/height) is larger than surface size) */
213         PLAYER_DISPLAY_MODE_DST_ROI,            /**< Dst ROI mode */
214         PLAYER_DISPLAY_MODE_NUM
215 } player_display_mode_e;
216
217 /**
218  * @}
219  */
220
221 /**
222  * @addtogroup CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE
223  * @{
224  */
225
226 /**
227  * @brief Enumeration for media stream content information.
228  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
229  */
230 typedef enum {
231         PLAYER_CONTENT_INFO_ALBUM,      /**< Album */
232         PLAYER_CONTENT_INFO_ARTIST,     /**< Artist */
233         PLAYER_CONTENT_INFO_AUTHOR,     /**< Author */
234         PLAYER_CONTENT_INFO_GENRE,      /**< Genre */
235         PLAYER_CONTENT_INFO_TITLE,      /**< Title */
236         PLAYER_CONTENT_INFO_YEAR,       /**< Year */
237 } player_content_info_e;
238
239 /**
240  * @}
241  */
242
243
244 /**
245  * @addtogroup CAPI_MEDIA_PLAYER_SUBTITLE_MODULE
246  * @{
247  */
248
249 /**
250  * @brief  Called when the subtitle is updated.
251  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
252  * @param[in]   duration        The duration of the updated subtitle
253  * @param[in]   text            The text of the updated subtitle
254  * @param[in]   user_data       The user data passed from the callback registration function
255  * @see player_set_subtitle_updated_cb()
256  * @see player_unset_subtitle_updated_cb()
257  */
258 typedef void (*player_subtitle_updated_cb)(unsigned long duration, char *text, void *user_data);
259
260 /**
261  * @}
262  */
263
264 /**
265  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
266  * @{
267  */
268
269 /**
270  * @brief Called when the media player is prepared.
271  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
272  * @details It will be invoked when player has reached the begin of stream.
273  * @param[in]   user_data  The user data passed from the callback registration function
274  * @pre player_prepare_async() will cause this callback.
275  * @post The player state will be #PLAYER_STATE_READY.
276  * @see player_prepare_async()
277  */
278 typedef void (*player_prepared_cb)(void *user_data);
279
280 /**
281  * @brief Called when the media player is completed.
282  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
283  * @details It will be invoked when player has reached the end of the stream.
284  * @param[in]   user_data  The user data passed from the callback registration function
285  * @pre It will be invoked when the playback is completed if you register this callback using player_set_completed_cb().
286  * @see player_set_completed_cb()
287  * @see player_unset_completed_cb()
288  */
289 typedef void (*player_completed_cb)(void *user_data);
290
291 /**
292  * @brief Called when the seek operation is completed.
293  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
294  * @param[in]   user_data  The user data passed from the callback registration function
295  * @see player_set_play_position()
296  */
297 typedef void (*player_seek_completed_cb)(void *user_data);
298
299 /**
300  * @brief Called when the media player is interrupted.
301  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
302  * @details If the code is #PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, the player handle will be unprepared.
303  * @param[in]   error_code      The interrupted error code
304  * @param[in]   user_data       The user data passed from the callback registration function
305  * @see player_set_interrupted_cb()
306  * @see player_unset_interrupted_cb()
307  */
308 typedef void (*player_interrupted_cb)(player_interrupted_code_e code, void *user_data);
309
310 /**
311  * @brief Called when an error occurs in the media player.
312  * @details Following error codes can be delivered.
313  *          #PLAYER_ERROR_INVALID_OPERATION
314  *          #PLAYER_ERROR_INVALID_STATE
315  *          #PLAYER_ERROR_INVALID_URI
316  *          #PLAYER_ERROR_CONNECTION_FAILED
317  *          #PLAYER_ERROR_DRM_NOT_PERMITTED
318  *          #PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE
319  *          #PLAYER_ERROR_NOT_SUPPORTED_FILE
320  *          #PLAYER_ERROR_SEEK_FAILED
321  *          #PLAYER_ERROR_SERVICE_DISCONNECTED
322  *          #PLAYER_ERROR_NOT_SUPPORTED_AUDIO_CODEC (Since 4.0)
323  *          #PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC (Since 4.0)
324  *          #PLAYER_ERROR_NOT_SUPPORTED_SUBTITLE (Since 4.0)
325  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
326  * @param[in]   error_code  The error code
327  * @param[in]   user_data       The user data passed from the callback registration function
328  * @see player_set_error_cb()
329  * @see player_unset_error_cb()
330  */
331 typedef void (*player_error_cb)(int error_code, void *user_data);
332
333 /**
334  * @brief Called when the buffering percentage of the media playback is updated.
335  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
336  * @details If the buffer is full, it will return 100%.
337  * @param[in]   percent The percentage of buffering completed (0~100)
338  * @param[in]   user_data       The user data passed from the callback registration function
339  * @see player_set_buffering_cb()
340  * @see player_unset_buffering_cb()
341  */
342 typedef void (*player_buffering_cb)(int percent, void *user_data);
343
344 /**
345  * @brief Called when progressive download is started or completed.
346  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
347  * @param[in]   type            The message type for progressive download
348  * @param[in]   user_data       The user data passed from the callback registration function
349  * @see player_set_progressive_download_path()
350  */
351 typedef void (*player_pd_message_cb)(player_pd_message_type_e type, void *user_data);
352
353 /**
354  * @brief Called when the video is captured.
355  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
356  * @remarks The color space format of the captured image is IMAGE_UTIL_COLORSPACE_RGB888.
357  * @param[in]   data    The captured image buffer
358  * @param[in]   width   The width of the captured image
359  * @param[in]   height  The height of the captured image
360  * @param[in]   size    The size of the captured image
361  * @param[in]   user_data       The user data passed from the callback registration function
362  * @see player_capture_video()
363  */
364 typedef void (*player_video_captured_cb)(unsigned char *data, int width, int height, unsigned int size, void *user_data);
365
366 /**
367  * @brief Called to register for notifications about delivering media packet when every video frame is decoded.
368  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
369  *
370  * @remarks This function is called in the context of gstreamer so the UI update code must not be directly invoked.\n
371  *          The packet must be released after use by calling media_packet_destroy(). \n
372  *          If not, the decoder will fail due to having insufficient buffer space for the decoded frame.
373  *
374  * @param[in] pkt Reference pointer to the media packet
375  * @param[in] user_data The user data passed from the callback registration function
376  */
377 typedef void (*player_media_packet_video_decoded_cb)(media_packet_h pkt, void *user_data);
378
379 /**
380  * @brief Called when the buffer level drops below the threshold of max size or no free space in buffer.
381  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
382  * @remarks This API is used for media stream playback only.
383  * @param[in] status The buffer status
384  * @param[in] user_data The user data passed from the callback registration function
385  * @see player_set_media_stream_buffer_status_cb()
386  * @see player_set_media_stream_buffer_max_size()
387  * @see player_set_media_stream_buffer_min_threshold()
388  */
389 typedef void (*player_media_stream_buffer_status_cb) (player_media_stream_buffer_status_e status, void *user_data);
390
391 /**
392  * @brief Called to notify the next push-buffer offset when seeking is occurred.
393  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
394  * @remarks This API is used for media stream playback only.
395  * @details The next push-buffer should produce buffers from the new offset.
396  * @param[in] offset The new byte position to seek
397  * @param[in] user_data The user data passed from the callback registration function
398  */
399 typedef void (*player_media_stream_seek_cb) (unsigned long long offset, void *user_data);
400
401 /**
402  * @brief Called to notify the video stream changed.
403  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
404  * @details The video stream changing is detected just before rendering operation.
405  * @param[in] width     The width of the captured image
406  * @param[in] height The height of the captured image
407  * @param[in] fps The frame per second of the video \n
408  *            It can be @c 0 if there is no video stream information.
409  * @param[in] bit_rate The video bit rate [Hz] \n
410  *            It can be an invalid value if there is no video stream information.
411  * @param[in] user_data The user data passed from the callback registration function
412  * @see player_set_video_stream_changed_cb()
413  */
414 typedef void (*player_video_stream_changed_cb) (int width, int height, int fps, int bit_rate, void *user_data);
415
416 /**
417  * @brief Creates a player handle for playing multimedia content.
418  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
419  * @remarks You must release @a player by using player_destroy().\n
420  *          Although you can create multiple player handles at the same time,
421  *          the player cannot guarantee proper operation because of limited resources, such as
422  *          audio or display device.
423  *
424  * @param[out]  player  A new handle to the media player
425  * @retval #PLAYER_ERROR_NONE Successful
426  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
427  * @retval #PLAYER_ERROR_OUT_OF_MEMORY Out of memory
428  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
429  * @retval #PLAYER_ERROR_RESOURCE_LIMIT Cannot create more instance due to resource(socket, thread, etc) limitation on system.
430  * @post The player state will be #PLAYER_STATE_IDLE.
431  * @see player_destroy()
432  */
433 int player_create(player_h *player);
434
435 /**
436  * @brief Destroys the media player handle and releases all its resources.
437  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
438  * @remarks To completely shutdown player operation, call this function with a valid player handle from any player state.
439  * @param[in] player The handle to the media player to be destroyed
440  * @return @c 0 on success,
441  *         otherwise a negative error value
442  * @retval #PLAYER_ERROR_NONE Successful
443  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
444  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
445  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
446  * @post The player state will be #PLAYER_STATE_NONE.
447  * @see player_create()
448  */
449 int player_destroy(player_h player);
450
451 /**
452  * @brief Prepares the media player for playback.
453  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
454  * @remarks The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any video/audio files are used to play located in the internal storage.
455  * @remarks The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any video/audio files are used to play located in the external storage.
456  * @remarks The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from network.
457  * @param[in]   player The handle to the media player
458  * @return @c 0 on success,
459  *         otherwise a negative error value
460  * @retval #PLAYER_ERROR_NONE Successful
461  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
462  * @retval #PLAYER_ERROR_INVALID_URI Invalid URI
463  * @retval #PLAYER_ERROR_NO_SUCH_FILE File not found
464  * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE File not supported
465  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
466  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
467  * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied
468  * @retval #PLAYER_ERROR_NOT_SUPPORTED_AUDIO_CODEC Not support audio codec format (Since 4.0)
469  * @retval #PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC Not support video codec format (Since 4.0)
470  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). After that, call player_set_uri() to load the media content you want to play.
471  * @post The player state will be #PLAYER_STATE_READY.
472  * @see player_prepare_async()
473  * @see player_unprepare()
474  * @see player_set_uri()
475  */
476 int player_prepare(player_h player);
477
478 /**
479  * @brief Prepares the media player for playback, asynchronously.
480  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
481  * @remarks The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any video/audio files are used to play located in the internal storage.
482  * @remarks The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any video/audio files are used to play located in the external storage.
483  * @remarks The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from network.
484  * @param[in] player The handle to the media player
485  * @param[in] callback  The callback function to register
486  * @param[in] user_data The user data to be passed to the callback function
487  * @return @c 0 on success,
488  *         otherwise a negative error value
489  * @retval #PLAYER_ERROR_NONE Successful
490  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
491  * @retval #PLAYER_ERROR_INVALID_URI Invalid URI
492  * @retval #PLAYER_ERROR_NO_SUCH_FILE File not found
493  * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE File not supported
494  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
495  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
496  * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied
497  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare(). After that, call player_set_uri() to load the media content you want to play.
498  * @post It invokes player_prepared_cb() when playback is prepared.
499  * @see player_prepare()
500  * @see player_prepared_cb()
501  * @see player_unprepare()
502  * @see player_set_uri()
503  */
504 int player_prepare_async(player_h player, player_prepared_cb callback, void* user_data);
505
506 /**
507  * @brief Resets the media player.
508  * @details The most recently used media is reset and no longer associated with the player.
509  *          Playback is no longer possible. If you want to use the player again, you must set the data URI and call
510  *          player_prepare() again.
511  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
512  * @param[in] player The handle to the media player
513  * @return @c 0 on success,
514  *         otherwise a negative error value
515  * @retval #PLAYER_ERROR_NONE Successful
516  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
517  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
518  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
519  * @pre The player state must be higher than #PLAYER_STATE_IDLE.
520  * @post The player state will be #PLAYER_STATE_IDLE.
521  * @see player_prepare()
522  */
523 int player_unprepare(player_h player);
524
525 /**
526  * @brief Sets the data source (file-path, HTTP or RTSP URI) to use.
527  *
528  * @details Associates media contents, referred to by the URI, with the player.
529  *          If the function call is successful, subsequent calls to player_prepare() and player_start() will start playing the media.
530  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
531  * @remarks If you use HTTP or RTSP, URI must start with "http://" or "rtsp://". The default protocol is "file://".
532  *          If you provide an invalid URI, you won't receive an error message until you call player_start().
533  * @remarks This API must be called before calling the player_prepare() or player_prepare_async() to build the player based on the uri information.
534  * @remarks The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any video/audio files are used to play located in the internal storage.
535  * @remarks The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any video/audio files are used to play located in the external storage.
536  * @remarks The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from network.
537  *
538  * @param[in]   player The handle to the media player
539  * @param[in]   uri The content location, such as the file path, the URI of the HTTP or RTSP stream you want to play
540  *
541  * @return @c 0 on success,
542  *         otherwise a negative error value
543  * @retval #PLAYER_ERROR_NONE Successful
544  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
545  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
546  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
547  * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied
548  * @if WEARABLE @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature @endif
549  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
550  * @see player_set_memory_buffer()
551  */
552 int player_set_uri(player_h player, const char * uri);
553
554 /**
555  * @brief Sets memory as the data source.
556  *
557  * @details Associates media content, cached in memory, with the player. Unlike the case of player_set_uri(), the media resides in memory.
558  *          If the function call is successful, subsequent calls to player_prepare() and player_start() will start playing the media.
559  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
560  * @remarks If you provide an invalid data, you won't receive an error message until you call player_start().
561  * @remarks This API must be called before calling the player_prepare() or player_prepare_async()
562  *          to build the player based on the data.
563  *
564  * @param[in]   player The handle to the media player
565  * @param[in]   data The memory pointer of media data
566  * @param[in]   size The size of media data
567  * @return @c 0 on success,
568  *         otherwise a negative error value
569  * @retval #PLAYER_ERROR_NONE Successful
570  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
571  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
572  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
573  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
574  * @see player_set_uri()
575  */
576 int player_set_memory_buffer(player_h player, const void * data, int size);
577
578 /**
579  * @brief Gets the player's current state.
580  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
581  * @param[in]   player  The handle to the media player
582  * @param[out]  state   The current state of the player
583  * @return @c 0 on success,
584  *         otherwise a negative error value
585  * @retval #PLAYER_ERROR_NONE Successful
586  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
587  * @see #player_state_e
588  */
589 int  player_get_state(player_h player, player_state_e *state);
590
591 /**
592  * @brief Sets the player's volume.
593  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
594  * @details  Setting this volume adjusts the player's instance volume, not the system volume.
595  *           The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0.
596  *           To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
597  *           Finally, it does not support to set other value into each channel currently.
598  *
599  * @param[in]   player The handle to the media player
600  * @param[in]   left The left volume scalar
601  * @param[in]   right The right volume scalar
602  * @return @c 0 on success,
603  *         otherwise a negative error value
604  * @retval #PLAYER_ERROR_NONE Successful
605  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
606  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
607  * @see player_get_volume()
608  */
609 int player_set_volume(player_h player, float left, float right);
610
611 /**
612  * @brief Gets the player's current volume factor.
613  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
614  * @details The range of @a left and @a right is from @c 0 to @c 1.0, inclusive (1.0 = 100%).
615  *          This function gets the player volume, not the system volume.
616  *          To get the system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
617  *
618  * @param[in]   player The handle to the media player
619  * @param[out]  left The current left volume scalar
620  * @param[out]  right The current right volume scalar
621  * @return @c 0 on success,
622  *         otherwise a negative error value
623  * @retval #PLAYER_ERROR_NONE Successful
624  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
625  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
626  * @see player_set_volume()
627  */
628 int player_get_volume(player_h player, float *left, float *right);
629
630 /**
631  * @deprecated Deprecated since 3.0. Use player_set_sound_stream_info() instead.
632  * @brief Sets the player's volume type.
633  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
634  * @remarks The default sound type of the player is #SOUND_TYPE_MEDIA.
635  *          To get the current sound type, use sound_manager_get_current_sound_type().
636  * @remarks If stream_info already exists by calling sound_manager_create_stream_info(),
637  *          It will return error since 3.0.
638  *
639  * @param[in]   player The handle to the media player
640  * @param[in]   type The sound type
641  * @return @c 0 on success,
642  *         otherwise a negative error value
643  * @retval #PLAYER_ERROR_NONE Successful
644  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
645  * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
646  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create().
647  * @see sound_manager_get_current_sound_type()
648  */
649 int player_set_sound_type(player_h player, sound_type_e type) TIZEN_DEPRECATED_API;
650
651 /**
652  * @brief Sets the player's sound manager stream information.
653  * @since_tizen 3.0
654  * @remarks You can set sound stream information including audio routing and volume type.
655  *          For more details, please refer to sound_manager.h
656  * @remarks This API must be called before calling the player_prepare() or player_prepare_async()
657  *          to reflect the sound stream information when the player is building.
658  *
659  * @param[in] player The handle to the media player
660  * @param[in] stream_info The sound manager info type
661  * @return @c 0 on success,
662  *         otherwise a negative error value
663  * @retval #PLAYER_ERROR_NONE Successful
664  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
665  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
666  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
667  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
668  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create().
669  * @see #sound_stream_info_h
670  * @see sound_manager_create_stream_information()
671  * @see sound_manager_destroy_stream_information()
672  * @par Example
673    @code
674        #include <player.h>
675        #include <sound_manager.h>
676        ...
677        player_h player = NULL;
678        sound_stream_info_h stream_info = NULL;
679        sound_stream_type_e stream_type = SOUND_STREAM_TYPE_MEDIA;
680        ...
681        sound_manager_create_stream_information (stream_type, _focus_callback, use_data, &stream_info);
682        player_create (&player);
683        player_set_sound_stream_info (player, stream_info);
684        ...
685        player_prepare_async (player, _prepared_cb, udata);
686        ...
687    @endcode
688  */
689 int player_set_sound_stream_info(player_h player, sound_stream_info_h stream_info);
690
691 /**
692  * @brief Sets the audio latency mode.
693  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
694  * @remarks The default audio latency mode of the player is #AUDIO_LATENCY_MODE_MID.
695  *              To get the current audio latency mode, use player_get_audio_latency_mode().
696  *              If it's high mode, audio output interval can be increased so, it can keep more audio data to play.
697  *              But, state transition like pause or resume can be more slower than default(mid) mode.
698  *
699  * @param[in] player The handle to the media player
700  * @param[in] latency_mode The latency mode to be applied to the audio
701  * @return @c 0 on success,
702  *         otherwise a negative error value
703  * @retval #PLAYER_ERROR_NONE Successful
704  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
705  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
706  * @see #audio_latency_mode_e
707  * @see player_get_audio_latency_mode()
708  */
709 int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_mode);
710
711 /**
712  * @brief Gets the current audio latency mode.
713  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
714  * @param[in] player The handle to the media player
715  * @param[out] latency_mode The latency mode to get from the audio
716  * @return @c 0 on success,
717  *         otherwise a negative error value
718  * @retval #PLAYER_ERROR_NONE Successful
719  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
720  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
721  * @see #audio_latency_mode_e
722  * @see player_set_audio_latency_mode()
723  */
724 int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *latency_mode);
725
726 /**
727  * @brief Starts or resumes playback.
728  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
729  * @remarks Sound can be mixed with other sounds if you don't control the stream focus in sound-manager module since 3.0.\n
730  * You can refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE.
731  * @remarks Even if you don't set visible to true by calling player_set_display_visible, the video will be shown on #PLAYER_STATE_PLAYING state.
732  * @details Plays current media content, or resumes play if paused.
733  *
734  * @param[in]   player The handle to the media player
735  * @return @c 0 on success,
736  *         otherwise a negative error value
737  * @retval #PLAYER_ERROR_NONE Successful
738  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
739  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
740  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
741  * @retval #PLAYER_ERROR_CONNECTION_FAILED Network connection failed
742  * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
743  * @pre player_prepare() must be called before calling this function.
744  * @pre The player state must be set to #PLAYER_STATE_READY by calling player_prepare() or set to #PLAYER_STATE_PAUSED by calling player_pause().
745  * @post The player state will be #PLAYER_STATE_PLAYING.
746  * @post It invokes player_completed_cb() when playback completes, if you set a callback with player_set_completed_cb().
747  * @post It invokes player_pd_message_cb() when progressive download starts or completes, if you set a download path with player_set_progressive_download_path() and a callback with player_set_progressive_download_message_cb().
748  * @see player_prepare()
749  * @see player_prepare_async()
750  * @see player_stop()
751  * @see player_pause()
752  * @see player_set_completed_cb()
753  * @see player_completed_cb()
754  * @see player_set_progressive_download_path()
755  * @see player_set_progressive_download_message_cb()
756  * @see player_pd_message_cb()
757  * @see player_set_display_visible()
758  */
759 int player_start(player_h player);
760
761 /**
762  * @brief Stops playing media content.
763  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
764  * @param[in]   player The handle to the media player
765  * @return @c 0 on success,
766  *         otherwise a negative error value
767  * @retval #PLAYER_ERROR_NONE Successful
768  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid state
769  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
770  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
771  * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
772  * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause().
773  * @post The player state will be #PLAYER_STATE_READY.
774  * @post The downloading will be aborted if you use progressive download.
775  * @see player_start()
776  * @see player_pause()
777  */
778 int player_stop(player_h player);
779
780 /**
781  * @brief Pauses the player.
782  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
783  * @remarks     You can resume playback using player_start().
784  *
785  * @param[in]   player The handle to the media player
786  * @return @c 0 on success,
787  *         otherwise a negative error value
788  * @retval #PLAYER_ERROR_NONE Successful
789  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid state
790  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
791  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
792  * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
793  * @pre The player state must be set to #PLAYER_STATE_PLAYING.
794  * @post The player state will be #PLAYER_STATE_READY.
795  * @see player_start()
796  */
797 int player_pause(player_h player);
798
799 /**
800  * @brief Sets the seek position for playback, asynchronously.
801  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
802  * @remarks This api will trigger the seeking operation on player instance.
803  *          Normally application need to wait for player_seek_completed_cb() before calling it again.
804  *          Otherwise it will return PLAYER_ERROR_SEEK_FAILED.
805  *          Please note that if application is playing external media data via player_set_media_stream_info(),
806  *          then consecutive calling of this api will always success and no need to wait for player_seek_completed_cb()
807  *          before next calling of this api.(since_tizen 3.0)
808  * @remarks Even if you don't set visible to true by calling player_set_display_visible,
809  *          the video will be shown when the _seek_completed cb is invoked.
810  * @remarks In case of non-seekable content, it will return PLAYER_ERROR_INVALID_OPERATION.
811  *          If application ignore this error, player will keep playing without changing play position.
812  * @param[in] player The handle to the media player
813  * @param[in] millisecond The position in milliseconds from the start to the seek point
814  * @param[in] accurate If @c true the selected position is returned, but this might be considerably slow,
815  *                     if @c false the nearest key frame position is returned, but this might be faster but less accurate.
816  * @param[in] callback  The callback function to register
817  * @param[in] user_data The user data to be passed to the callback function
818  * @return @c 0 on success,
819  *         otherwise a negative error value
820  * @retval #PLAYER_ERROR_NONE Successful
821  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
822  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
823  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
824  * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
825  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
826  * @post It invokes player_seek_completed_cb() when seek operation completes, if you set a callback.
827  * @see player_get_play_position()
828  */
829 int player_set_play_position(player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data);
830
831 /**
832  * @brief Gets the current position in milliseconds.
833  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
834  * @param[in]   player The handle to the media player
835  * @param[out]  millisecond The current position in milliseconds
836  * @return @c 0 on success,
837  *         otherwise a negative error value
838  * @retval #PLAYER_ERROR_NONE Successful
839  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
840  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
841  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
842  * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
843  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
844  * @see player_set_play_position()
845  */
846 int player_get_play_position(player_h player, int *millisecond);
847
848 /**
849  * @brief Sets the player's mute status.
850  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
851  * @details If the mute status is @c true, no sounds are played.
852  *          If it is @c false, sounds are played at the previously set volume level.
853  *          Until this function is called, by default the player is not muted.
854  *
855  * @param[in]   player The handle to the media player
856  * @param[in]   muted The new mute status: (@c true = mute, @c false = not muted)
857  * @return @c 0 on success,
858  *         otherwise a negative error value
859  * @retval #PLAYER_ERROR_NONE Successful
860  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
861  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
862  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
863  * @see player_is_muted()
864  */
865 int player_set_mute(player_h player, bool muted);
866
867 /**
868  * @brief Gets the player's mute status.
869  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
870  * @details If the mute status is @c true, no sounds are played.
871  *          If it is @c false, sounds are played at the previously set volume level.
872  *
873  * @param[in]   player The handle to the media player
874  * @param[out]  muted  The current mute status: (@c true = mute, @c false = not muted)
875  * @return @c 0 on success,
876  *         otherwise a negative error value
877  * @retval #PLAYER_ERROR_NONE Successful
878  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
879  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
880  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
881  * @see player_set_mute()
882  */
883 int player_is_muted(player_h player, bool *muted);
884
885 /**
886  * @brief Sets the player's looping status.
887  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
888  * @details If the looping status is @c true, playback automatically restarts upon finishing.
889  *          If it is @c false, it won't. The default value is @c false.
890  *
891  * @param[in]   player The handle to the media player
892  * @param[in]   looping The new looping status: (@c true = looping, @c false = non-looping )
893  * @return @c 0 on success,
894  *         otherwise a negative error value
895  * @retval #PLAYER_ERROR_NONE Successful
896  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
897  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
898  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
899  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
900  * @see player_is_looping()
901  */
902 int player_set_looping(player_h player, bool looping);
903
904 /**
905  * @brief Gets the player's looping status.
906  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
907  * @details If the looping status is @c true, playback automatically restarts upon finishing.
908  *          If it is @c false, it won't.
909  *
910  * @param[in]   player The handle to the media player
911  * @param[out]  looping The looping status: (@c true = looping, @c false = non-looping )
912  * @return @c 0 on success,
913  *         otherwise a negative error value
914  * @retval #PLAYER_ERROR_NONE Successful
915  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
916  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
917  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
918  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
919  * @see player_set_looping()
920  */
921 int player_is_looping(player_h player, bool *looping);
922
923 /**
924  * @brief Sets the video display.
925  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
926  * @remarks To get @a display to set, use #GET_DISPLAY().
927  * @remarks We are not supporting changing display.
928  * @remarks This API have be called before calling the player_prepare() or player_prepare_async() \n
929  *          to reflect the display type.
930  * @param[in]   player The handle to the media player
931  * @param[in]   type The display type
932  * @param[in]   display The handle to display
933  * @return @c 0 on success,
934  *         otherwise a negative error value
935  * @retval #PLAYER_ERROR_NONE Successful
936  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
937  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
938  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
939  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
940  * @see #player_display_type_e
941  * @see player_set_display_mode
942  * @see player_set_display_roi_area
943  * @see player_set_display_visible
944  * @see player_set_display_rotation
945  */
946 int player_set_display(player_h player, player_display_type_e type, player_display_h display);
947
948 /**
949  * @brief Registers a media packet video callback function to be called once per frame.
950  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
951  * @remarks This function must be called before calling player_prepare() or player_prepare_async().\n
952  *          A registered callback is called in a separate thread (not in the main loop).\n
953  *          A video frame can be retrieved using a registered callback as a media packet.\n
954  *          The callback function holds the same buffer that will be drawn on the display device.\n
955  *          So if you change the media packet in a registered callback, it will be displayed on the device\n
956  *          and the media packet is available until it's destroyed by media_packet_destroy().\n
957  *          The packet have to be destroyed as quickly as possible after rendering the packet\n
958  *          and all the packets have to be destroyed before player_unprepare() is called.\n
959  * @param[in] player The handle to the media player
960  * @param[in] callback The callback function to be registered
961  * @param[in] user_data The user data to be passed to the callback function
962  * @return @c 0 on success,
963  *         otherwise a negative error value
964  * @retval #PLAYER_ERROR_NONE Successful
965  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
966  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
967  * @pre The player's state must be #PLAYER_STATE_IDLE. And, #PLAYER_DISPLAY_TYPE_NONE must be set by calling player_set_display().
968  * @see player_unset_media_packet_video_frame_decoded_cb
969  */
970 int player_set_media_packet_video_frame_decoded_cb(player_h player, player_media_packet_video_decoded_cb callback, void *user_data);
971
972 /**
973  * @brief Unregisters the callback function.
974  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
975  * @param[in] player The handle to the media player
976  * @return @c 0 on success,
977  *         otherwise a negative error value
978  * @retval #PLAYER_ERROR_NONE Successful
979  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
980  * @pre The player's state must be #PLAYER_STATE_READY or #PLAYER_STATE_IDLE
981  * @see player_set_media_packet_video_frame_decoded_cb()
982  */
983 int player_unset_media_packet_video_frame_decoded_cb(player_h player);
984
985 /**
986  * @brief  Pushes elementary stream to decode audio or video
987  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
988  * @remarks player_set_media_stream_info() must be called before using this API.
989  * @remarks The available buffer size can be set by calling player_set_media_stream_buffer_max_size() API.
990  *          If there is no available buffer space, this api will return error since 3.0.
991  * @param[in]  player   The handle to media player
992  * @param[in]  packet   The media packet to decode
993  * @return @c 0 on success,
994  *         otherwise a negative error value
995  * @retval #PLAYER_ERROR_NONE Successful
996  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
997  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
998  * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE File not supported
999  * @retval #PLAYER_ERROR_BUFFER_SPACE No buffer space available (since 3.0)
1000  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation (since 3.0)
1001  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1002  * @see player_set_media_stream_info()
1003  * @see player_set_media_stream_buffer_max_size()
1004  */
1005 int player_push_media_stream(player_h player, media_packet_h packet);
1006
1007 /**
1008  * @brief  Sets contents information for media stream
1009  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
1010  * @remarks AV format must be set before pushing elementary stream with player_push_media_stream().
1011  * @remarks This API must be called before calling the player_prepare() or player_prepare_async()
1012  *          to reflect the media information.
1013  * @remarks AAC can be supported.
1014  * @remarks H.264 can be supported.
1015  * @param[in] player The handle to media player
1016  * @param[in] type   The type of target stream
1017  * @param[in] format The media format to set audio information
1018  * @return @c 0 on success,
1019  *         otherwise a negative error value
1020  * @retval #PLAYER_ERROR_NONE Successful
1021  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1022  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
1023  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1024  * @see  player_push_media_stream()
1025  */
1026 int player_set_media_stream_info(player_h player, player_stream_type_e type, media_format_h format);
1027
1028 /**
1029  * @brief Registers a callback function to be invoked when buffer underrun or overflow is occurred.
1030  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
1031  * @remarks This API is used for media stream playback only.
1032  * @remarks The callback is called in a separate thread (not in the main loop).
1033  * @param[in] player   The handle to the media player
1034  * @param[in] type     The type of target stream
1035  * @param[in] callback The buffer status callback function to register
1036  * @param[in] user_data The user data to be passed to the callback function
1037  * @return @c 0 on success,
1038  *         otherwise a negative error value
1039  * @retval #PLAYER_ERROR_NONE Successful
1040  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1041  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1042  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1043  * @post player_media_stream_buffer_status_cb() will be invoked.
1044  * @see player_unset_media_stream_buffer_status_cb()
1045  * @see player_media_stream_buffer_status_cb()
1046  */
1047 int player_set_media_stream_buffer_status_cb(player_h player, player_stream_type_e type, player_media_stream_buffer_status_cb callback, void *user_data);
1048
1049 /**
1050  * @brief Unregisters the buffer status callback function.
1051  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
1052  * @remarks This API is used for media stream playback only.
1053  * @param[in] player The handle to the media player
1054  * @param[in] type   The type of target stream
1055  * @return @c 0 on success,
1056  *         otherwise a negative error value
1057  * @retval #PLAYER_ERROR_NONE Successful
1058  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1059  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1060  * @see player_set_media_stream_buffer_status_cb()
1061  */
1062 int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_type_e type);
1063
1064 /**
1065  * @brief Registers a callback function to be invoked when seeking is occurred.
1066  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
1067  * @remarks This API is used for media stream playback only.
1068  * @remarks The callback is called in a separate thread (not in the main loop).
1069  * @param[in] player    The handle to the media player
1070  * @param[in] type      The type of target stream
1071  * @param[in] callback  The callback function to register
1072  * @param[in] user_data The user data to be passed to the callback function
1073  * @return @c 0 on success,
1074  *         otherwise a negative error value
1075  * @retval #PLAYER_ERROR_NONE Successful
1076  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1077  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1078  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1079  * @post player_media_stream_seek_cb() will be invoked.
1080  * @see player_unset_media_stream_seek_cb()
1081  * @see player_media_stream_seek_cb()
1082  */
1083 int player_set_media_stream_seek_cb(player_h player, player_stream_type_e type, player_media_stream_seek_cb callback, void *user_data);
1084
1085 /**
1086  * @brief Unregisters the seek callback function.
1087  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
1088  * @param[in] player The handle to the media player
1089  * @param[in] type   The type of target stream
1090  * @return @c 0 on success,
1091  *         otherwise a negative error value
1092  * @retval #PLAYER_ERROR_NONE Successful
1093  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1094  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1095  * @see player_set_media_stream_seek_cb()
1096  */
1097 int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e type);
1098
1099 /**
1100  * @brief Sets the max size bytes of buffer.
1101  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
1102  * @remarks This API is used for media stream playback only.
1103  * @remarks If the buffer level over the max size, player_media_stream_buffer_status_cb() will be invoked with overflow status.
1104  * @param[in] player The handle to the media player
1105  * @param[in] type   The type of target stream
1106  * @param[in] max_size The max bytes of buffer, it has to be bigger than zero. (default: 200000)
1107  * @return @c 0 on success,
1108  *         otherwise a negative error value
1109  * @retval #PLAYER_ERROR_NONE Successful
1110  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1111  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1112  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. (since 3.0)
1113  * @see player_get_media_stream_buffer_max_size()
1114  * @see player_media_stream_buffer_status_cb()
1115  */
1116 int player_set_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long max_size);
1117
1118 /**
1119  * @brief Gets the max size bytes of buffer.
1120  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
1121  * @remarks This API is used for media stream playback only.
1122  * @remarks If the buffer level over the max size, player_media_stream_buffer_status_cb() will be invoked with overflow status.
1123  * @param[in] player The handle to the media player
1124  * @param[in] type   The type of target stream
1125  * @param[out] max_size The max bytes of buffer
1126  * @return @c 0 on success,
1127  *         otherwise a negative error value
1128  * @retval #PLAYER_ERROR_NONE Successful
1129  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1130  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1131  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1132  * @see player_set_media_stream_buffer_max_size()
1133  * @see player_media_stream_buffer_status_cb()
1134  */
1135 int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long *max_size);
1136
1137 /**
1138  * @brief Sets the buffer threshold percent of buffer.
1139  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
1140  * @remarks This API is used for media stream playback only.
1141  * @remarks If the buffer level drops below the percent value, player_media_stream_buffer_status_cb() will be invoked with underrun status.
1142  * @param[in] player The handle to the media player
1143  * @param[in] type   The type of target stream
1144  * @param[in] percent The minimum threshold(0~100) of buffer (default: 0)
1145  * @return @c 0 on success,
1146  *         otherwise a negative error value
1147  * @retval #PLAYER_ERROR_NONE Successful
1148  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1149  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1150  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. (since 3.0)
1151  * @see player_get_media_stream_buffer_min_threshold()
1152  * @see player_media_stream_buffer_status_cb()
1153  */
1154 int player_set_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int percent);
1155
1156 /**
1157  * @brief Gets the buffer threshold percent of buffer.
1158  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
1159  * @remarks This API is used for media stream playback only.
1160  * @remarks If the buffer level drops below the percent value, player_media_stream_buffer_status_cb() will be invoked with underrun status.
1161  * @param[in] player The handle to the media player
1162  * @param[in] type   The type of target stream
1163  * @param[out] percent The minimum threshold(0~100) of buffer
1164  * @return @c 0 on success,
1165  *         otherwise a negative error value
1166  * @retval #PLAYER_ERROR_NONE Successful
1167  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1168  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1169  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1170  * @see player_set_media_stream_buffer_min_threshold()
1171  * @see player_media_stream_buffer_status_cb()
1172  */
1173 int player_get_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int *percent);
1174
1175 /**
1176  * @}
1177  */
1178
1179 /**
1180  * @addtogroup CAPI_MEDIA_PLAYER_DISPLAY_MODULE
1181  * @{
1182  */
1183
1184 /**
1185  * @brief Sets the video display mode.
1186  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1187  * @remarks If no display is set, no operation is performed.
1188  * @param[in] player   The handle to the media player
1189  * @param[in] mode     The display mode
1190  * @return @c 0 on success,
1191  *         otherwise a negative error value
1192  * @retval #PLAYER_ERROR_NONE Successful
1193  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1194  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1195  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
1196  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1197  * @see #player_display_mode_e
1198  * @see player_set_display()
1199  * @see player_get_display_mode()
1200  */
1201 int player_set_display_mode(player_h player, player_display_mode_e mode);
1202
1203 /**
1204  * @brief Gets the video display mode.
1205  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1206  * @remarks If no display is set, no operation is performed.
1207  * @param[in] player The handle to the media player
1208  * @param[out] mode The current display mode
1209  * @return @c 0 on success,
1210  *         otherwise a negative error value
1211  * @retval  #PLAYER_ERROR_NONE Successful
1212  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1213  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1214  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1215  * @see #player_display_mode_e
1216  * @see player_set_display_mode()
1217  */
1218 int player_get_display_mode(player_h player, player_display_mode_e *mode);
1219
1220 /**
1221  * @brief Sets the ROI(Region Of Interest) area of display.
1222  * @since_tizen 3.0
1223  * @remarks If no display is set, no operation is performed.
1224  * @remarks Before set display ROI area, #PLAYER_DISPLAY_MODE_DST_ROI must be set with player_set_display_mode().
1225  *          The minimum value of width and height are 1.
1226  * @param[in] player The handle to the media player
1227  * @param[in] x X coordinate of area
1228  * @param[in] y Y coordinate of area
1229  * @param[in] width Width of area
1230  * @param[in] height Height of area
1231  * @return @c 0 on success,
1232  *         otherwise a negative error value
1233  * @retval  #PLAYER_ERROR_NONE Successful
1234  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1235  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1236  * @pre display_mode must be set to #PLAYER_DISPLAY_MODE_DST_ROI.
1237  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1238  * @see player_set_display()
1239  * @see player_set_display_mode()
1240  */
1241 int player_set_display_roi_area(player_h player, int x, int y, int width, int height);
1242
1243 /**
1244  * @brief Sets the visibility of the video display
1245  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1246  * @remarks If no display is set, no operation is performed.
1247  * @remarks If you set visible before calling player_set_display, it will be applied on #PLAYER_STATE_READY state.
1248  * @param[in] player   The handle to the media player
1249  * @param[in] visible The visibility of the display (@c true = visible, @c false = non-visible )
1250  * @return @c 0 on success,
1251  *         otherwise a negative error value
1252  * @retval #PLAYER_ERROR_NONE Successful
1253  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1254  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1255  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
1256  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1257  * @see player_set_display()
1258  * @see player_is_display_visible()
1259  */
1260 int player_set_display_visible(player_h player, bool visible);
1261
1262 /**
1263  * @brief Gets the visibility of the video display.
1264  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1265  * @param[in] player The handle to the media player
1266  * @param[out] visible The current visibility of the display (@c true = visible, @c false = non-visible )
1267  * @return @c 0 on success,
1268  *         otherwise a negative error value
1269  * @retval  #PLAYER_ERROR_NONE Successful
1270  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1271  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1272  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1273  * @see player_set_display_visible()
1274  */
1275 int player_is_display_visible(player_h player, bool* visible);
1276
1277 /**
1278  * @brief Sets the rotation settings of the video surface display.
1279  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1280  * @remarks If no display is set, no operation is performed.
1281  * @details Use this function to change the video orientation to portrait mode.
1282  * @param[in] player   The handle to the media player
1283  * @param[in] rotation The rotation of the display
1284  * @return @c 0 on success,
1285  *         otherwise a negative error value
1286  * @retval #PLAYER_ERROR_NONE Successful
1287  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1288  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1289  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
1290  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1291  * @see #player_display_rotation_e
1292  * @see  player_set_display
1293  * @see  player_get_display_rotation()
1294  */
1295 int player_set_display_rotation(player_h player, player_display_rotation_e rotation);
1296
1297 /**
1298  * @brief Gets the rotation of the video surface display.
1299  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1300  * @param[in] player The handle to the media player
1301  * @param[out] rotation The current rotation of the display
1302  * @return @c 0 on success,
1303  *         otherwise a negative error value
1304  * @retval  #PLAYER_ERROR_NONE Successful
1305  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1306  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1307  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1308  * @see #player_display_rotation_e
1309  * @see     player_set_display_rotation()
1310  */
1311 int player_get_display_rotation(player_h player, player_display_rotation_e *rotation);
1312
1313 /**
1314  * @}
1315  */
1316
1317
1318 /**
1319  * @addtogroup CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE
1320  * @{
1321  */
1322
1323  /**
1324  * @brief Gets the media content information.
1325  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1326  * @remarks You must release @a value using @c free().
1327  * @remarks The playback type should be local playback or HTTP streaming playback.
1328  * @param[in]  player The handle to the media player
1329  * @param[in] key The key attribute name to get
1330  * @param[out] value The value of the key attribute \n
1331  *                   It can be an empty string if there is no content information.
1332  * @return @c 0 on success,
1333  *         otherwise a negative error value
1334  * @retval #PLAYER_ERROR_NONE Successful
1335  * @retval #PLAYER_ERROR_INVALID_PARAMETER  Invalid parameter
1336  * @retval #PLAYER_ERROR_OUT_OF_MEMORY Not enough memory is available
1337  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1338  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1339  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1340  */
1341 int player_get_content_info(player_h player, player_content_info_e key, char ** value);
1342
1343 /**
1344  * @brief Gets the audio and video codec information.
1345  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1346  * @remarks You must release @a audio_codec and @a video_codec using free().
1347  * @remarks The playback type should be local playback or HTTP streaming playback.
1348  * @param[in] player The handle to the media player
1349  * @param[out] audio_codec The name of the audio codec \n
1350  *                         It can be @c NULL if there is no audio codec.
1351  * @param[out] video_codec The name of the video codec \n
1352  *                         It can be @c NULL if there is no video codec.
1353  * @return @c 0 on success,
1354  *         otherwise a negative error value
1355  * @retval #PLAYER_ERROR_NONE Successful
1356  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1357  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1358  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1359  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1360  */
1361 int player_get_codec_info(player_h player, char **audio_codec, char **video_codec);
1362
1363 /**
1364  * @brief Gets the audio stream information.
1365  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1366  * @remarks The playback type should be local playback or HTTP streaming playback.
1367  * @param[in] player The handle to the media player
1368  * @param[out]  sample_rate The audio sample rate [Hz] \n
1369  *                          Value can be invalid if there is no audio stream information.
1370  * @param[out]  channel The audio channel (1: mono, 2: stereo) \n
1371  *                      Value can be invalid if there is no audio stream information.
1372  * @param[out]  bit_rate The audio bit rate [Hz] \n
1373  *                       Value can be invalid if there is no audio stream information.
1374  * @return @c 0 on success,
1375  *         otherwise a negative error value
1376  * @retval #PLAYER_ERROR_NONE Successful
1377  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1378  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1379  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1380  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1381  */
1382 int player_get_audio_stream_info(player_h player, int *sample_rate, int *channel, int *bit_rate);
1383
1384 /**
1385  * @brief Gets the video stream information.
1386  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1387  * @remarks The playback type should be local playback or HTTP streaming playback.
1388  * @param[in] player The handle to the media player
1389  * @param[out]  fps The frame per second of the video \n
1390  *                  It can be @c 0 if there is no video stream information.
1391  * @param[out]  bit_rate The video bit rate [Hz] \n
1392  *                       It can be an invalid value if there is no video stream information.
1393  * @return @c 0 on success,
1394  *         otherwise a negative error value
1395  * @retval #PLAYER_ERROR_NONE Successful
1396  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1397  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1398  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1399  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1400  */
1401 int player_get_video_stream_info(player_h player, int *fps, int *bit_rate);
1402
1403 /**
1404  * @brief Gets the video display's height and width.
1405  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1406  * @remarks The playback type should be local playback or HTTP streaming playback.
1407  * @param[in] player The handle to the media player
1408  * @param[out] width The width of the video \n
1409  *                   Value can be invalid if there is no video or no display is set.
1410  * @param[out] height The height of the video \n
1411  *                    Value can be invalid value if there is no video or no display is set.
1412  * @return @c 0 on success,
1413  *         otherwise a negative error value
1414  * @retval #PLAYER_ERROR_NONE Successful
1415  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1416  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1417  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1418  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1419  */
1420 int player_get_video_size(player_h player, int *width, int *height);
1421
1422 /**
1423  * @brief Gets the album art in the media resource.
1424  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1425  * @remarks You must not release @a album_art. It will be released by framework when the player is destroyed.
1426  * @param[in] player The handle to the media player
1427  * @param[out] album_art The encoded artwork image
1428  * @param[out] size The encoded artwork size
1429  * @return @c 0 on success,
1430  *         otherwise a negative error value
1431  * @retval #PLAYER_ERROR_NONE Successful
1432  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1433  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1434  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1435  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1436  */
1437 int player_get_album_art(player_h player, void **album_art, int *size);
1438
1439 /**
1440  * @brief Gets the total running time of the associated media.
1441  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1442  * @remarks The media source is associated with the player, using either player_set_uri() or player_set_memory_buffer().
1443  * @remarks The playback type should be local playback or HTTP streaming playback.
1444  * @param[in]   player The handle to the media player
1445  * @param[out]  duration The duration in milliseconds
1446  * @return @c 0 on success,
1447  *         otherwise a negative error value
1448  * @retval #PLAYER_ERROR_NONE Successful
1449  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1450  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1451  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1452  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1453  * @see player_set_uri()
1454  * @see player_set_memory_buffer()
1455  */
1456 int player_get_duration(player_h player, int *duration);
1457
1458 /**
1459  * @}
1460  */
1461
1462
1463 /**
1464  * @addtogroup CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE
1465  * @{
1466  */
1467
1468 /**
1469  * @brief Gets the number of equalizer bands.
1470  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1471  * @param[in] player The handle to the media player
1472  * @param[out] count The number of equalizer bands
1473  * @return @c 0 on success,
1474  *         otherwise a negative error value
1475  * @retval #PLAYER_ERROR_NONE Successful
1476  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1477  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1478  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1479  * @see player_audio_effect_equalizer_is_available()
1480  * @see player_audio_effect_set_equalizer_band_level()
1481  * @see player_audio_effect_set_equalizer_all_bands()
1482  */
1483 int player_audio_effect_get_equalizer_bands_count(player_h player, int *count);
1484
1485 /**
1486  * @brief Sets the gain set for the given equalizer band.
1487  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1488  * @param[in] player The handle to the media player
1489  * @param[in] index The index of the equalizer band to be set
1490  * @param[in] level The new gain in decibel that is set to the given band [dB]
1491  * @return @c 0 on success,
1492  *         otherwise a negative error value
1493  * @retval #PLAYER_ERROR_NONE Successful
1494  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1495  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1496  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1497  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1498  * @see player_audio_effect_equalizer_is_available()
1499  * @see player_audio_effect_get_equalizer_bands_count()
1500  * @see player_audio_effect_get_equalizer_level_range()
1501  * @see player_audio_effect_get_equalizer_band_level()
1502  * @see player_audio_effect_set_equalizer_all_bands()
1503  */
1504 int player_audio_effect_set_equalizer_band_level(player_h player, int index, int level);
1505
1506 /**
1507  * @brief Gets the gain set for the given equalizer band.
1508  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1509  * @param[in]   player The handle to the media player
1510  * @param[in]   index The index of the requested equalizer band
1511  * @param[out]   level The gain in decibel of the given band [dB]
1512  * @return @c 0 on success,
1513  *         otherwise a negative error value
1514  * @retval #PLAYER_ERROR_NONE Successful
1515  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1516  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1517  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1518  * @see player_audio_effect_equalizer_is_available()
1519  * @see player_audio_effect_set_equalizer_band_level()
1520  */
1521 int player_audio_effect_get_equalizer_band_level(player_h player, int index, int *level);
1522
1523 /**
1524  * @brief Sets all bands of the equalizer.
1525  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1526  * @param[in] player The handle to the media player
1527  * @param[in] band_levels The list of band levels to be set
1528  * @param[in] length The length of the band level
1529  * @return @c 0 on success,
1530  *         otherwise a negative error value
1531  * @retval #PLAYER_ERROR_NONE Successful
1532  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1533  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1534  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1535  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1536  * @see player_audio_effect_equalizer_is_available()
1537  * @see player_audio_effect_get_equalizer_bands_count()
1538  * @see player_audio_effect_get_equalizer_level_range()
1539  * @see player_audio_effect_set_equalizer_band_level()
1540  */
1541 int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_levels, int length);
1542
1543 /**
1544  * @brief Gets the valid band level range of the equalizer.
1545  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1546  * @param[in] player The handle to the media player
1547  * @param[out] min The minimum value to be set [dB]
1548  * @param[out] max The maximum value to be set [dB]
1549  * @return @c 0 on success,
1550  *         otherwise a negative error value
1551  * @retval #PLAYER_ERROR_NONE Successful
1552  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1553  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1554  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1555  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1556  * @see player_audio_effect_equalizer_is_available()
1557  * @see player_audio_effect_set_equalizer_band_level()
1558  * @see player_audio_effect_set_equalizer_all_bands()
1559  */
1560 int player_audio_effect_get_equalizer_level_range(player_h player, int* min, int* max);
1561
1562 /**
1563  * @brief Gets the band frequency of the equalizer.
1564  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1565  * @param[in] player The handle to the media player
1566  * @param[in]  index The index of the requested equalizer band
1567  * @param[out] frequency The frequency of the given band [dB]
1568  * @return @c 0 on success,
1569  *         otherwise a negative error value
1570  * @retval #PLAYER_ERROR_NONE Successful
1571  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1572  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1573  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1574  * @see player_audio_effect_equalizer_is_available()
1575  */
1576 int player_audio_effect_get_equalizer_band_frequency(player_h player, int index, int *frequency);
1577
1578 /**
1579  * @brief Gets the band frequency range of the equalizer.
1580  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1581  * @param[in] player The handle to the media player
1582  * @param[in]  index The index of the requested equalizer band
1583  * @param[out] range The frequency range of the given band [dB]
1584  * @return @c 0 on success,
1585  *         otherwise a negative error value
1586  * @retval #PLAYER_ERROR_NONE Successful
1587  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1588  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1589  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1590  * @see player_audio_effect_equalizer_is_available()
1591  */
1592 int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int index, int *range);
1593
1594 /**
1595  * @brief Clears the equalizer effect.
1596  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1597  * @param[in] player The handle to the media player
1598  * @retval #PLAYER_ERROR_NONE Successful
1599  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1600  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1601  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1602  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1603  * @see player_audio_effect_equalizer_is_available()
1604  * @see player_audio_effect_set_equalizer_band_level()
1605  * @see player_audio_effect_set_equalizer_all_bands()
1606  */
1607 int player_audio_effect_equalizer_clear(player_h player);
1608
1609 /**
1610  * @brief Checks whether the custom equalizer effect is available.
1611  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1612  * @param[in] player The handle to the media player
1613  * @param[out] available If @c true the specified audio effect is available,
1614  *                       otherwise @c false
1615  * @retval #PLAYER_ERROR_NONE Successful
1616  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1617  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1618  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1619  * @see player_audio_effect_set_equalizer_band_level()
1620  * @see player_audio_effect_set_equalizer_all_bands()
1621  */
1622 int player_audio_effect_equalizer_is_available(player_h player, bool *available);
1623
1624 /**
1625  * @}
1626  */
1627
1628
1629 /**
1630  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
1631  * @{
1632  */
1633
1634 /**
1635  * @brief Captures the video frame, asynchronously.
1636  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1637  * @param[in] player The handle to the media player
1638  * @param[in] callback  The callback function to register
1639  * @param[in] user_data The user data to be passed to the callback function
1640  * @return @c 0 on success,
1641  *         otherwise a negative error value
1642  * @retval #PLAYER_ERROR_NONE Successful
1643  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1644  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1645  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1646  * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause().
1647  * @pre Video display type should be set by calling player_set_display() otherwise, audio stream is only processed even though video file is set.
1648  * @post It invokes player_video_captured_cb() when capture completes, if you set a callback.
1649  * @see player_video_captured_cb()
1650  */
1651 int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data);
1652
1653 /**
1654  * @brief Sets the cookie for streaming playback.
1655  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1656  * @remarks This API must be called before calling the player_prepare() or player_prepare_async()
1657  *          to reflect the cookie information when the streaming connection is set up.
1658  * @param[in] player The handle to the media player
1659  * @param[in] cookie The cookie to set
1660  * @param[in] size The size of the cookie
1661  * @return @c 0 on success,
1662  *         otherwise a negative error value
1663  * @retval #PLAYER_ERROR_NONE Successful
1664  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1665  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1666  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1667  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1668  * @see player_set_uri()
1669  * @see player_set_streaming_user_agent()
1670  */
1671 int player_set_streaming_cookie(player_h player, const char *cookie, int size);
1672
1673 /**
1674  * @brief Sets the streaming user agent for playback.
1675  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1676  * @remarks This API must be called before calling the player_prepare() or player_prepare_async()
1677  *          to reflect the user agent information when the streaming connection is set up.
1678  * @param[in] player The handle to the media player
1679  * @param[in] user_agent The user agent to set
1680  * @param[in] size The size of the user agent
1681  * @return @c 0 on success,
1682  *         otherwise a negative error value
1683  * @retval #PLAYER_ERROR_NONE Successful
1684  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1685  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1686  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1687  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1688  * @see player_set_uri()
1689  * @see player_set_streaming_cookie()
1690  */
1691 int player_set_streaming_user_agent(player_h player, const char *user_agent, int size);
1692
1693 /**
1694  * @brief Gets the download progress for streaming playback.
1695  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1696  * @param[in] player The handle to the media player
1697  * @param[out] start The starting position in percentage [0, 100]
1698  * @param[out] current The current position in percentage [0, 100]
1699  * @return @c 0 on success,
1700  *         otherwise a negative error value
1701  * @retval #PLAYER_ERROR_NONE Successful
1702  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1703  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1704  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1705  * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause().
1706  */
1707 int player_get_streaming_download_progress(player_h player, int *start, int *current);
1708
1709 /**
1710  * @brief Registers a callback function to be invoked when the playback is finished.
1711  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1712  * @param[in] player    The handle to the media player
1713  * @param[in] callback  The callback function to register
1714  * @param[in] user_data The user data to be passed to the callback function
1715  * @return @c 0 on success,
1716  *         otherwise a negative error value
1717  * @retval #PLAYER_ERROR_NONE Successful
1718  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1719  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1720  * @post  player_completed_cb() will be invoked.
1721  * @see player_unset_completed_cb()
1722  * @see player_completed_cb()
1723  * @see player_start()
1724  */
1725 int player_set_completed_cb(player_h player, player_completed_cb callback, void *user_data);
1726
1727 /**
1728  * @brief Unregisters the callback function.
1729  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1730  * @param[in] player The handle to the media player
1731  * @return @c 0 on success,
1732  *         otherwise a negative error value
1733  * @retval #PLAYER_ERROR_NONE Successful
1734  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1735  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1736  * @see player_set_completed_cb()
1737  */
1738 int player_unset_completed_cb(player_h player);
1739
1740 /**
1741  * @brief Registers a callback function to be invoked when the playback is interrupted or the interrupt is completed.
1742  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1743  * @param[in] player    The handle to the media player
1744  * @param[in] callback  The callback function to register
1745  * @param[in] user_data The user data to be passed to the callback function
1746  * @return @c 0 on success,
1747  *         otherwise a negative error value
1748  * @retval #PLAYER_ERROR_NONE Successful
1749  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1750  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1751  * @post  player_interrupted_cb() will be invoked.
1752  * @see player_unset_interrupted_cb()
1753  * @see #player_interrupted_code_e
1754  * @see player_interrupted_cb()
1755  */
1756 int player_set_interrupted_cb(player_h player, player_interrupted_cb callback, void *user_data);
1757
1758 /**
1759  * @brief Unregisters the callback function.
1760  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1761  * @param[in] player The handle to the media player
1762  * @return @c 0 on success,
1763  *         otherwise a negative error value
1764  * @retval #PLAYER_ERROR_NONE Successful
1765  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1766  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1767  * @see player_set_interrupted_cb()
1768  */
1769 int player_unset_interrupted_cb(player_h player);
1770
1771 /**
1772  * @brief Registers a callback function to be invoked when an error occurs.
1773  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1774  * @param[in] player    The handle to the media player
1775  * @param[in] callback  The callback function to register
1776  * @param[in] user_data The user data to be passed to the callback function
1777  * @return @c 0 on success,
1778  *         otherwise a negative error value
1779  * @retval #PLAYER_ERROR_NONE Successful
1780  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1781  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1782  * @post  player_error_cb() will be invoked.
1783  * @see player_unset_error_cb()
1784  * @see player_error_cb()
1785  */
1786 int player_set_error_cb(player_h player, player_error_cb callback, void *user_data);
1787
1788 /**
1789  * @brief Unregisters the callback function.
1790  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1791  * @param[in] player The handle to the media player
1792  * @return @c 0 on success,
1793  *         otherwise a negative error value
1794  * @retval #PLAYER_ERROR_NONE Successful
1795  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1796  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1797  * @see player_set_error_cb()
1798  */
1799 int player_unset_error_cb(player_h player);
1800
1801 /**
1802  * @brief Registers a callback function to be invoked when there is a change in the buffering status of a media stream.
1803  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1804  * @remarks The media resource should be streamed over the network.
1805  * @param[in] player    The handle to the media player
1806  * @param[in] callback  The callback function to register
1807  * @param[in] user_data The user data to be passed to the callback function
1808  * @return @c 0 on success,
1809  *         otherwise a negative error value
1810  * @retval #PLAYER_ERROR_NONE Successful
1811  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1812  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1813  * @if WEARABLE @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature @endif
1814  * @post  player_buffering_cb() will be invoked.
1815  * @see player_unset_buffering_cb()
1816  * @see player_set_uri()
1817  * @see player_buffering_cb()
1818  */
1819 int player_set_buffering_cb(player_h player, player_buffering_cb callback, void *user_data);
1820
1821 /**
1822  * @brief Unregisters the callback function.
1823  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1824  * @param[in] player The handle to the media player
1825  * @return @c 0 on success,
1826  *         otherwise a negative error value
1827  * @retval #PLAYER_ERROR_NONE Successful
1828  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1829  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1830  * @see player_set_buffering_cb()
1831  */
1832 int player_unset_buffering_cb(player_h player);
1833
1834 /**
1835  * @deprecated Deprecated since 4.0.
1836  * @brief Sets a path to download, progressively.
1837  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1838  * @remarks Progressive download will be started when you invoke player_start().
1839  * @remarks This API must be called before calling the player_prepare() or player_prepare_async() to reflect the download path when the player is building.
1840  * @remarks The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any files are used to download and play located in the internal storage.
1841  * @remarks The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any files are used to download and play located in the external storage.
1842  *
1843  * @param[in]   player The handle to the media player
1844  * @param[in]   path The absolute path to download
1845  * @return @c 0 on success,
1846  *         otherwise a negative error value
1847  * @retval #PLAYER_ERROR_NONE Successful
1848  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1849  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1850  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1851  * @if WEARABLE @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature @endif
1852  * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied
1853  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1854  * @see player_set_progressive_download_message_cb()
1855  * @see player_unset_progressive_download_message_cb()
1856  */
1857 int player_set_progressive_download_path(player_h player, const char *path) TIZEN_DEPRECATED_API;
1858
1859 /**
1860  * @deprecated Deprecated since 4.0.
1861  * @brief Gets the status of progressive download.
1862  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1863  * @param[in] player The handle to the media player
1864  * @param[out] current The current download position (bytes)
1865  * @param[out] total_size The total size of the file (bytes)
1866  * @return @c 0 on success,
1867  *         otherwise a negative error value
1868  * @retval #PLAYER_ERROR_NONE Successful
1869  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1870  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1871  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1872  * @pre The progressive download path must be set by calling player_set_progressive_download_path().
1873  * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause().
1874  */
1875 int player_get_progressive_download_status(player_h player, unsigned long *current, unsigned long *total_size) TIZEN_DEPRECATED_API;
1876
1877 /**
1878  * @deprecated Deprecated since 4.0.
1879  * @brief Registers a callback function to be invoked when progressive download is started or completed.
1880  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1881  * @param[in] player    The handle to the media player
1882  * @param[in] callback  The callback function to register
1883  * @param[in] user_data The user data to be passed to the callback function
1884  * @return @c 0 on success,
1885  *         otherwise a negative error value
1886  * @retval #PLAYER_ERROR_NONE Successful
1887  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1888  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1889  * @if WEARABLE @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature @endif
1890  * @pre The path to download must be set by calling player_set_progressive_download_path().
1891  * @post  player_pd_message_cb() will be invoked.
1892  * @see player_unset_progressive_download_message_cb()
1893  * @see player_set_progressive_download_path()
1894  */
1895 int player_set_progressive_download_message_cb(player_h player, player_pd_message_cb callback, void *user_data) TIZEN_DEPRECATED_API;
1896
1897 /**
1898  * @deprecated Deprecated since 4.0.
1899  * @brief Unregisters the callback function.
1900  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1901  * @param[in] player The handle to the media player
1902  * @return @c 0 on success,
1903  *         otherwise a negative error value
1904  * @retval #PLAYER_ERROR_NONE Successful
1905  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1906  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1907  * @see player_set_progressive_download_message_cb()
1908  */
1909 int player_unset_progressive_download_message_cb(player_h player) TIZEN_DEPRECATED_API;
1910
1911 /**
1912  * @brief Sets the playback rate.
1913  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1914  * @details The default value is @c 1.0.
1915  * @remarks #PLAYER_ERROR_INVALID_OPERATION occurs when streaming playback.
1916  * @remarks No operation is performed, if @a rate is @c 0.
1917  * @remarks The sound is muted, when playback rate is under @c 0.0 and over @c 2.0.
1918  * @param[in] player The handle to the media player
1919  * @param[in] rate The playback rate (-5.0x ~ 5.0x)
1920  * @retval #PLAYER_ERROR_NONE Successful
1921  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1922  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1923  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1924  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1925  */
1926 int player_set_playback_rate(player_h player, float rate);
1927
1928 /**
1929  * @}
1930  */
1931
1932 /**
1933  * @addtogroup CAPI_MEDIA_PLAYER_SUBTITLE_MODULE
1934  * @{
1935  */
1936
1937 /**
1938  * @brief Sets a subtitle path.
1939  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1940  * @remarks Only MicroDVD/SubViewer(*.sub), SAMI(*.smi), and SubRip(*.srt) subtitle formats are supported.
1941  * @remarks The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any files are used to play located in the internal storage.
1942  * @remarks The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any files are used to play located in the external storage.
1943  * @remarks The path value can be @c NULL for reset before calling player_prepare() or player_prepare_async().
1944  *
1945  * @param[in]   player The handle to the media player
1946  * @param[in]   path The absolute path of the subtitle file, it can be @c NULL in the #PLAYER_STATE_IDLE state.
1947  * @return @c 0 on success,
1948  *         otherwise a negative error value
1949  * @retval #PLAYER_ERROR_NONE Successful
1950  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1951  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1952  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1953  * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied
1954  * @retval #PLAYER_ERROR_NO_SUCH_FILE File not found (Since 4.0)
1955  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1956  */
1957 int player_set_subtitle_path(player_h player, const char *path);
1958
1959 /**
1960  * @brief Registers a callback function to be invoked when a subtitle updates.
1961  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1962  * @remarks The callback is called in a separate thread (not in the main loop).
1963  * @param[in] player    The handle to the media player
1964  * @param[in] callback  The callback function to register
1965  * @param[in] user_data The user data to be passed to the callback function
1966  * @return @c 0 on success,
1967  *         otherwise a negative error value
1968  * @retval #PLAYER_ERROR_NONE Successful
1969  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1970  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1971  * @pre The subtitle must be set by calling player_set_subtitle_path().
1972  * @post  player_subtitle_updated_cb() will be invoked.
1973  * @see player_unset_subtitle_updated_cb()
1974  * @see player_subtitle_updated_cb()
1975  * @see player_set_subtitle_path()
1976  */
1977 int player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb callback, void *user_data);
1978
1979 /**
1980  * @brief Unregisters the callback function.
1981  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
1982  * @param[in] player The handle to the media player
1983  * @return @c 0 on success,
1984  *         otherwise a negative error value
1985  * @retval #PLAYER_ERROR_NONE Successful
1986  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1987  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1988  * @see player_set_subtitle_updated_cb()
1989  */
1990 int player_unset_subtitle_updated_cb(player_h player);
1991
1992 /**
1993  * @brief Sets the seek position for the subtitle.
1994  * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif.1
1995  * @remarks Only MicroDVD/SubViewer(*.sub), SAMI(*.smi), and SubRip(*.srt) subtitle formats are supported.
1996  * @param[in]  player The handle to the media player
1997  * @param[in]  millisecond The position in milliseconds from the start to the seek point
1998  * @return @c 0 on success,
1999  *         otherwise a negative error value
2000  * @retval #PLAYER_ERROR_NONE Successful
2001  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2002  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2003  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2004  * @pre The subtitle must be set by calling player_set_subtitle_path().
2005  * @pre The player state must be one of #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
2006  */
2007 int player_set_subtitle_position_offset(player_h player, int millisecond);
2008
2009 /**
2010  * @brief Registers a callback function to be invoked when video stream is changed.
2011  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
2012  * @remarks The stream changing is detected just before rendering operation.
2013  * @remarks The callback is called in a separate thread (not in the main loop).
2014  * @remarks This API must be called before calling the player_prepare() or player_prepare_async()
2015  *          to reflect the requirement when the player is building.
2016  * @param[in] player   The handle to the media player
2017  * @param[in] callback The stream changed callback function to register
2018  * @param[in] user_data The user data to be passed to the callback function
2019  * @return @c 0 on success,
2020  *         otherwise a negative error value
2021  * @retval #PLAYER_ERROR_NONE Successful
2022  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2023  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2024  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
2025  * @post player_video_stream_changed_cb() will be invoked.
2026  * @see player_unset_video_stream_changed_cb()
2027  * @see player_video_stream_changed_cb()
2028  */
2029 int player_set_video_stream_changed_cb(player_h player, player_video_stream_changed_cb callback, void *user_data);
2030
2031 /**
2032  * @brief Unregisters the video stream changed callback function.
2033  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
2034  * @param[in] player The handle to the media player
2035  * @return @c 0 on success,
2036  *         otherwise a negative error value
2037  * @retval #PLAYER_ERROR_NONE Successful
2038  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2039  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2040  * @see player_set_video_stream_changed_cb()
2041  */
2042 int player_unset_video_stream_changed_cb(player_h player);
2043
2044 /**
2045  * @brief Gets current track index.
2046  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
2047  * @details Index starts from 0.
2048  * @param[in] player The handle to the media player
2049  * @param[in] type The type of target stream which is PLAYER_STREAM_TYPE_AUDIO or PLAYER_STREAM_TYPE_TEXT
2050  * @param[out] index  The index of track
2051  * @return @c 0 on success,
2052  *         otherwise a negative error value
2053  * @retval #PLAYER_ERROR_NONE Successful
2054  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2055  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2056  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2057  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2058  */
2059 int player_get_current_track(player_h player, player_stream_type_e type, int *index);
2060
2061 /**
2062  * @brief Gets language code of a track.
2063  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
2064  * @remarks @a code must be released with @c free() by caller
2065  * @param[in] player The handle to the media player
2066  * @param[in] type The type of target stream which is PLAYER_STREAM_TYPE_AUDIO or PLAYER_STREAM_TYPE_TEXT
2067  * @param[in] index  The index of track
2068  * @param[out] code A language code in ISO 639-1. "und" will be returned if the language is undefined.
2069  * @return @c 0 on success,
2070  *         otherwise a negative error value
2071  * @retval #PLAYER_ERROR_NONE Successful
2072  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2073  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2074  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2075  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2076  */
2077 int player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code);
2078
2079 /**
2080  * @brief Gets the track count.
2081  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
2082  * @param[in] player The handle to the media player
2083  * @param[in] type The type of target stream which is PLAYER_STREAM_TYPE_AUDIO or PLAYER_STREAM_TYPE_TEXT
2084  * @param[out] count The number of track
2085  * @return @c 0 on success,
2086  *         otherwise a negative error value
2087  * @retval #PLAYER_ERROR_NONE Successful
2088  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2089  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2090  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2091  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2092  */
2093 int player_get_track_count(player_h player, player_stream_type_e type, int *count);
2094
2095 /**
2096  * @brief Selects a track to play.
2097  * @since_tizen @if WEARABLE 3.0 @else 2.4 @endif
2098  * @param[in] player The handle to the media player
2099  * @param[in] type The type of target stream which is PLAYER_STREAM_TYPE_AUDIO or PLAYER_STREAM_TYPE_TEXT
2100  * @param[in] index  The index of track
2101  * @return @c 0 on success,
2102  *         otherwise a negative error value
2103  * @retval #PLAYER_ERROR_NONE Successful
2104  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2105  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2106  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2107  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2108  * @see player_get_current_track()
2109  */
2110 int player_select_track(player_h player, player_stream_type_e type, int index);
2111
2112 /**
2113  * @}
2114  */
2115
2116 #ifdef __cplusplus
2117 }
2118 #endif
2119
2120 #endif /* __TIZEN_MEDIA_PLAYER_H__ */
2121