[1.0.0] Set so version for compatibility
[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 /**
29  * @brief The player error class define.
30  * @since_tizen 2.3
31  */
32 #define PLAYER_ERROR_CLASS          TIZEN_ERROR_PLAYER | 0x20
33
34 /**
35  * @brief The player custom error class define.
36  * @since_tizen 3.0
37  */
38 #define PLAYER_CUSTOM_ERROR_CLASS   TIZEN_ERROR_PLAYER | 0x1000
39
40 /**
41  * @file player.h
42  * @brief This file contains the media player API.
43  */
44
45 /**
46  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
47  * @{
48  */
49
50 /**
51  * @brief The media player's type handle.
52  * @since_tizen 2.3
53  */
54 typedef struct player_s *player_h;
55
56 /**
57  * @brief Enumeration for media player state.
58  * @since_tizen 2.3
59  */
60 typedef enum {
61         PLAYER_STATE_NONE,          /**< Player is not created */
62         PLAYER_STATE_IDLE,          /**< Player is created, but not prepared */
63         PLAYER_STATE_READY,         /**< Player is ready to play media */
64         PLAYER_STATE_PLAYING,       /**< Player is playing media */
65         PLAYER_STATE_PAUSED,        /**< Player is paused while playing media */
66 } player_state_e;
67
68 /**
69  * @brief Enumeration for media player's error codes.
70  * @since_tizen 2.3
71  */
72 typedef enum {
73         PLAYER_ERROR_NONE               = TIZEN_ERROR_NONE,                             /**< Successful */
74         PLAYER_ERROR_OUT_OF_MEMORY      = TIZEN_ERROR_OUT_OF_MEMORY,                    /**< Out of memory */
75         PLAYER_ERROR_INVALID_PARAMETER  = TIZEN_ERROR_INVALID_PARAMETER,                /**< Invalid parameter */
76         PLAYER_ERROR_NO_SUCH_FILE       = TIZEN_ERROR_NO_SUCH_FILE,                     /**< No such file or directory */
77         PLAYER_ERROR_INVALID_OPERATION  = TIZEN_ERROR_INVALID_OPERATION,                /**< Invalid operation */
78         PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE    = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE,  /**< No space left on the device */
79         PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE    = TIZEN_ERROR_NOT_SUPPORTED,    /**< Not supported Feature */
80         PLAYER_ERROR_SEEK_FAILED        = PLAYER_ERROR_CLASS | 0x01,                    /**< Seek operation failure */
81         PLAYER_ERROR_INVALID_STATE      = PLAYER_ERROR_CLASS | 0x02,                    /**< Invalid state */
82         PLAYER_ERROR_NOT_SUPPORTED_FILE = PLAYER_ERROR_CLASS | 0x03,                    /**< File format not supported */
83         PLAYER_ERROR_INVALID_URI        = PLAYER_ERROR_CLASS | 0x04,                    /**< Invalid URI */
84         PLAYER_ERROR_SOUND_POLICY       = PLAYER_ERROR_CLASS | 0x05,                    /**< Sound policy error */
85         PLAYER_ERROR_CONNECTION_FAILED  = PLAYER_ERROR_CLASS | 0x06,                    /**< Streaming connection failed */
86         PLAYER_ERROR_VIDEO_CAPTURE_FAILED   = PLAYER_ERROR_CLASS | 0x07,                /**< Video capture failed */
87         PLAYER_ERROR_DRM_EXPIRED        = PLAYER_ERROR_CLASS | 0x08,                    /**< Expired license */
88         PLAYER_ERROR_DRM_NO_LICENSE     = PLAYER_ERROR_CLASS | 0x09,                    /**< No license */
89         PLAYER_ERROR_DRM_FUTURE_USE     = PLAYER_ERROR_CLASS | 0x0a,                    /**< License for future use */
90         PLAYER_ERROR_DRM_NOT_PERMITTED  = PLAYER_ERROR_CLASS | 0x0b,                    /**< Format not permitted */
91         PLAYER_ERROR_RESOURCE_LIMIT     = PLAYER_ERROR_CLASS | 0x0c,                    /**< Resource limit */
92         PLAYER_ERROR_PERMISSION_DENIED  = TIZEN_ERROR_PERMISSION_DENIED,                /**< Permission denied */
93         PLAYER_ERROR_SERVICE_DISCONNECTED = PLAYER_ERROR_CLASS | 0x0d,                  /**< Socket connection lost (Since 3.0) */
94         PLAYER_ERROR_BUFFER_SPACE         = TIZEN_ERROR_BUFFER_SPACE,                   /**< No buffer space available (Since 3.0) */
95         PLAYER_ERROR_NOT_SUPPORTED_AUDIO_CODEC = PLAYER_ERROR_CLASS | 0x0e,             /**< Not supported audio codec but video can be played (Since 4.0) */
96         PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC = PLAYER_ERROR_CLASS | 0x0f,             /**< Not supported video codec but audio can be played (Since 4.0) */
97         PLAYER_ERROR_NOT_SUPPORTED_SUBTITLE = PLAYER_ERROR_CLASS | 0x10,                /**< Not supported subtitle format (Since 4.0) */
98         PLAYER_ERROR_NOT_SUPPORTED_FORMAT = PLAYER_ERROR_CLASS | 0x11,                  /**< Not supported format (Since 5.5) */
99         PLAYER_ERROR_NOT_AVAILABLE        = PLAYER_ERROR_CLASS | 0x12,                  /**< Not available operation (Since 5.5)*/
100 } player_error_e;
101
102 /**
103  * @brief Enumeration for media player's interruption type.
104  * @since_tizen 2.3
105  */
106 typedef enum {
107         PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT = 4,    /**< Interrupted by a resource conflict and the player handle will be paused or unprepared */
108 } player_interrupted_code_e;
109
110 /**
111  * @brief Enumeration for display type.
112  * @since_tizen 2.3
113  * @details In case of using #PLAYER_DISPLAY_TYPE_OVERLAY_SYNC_UI, the video is rendering in full scale in the rendering area.\n
114  *          To change the video rendering position, use UI API functions like ecore_wl2_subsurface_exported_surface_move(),
115  *          ecore_wl2_subsurface_exported_surface_resize(), ecore_wl2_subsurface_exported_surface_transform_set(),
116  *          ecore_wl2_subsurface_exported_surface_show() and ecore_wl2_subsurface_exported_surface_commit().\n
117  *          player_set_display_mode(), player_set_display_rotation() and player_set_display_roi_area() cannot be used and
118  *          #PLAYER_ERROR_NOT_AVAILABLE is returned if they are used.\n
119  *          Exported shell handle must be obtained by ecore_wl2_subsurface_exported_surface_handle_get() from Ecore_Wl2_Subsurface.\n
120  *          Then the exported shell handle should be set with player_set_display().\n
121  *          To render the first video buffer, commit by ecore_wl2_window_commit() after player_prepare() of Ecore_Wl2_Subsurface.\n
122  *          Always commit with ecore_wl2_window_commit() with parent surface when the UI changes and the video needs to be synchronized.
123  */
124 typedef enum {
125         PLAYER_DISPLAY_TYPE_OVERLAY = 0,        /**< Overlay surface display */
126         PLAYER_DISPLAY_TYPE_EVAS = 3,           /**< Evas image object surface display (Since 4.0) */
127         PLAYER_DISPLAY_TYPE_NONE = 4,           /**< This disposes of buffers (Since 4.0) */
128         PLAYER_DISPLAY_TYPE_OVERLAY_SYNC_UI = 5 /**< Overlay surface display for synchronization between UI and video (Since 6.5) */
129 } player_display_type_e;
130
131 /**
132  * @brief Enumeration for audio latency mode.
133  * @since_tizen 2.3
134  */
135 typedef enum {
136         AUDIO_LATENCY_MODE_LOW = 0,     /**< Low audio latency mode */
137         AUDIO_LATENCY_MODE_MID,         /**< Middle audio latency mode */
138         AUDIO_LATENCY_MODE_HIGH,        /**< High audio latency mode */
139 } audio_latency_mode_e;
140
141 /**
142  * @brief Enumeration for stream type.
143  * @since_tizen 2.4
144  */
145 typedef enum {
146         PLAYER_STREAM_TYPE_DEFAULT,     /**< Container type */
147         PLAYER_STREAM_TYPE_AUDIO,       /**< Audio element stream type */
148         PLAYER_STREAM_TYPE_VIDEO,       /**< Video element stream type */
149         PLAYER_STREAM_TYPE_TEXT,        /**< Text type */
150 } player_stream_type_e;
151
152 /**
153  * @brief Enumeration of media stream buffer status.
154  * @since_tizen 2.4
155  * @see player_set_media_stream_buffer_max_size()
156  * @see player_set_media_stream_buffer_min_threshold()
157  */
158 typedef enum {
159         PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN, /**< The buffer level is lower than the threshold */
160         PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW, /**< The buffer level is over than the threshold */
161 } player_media_stream_buffer_status_e;
162
163 /**
164  * @brief Enumeration of audio extract option.
165  * @since_tizen 5.5
166  * @see player_set_media_packet_audio_frame_decoded_cb()
167  */
168 typedef enum {
169         PLAYER_AUDIO_EXTRACT_DEFAULT                        = 0x00,   /**< Synchronized multichannel audio stream with the playback clock */
170         PLAYER_AUDIO_EXTRACT_NO_SYNC_WITH_CLOCK             = 0x01,   /**< No synchronized multichannel audio stream with the playback clock */
171         PLAYER_AUDIO_EXTRACT_DEINTERLEAVE                   = 0x02,   /**< Synchronized mono audio stream with the playback clock */
172         PLAYER_AUDIO_EXTRACT_NO_SYNC_AND_DEINTERLEAVE       = 0x03,   /**< No synchronized mono audio stream with playback clock */
173 } player_audio_extract_option_e;
174
175 /**
176  * @brief Enumeration for codec type.
177  * @since_tizen 5.5
178  */
179 typedef enum {
180         PLAYER_CODEC_TYPE_HW,           /**< This is an optional flag for using the H/W codec */
181         PLAYER_CODEC_TYPE_SW,           /**< This is an optional flag for using the S/W codec */
182 } player_codec_type_e;
183
184 /**
185  * @}
186  */
187
188 /**
189  * @addtogroup CAPI_MEDIA_PLAYER_DISPLAY_MODULE
190  * @{
191  */
192
193 /**
194  * @brief The player display handle.
195  * @since_tizen 2.3
196  */
197 typedef void *player_display_h;
198
199 #ifndef GET_DISPLAY
200 /**
201  * @brief Definition for a display handle from evas object.
202  * @since_tizen 2.3
203  */
204 #define GET_DISPLAY(x) (void *)(x)
205 #endif
206
207 /**
208  * @brief Enumeration for display rotation type.
209  * @since_tizen 2.3
210  */
211 typedef enum {
212         PLAYER_DISPLAY_ROTATION_NONE,   /**< Display is not rotated */
213         PLAYER_DISPLAY_ROTATION_90,     /**< Display is rotated 90 degrees */
214         PLAYER_DISPLAY_ROTATION_180,    /**< Display is rotated 180 degrees */
215         PLAYER_DISPLAY_ROTATION_270,    /**< Display is rotated 270 degrees */
216 } player_display_rotation_e;
217
218 /**
219  * @brief Enumeration for display mode.
220  * @since_tizen 2.3
221  */
222 typedef enum {
223         PLAYER_DISPLAY_MODE_LETTER_BOX = 0,     /**< Letter box */
224         PLAYER_DISPLAY_MODE_ORIGIN_SIZE,        /**< Origin size */
225         PLAYER_DISPLAY_MODE_FULL_SCREEN,        /**< Full-screen */
226         PLAYER_DISPLAY_MODE_CROPPED_FULL,       /**< Cropped full-screen */
227         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) */
228         PLAYER_DISPLAY_MODE_DST_ROI,            /**< Dst ROI mode */
229         PLAYER_DISPLAY_MODE_NUM
230 } player_display_mode_e;
231
232 /**
233  * @}
234  */
235
236 /**
237  * @addtogroup CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE
238  * @{
239  */
240
241 /**
242  * @brief Enumeration for media stream content information.
243  * @since_tizen 2.3
244  */
245 typedef enum {
246         PLAYER_CONTENT_INFO_ALBUM,      /**< Album */
247         PLAYER_CONTENT_INFO_ARTIST,     /**< Artist */
248         PLAYER_CONTENT_INFO_AUTHOR,     /**< Author */
249         PLAYER_CONTENT_INFO_GENRE,      /**< Genre */
250         PLAYER_CONTENT_INFO_TITLE,      /**< Title */
251         PLAYER_CONTENT_INFO_YEAR,       /**< Year */
252 } player_content_info_e;
253
254 /**
255  * @}
256  */
257
258
259 /**
260  * @addtogroup CAPI_MEDIA_PLAYER_SUBTITLE_MODULE
261  * @{
262  */
263
264 /**
265  * @brief  Called when the subtitle is updated.
266  * @since_tizen 2.3
267  * @remarks The @a text should not be released and it can be used only in the callback.
268  *          To use outside, make a copy.
269  * @param[in] duration    The duration of the updated subtitle
270  * @param[in] text        The text of the updated subtitle
271  * @param[in] user_data   The user data passed from the callback registration function
272  * @see player_set_subtitle_updated_cb()
273  * @see player_unset_subtitle_updated_cb()
274  */
275 typedef void (*player_subtitle_updated_cb)(unsigned long duration, char *text, void *user_data);
276
277 /**
278  * @}
279  */
280
281 /**
282  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
283  * @{
284  */
285
286 /**
287  * @brief Called when the media player is prepared.
288  * @details It will be invoked when player has reached the begin of stream.
289  * @since_tizen 2.3
290  * @param[in]   user_data  The user data passed from the callback registration function
291  * @pre player_prepare_async() will cause this callback.
292  * @post The player state will be #PLAYER_STATE_READY.
293  * @see player_prepare_async()
294  */
295 typedef void (*player_prepared_cb)(void *user_data);
296
297 /**
298  * @brief Called when the media player is completed.
299  * @details It will be invoked when player has reached the end of the stream.
300  * @since_tizen 2.3
301  * @param[in]   user_data  The user data passed from the callback registration function
302  * @pre It will be invoked when the playback is completed if you register this callback using player_set_completed_cb().
303  * @see player_set_completed_cb()
304  * @see player_unset_completed_cb()
305  */
306 typedef void (*player_completed_cb)(void *user_data);
307
308 /**
309  * @brief Called when the seek operation is completed.
310  * @since_tizen 2.3
311  * @param[in]   user_data  The user data passed from the callback registration function
312  * @see player_set_play_position()
313  * @see player_set_play_position_nsec()
314  */
315 typedef void (*player_seek_completed_cb)(void *user_data);
316
317 /**
318  * @brief Called when the media player is interrupted.
319  * @details If the code is #PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT,
320  *          the player state will be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, or #PLAYER_STATE_PAUSED.
321  *          Application should get exact state by calling player_get_state().
322  * @since_tizen 2.3
323  * @param[in] code        The interrupted error code
324  * @param[in] user_data   The user data passed from the callback registration function
325  * @see player_set_interrupted_cb()
326  * @see player_unset_interrupted_cb()
327  * @see player_get_state()
328  */
329 typedef void (*player_interrupted_cb)(player_interrupted_code_e code, void *user_data);
330
331 /**
332  * @brief Called when an error occurs in the media player.
333  * @details Following error codes can be delivered.
334  *          #PLAYER_ERROR_INVALID_OPERATION
335  *          #PLAYER_ERROR_INVALID_STATE
336  *          #PLAYER_ERROR_INVALID_URI
337  *          #PLAYER_ERROR_CONNECTION_FAILED
338  *          #PLAYER_ERROR_DRM_NOT_PERMITTED
339  *          #PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE
340  *          #PLAYER_ERROR_NOT_SUPPORTED_FILE
341  *          #PLAYER_ERROR_SEEK_FAILED
342  *          #PLAYER_ERROR_SERVICE_DISCONNECTED
343  *          #PLAYER_ERROR_NOT_SUPPORTED_AUDIO_CODEC (Since 4.0)
344  *          #PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC (Since 4.0)
345  *          #PLAYER_ERROR_NOT_SUPPORTED_SUBTITLE (Since 4.0)
346  * @since_tizen 2.3
347  * @param[in] error_code  The error code
348  * @param[in] user_data   The user data passed from the callback registration function
349  * @see player_set_error_cb()
350  * @see player_unset_error_cb()
351  */
352 typedef void (*player_error_cb)(int error_code, void *user_data);
353
354 /**
355  * @brief Called when the video is captured.
356  * @since_tizen 2.3
357  * @remarks The color space format of the captured image is #IMAGE_UTIL_COLORSPACE_RGB888.
358  * @remarks The @a captured_data should not be released and it can be used only in the callback.
359  *          To use outside, make a copy.
360  * @param[in] captured_data     The captured image buffer
361  * @param[in] width             The width of the captured image
362  * @param[in] height            The height of the captured image
363  * @param[in] size              The size of the captured image
364  * @param[in] user_data         The user data passed from the callback registration function
365  * @see player_capture_video()
366  */
367 typedef void (*player_video_captured_cb)(unsigned char *captured_data, int width, int height, unsigned int size, void *user_data);
368
369 /**
370  * @brief Called to register for notifications about delivering media packet when each video frame is decoded.
371  * @since_tizen 2.3
372  * @remarks The UI update code must not be directly invoked.\n
373  * @remarks The @a packet should be released using media_packet_destroy(). \n
374  *          If not, the decoder will fail due to having insufficient buffer space for the decoded frame.
375  *
376  * @param[in] packet      Reference pointer to the media packet
377  * @param[in] user_data   The user data passed from the callback registration function
378  */
379 typedef void (*player_media_packet_video_decoded_cb)(media_packet_h packet, void *user_data);
380
381 /**
382  * @brief Called to register for notifications about delivering media packet when audio data is decoded.
383  * @since_tizen 5.5
384  * @remarks The @a packet should be released by calling media_packet_destroy(). \n
385  *          It is recommended to release it as soon as it is rendered, to avoid memory exhaustion.
386  *
387  * @param[in] packet      Reference pointer to the media packet
388  * @param[in] user_data   The user data passed from the callback registration function
389  */
390 typedef void (*player_media_packet_audio_decoded_cb)(media_packet_h packet, void *user_data);
391
392 /**
393  * @brief Called when the buffer level drops below the threshold of max size or no free space in buffer.
394  * @since_tizen 2.4
395  * @remarks This function is used for media stream playback only.
396  * @param[in] status    The buffer status
397  * @param[in] user_data The user data passed from the callback registration function
398  * @see player_set_media_stream_buffer_status_cb()
399  * @see player_set_media_stream_buffer_max_size()
400  * @see player_set_media_stream_buffer_min_threshold()
401  */
402 typedef void (*player_media_stream_buffer_status_cb)(player_media_stream_buffer_status_e status, void *user_data);
403
404 /**
405  * @brief Called to notify the next push-buffer offset when seeking is occurred.
406  * @details The next push-buffer should produce buffers from the new offset.
407  * @since_tizen 2.4
408  * @remarks This function is used for media stream playback only.
409  * @param[in] offset    The new byte position to seek
410  * @param[in] user_data The user data passed from the callback registration function
411  */
412 typedef void (*player_media_stream_seek_cb)(unsigned long long offset, void *user_data);
413
414 /**
415  * @brief Called to inform about the supported media format MIME type.
416  * @details The supported media format can vary depending on the device capabilities.
417  * @since_tizen 5.5
418  * @param[in] format      The supportable media format MIME type
419  * @param[in] user_data   The user data passed from the callback registration function
420  * @return @c true to continue with the next iteration of the loop, otherwise @c false to break out of the loop
421  * @see #media_format_mimetype_e
422  * @see player_audio_offload_foreach_supported_format()
423  */
424 typedef bool (*player_supported_media_format_cb)(media_format_mimetype_e format, void *user_data);
425
426 /**
427  * @}
428  */
429
430 /**
431  * @addtogroup CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE
432  * @{
433  */
434
435 /**
436  * @brief Called to notify the video stream changed.
437  * @details The video stream changing is detected just before rendering operation.
438  * @since_tizen 2.4
439  * @param[in] width       The width of the captured image
440  * @param[in] height      The height of the captured image
441  * @param[in] fps         The frame per second of the video \n
442  *                        It can be @c 0 if there is no video stream information.
443  * @param[in] bit_rate    The video bit rate [Hz] \n
444  *                        It can be an invalid value if there is no video stream information.
445  * @param[in] user_data   The user data passed from the callback registration function
446  * @see player_set_video_stream_changed_cb()
447  */
448 typedef void (*player_video_stream_changed_cb)(int width, int height, int fps, int bit_rate, void *user_data);
449
450 /**
451  * @}
452  */
453
454 /**
455  * @addtogroup CAPI_MEDIA_PLAYER_STREAMING_MODULE
456  * @{
457  */
458
459 /**
460  * @brief Called when the buffering percentage of the media playback is updated.
461  * @details If the buffer is full, it will return 100%.
462  * @since_tizen 2.3
463  * @param[in] percent     The percentage of buffering completed (0~100)
464  * @param[in] user_data   The user data passed from the callback registration function
465  * @see player_set_buffering_cb()
466  * @see player_unset_buffering_cb()
467  */
468 typedef void (*player_buffering_cb)(int percent, void *user_data);
469
470 /**
471  * @brief Called to notify the streaming variant information.
472  * @details The adaptive streaming protocol(hls, mpeg dash) can support variant stream condition.
473  *          All the streaming variant information can be shared by calling player_foreach_adaptive_variant().
474  * @since_tizen 4.0
475  * @param[in] bandwidth   The bandwidth of the stream can be supportable, this is mandatory parameter
476  * @param[in] width       The width of the stream, this is optional parameter
477  * @param[in] height      The height of the stream, this is optional parameter
478  * @param[in] user_data   The user data passed from the callback registration function
479  * @see player_foreach_adaptive_variant()
480  */
481 typedef void (*player_adaptive_variant_cb)(int bandwidth, int width, int height, void *user_data);
482
483 /**
484  * @}
485  */
486
487 /**
488  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
489  * @{
490  */
491
492 /**
493  * @brief Creates a player handle for playing multimedia content.
494  * @since_tizen 2.3
495  * @remarks You must release @a player by using player_destroy().\n
496  *          Although you can create multiple player handles at the same time,
497  *          the player cannot guarantee proper operation because of limited resources, such as
498  *          audio or display device.
499  *
500  * @param[out] player   A new handle to the media player
501  * @return @c 0 on success,
502  *         otherwise a negative error value
503  * @retval #PLAYER_ERROR_NONE Successful
504  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
505  * @retval #PLAYER_ERROR_OUT_OF_MEMORY Out of memory
506  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
507  * @retval #PLAYER_ERROR_RESOURCE_LIMIT Cannot create more instance due to resource(socket, thread, etc) limitation on system.
508  * @post The player state will be #PLAYER_STATE_IDLE.
509  * @see player_destroy()
510  */
511 int player_create(player_h *player);
512
513 /**
514  * @brief Destroys the media player handle and releases all its resources.
515  * @since_tizen 2.3
516  * @remarks To completely shutdown player operation, call this function with a valid player handle from any player state.
517  * @param[in] player   The handle to the media player to be destroyed
518  * @return @c 0 on success,
519  *         otherwise a negative error value
520  * @retval #PLAYER_ERROR_NONE Successful
521  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
522  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
523  * @pre The player state must be one of #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
524  * @post The player state will be #PLAYER_STATE_NONE.
525  * @see player_create()
526  */
527 int player_destroy(player_h player);
528
529 /**
530  * @brief Prepares the media player for playback.
531  * @since_tizen 2.3
532  * @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.
533  * @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.
534  * @remarks The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from network.
535  * @param[in] player   The handle to the media player
536  * @return @c 0 on success,
537  *         otherwise a negative error value
538  * @retval #PLAYER_ERROR_NONE Successful
539  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
540  * @retval #PLAYER_ERROR_INVALID_URI Invalid URI
541  * @retval #PLAYER_ERROR_NO_SUCH_FILE File not found
542  * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE File not supported
543  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
544  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
545  * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied
546  * @retval #PLAYER_ERROR_NOT_SUPPORTED_AUDIO_CODEC Not support audio codec format (Since 4.0)
547  * @retval #PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC Not support video codec format (Since 4.0)
548  * @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.
549  * @post The player state will be #PLAYER_STATE_READY.
550  * @see player_prepare_async()
551  * @see player_unprepare()
552  * @see player_set_uri()
553  */
554 int player_prepare(player_h player);
555
556 /**
557  * @brief Prepares the media player for playback, asynchronously.
558  * @since_tizen 2.3
559  * @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.
560  *          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.
561  *          The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from network. \n
562  *          Since 5.0: To cancel the asynchronous preparing, call player_unprepare() even in #PLAYER_STATE_IDLE state.
563  * @param[in] player      The handle to the media player
564  * @param[in] callback    The callback function to register
565  * @param[in] user_data   The user data to be passed to the callback function
566  * @return @c 0 on success,
567  *         otherwise a negative error value
568  * @retval #PLAYER_ERROR_NONE Successful
569  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
570  * @retval #PLAYER_ERROR_INVALID_URI Invalid URI
571  * @retval #PLAYER_ERROR_NO_SUCH_FILE File not found
572  * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE File not supported
573  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
574  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
575  * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied
576  * @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.
577  * @post It invokes player_prepared_cb() when playback is prepared.
578  * @see player_prepare()
579  * @see player_prepared_cb()
580  * @see player_unprepare()
581  * @see player_set_uri()
582  */
583 int player_prepare_async(player_h player, player_prepared_cb callback, void *user_data);
584
585 /**
586  * @brief Resets the media player.
587  * @details The most recently used media is reset and no longer associated with the player.
588  *          Playback is no longer possible. If you want to use the player again, you must set the data URI and call
589  *          player_prepare() again.
590  * @since_tizen 2.3
591  * @param[in] player   The handle to the media player
592  * @return @c 0 on success,
593  *         otherwise a negative error value
594  * @retval #PLAYER_ERROR_NONE Successful
595  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
596  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
597  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
598  * @pre Before 5.0: The player state must be one of: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, #PLAYER_STATE_PAUSED. \n
599  * @pre Since 5.0: The player state must be one of: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, #PLAYER_STATE_PAUSED.
600  *                 #PLAYER_STATE_IDLE is allowed only if player preparation was started with player_prepare_async().
601  * @post The player state will be #PLAYER_STATE_IDLE.
602  * @see player_prepare()
603  */
604 int player_unprepare(player_h player);
605
606 /**
607  * @brief Sets the data source (file-path, HTTP or RTSP URI) to use.
608  *
609  * @details Associates media contents, referred to by the URI, with the player.
610  *          If the function call is successful, subsequent calls to player_prepare() and player_start() will start playing the media.
611  * @since_tizen 2.3
612  * @remarks If you use HTTP or RTSP, URI must start with "http://" or "rtsp://". The default protocol is "file://".
613  *          If you provide an invalid URI, you won't receive an error message until you call player_start().
614  * @remarks This function must be called before calling the player_prepare() or player_prepare_async() to build the player based on the URI information.
615  * @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.
616  * @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.
617  * @remarks The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from network.
618  *
619  * @param[in] player   The handle to the media player
620  * @param[in] uri      The content location, such as the file path, the URI of the HTTP or RTSP stream you want to play
621  *
622  * @return @c 0 on success,
623  *         otherwise a negative error value
624  * @retval #PLAYER_ERROR_NONE Successful
625  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
626  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
627  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
628  * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied
629  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
630  * @see player_set_memory_buffer()
631  */
632 int player_set_uri(player_h player, const char *uri);
633
634 /**
635  * @brief Sets memory as the data source.
636  *
637  * @details Associates media content, cached in memory, with the player. Unlike the case of player_set_uri(), the media resides in memory.
638  *          If the function call is successful, subsequent calls to player_prepare() and player_start() will start playing the media.
639  * @since_tizen 2.3
640  * @remarks If you provide an invalid data, you won't receive an error message until you call player_start().
641  * @remarks This function must be called before calling the player_prepare() or player_prepare_async()
642  *          to build the player based on the data.
643  *
644  * @param[in] player   The handle to the media player
645  * @param[in] data     The memory pointer of media data
646  * @param[in] size     The size of media data
647  * @return @c 0 on success,
648  *         otherwise a negative error value
649  * @retval #PLAYER_ERROR_NONE Successful
650  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
651  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
652  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
653  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
654  * @see player_set_uri()
655  */
656 int player_set_memory_buffer(player_h player, const void *data, int size);
657
658 /**
659  * @brief Gets the player's current state.
660  * @since_tizen 2.3
661  * @param[in]  player   The handle to the media player
662  * @param[out] state    The current state of the player
663  * @return @c 0 on success,
664  *         otherwise a negative error value
665  * @retval #PLAYER_ERROR_NONE Successful
666  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
667  * @see #player_state_e
668  */
669 int player_get_state(player_h player, player_state_e *state);
670
671 /**
672  * @brief Sets the player's volume.
673  * @details  Setting this volume adjusts the player's instance volume, not the system volume.
674  *           The valid range is from 0 to 1.0, inclusive (1.0 = 100%). Default value is 1.0.
675  *           To change system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
676  *           Finally, it does not support to set other value into each channel currently.
677  * @since_tizen 2.3
678  * @param[in] player   The handle to the media player
679  * @param[in] left     The left volume scalar
680  * @param[in] right    The right volume scalar
681  * @return @c 0 on success,
682  *         otherwise a negative error value
683  * @retval #PLAYER_ERROR_NONE Successful
684  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
685  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
686  * @see player_get_volume()
687  */
688 int player_set_volume(player_h player, float left, float right);
689
690 /**
691  * @brief Gets the player's current volume factor.
692  * @details The range of @a left and @a right is from @c 0 to @c 1.0, inclusive (1.0 = 100%).
693  *          This function gets the player volume, not the system volume.
694  *          To get the system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
695  * @since_tizen 2.3
696  * @param[in]  player   The handle to the media player
697  * @param[out] left     The current left volume scalar
698  * @param[out] right    The current right volume scalar
699  * @return @c 0 on success,
700  *         otherwise a negative error value
701  * @retval #PLAYER_ERROR_NONE Successful
702  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
703  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
704  * @see player_set_volume()
705  */
706 int player_get_volume(player_h player, float *left, float *right);
707
708 /**
709  * @brief Sets the player's sound manager stream information.
710  * @since_tizen 3.0
711  * @remarks You can set sound stream information including audio routing and volume type.
712  *          For more details, please refer to sound_manager.h
713  * @remarks This function must be called before calling the player_prepare() or player_prepare_async()
714  *          to reflect the sound stream information when the player is building.
715  * @remarks This function is related to the following feature:\n
716  *          %http://tizen.org/feature/multimedia.player.stream_info\n
717  *          If this feature is not supported, the stream_type of the player is fixed to the #SOUND_STREAM_TYPE_MEDIA.
718  * @param[in] player      The handle to the media player
719  * @param[in] stream_info The sound manager info type
720  * @return @c 0 on success,
721  *         otherwise a negative error value
722  * @retval #PLAYER_ERROR_NONE Successful
723  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
724  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
725  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
726  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
727  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create().
728  * @see #sound_stream_info_h
729  * @see sound_manager_create_stream_information()
730  * @see sound_manager_destroy_stream_information()
731  * @par Example
732    @code
733        #include <player.h>
734        #include <sound_manager.h>
735        ...
736        player_h player = NULL;
737        sound_stream_info_h stream_info = NULL;
738        sound_stream_type_e stream_type = SOUND_STREAM_TYPE_MEDIA;
739        ...
740        sound_manager_create_stream_information (stream_type, _focus_callback, use_data, &stream_info);
741        player_create (&player);
742        player_set_sound_stream_info (player, stream_info);
743        ...
744        player_prepare_async (player, _prepared_cb, udata);
745        ...
746    @endcode
747  */
748 int player_set_sound_stream_info(player_h player, sound_stream_info_h stream_info);
749
750 /**
751  * @brief Sets the audio latency mode.
752  * @since_tizen 2.3
753  * @remarks The default audio latency mode of the player is #AUDIO_LATENCY_MODE_MID.
754  *          To get the current audio latency mode, use player_get_audio_latency_mode().
755  *          If it's high mode, audio output interval can be increased so, it can keep more audio data to play.
756  *          But, state transition like pause or resume can be more slower than default(mid) mode.
757  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
758  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE and
759  *          this will not work at all even if it was called before enabling offload. (Since 5.5)
760  * @param[in] player       The handle to the media player
761  * @param[in] latency_mode The latency mode to be applied to the audio
762  * @return @c 0 on success,
763  *         otherwise a negative error value
764  * @retval #PLAYER_ERROR_NONE Successful
765  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
766  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
767  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
768  * @see #audio_latency_mode_e
769  * @see player_get_audio_latency_mode()
770  * @see player_audio_offload_set_enabled()
771  * @see player_audio_offload_is_enabled()
772  */
773 int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_mode);
774
775 /**
776  * @brief Gets the current audio latency mode.
777  * @since_tizen 2.3
778  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
779  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
780  * @param[in] player        The handle to the media player
781  * @param[out] latency_mode The latency mode to get from the audio
782  * @return @c 0 on success,
783  *         otherwise a negative error value
784  * @retval #PLAYER_ERROR_NONE Successful
785  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
786  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
787  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
788  * @see #audio_latency_mode_e
789  * @see player_set_audio_latency_mode()
790  * @see player_audio_offload_set_enabled()
791  * @see player_audio_offload_is_enabled()
792  */
793 int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *latency_mode);
794
795 /**
796  * @brief Starts or resumes playback.
797  * @details Plays current media content, or resumes playback if the player is paused or buffering during HTTP streaming play.
798  * @since_tizen 2.3
799  * @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.
800  * @remarks Since 3.0: \n
801  *          Sound can be mixed with other sounds, if you don't control the stream focus in sound-manager module.\n
802  *          You can refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE.
803  * @remarks Since 5.0: \n
804  *          In case of HTTP streaming playback, the player could be internally paused for buffering.
805  *          If the application calls this function during the buffering, the playback will be resumed by force
806  *          and the buffering message posting by player_buffering_cb() will be stopped.
807  * @param[in]   player The handle to the media player
808  * @return @c 0 on success,
809  *         otherwise a negative error value
810  * @retval #PLAYER_ERROR_NONE Successful
811  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
812  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
813  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
814  * @retval #PLAYER_ERROR_CONNECTION_FAILED Network connection failed
815  * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
816  * @pre Before 5.0: The player state must be #PLAYER_STATE_READY or #PLAYER_STATE_PAUSED. \n
817  * @pre Since 5.0: The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
818  * @post The player state will be #PLAYER_STATE_PLAYING.
819  * @post It invokes player_completed_cb() when playback completes, if you set a callback with player_set_completed_cb().
820  * @see player_prepare()
821  * @see player_prepare_async()
822  * @see player_stop()
823  * @see player_pause()
824  * @see player_set_completed_cb()
825  * @see player_completed_cb()
826  * @see player_set_display_visible()
827  * @see player_set_buffering_cb()
828  * @see player_buffering_cb()
829  */
830 int player_start(player_h player);
831
832 /**
833  * @brief Stops playing media content.
834  * @since_tizen 2.3
835  * @param[in]   player The handle to the media player
836  * @return @c 0 on success,
837  *         otherwise a negative error value
838  * @retval #PLAYER_ERROR_NONE Successful
839  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid state
840  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
841  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
842  * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
843  * @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().
844  * @post The player state will be #PLAYER_STATE_READY.
845  * @see player_start()
846  * @see player_pause()
847  */
848 int player_stop(player_h player);
849
850 /**
851  * @brief Pauses the player.
852  * @since_tizen 2.3
853  * @remarks You can resume playback using player_start().
854  *
855  * @param[in]   player The handle to the media player
856  * @return @c 0 on success,
857  *         otherwise a negative error value
858  * @retval #PLAYER_ERROR_NONE Successful
859  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid state
860  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
861  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
862  * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error
863  * @pre The player state must be set to #PLAYER_STATE_PLAYING.
864  * @post The player state will be #PLAYER_STATE_PAUSED.
865  * @see player_start()
866  */
867 int player_pause(player_h player);
868
869 /**
870  * @brief Sets the seek position for playback, asynchronously.
871  * @since_tizen 2.3
872  * @remarks This function will trigger the seeking operation on player instance like in the case of player_set_play_position_nsec().
873  *          Normally application needs to wait for player_seek_completed_cb() before calling setting position function again.
874  *          Otherwise it will return #PLAYER_ERROR_SEEK_FAILED.
875  * @remarks Calling player_pause() or player_start() before player_seek_completed_cb() is invoked will cause #PLAYER_ERROR_INVALID_OPERATION to be returned.
876  * @remarks Please note that if application is playing external media data via player_set_media_stream_info(),
877  *          then consecutive calling of this function will always succeed and there is no need to wait for player_seek_completed_cb()
878  *          before next calling of this function.(Since 3.0)
879  * @remarks Even if you don't set visible to true by calling player_set_display_visible(),
880  *          the video will be shown when the player_seek_completed_cb() is invoked.
881  * @remarks In case of non-seekable content, the function will return #PLAYER_ERROR_INVALID_OPERATION
882  *          and the player will keep playing without changing the play position.
883  * @param[in] player        The handle to the media player
884  * @param[in] milliseconds  The position in milliseconds from the start to the seek point
885  * @param[in] accurate      If @c true the nearest frame position is returned, but this might be considerably slow,
886  *                          if @c false the nearest key frame position is returned, this might be faster but less accurate.
887  * @param[in] callback      The callback function to register
888  * @param[in] user_data     The user data to be passed to the callback function
889  * @return @c 0 on success,
890  *         otherwise a negative error value
891  * @retval #PLAYER_ERROR_NONE Successful
892  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
893  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
894  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
895  * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
896  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
897  * @post It invokes player_seek_completed_cb() when seek operation completes, if you set a callback.
898  * @see player_get_play_position()
899  * @see player_set_play_position_nsec()
900  * @see player_get_play_position_nsec()
901  */
902 int player_set_play_position(player_h player, int milliseconds, bool accurate, player_seek_completed_cb callback, void *user_data);
903
904 /**
905  * @brief Sets the seek position in nanoseconds for playback, asynchronously.
906  * @since_tizen 5.0
907  * @remarks This function will trigger the seeking operation on player instance like in the case of player_set_play_position().
908  *          Normally application needs to wait for player_seek_completed_cb() before calling setting position function again.
909  *          Otherwise it will return #PLAYER_ERROR_SEEK_FAILED.
910  * @remarks Calling player_pause() or player_start() before player_seek_completed_cb() is invoked will cause #PLAYER_ERROR_INVALID_OPERATION to be returned.
911  * @remarks Please note that if application is playing external media data via player_set_media_stream_info(),
912  *          then consecutive calling of this function will always succeed and there is no need to wait for player_seek_completed_cb()
913  *          before next calling of this function.
914  * @remarks Even if you don't set visible to true by calling player_set_display_visible(),
915  *          the video will be shown when the player_seek_completed_cb() is invoked.
916  * @remarks In case of non-seekable content, the function will return #PLAYER_ERROR_INVALID_OPERATION
917  *          and the player will keep playing without changing the play position.
918  * @param[in] player        The handle to the media player
919  * @param[in] nanoseconds   The position in nanoseconds from the start to the seek point
920  * @param[in] accurate      If @c true the nearest frame position is returned, but this might be considerably slow,
921  *                          if @c false the nearest key frame position is returned, this might be faster but less accurate.
922  * @param[in] callback      The callback function to register
923  * @param[in] user_data     The user data to be passed to the callback function
924  * @return @c 0 on success,
925  *         otherwise a negative error value
926  * @retval #PLAYER_ERROR_NONE Successful
927  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
928  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
929  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
930  * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
931  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
932  * @post It invokes player_seek_completed_cb() when seek operation completes, if you set a callback.
933  * @see player_set_play_position()
934  * @see player_get_play_position()
935  * @see player_get_play_position_nsec()
936  */
937 int player_set_play_position_nsec(player_h player, int64_t nanoseconds, bool accurate, player_seek_completed_cb callback, void *user_data);
938
939 /**
940  * @brief Gets the current position in milliseconds.
941  * @since_tizen 2.3
942  * @param[in]   player        The handle to the media player
943  * @param[out]  milliseconds  The current position in milliseconds
944  * @return @c 0 on success,
945  *         otherwise a negative error value
946  * @retval #PLAYER_ERROR_NONE Successful
947  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
948  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
949  * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
950  * @see player_set_play_position()
951  * @see player_set_play_position_nsec()
952  * @see player_get_play_position_nsec()
953  */
954 int player_get_play_position(player_h player, int *milliseconds);
955
956 /**
957  * @brief Gets the current position in nanoseconds.
958  * @since_tizen 5.0
959  * @param[in]   player        The handle to the media player
960  * @param[out]  nanoseconds   The current position in nanoseconds
961  * @return @c 0 on success,
962  *         otherwise a negative error value
963  * @retval #PLAYER_ERROR_NONE Successful
964  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
965  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
966  * @retval #PLAYER_ERROR_SEEK_FAILED Seek operation failure
967  * @see player_set_play_position()
968  * @see player_get_play_position()
969  * @see player_set_play_position_nsec()
970  */
971 int player_get_play_position_nsec(player_h player, int64_t *nanoseconds);
972
973 /**
974  * @brief Sets the player's mute status.
975  * @details If the mute status is @c true, no sounds are played.
976  *          If it is @c false, sounds are played at the previously set volume level.
977  *          Until this function is called, by default the player is not muted.
978  * @since_tizen 2.3
979  * @param[in]   player The handle to the media player
980  * @param[in]   muted  The new mute status: (@c true = mute, @c false = not muted)
981  * @return @c 0 on success,
982  *         otherwise a negative error value
983  * @retval #PLAYER_ERROR_NONE Successful
984  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
985  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
986  * @see player_is_muted()
987  */
988 int player_set_mute(player_h player, bool muted);
989
990 /**
991  * @brief Gets the player's mute status.
992  * @details If the mute status is @c true, no sounds are played.
993  *          If it is @c false, sounds are played at the previously set volume level.
994  * @since_tizen 2.3
995  * @param[in]   player The handle to the media player
996  * @param[out]  muted  The current mute status: (@c true = mute, @c false = not muted)
997  * @return @c 0 on success,
998  *         otherwise a negative error value
999  * @retval #PLAYER_ERROR_NONE Successful
1000  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1001  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1002  * @see player_set_mute()
1003  */
1004 int player_is_muted(player_h player, bool *muted);
1005
1006 /**
1007  * @brief Sets the player's looping status.
1008  * @details If the looping status is @c true, playback automatically restarts upon finishing.
1009  *          If it is @c false, it won't. The default value is @c false.
1010  * @since_tizen 2.3
1011  * @param[in]   player  The handle to the media player
1012  * @param[in]   looping The new looping status: (@c true = looping, @c false = non-looping )
1013  * @return @c 0 on success,
1014  *         otherwise a negative error value
1015  * @retval #PLAYER_ERROR_NONE Successful
1016  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1017  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1018  * @see player_is_looping()
1019  */
1020 int player_set_looping(player_h player, bool looping);
1021
1022 /**
1023  * @brief Gets the player's looping status.
1024  * @details If the looping status is @c true, playback automatically restarts upon finishing.
1025  *          If it is @c false, it won't.
1026  * @since_tizen 2.3
1027  * @param[in]   player  The handle to the media player
1028  * @param[out]  looping The looping status: (@c true = looping, @c false = non-looping )
1029  * @return @c 0 on success,
1030  *         otherwise a negative error value
1031  * @retval #PLAYER_ERROR_NONE Successful
1032  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1033  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1034  * @see player_set_looping()
1035  */
1036 int player_is_looping(player_h player, bool *looping);
1037
1038 /**
1039  * @brief Sets the video display.
1040  * @since_tizen 2.3
1041  * @remarks To get @a display to set, use #GET_DISPLAY().
1042  * @remarks We are not supporting changing display.
1043  * @remarks This function must be called before calling the player_prepare() or player_prepare_async() \n
1044  *          to reflect the display type.
1045  * @remarks This function must be called in main thread of application.
1046  *          Otherwise, it will return #PLAYER_ERROR_INVALID_OPERATION by internal restriction.
1047  *          To avoid #PLAYER_ERROR_INVALID_OPERATION in sub thread, ecore_thread_main_loop_begin() and
1048  *          ecore_thread_main_loop_end() can be used, but deadlock can be also occurred if main thread is busy.
1049  *          So, it's not recommended to use them. (since 5.0)
1050  * @param[in]   player  The handle to the media player
1051  * @param[in]   type    The display type
1052  * @param[in]   display The handle to display
1053  * @return @c 0 on success,
1054  *         otherwise a negative error value
1055  * @retval #PLAYER_ERROR_NONE Successful
1056  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1057  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1058  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1059  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1060  * @see #player_display_type_e
1061  * @see player_set_display_mode()
1062  * @see player_set_display_roi_area()
1063  * @see player_set_display_visible()
1064  * @see player_set_display_rotation()
1065  * @see ecore_thread_main_loop_begin()
1066  * @see ecore_thread_main_loop_end()
1067  */
1068 int player_set_display(player_h player, player_display_type_e type, player_display_h display);
1069
1070 /**
1071  * @brief Sets a callback function for getting the decoded video frame.
1072  * @since_tizen 2.3
1073  * @remarks This function must be called before calling player_prepare() or player_prepare_async().\n
1074  *          A registered callback is called in a separate thread (not in the main loop).\n
1075  *          A video frame can be retrieved using a registered callback as a media packet.\n
1076  *          The callback function holds the same buffer that will be drawn on the display device.\n
1077  *          So if you change the media packet in a registered callback, it will be displayed on the device\n
1078  *          and the media packet is available until it's destroyed by media_packet_destroy().\n
1079  *          The packet have to be destroyed as quickly as possible after rendering the packet\n
1080  *          and all the packets have to be destroyed before player_unprepare() is called.\n
1081  * @remarks If the content is encrypted or there are copyright issues with it,
1082  *          this function could be unsupported depending on the DRM policy.
1083  * @param[in] player    The handle to the media player
1084  * @param[in] callback  The callback function to be registered
1085  * @param[in] user_data The user data to be passed to the callback function
1086  * @return @c 0 on success,
1087  *         otherwise a negative error value
1088  * @retval #PLAYER_ERROR_NONE Successful
1089  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1090  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
1091  * @pre The player's state must be #PLAYER_STATE_IDLE. And, #PLAYER_DISPLAY_TYPE_NONE must be set by calling player_set_display().
1092  * @see player_unset_media_packet_video_frame_decoded_cb()
1093  */
1094 int player_set_media_packet_video_frame_decoded_cb(player_h player, player_media_packet_video_decoded_cb callback, void *user_data);
1095
1096 /**
1097  * @brief Unsets the callback notifying the decoded video frame.
1098  * @since_tizen 2.3
1099  * @param[in] player The handle to the media player
1100  * @return @c 0 on success,
1101  *         otherwise a negative error value
1102  * @retval #PLAYER_ERROR_NONE Successful
1103  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1104  * @pre The player's state must be #PLAYER_STATE_READY or #PLAYER_STATE_IDLE
1105  * @see player_set_media_packet_video_frame_decoded_cb()
1106  */
1107 int player_unset_media_packet_video_frame_decoded_cb(player_h player);
1108
1109 /**
1110  * @brief Sets a callback function for getting the decoded audio data.
1111  * @details This function is used to get audio PCM data of input media content via registered callback.\n
1112  *          An application can specify the output PCM format by @ref CAPI_MEDIA_TOOL_MEDIA_FORMAT_MODULE API.
1113  * @since_tizen 5.5
1114  * @remarks This function must be called before calling player_prepare() or player_prepare_async().\n
1115  *          A registered callback is called in a separate thread (not in the main loop).\n
1116  *          The audio PCM data can be retrieved using a registered callback as a media packet
1117  *          and it is available until it's destroyed by media_packet_destroy().\n
1118  *          The packet has to be destroyed as quickly as possible after rendering the data\n
1119  *          and all the packets have to be destroyed before player_unprepare() is called.\n
1120  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
1121  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE and
1122  *          this will not work at all even if this was called before enabling offload.
1123  * @remarks This function could be unavailable depending on the audio codec type and
1124  *          this will return #PLAYER_ERROR_NOT_AVAILABLE.
1125  * @remarks If the content is encrypted or there are copyright issues with it,
1126  *          this function could be unsupported depending on the DRM policy.
1127  * @param[in] player     The handle to the media player
1128  * @param[in] format     The media format handle about required audio PCM specification.
1129  *                       This format has to include PCM MIME type, audio channel and sampling rate.
1130  *                       If the format is NULL, the original PCM format or platform default PCM format will be applied.
1131  * @param[in] opt        The audio extract option
1132  * @param[in] callback   The callback function to be registered
1133  * @param[in] user_data  The user data to be passed to the callback function
1134  * @return @c 0 on success,
1135  *         otherwise a negative error value
1136  * @retval #PLAYER_ERROR_NONE Successful
1137  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1138  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
1139  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1140  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available
1141  * @pre The player's state must be #PLAYER_STATE_IDLE.
1142  * @see player_unset_media_packet_audio_frame_decoded_cb()
1143  * @see player_audio_offload_set_enabled()
1144  * @see player_audio_offload_is_enabled()
1145  * @see player_set_audio_codec_type()
1146  * @see player_get_audio_codec_type()
1147  * @par Example
1148    @code
1149       #include <player.h>
1150       #include <media_format.h>
1151        ...
1152        player_h player = NULL;
1153        media_format_h a_format = NULL;
1154        ...
1155        media_format_create(&a_format);
1156        media_format_set_audio_mime(a_format, MEDIA_FORMAT_PCM_F32LE);
1157        media_format_set_audio_channel(a_format, 2);
1158        media_format_set_audio_samplerate(a_format, 44100);
1159
1160        player_set_media_packet_audio_frame_decoded_cb(player, a_format, PLAYER_AUDIO_EXTRACT_DEFAULT, _audio_pcm_cb, udata);
1161
1162        media_format_unref(a_format);
1163        ...
1164    @endcode
1165  */
1166 int player_set_media_packet_audio_frame_decoded_cb(player_h player, media_format_h format,
1167                 player_audio_extract_option_e opt, player_media_packet_audio_decoded_cb callback, void *user_data);
1168
1169 /**
1170  * @brief Unsets the callback notifying the decoded audio data.
1171  * @since_tizen 5.5
1172  * @remarks Depending on the audio codec type or by enabling audio offload,
1173  *          this function could be unavailable and this will return #PLAYER_ERROR_NOT_AVAILABLE.
1174  * @param[in] player The handle to the media player
1175  * @return @c 0 on success,
1176  *         otherwise a negative error value
1177  * @retval #PLAYER_ERROR_NONE Successful
1178  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1179  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
1180  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available
1181  * @pre The player's state must be #PLAYER_STATE_READY or #PLAYER_STATE_IDLE
1182  * @see player_set_media_packet_audio_frame_decoded_cb()
1183  * @see player_audio_offload_set_enabled()
1184  * @see player_audio_offload_is_enabled()
1185  * @see player_set_audio_codec_type()
1186  * @see player_get_audio_codec_type()
1187  */
1188 int player_unset_media_packet_audio_frame_decoded_cb(player_h player);
1189
1190 /**
1191  * @brief  Pushes elementary stream to decode audio or video.
1192  * @since_tizen 2.4
1193  * @remarks player_set_media_stream_info() must be called before using this function.
1194  * @remarks The available buffer size can be set by calling player_set_media_stream_buffer_max_size().
1195  *          If there is no available buffer space, this function will return error since 3.0.
1196  * @param[in]  player   The handle to media player
1197  * @param[in]  packet   The media packet to decode
1198  * @return @c 0 on success,
1199  *         otherwise a negative error value
1200  * @retval #PLAYER_ERROR_NONE Successful
1201  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1202  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
1203  * @retval #PLAYER_ERROR_NOT_SUPPORTED_FILE File not supported
1204  * @retval #PLAYER_ERROR_BUFFER_SPACE No buffer space available (since 3.0)
1205  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation (since 3.0)
1206  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1207  * @see player_set_media_stream_info()
1208  * @see player_set_media_stream_buffer_max_size()
1209  */
1210 int player_push_media_stream(player_h player, media_packet_h packet);
1211
1212 /**
1213  * @brief Retrieves all supported media formats for the playback of external media stream.
1214  * @details The supported media format can vary depending on the device capabilities.
1215  * @since_tizen 5.5
1216  * @param[in] player      The handle to the media player
1217  * @param[in] callback    The iteration callback function
1218  * @param[in] user_data   The user data to be passed to the callback function
1219  * @return @c 0 on success,
1220  *         otherwise a negative error value
1221  * @retval #PLAYER_ERROR_NONE Successful
1222  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1223  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1224  * @see player_supported_media_format_cb()
1225  * @see player_set_media_stream_info()
1226  * @see player_push_media_stream()
1227  */
1228 int player_foreach_media_stream_supported_format(player_h player, player_supported_media_format_cb callback, void *user_data);
1229
1230 /**
1231  * @brief  Sets contents information for media stream.
1232  * @since_tizen 2.4
1233  * @remarks AV format must be set before pushing elementary stream with player_push_media_stream().
1234  * @remarks This function must be called before calling the player_prepare() or player_prepare_async()
1235  *          to reflect the media information.
1236  * @remarks The supported media format MIME type can be checked
1237  *          by calling player_foreach_media_stream_supported_format(). (Since 5.5)
1238  * @param[in] player The handle to media player
1239  * @param[in] type   The type of target stream
1240  * @param[in] format The media format to set media information
1241  * @return @c 0 on success,
1242  *         otherwise a negative error value
1243  * @retval #PLAYER_ERROR_NONE Successful
1244  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1245  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
1246  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1247  * @retval #PLAYER_ERROR_NOT_SUPPORTED_FORMAT Not supported format (Since 5.5)
1248  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1249  * @see player_push_media_stream()
1250  * @see player_foreach_media_stream_supported_format()
1251  */
1252 int player_set_media_stream_info(player_h player, player_stream_type_e type, media_format_h format);
1253
1254 /**
1255  * @brief Sets a callback function to be invoked when buffer underrun or overflow is occurred.
1256  * @since_tizen 2.4
1257  * @remarks This function is used for media stream playback only.
1258  * @remarks The callback is called in a separate thread (not in the main loop).
1259  * @param[in] player    The handle to the media player
1260  * @param[in] type      The type of target stream
1261  * @param[in] callback  The buffer status callback function to register
1262  * @param[in] user_data The user data to be passed to the callback function
1263  * @return @c 0 on success,
1264  *         otherwise a negative error value
1265  * @retval #PLAYER_ERROR_NONE Successful
1266  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1267  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1268  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1269  * @post player_media_stream_buffer_status_cb() will be invoked.
1270  * @see player_unset_media_stream_buffer_status_cb()
1271  * @see player_media_stream_buffer_status_cb()
1272  */
1273 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);
1274
1275 /**
1276  * @brief Unsets the buffer status callback function.
1277  * @since_tizen 2.4
1278  * @remarks This function is used for media stream playback only.
1279  * @param[in] player The handle to the media player
1280  * @param[in] type   The type of target stream
1281  * @return @c 0 on success,
1282  *         otherwise a negative error value
1283  * @retval #PLAYER_ERROR_NONE Successful
1284  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1285  * @see player_set_media_stream_buffer_status_cb()
1286  */
1287 int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_type_e type);
1288
1289 /**
1290  * @brief Sets a callback function to be invoked when seeking is occurred.
1291  * @since_tizen 2.4
1292  * @remarks This function is used for media stream playback only.
1293  * @remarks The callback is called in a separate thread (not in the main loop).
1294  * @param[in] player    The handle to the media player
1295  * @param[in] type      The type of target stream
1296  * @param[in] callback  The callback function to register
1297  * @param[in] user_data The user data to be passed to the callback function
1298  * @return @c 0 on success,
1299  *         otherwise a negative error value
1300  * @retval #PLAYER_ERROR_NONE Successful
1301  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1302  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1303  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1304  * @post player_media_stream_seek_cb() will be invoked.
1305  * @see player_unset_media_stream_seek_cb()
1306  * @see player_media_stream_seek_cb()
1307  */
1308 int player_set_media_stream_seek_cb(player_h player, player_stream_type_e type, player_media_stream_seek_cb callback, void *user_data);
1309
1310 /**
1311  * @brief Unsets the seek callback function.
1312  * @since_tizen 2.4
1313  * @param[in] player The handle to the media player
1314  * @param[in] type   The type of target stream
1315  * @return @c 0 on success,
1316  *         otherwise a negative error value
1317  * @retval #PLAYER_ERROR_NONE Successful
1318  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1319  * @see player_set_media_stream_seek_cb()
1320  */
1321 int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e type);
1322
1323 /**
1324  * @brief Sets the max size bytes of buffer.
1325  * @since_tizen 2.4
1326  * @remarks This function is used for media stream playback only.
1327  * @remarks If the buffer level over the max size, player_media_stream_buffer_status_cb() will be invoked with overflow status.
1328  * @param[in] player   The handle to the media player
1329  * @param[in] type     The type of target stream
1330  * @param[in] max_size The max bytes of buffer, it has to be bigger than zero. (default: 200000)
1331  * @return @c 0 on success,
1332  *         otherwise a negative error value
1333  * @retval #PLAYER_ERROR_NONE Successful
1334  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1335  * @see player_get_media_stream_buffer_max_size()
1336  * @see player_media_stream_buffer_status_cb()
1337  */
1338 int player_set_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long max_size);
1339
1340 /**
1341  * @brief Gets the max size bytes of buffer.
1342  * @since_tizen 2.4
1343  * @remarks This function is used for media stream playback only.
1344  * @remarks If the buffer level over the max size, player_media_stream_buffer_status_cb() will be invoked with overflow status.
1345  * @param[in] player    The handle to the media player
1346  * @param[in] type      The type of target stream
1347  * @param[out] max_size The max bytes of buffer
1348  * @return @c 0 on success,
1349  *         otherwise a negative error value
1350  * @retval #PLAYER_ERROR_NONE Successful
1351  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1352  * @see player_set_media_stream_buffer_max_size()
1353  * @see player_media_stream_buffer_status_cb()
1354  */
1355 int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long *max_size);
1356
1357 /**
1358  * @brief Sets the buffer threshold percent of buffer.
1359  * @since_tizen 2.4
1360  * @remarks This function is used for media stream playback only.
1361  * @remarks If the buffer level drops below the percent value, player_media_stream_buffer_status_cb() will be invoked with underrun status.
1362  * @param[in] player  The handle to the media player
1363  * @param[in] type    The type of target stream
1364  * @param[in] percent The minimum threshold(0~100) of buffer (default: 0)
1365  * @return @c 0 on success,
1366  *         otherwise a negative error value
1367  * @retval #PLAYER_ERROR_NONE Successful
1368  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1369  * @see player_get_media_stream_buffer_min_threshold()
1370  * @see player_media_stream_buffer_status_cb()
1371  */
1372 int player_set_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int percent);
1373
1374 /**
1375  * @brief Gets the buffer threshold percent of buffer.
1376  * @since_tizen 2.4
1377  * @remarks This function is used for media stream playback only.
1378  * @remarks If the buffer level drops below the percent value, player_media_stream_buffer_status_cb() will be invoked with underrun status.
1379  * @param[in] player   The handle to the media player
1380  * @param[in] type     The type of target stream
1381  * @param[out] percent The minimum threshold(0~100) of buffer
1382  * @return @c 0 on success,
1383  *         otherwise a negative error value
1384  * @retval #PLAYER_ERROR_NONE Successful
1385  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1386  * @see player_set_media_stream_buffer_min_threshold()
1387  * @see player_media_stream_buffer_status_cb()
1388  */
1389 int player_get_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int *percent);
1390
1391 /**
1392  * @}
1393  */
1394
1395 /**
1396  * @addtogroup CAPI_MEDIA_PLAYER_DISPLAY_MODULE
1397  * @{
1398  */
1399
1400 /**
1401  * @brief Sets the video display mode.
1402  * @since_tizen 2.3
1403  * @remarks If no display is set, no operation is performed.
1404  * @param[in] player   The handle to the media player
1405  * @param[in] mode     The display mode
1406  * @return @c 0 on success,
1407  *         otherwise a negative error value
1408  * @retval #PLAYER_ERROR_NONE Successful
1409  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1410  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1411  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 6.5)
1412  * @see #player_display_mode_e
1413  * @see player_set_display()
1414  * @see player_get_display_mode()
1415  */
1416 int player_set_display_mode(player_h player, player_display_mode_e mode);
1417
1418 /**
1419  * @brief Gets the video display mode.
1420  * @since_tizen 2.3
1421  * @remarks If no display is set, no operation is performed.
1422  * @param[in] player The handle to the media player
1423  * @param[out] mode  The current display mode
1424  * @return @c 0 on success,
1425  *         otherwise a negative error value
1426  * @retval  #PLAYER_ERROR_NONE Successful
1427  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1428  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1429  * @retval  #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 6.5)
1430  * @see #player_display_mode_e
1431  * @see player_set_display_mode()
1432  */
1433 int player_get_display_mode(player_h player, player_display_mode_e *mode);
1434
1435 /**
1436  * @brief Sets the ROI (Region Of Interest) area of display.
1437  * @since_tizen 3.0
1438  * @remarks If no display is set, no operation is performed and
1439  *          the ROI area is valid only in #PLAYER_DISPLAY_MODE_DST_ROI display mode.
1440  * @remarks The minimum value of width and height are 1.
1441  * @remarks ROI area can be set before setting ROI display mode. (since 4.0)
1442  * @param[in] player The handle to the media player
1443  * @param[in] x      X coordinate of area
1444  * @param[in] y      Y coordinate of area
1445  * @param[in] width  Width of area
1446  * @param[in] height Height of area
1447  * @return @c 0 on success,
1448  *         otherwise a negative error value
1449  * @retval  #PLAYER_ERROR_NONE Successful
1450  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1451  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1452  * @retval  #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 6.5)
1453  * @see player_set_display()
1454  * @see player_set_display_mode()
1455  */
1456 int player_set_display_roi_area(player_h player, int x, int y, int width, int height);
1457
1458 /**
1459  * @brief Sets the visibility of the video display.
1460  * @since_tizen 2.3
1461  * @remarks If no display is set, no operation is performed.
1462  * @remarks If you set visible before calling player_set_display(), it will be applied on #PLAYER_STATE_READY state.
1463  * @param[in] player   The handle to the media player
1464  * @param[in] visible  The visibility of the display (@c true = visible, @c false = non-visible )
1465  * @return @c 0 on success,
1466  *         otherwise a negative error value
1467  * @retval #PLAYER_ERROR_NONE Successful
1468  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1469  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1470  * @see player_set_display()
1471  * @see player_is_display_visible()
1472  */
1473 int player_set_display_visible(player_h player, bool visible);
1474
1475 /**
1476  * @brief Gets the visibility of the video display.
1477  * @since_tizen 2.3
1478  * @param[in] player   The handle to the media player
1479  * @param[out] visible The current visibility of the display (@c true = visible, @c false = non-visible )
1480  * @return @c 0 on success,
1481  *         otherwise a negative error value
1482  * @retval  #PLAYER_ERROR_NONE Successful
1483  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1484  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1485  * @see player_set_display_visible()
1486  */
1487 int player_is_display_visible(player_h player, bool *visible);
1488
1489 /**
1490  * @brief Sets the rotation settings of the video surface display.
1491  * @details Use this function to change the video orientation to portrait mode.
1492  *          The video out will be rotated in a counterclockwise direction.
1493  * @since_tizen 2.3
1494  * @remarks If no display is set, no operation is performed.
1495  * @param[in] player   The handle to the media player
1496  * @param[in] rotation The rotation of the display
1497  * @return @c 0 on success,
1498  *         otherwise a negative error value
1499  * @retval #PLAYER_ERROR_NONE Successful
1500  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1501  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1502  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 6.5)
1503  * @see #player_display_rotation_e
1504  * @see  player_set_display()
1505  * @see  player_get_display_rotation()
1506  */
1507 int player_set_display_rotation(player_h player, player_display_rotation_e rotation);
1508
1509 /**
1510  * @brief Gets the rotation of the video surface display.
1511  * @since_tizen 2.3
1512  * @param[in] player    The handle to the media player
1513  * @param[out] rotation The current rotation of the display
1514  * @return @c 0 on success,
1515  *         otherwise a negative error value
1516  * @retval  #PLAYER_ERROR_NONE Successful
1517  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1518  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1519  * @retval  #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 6.5)
1520  * @see     #player_display_rotation_e
1521  * @see     player_set_display_rotation()
1522  */
1523 int player_get_display_rotation(player_h player, player_display_rotation_e *rotation);
1524
1525 /**
1526  * @}
1527  */
1528
1529
1530 /**
1531  * @addtogroup CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE
1532  * @{
1533  */
1534
1535  /**
1536  * @brief Gets the media content information.
1537  * @since_tizen 2.3
1538  * @remarks You must release @a value using @c free().
1539  * @remarks The playback type should be local playback or HTTP streaming playback.
1540  * @param[in] player  The handle to the media player
1541  * @param[in] key     The key attribute name to get
1542  * @param[out] value  The value of the key attribute \n
1543  *                   It can be an empty string if there is no content information.
1544  * @return @c 0 on success,
1545  *         otherwise a negative error value
1546  * @retval #PLAYER_ERROR_NONE Successful
1547  * @retval #PLAYER_ERROR_INVALID_PARAMETER  Invalid parameter
1548  * @retval #PLAYER_ERROR_OUT_OF_MEMORY Not enough memory is available
1549  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1550  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1551  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1552  */
1553 int player_get_content_info(player_h player, player_content_info_e key, char **value);
1554
1555 /**
1556  * @brief Gets the audio and video codec information.
1557  * @since_tizen 2.3
1558  * @remarks You must release @a audio_codec and @a video_codec using free().
1559  * @remarks The playback type should be local playback or HTTP streaming playback.
1560  * @param[in] player       The handle to the media player
1561  * @param[out] audio_codec The name of the audio codec \n
1562  *                         It can be @c NULL if there is no audio codec.
1563  * @param[out] video_codec The name of the video codec \n
1564  *                         It can be @c NULL if there is no video codec.
1565  * @return @c 0 on success,
1566  *         otherwise a negative error value
1567  * @retval #PLAYER_ERROR_NONE Successful
1568  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1569  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1570  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1571  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1572  */
1573 int player_get_codec_info(player_h player, char **audio_codec, char **video_codec);
1574
1575 /**
1576  * @brief Gets the audio stream information.
1577  * @since_tizen 2.3
1578  * @remarks The playback type should be local playback or HTTP streaming playback.
1579  * @param[in] player       The handle to the media player
1580  * @param[out] sample_rate The audio sample rate [Hz] \n
1581  *                         Value can be invalid if there is no audio stream information.
1582  * @param[out] channel     The audio channel (1: mono, 2: stereo) \n
1583  *                         Value can be invalid if there is no audio stream information.
1584  * @param[out] bit_rate    The audio bit rate [Hz] \n
1585  *                         Value can be invalid if there is no audio stream information.
1586  * @return @c 0 on success,
1587  *         otherwise a negative error value
1588  * @retval #PLAYER_ERROR_NONE Successful
1589  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1590  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1591  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1592  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1593  */
1594 int player_get_audio_stream_info(player_h player, int *sample_rate, int *channel, int *bit_rate);
1595
1596 /**
1597  * @brief Gets the video stream information.
1598  * @since_tizen 2.3
1599  * @remarks The playback type should be local playback or HTTP streaming playback.
1600  * @param[in] player     The handle to the media player
1601  * @param[out]  fps      The frame per second of the video \n
1602  *                       It can be @c 0 if there is no video stream information.
1603  * @param[out]  bit_rate The video bit rate [Hz] \n
1604  *                       It can be an invalid value if there is no video stream information.
1605  * @return @c 0 on success,
1606  *         otherwise a negative error value
1607  * @retval #PLAYER_ERROR_NONE Successful
1608  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1609  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1610  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1611  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1612  */
1613 int player_get_video_stream_info(player_h player, int *fps, int *bit_rate);
1614
1615 /**
1616  * @brief Gets the video display's height and width.
1617  * @since_tizen 2.3
1618  * @remarks The playback type should be local playback or HTTP streaming playback.
1619  * @param[in] player  The handle to the media player
1620  * @param[out] width  The width of the video \n
1621  *                    Value can be invalid if there is no video or no display is set.
1622  * @param[out] height The height of the video \n
1623  *                    Value can be invalid value if there is no video or no display is set.
1624  * @return @c 0 on success,
1625  *         otherwise a negative error value
1626  * @retval #PLAYER_ERROR_NONE Successful
1627  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1628  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1629  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1630  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1631  */
1632 int player_get_video_size(player_h player, int *width, int *height);
1633
1634 /**
1635  * @brief Gets the album art in the media resource.
1636  * @since_tizen 2.3
1637  * @remarks You must not release @a album_art.
1638  *          The @a album_art is managed by the platform and will be released
1639  *          when the player is unprepared or destroyed by calling player_unprepare() or player_destroy().
1640  * @param[in] player     The handle to the media player
1641  * @param[out] album_art The encoded artwork image
1642  * @param[out] size      The encoded artwork size
1643  * @return @c 0 on success,
1644  *         otherwise a negative error value
1645  * @retval #PLAYER_ERROR_NONE Successful
1646  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1647  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1648  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1649  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1650  */
1651 int player_get_album_art(player_h player, void **album_art, int *size);
1652
1653 /**
1654  * @brief Gets the total running time of the associated media.
1655  * @since_tizen 2.3
1656  * @remarks The media source is associated with the player, using either player_set_uri() or player_set_memory_buffer().
1657  * @remarks The playback type should be local playback or HTTP streaming playback.
1658  * @param[in]   player         The handle to the media player
1659  * @param[out]  milliseconds   The duration in milliseconds
1660  * @return @c 0 on success,
1661  *         otherwise a negative error value
1662  * @retval #PLAYER_ERROR_NONE Successful
1663  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1664  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1665  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1666  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1667  * @see player_set_uri()
1668  * @see player_set_memory_buffer()
1669  * @see player_get_duration_nsec()
1670  */
1671 int player_get_duration(player_h player, int *milliseconds);
1672
1673 /**
1674  * @brief Gets the total running time in nanoseconds of the associated media.
1675  * @since_tizen 5.0
1676  * @param[in]   player         The handle to the media player
1677  * @param[out]  nanoseconds    The duration time in nanoseconds
1678  * @return @c 0 on success,
1679  *         otherwise a negative error value
1680  * @retval #PLAYER_ERROR_NONE Successful
1681  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1682  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1683  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1684  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
1685  * @see player_set_uri()
1686  * @see player_set_memory_buffer()
1687  * @see player_get_duration()
1688  */
1689 int player_get_duration_nsec(player_h player, int64_t *nanoseconds);
1690
1691 /**
1692  * @}
1693  */
1694
1695
1696 /**
1697  * @addtogroup CAPI_MEDIA_PLAYER_AUDIO_EFFECT_MODULE
1698  * @{
1699  */
1700
1701 /**
1702  * @brief Gets the number of equalizer bands.
1703  * @since_tizen 2.3
1704  * @remarks If player_audio_effect_equalizer_is_available() returns @a available parameter as @c false,
1705  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
1706  * @param[in] player The handle to the media player
1707  * @param[out] count The number of equalizer bands
1708  * @return @c 0 on success,
1709  *         otherwise a negative error value
1710  * @retval #PLAYER_ERROR_NONE Successful
1711  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1712  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
1713  * @see player_audio_effect_equalizer_is_available()
1714  * @see player_audio_effect_set_equalizer_band_level()
1715  * @see player_audio_effect_set_equalizer_all_bands()
1716  */
1717 int player_audio_effect_get_equalizer_bands_count(player_h player, int *count);
1718
1719 /**
1720  * @brief Sets the gain set for the given equalizer band.
1721  * @since_tizen 2.3
1722  * @remarks If player_audio_effect_equalizer_is_available() returns @a available parameter as @c false,
1723  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE and
1724  *          this will not work at all even if it was called before enabling audio offload
1725  *          which makes audio effect function group unavailable. (Since 5.5)
1726  * @param[in] player The handle to the media player
1727  * @param[in] index  The index of the equalizer band to be set
1728  * @param[in] level  The new gain in decibel that is set to the given band [dB]
1729  * @return @c 0 on success,
1730  *         otherwise a negative error value
1731  * @retval #PLAYER_ERROR_NONE Successful
1732  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1733  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1734  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
1735  * @see player_audio_effect_equalizer_is_available()
1736  * @see player_audio_effect_get_equalizer_bands_count()
1737  * @see player_audio_effect_get_equalizer_level_range()
1738  * @see player_audio_effect_get_equalizer_band_level()
1739  * @see player_audio_effect_set_equalizer_all_bands()
1740  * @see player_audio_offload_set_enabled()
1741  */
1742 int player_audio_effect_set_equalizer_band_level(player_h player, int index, int level);
1743
1744 /**
1745  * @brief Gets the gain set for the given equalizer band.
1746  * @since_tizen 2.3
1747  * @remarks If player_audio_effect_equalizer_is_available() returns @a available parameter as @c false,
1748  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
1749  * @param[in] player The handle to the media player
1750  * @param[in] index  The index of the requested equalizer band
1751  * @param[out] level The gain in decibel of the given band [dB]
1752  * @return @c 0 on success,
1753  *         otherwise a negative error value
1754  * @retval #PLAYER_ERROR_NONE Successful
1755  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1756  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
1757  * @see player_audio_effect_equalizer_is_available()
1758  * @see player_audio_effect_set_equalizer_band_level()
1759  */
1760 int player_audio_effect_get_equalizer_band_level(player_h player, int index, int *level);
1761
1762 /**
1763  * @brief Sets all bands of the equalizer.
1764  * @since_tizen 2.3
1765  * @remarks If player_audio_effect_equalizer_is_available() returns @a available parameter as @c false,
1766  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE and
1767  *          this will not work at all even if it was called before enabling audio offload
1768  *          which makes audio effect function group unavailable. (Since 5.5)
1769  * @param[in] player      The handle to the media player
1770  * @param[in] band_levels The list of band levels to be set
1771  * @param[in] length      The length of the band level
1772  * @return @c 0 on success,
1773  *         otherwise a negative error value
1774  * @retval #PLAYER_ERROR_NONE Successful
1775  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1776  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1777  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
1778  * @see player_audio_effect_equalizer_is_available()
1779  * @see player_audio_effect_get_equalizer_bands_count()
1780  * @see player_audio_effect_get_equalizer_level_range()
1781  * @see player_audio_effect_set_equalizer_band_level()
1782  * @see player_audio_offload_set_enabled()
1783  */
1784 int player_audio_effect_set_equalizer_all_bands(player_h player, int *band_levels, int length);
1785
1786 /**
1787  * @brief Gets the valid band level range of the equalizer.
1788  * @since_tizen 2.3
1789  * @remarks If player_audio_effect_equalizer_is_available() returns @a available parameter as @c false,
1790  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
1791  * @param[in] player The handle to the media player
1792  * @param[out] min   The minimum value to be set [dB]
1793  * @param[out] max   The maximum value to be set [dB]
1794  * @return @c 0 on success,
1795  *         otherwise a negative error value
1796  * @retval #PLAYER_ERROR_NONE Successful
1797  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1798  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1799  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
1800  * @see player_audio_effect_equalizer_is_available()
1801  * @see player_audio_effect_set_equalizer_band_level()
1802  * @see player_audio_effect_set_equalizer_all_bands()
1803  */
1804 int player_audio_effect_get_equalizer_level_range(player_h player, int *min, int *max);
1805
1806 /**
1807  * @brief Gets the band frequency of the equalizer.
1808  * @since_tizen 2.3
1809  * @remarks If player_audio_effect_equalizer_is_available() returns @a available parameter as @c false,
1810  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
1811  * @param[in] player     The handle to the media player
1812  * @param[in]  index     The index of the requested equalizer band
1813  * @param[out] frequency The frequency of the given band [dB]
1814  * @return @c 0 on success,
1815  *         otherwise a negative error value
1816  * @retval #PLAYER_ERROR_NONE Successful
1817  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1818  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
1819  * @see player_audio_effect_equalizer_is_available()
1820  */
1821 int player_audio_effect_get_equalizer_band_frequency(player_h player, int index, int *frequency);
1822
1823 /**
1824  * @brief Gets the band frequency range of the equalizer.
1825  * @since_tizen 2.3
1826  * @remarks If player_audio_effect_equalizer_is_available() returns @a available parameter as @c false,
1827  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
1828  * @param[in] player The handle to the media player
1829  * @param[in]  index The index of the requested equalizer band
1830  * @param[out] range The frequency range of the given band [dB]
1831  * @return @c 0 on success,
1832  *         otherwise a negative error value
1833  * @retval #PLAYER_ERROR_NONE Successful
1834  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1835  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
1836  * @see player_audio_effect_equalizer_is_available()
1837  */
1838 int player_audio_effect_get_equalizer_band_frequency_range(player_h player, int index, int *range);
1839
1840 /**
1841  * @brief Clears the equalizer effect.
1842  * @since_tizen 2.3
1843  * @remarks If player_audio_effect_equalizer_is_available() returns @a available parameter as @c false,
1844  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
1845  * @param[in] player The handle to the media player
1846  * @return @c 0 on success,
1847  *         otherwise a negative error value
1848  * @retval #PLAYER_ERROR_NONE Successful
1849  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1850  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1851  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
1852  * @see player_audio_effect_equalizer_is_available()
1853  * @see player_audio_effect_set_equalizer_band_level()
1854  * @see player_audio_effect_set_equalizer_all_bands()
1855  */
1856 int player_audio_effect_equalizer_clear(player_h player);
1857
1858 /**
1859  * @brief Checks whether the custom equalizer effect is available.
1860  * @details This function returns the availability of the audio effect function group and
1861  *          it could be unavailable depending on the platform capabilities.
1862  * @since_tizen 2.3
1863  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
1864  *          @a available will be @c false.
1865  * @param[in]  player    The handle to the media player
1866  * @param[out] available If @c true the specified audio effect is available,
1867  *                       otherwise @c false
1868  * @return @c 0 on success,
1869  *         otherwise a negative error value
1870  * @retval #PLAYER_ERROR_NONE Successful
1871  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1872  * @see player_audio_effect_set_equalizer_band_level()
1873  * @see player_audio_effect_set_equalizer_all_bands()
1874  * @see player_audio_offload_set_enabled()
1875  * @see player_audio_offload_is_enabled()
1876  * @see player_set_audio_codec_type()
1877  * @see player_get_audio_codec_type()
1878  */
1879 int player_audio_effect_equalizer_is_available(player_h player, bool *available);
1880
1881 /**
1882  * @}
1883  */
1884
1885
1886 /**
1887  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
1888  * @{
1889  */
1890
1891 /**
1892  * @brief Captures the video frame, asynchronously.
1893  * @since_tizen 2.3
1894  * @remarks If the content is encrypted or there are copyright issues with it,
1895  *          this function could be unsupported depending on the DRM policy.
1896  *          In case the function is not supported by the DRM policy, it will return an error.
1897  * @param[in] player      The handle to the media player
1898  * @param[in] callback    The callback function to register
1899  * @param[in] user_data   The user data to be passed to the callback function
1900  * @return @c 0 on success,
1901  *         otherwise a negative error value
1902  * @retval #PLAYER_ERROR_NONE Successful
1903  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1904  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1905  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1906  * @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().
1907  * @pre Video display type should be set by calling player_set_display() otherwise, audio stream is only processed even though video file is set.
1908  * @post It invokes player_video_captured_cb() when capture completes, if you set a callback.
1909  * @see player_video_captured_cb()
1910  */
1911 int player_capture_video(player_h player, player_video_captured_cb callback, void *user_data);
1912
1913 /**
1914  * @}
1915  */
1916
1917 /**
1918  * @addtogroup CAPI_MEDIA_PLAYER_STREAMING_MODULE
1919  * @{
1920  */
1921
1922 /**
1923  * @brief Sets the cookie for streaming playback.
1924  * @since_tizen 2.3
1925  * @remarks This function must be called before calling the player_prepare() or player_prepare_async()
1926  *          to reflect the cookie information when the streaming connection is set up.
1927  * @param[in] player The handle to the media player
1928  * @param[in] cookie The cookie to set
1929  * @param[in] size   The size of the cookie
1930  * @return @c 0 on success,
1931  *         otherwise a negative error value
1932  * @retval #PLAYER_ERROR_NONE Successful
1933  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1934  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1935  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1936  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1937  * @see player_set_uri()
1938  * @see player_set_streaming_user_agent()
1939  */
1940 int player_set_streaming_cookie(player_h player, const char *cookie, int size);
1941
1942 /**
1943  * @brief Sets the streaming user agent for playback.
1944  * @since_tizen 2.3
1945  * @remarks This function must be called before calling the player_prepare() or player_prepare_async()
1946  *          to reflect the user agent information when the streaming connection is set up.
1947  * @param[in] player     The handle to the media player
1948  * @param[in] user_agent The user agent to set
1949  * @param[in] size       The size of the user agent
1950  * @return @c 0 on success,
1951  *         otherwise a negative error value
1952  * @retval #PLAYER_ERROR_NONE Successful
1953  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1954  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1955  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1956  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
1957  * @see player_set_uri()
1958  * @see player_set_streaming_cookie()
1959  */
1960 int player_set_streaming_user_agent(player_h player, const char *user_agent, int size);
1961
1962 /**
1963  * @brief Gets the download progress for streaming playback.
1964  * @since_tizen 2.3
1965  * @param[in] player The handle to the media player
1966  * @param[out] start The starting position of received data in percentage [0, 100]
1967  * @param[out] end   The end position of received data in percentage [0, 100]
1968  * @return @c 0 on success,
1969  *         otherwise a negative error value
1970  * @retval #PLAYER_ERROR_NONE Successful
1971  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1972  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1973  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
1974  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
1975  */
1976 int player_get_streaming_download_progress(player_h player, int *start, int *end);
1977
1978 /**
1979  * @}
1980  */
1981
1982 /**
1983  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
1984  * @{
1985  */
1986
1987 /**
1988  * @brief Sets a callback function to be invoked when the playback is finished.
1989  * @since_tizen 2.3
1990  * @param[in] player      The handle to the media player
1991  * @param[in] callback    The callback function to register
1992  * @param[in] user_data   The user data to be passed to the callback function
1993  * @return @c 0 on success,
1994  *         otherwise a negative error value
1995  * @retval #PLAYER_ERROR_NONE Successful
1996  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
1997  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
1998  * @post  player_completed_cb() will be invoked.
1999  * @see player_unset_completed_cb()
2000  * @see player_completed_cb()
2001  * @see player_start()
2002  */
2003 int player_set_completed_cb(player_h player, player_completed_cb callback, void *user_data);
2004
2005 /**
2006  * @brief Unsets the playback completed callback function.
2007  * @since_tizen 2.3
2008  * @param[in] player The handle to the media player
2009  * @return @c 0 on success,
2010  *         otherwise a negative error value
2011  * @retval #PLAYER_ERROR_NONE Successful
2012  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2013  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2014  * @see player_set_completed_cb()
2015  */
2016 int player_unset_completed_cb(player_h player);
2017
2018 /**
2019  * @brief Sets a callback function to be invoked when the playback is interrupted or the interrupt is completed.
2020  * @since_tizen 2.3
2021  * @param[in] player      The handle to the media player
2022  * @param[in] callback    The callback function to register
2023  * @param[in] user_data   The user data to be passed to the callback function
2024  * @return @c 0 on success,
2025  *         otherwise a negative error value
2026  * @retval #PLAYER_ERROR_NONE Successful
2027  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2028  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2029  * @post  player_interrupted_cb() will be invoked.
2030  * @see player_unset_interrupted_cb()
2031  * @see #player_interrupted_code_e
2032  * @see player_interrupted_cb()
2033  */
2034 int player_set_interrupted_cb(player_h player, player_interrupted_cb callback, void *user_data);
2035
2036 /**
2037  * @brief Unsets the interrupted callback function.
2038  * @since_tizen 2.3
2039  * @param[in] player The handle to the media player
2040  * @return @c 0 on success,
2041  *         otherwise a negative error value
2042  * @retval #PLAYER_ERROR_NONE Successful
2043  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2044  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2045  * @see player_set_interrupted_cb()
2046  */
2047 int player_unset_interrupted_cb(player_h player);
2048
2049 /**
2050  * @brief Sets a callback function to be invoked when an error occurs.
2051  * @since_tizen 2.3
2052  * @param[in] player      The handle to the media player
2053  * @param[in] callback    The callback function to register
2054  * @param[in] user_data   The user data to be passed to the callback function
2055  * @return @c 0 on success,
2056  *         otherwise a negative error value
2057  * @retval #PLAYER_ERROR_NONE Successful
2058  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2059  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2060  * @post  player_error_cb() will be invoked.
2061  * @see player_unset_error_cb()
2062  * @see player_error_cb()
2063  */
2064 int player_set_error_cb(player_h player, player_error_cb callback, void *user_data);
2065
2066 /**
2067  * @brief Unsets the error callback function.
2068  * @since_tizen 2.3
2069  * @param[in] player The handle to the media player
2070  * @return @c 0 on success,
2071  *         otherwise a negative error value
2072  * @retval #PLAYER_ERROR_NONE Successful
2073  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2074  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2075  * @see player_set_error_cb()
2076  */
2077 int player_unset_error_cb(player_h player);
2078
2079 /**
2080  * @}
2081  */
2082
2083 /**
2084  * @addtogroup CAPI_MEDIA_PLAYER_STREAMING_MODULE
2085  * @{
2086  */
2087
2088 /**
2089  * @brief Sets a callback function to be invoked when there is a change in the buffering status of a media stream.
2090  * @since_tizen 2.3
2091  * @remarks The media resource should be streamed over the network.
2092  * @param[in] player      The handle to the media player
2093  * @param[in] callback    The callback function to register
2094  * @param[in] user_data   The user data to be passed to the callback function
2095  * @return @c 0 on success,
2096  *         otherwise a negative error value
2097  * @retval #PLAYER_ERROR_NONE Successful
2098  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2099  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2100  * @post  player_buffering_cb() will be invoked.
2101  * @see player_unset_buffering_cb()
2102  * @see player_set_uri()
2103  * @see player_buffering_cb()
2104  */
2105 int player_set_buffering_cb(player_h player, player_buffering_cb callback, void *user_data);
2106
2107 /**
2108  * @brief Unsets the buffering callback function.
2109  * @since_tizen 2.3
2110  * @param[in] player The handle to the media player
2111  * @return @c 0 on success,
2112  *         otherwise a negative error value
2113  * @retval #PLAYER_ERROR_NONE Successful
2114  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2115  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2116  * @see player_set_buffering_cb()
2117  */
2118 int player_unset_buffering_cb(player_h player);
2119
2120 /**
2121  * @}
2122  */
2123
2124 /**
2125  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
2126  * @{
2127  */
2128
2129 /**
2130  * @brief Sets the playback rate.
2131  * @details The default value is @c 1.0.
2132  * @since_tizen 2.3
2133  * @remarks #PLAYER_ERROR_INVALID_OPERATION occurs when streaming playback.
2134  * @remarks No operation is performed, if @a rate is @c 0.
2135  * @remarks The sound is muted, when playback rate is under @c 0.0 and over @c 2.0.
2136  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
2137  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
2138  * @param[in] player   The handle to the media player
2139  * @param[in] rate     The playback rate (-5.0x ~ 5.0x)
2140  * @return @c 0 on success,
2141  *         otherwise a negative error value
2142  * @retval #PLAYER_ERROR_NONE Successful
2143  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2144  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2145  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2146  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
2147  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
2148  * @see player_audio_offload_set_enabled()
2149  */
2150 int player_set_playback_rate(player_h player, float rate);
2151
2152 /**
2153  * @}
2154  */
2155
2156 /**
2157  * @addtogroup CAPI_MEDIA_PLAYER_SUBTITLE_MODULE
2158  * @{
2159  */
2160
2161 /**
2162  * @brief Sets a subtitle path.
2163  * @since_tizen 2.3
2164  * @remarks Only MicroDVD/SubViewer(*.sub), SAMI(*.smi), and SubRip(*.srt) subtitle formats are supported.
2165  * @remarks The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any files are used to play located in the internal storage.
2166  * @remarks The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any files are used to play located in the external storage.
2167  * @remarks The path value can be @c NULL for reset before calling player_prepare() or player_prepare_async().
2168  *
2169  * @param[in] player   The handle to the media player
2170  * @param[in] path     The absolute path of the subtitle file, it can be @c NULL in the #PLAYER_STATE_IDLE state.
2171  * @return @c 0 on success,
2172  *         otherwise a negative error value
2173  * @retval #PLAYER_ERROR_NONE Successful
2174  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2175  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2176  * @retval #PLAYER_ERROR_PERMISSION_DENIED Permission denied
2177  * @retval #PLAYER_ERROR_NO_SUCH_FILE File not found (Since 4.0)
2178  */
2179 int player_set_subtitle_path(player_h player, const char *path);
2180
2181 /**
2182  * @brief Sets a callback function to be invoked when a subtitle updates.
2183  * @since_tizen 2.3
2184  * @remarks The callback is called in a separate thread (not in the main loop).
2185  * @param[in] player      The handle to the media player
2186  * @param[in] callback    The callback function to register
2187  * @param[in] user_data   The user data to be passed to the callback function
2188  * @return @c 0 on success,
2189  *         otherwise a negative error value
2190  * @retval #PLAYER_ERROR_NONE Successful
2191  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2192  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2193  * @pre The subtitle must be set by calling player_set_subtitle_path().
2194  * @post  player_subtitle_updated_cb() will be invoked.
2195  * @see player_unset_subtitle_updated_cb()
2196  * @see player_subtitle_updated_cb()
2197  * @see player_set_subtitle_path()
2198  */
2199 int player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb callback, void *user_data);
2200
2201 /**
2202  * @brief Unsets the subtitle updated callback function.
2203  * @since_tizen 2.3
2204  * @param[in] player The handle to the media player
2205  * @return @c 0 on success,
2206  *         otherwise a negative error value
2207  * @retval #PLAYER_ERROR_NONE Successful
2208  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2209  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2210  * @see player_set_subtitle_updated_cb()
2211  */
2212 int player_unset_subtitle_updated_cb(player_h player);
2213
2214 /**
2215  * @brief Sets the seek position for the subtitle.
2216  * @since_tizen 2.3.1
2217  * @remarks Only MicroDVD/SubViewer(*.sub), SAMI(*.smi), and SubRip(*.srt) subtitle formats are supported.
2218  * @param[in]  player        The handle to the media player
2219  * @param[in]  milliseconds  The position in milliseconds from the start to the seek point
2220  * @return @c 0 on success,
2221  *         otherwise a negative error value
2222  * @retval #PLAYER_ERROR_NONE Successful
2223  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2224  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2225  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2226  * @pre The subtitle must be set by calling player_set_subtitle_path().
2227  * @pre The player state must be one of #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
2228  */
2229 int player_set_subtitle_position_offset(player_h player, int milliseconds);
2230
2231 /**
2232  * @}
2233  */
2234
2235
2236 /**
2237  * @addtogroup CAPI_MEDIA_PLAYER_STREAM_INFO_MODULE
2238  * @{
2239  */
2240
2241 /**
2242  * @brief Sets a callback function to be invoked when video stream is changed.
2243  * @since_tizen 2.4
2244  * @remarks The stream changing is detected just before rendering operation.
2245  * @remarks The callback is called in a separate thread (not in the main loop).
2246  * @remarks This function must be called before calling the player_prepare() or player_prepare_async()
2247  *          to reflect the requirement when the player is building.
2248  * @param[in] player      The handle to the media player
2249  * @param[in] callback    The stream changed callback function to register
2250  * @param[in] user_data   The user data to be passed to the callback function
2251  * @return @c 0 on success,
2252  *         otherwise a negative error value
2253  * @retval #PLAYER_ERROR_NONE Successful
2254  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2255  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2256  * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create() or player_unprepare().
2257  * @post player_video_stream_changed_cb() will be invoked.
2258  * @see player_unset_video_stream_changed_cb()
2259  * @see player_video_stream_changed_cb()
2260  */
2261 int player_set_video_stream_changed_cb(player_h player, player_video_stream_changed_cb callback, void *user_data);
2262
2263 /**
2264  * @brief Unsets the video stream changed callback function.
2265  * @since_tizen 2.4
2266  * @param[in] player   The handle to the media player
2267  * @return @c 0 on success,
2268  *         otherwise a negative error value
2269  * @retval #PLAYER_ERROR_NONE Successful
2270  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2271  * @see player_set_video_stream_changed_cb()
2272  */
2273 int player_unset_video_stream_changed_cb(player_h player);
2274
2275 /**
2276  * @}
2277  */
2278
2279
2280 /**
2281  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
2282  * @{
2283  */
2284
2285 /**
2286  * @brief Gets current track index.
2287  * @details Index starts from 0.
2288  * @since_tizen 2.4
2289  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
2290  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
2291  * @param[in]  player   The handle to the media player
2292  * @param[in]  type     The type of target stream which is #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_TEXT
2293  * @param[out] index    The index of track
2294  * @return @c 0 on success,
2295  *         otherwise a negative error value
2296  * @retval #PLAYER_ERROR_NONE Successful
2297  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2298  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2299  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2300  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
2301  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2302  * @see player_audio_offload_set_enabled()
2303  */
2304 int player_get_current_track(player_h player, player_stream_type_e type, int *index);
2305
2306 /**
2307  * @brief Gets language code of a track.
2308  * @since_tizen 2.4
2309  * @remarks @a code must be released with @c free() by caller
2310  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
2311  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
2312  * @param[in] player   The handle to the media player
2313  * @param[in] type     The type of target stream which is #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_TEXT
2314  * @param[in] index    The index of track
2315  * @param[out] code A language code in ISO 639-1. "und" will be returned if the language is undefined.
2316  * @return @c 0 on success,
2317  *         otherwise a negative error value
2318  * @retval #PLAYER_ERROR_NONE Successful
2319  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2320  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2321  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2322  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
2323  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2324  * @see player_audio_offload_set_enabled()
2325  */
2326 int player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code);
2327
2328 /**
2329  * @brief Gets the track count.
2330  * @since_tizen 2.4
2331  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
2332  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
2333  * @param[in] player   The handle to the media player
2334  * @param[in] type     The type of target stream which is #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_TEXT
2335  * @param[out] count   The number of track
2336  * @return @c 0 on success,
2337  *         otherwise a negative error value
2338  * @retval #PLAYER_ERROR_NONE Successful
2339  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2340  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2341  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2342  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
2343  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2344  * @see player_audio_offload_set_enabled()
2345  */
2346 int player_get_track_count(player_h player, player_stream_type_e type, int *count);
2347
2348 /**
2349  * @brief Selects a track to play.
2350  * @since_tizen 2.4
2351  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
2352  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
2353  * @param[in] player   The handle to the media player
2354  * @param[in] type     The type of target stream which is #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_TEXT
2355  * @param[in] index    The index of track
2356  * @return @c 0 on success,
2357  *         otherwise a negative error value
2358  * @retval #PLAYER_ERROR_NONE Successful
2359  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2360  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2361  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2362  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
2363  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2364  * @see player_get_current_track()
2365  * @see player_audio_offload_set_enabled()
2366  */
2367 int player_select_track(player_h player, player_stream_type_e type, int index);
2368
2369 /**
2370  * @}
2371  */
2372
2373 /**
2374  * @addtogroup CAPI_MEDIA_PLAYER_STREAMING_MODULE
2375  * @{
2376  */
2377
2378 /**
2379  * @brief Retrieves all the streaming variant information.
2380  * @since_tizen 4.0
2381  * @remarks This function is used for adaptive streaming(hls/mpeg dash) only.
2382  * @param[in] player      The handle to the media player
2383  * @param[in] callback    The iteration callback function
2384  * @param[in] user_data   The user data to be passed to the callback function
2385  * @return @c 0 on success,
2386  *         otherwise a negative error value
2387  * @retval #PLAYER_ERROR_NONE Successful
2388  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2389  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2390  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2391  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2392  * @see player_adaptive_variant_cb()
2393  */
2394 int player_foreach_adaptive_variant(player_h player, player_adaptive_variant_cb callback, void *user_data);
2395
2396 /**
2397  * @brief Sets the maximum limit of the streaming variant.
2398  * @since_tizen 4.0
2399  * @remarks This function is used for adaptive streaming(hls/mpeg dash) only.
2400  * @remarks The bandwidth setting can only be applied if there is no width, height information at streaming variant header.
2401  *          Application can get all the variant information by calling player_foreach_adaptive_variant() function.
2402  * @remarks If there is no affordable stream for the condition, the minimum bandwidth stream will be selected.
2403  * @param[in] player      The handle to the media player
2404  * @param[in] bandwidth   The max bandwidth limit of the stream variant (default: -1)
2405  * @param[in] width       The max width limit of the stream variant (default: -1)
2406  * @param[in] height      The max height limit of the stream variant (default: -1)
2407  * @return @c 0 on success,
2408  *         otherwise a negative error value
2409  * @retval #PLAYER_ERROR_NONE Successful
2410  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2411  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2412  * @see player_foreach_adaptive_variant()
2413  * @see player_get_max_adaptive_variant_limit()
2414  */
2415 int player_set_max_adaptive_variant_limit(player_h player, int bandwidth, int width, int height);
2416
2417 /**
2418  * @brief Gets the maximum limit of the streaming variant.
2419  * @since_tizen 4.0
2420  * @remarks This function is used for adaptive streaming(hls/mpeg dash) only.
2421  * @param[in]  player      The handle to the media player
2422  * @param[out] bandwidth   The max bandwidth limit of the stream variant (default: -1)
2423  * @param[out] width       The max width limit of the stream variant (default: -1)
2424  * @param[out] height      The max height limit of the stream variant (default: -1)
2425  * @return @c 0 on success,
2426  *         otherwise a negative error value
2427  * @retval #PLAYER_ERROR_NONE Successful
2428  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2429  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2430  * @see player_foreach_adaptive_variant()
2431  * @see player_set_max_adaptive_variant_limit()
2432  */
2433 int player_get_max_adaptive_variant_limit(player_h player, int *bandwidth, int *width, int *height);
2434
2435 /**
2436  * @}
2437  */
2438
2439 /**
2440  * @addtogroup CAPI_MEDIA_PLAYER_MODULE
2441  * @{
2442  */
2443
2444 /**
2445  * @brief Sets the audio only mode.
2446  * @details This function is used to disable or enable video rendering during playback.
2447  * @since_tizen 4.0
2448  * @param[in] player       The handle to the media player
2449  * @param[in] audio_only   The new audio only status: (@c true = enable audio only, @c false = disable audio only)
2450  * @return @c 0 on success,
2451  *         otherwise a negative error value
2452  * @retval #PLAYER_ERROR_NONE                Successful
2453  * @retval #PLAYER_ERROR_INVALID_PARAMETER   Invalid parameter
2454  * @retval #PLAYER_ERROR_INVALID_OPERATION   Invalid operation
2455  * @retval #PLAYER_ERROR_INVALID_STATE       Invalid player state
2456  * @pre The player state must be one of: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
2457  * @see player_is_audio_only()
2458  */
2459 int player_set_audio_only(player_h player, bool audio_only);
2460
2461 /**
2462  * @brief Gets the audio only mode status.
2463  * @since_tizen 4.0
2464  * @param[in]  player       The handle to the media player
2465  * @param[out] audio_only   The current audio only status: (@c true = audio only enabled, @c false = audio only disabled)
2466  * @return @c 0 on success,
2467  *         otherwise a negative error value
2468  * @retval #PLAYER_ERROR_NONE                Successful
2469  * @retval #PLAYER_ERROR_INVALID_PARAMETER   Invalid parameter
2470  * @retval #PLAYER_ERROR_INVALID_OPERATION   Invalid operation
2471  * @see player_set_audio_only()
2472  */
2473 int player_is_audio_only(player_h player, bool *audio_only);
2474
2475 /**
2476  * @brief Sets the player's replaygain status.
2477  * @details If the replaygain status is @c true, replaygain is applied (if contents has a replaygain tag).
2478  *          If it is @c false, the replaygain isn't affected by tag and properties.
2479  * @since_tizen 5.0
2480  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
2481  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE and
2482  *          this will not work at all even if this was called before enabling offload. (Since 5.5)
2483  * @remarks This function could be unavailable depending on the audio codec type and
2484  *          this will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
2485  * @param[in]   player  The handle to the media player
2486  * @param[in]   enabled The new replaygain status: (@c true = enable, @c false = disable)
2487  * @return @c 0 on success,
2488  *         otherwise a negative error value
2489  * @retval #PLAYER_ERROR_NONE Successful
2490  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2491  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2492  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
2493  * @see player_is_replaygain_enabled()
2494  * @see player_audio_offload_set_enabled()
2495  * @see player_audio_offload_is_enabled()
2496  * @see player_set_audio_codec_type()
2497  * @see player_get_audio_codec_type()
2498  */
2499 int player_set_replaygain_enabled(player_h player, bool enabled);
2500
2501 /**
2502  * @brief Gets the player's replaygain status.
2503  * @since_tizen 5.0
2504  * @remarks Depending on audio codec type or by enabling audio offload,
2505  *          this function could be unavailable and this will return #PLAYER_ERROR_NOT_AVAILABLE. (Since 5.5)
2506  * @param[in]   player    The handle to the media player
2507  * @param[out]  enabled   Pointer to store current replaygain status:
2508  *                        (@c true = enabled replaygain,
2509                           @c false = disabled replaygain)
2510  * @return @c 0 on success,
2511  *         otherwise a negative error value
2512  * @retval #PLAYER_ERROR_NONE Successful
2513  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2514  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2515  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available (Since 5.5)
2516  * @see player_set_replaygain_enabled()
2517  * @see player_audio_offload_set_enabled()
2518  * @see player_audio_offload_is_enabled()
2519  * @see player_set_audio_codec_type()
2520  * @see player_get_audio_codec_type()
2521  */
2522 int player_is_replaygain_enabled(player_h player, bool *enabled);
2523
2524 /**
2525  * @brief Sets the ROI (Region Of Interest) area of the content video source.
2526  * @details This function is to set the ROI area of video content to render it
2527  *          on #PLAYER_DISPLAY_TYPE_OVERLAY display with current display mode.
2528  *          It can be regarded as zooming operation because the selected video area will be rendered fit to the display.
2529  * @since_tizen 5.0
2530  * @remarks This function requires the ratio value of the each coordinate and size based on the video resolution size
2531  *          to consider the dynamic resolution video content.
2532  * @remarks This function have to be called after calling player_set_display() and the ROI area is valid only in #PLAYER_DISPLAY_TYPE_OVERLAY.
2533  * @param[in] player     The handle to the media player
2534  * @param[in] x_scale    X coordinate ratio value of the video source area based on the video width size \n
2535  *                       Valid range is 0.0~1.0.
2536  * @param[in] y_scale    Y coordinate ratio value of the video source area based on the video height size \n
2537  *                       Valid range is 0.0~1.0.
2538  * @param[in] w_scale    Width ratio value of the video source area based on the video width size \n
2539  *                       Valid range is from greater than 0.0 to 1.0.
2540  * @param[in] h_scale    Height ratio value of the video source area based on the video height size \n
2541  *                       Valid range is from greater than 0.0 to 1.0.
2542  * @return @c 0 on success,
2543  *         otherwise a negative error value
2544  * @retval  #PLAYER_ERROR_NONE Successful
2545  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2546  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2547  * @see #player_display_type_e
2548  * @see player_set_display()
2549  * @see player_set_display_mode()
2550  * @see player_get_video_size()
2551  * @see player_get_video_roi_area()
2552  * @par Example
2553    @code
2554        #include <player.h>
2555        ...
2556        player_h player = NULL;
2557        player_display_h display = NULL;
2558        int width = 0, height = 0;
2559        ...
2560        player_set_display (player, PLAYER_DISPLAY_TYPE_OVERLAY, display);
2561        player_get_video_size (player, &width, &height);
2562        ...
2563        player_set_video_roi_area (player, 30/(double)width, 30/(double)height, 480/(double)width, 270/(double)height);
2564        ...
2565    @endcode
2566  */
2567 int player_set_video_roi_area(player_h player, double x_scale, double y_scale, double w_scale, double h_scale);
2568
2569 /**
2570  * @brief Gets the ROI (Region Of Interest) area of the content video source.
2571  * @since_tizen 5.0
2572  * @remarks This function gets the ratio value of the each coordinate and size based on the video resolution size.
2573  * @remarks The ROI area is valid only in #PLAYER_DISPLAY_TYPE_OVERLAY.
2574  * @param[in]  player     The handle to the media player
2575  * @param[out] x_scale    The current X coordinate ratio value of the video source area based on the video width size
2576  * @param[out] y_scale    The current Y coordinate ratio value of the video source area based on the video height size
2577  * @param[out] w_scale    The current width ratio value of the video source area based on the video width size
2578  * @param[out] h_scale    The current height ratio value of the video source area based on the video height size
2579  * @return @c 0 on success,
2580  *         otherwise a negative error value
2581  * @retval  #PLAYER_ERROR_NONE Successful
2582  * @retval  #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2583  * @retval  #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2584  * @see #player_display_type_e
2585  * @see player_set_display()
2586  * @see player_get_video_size()
2587  * @see player_set_video_roi_area()
2588  */
2589 int player_get_video_roi_area(player_h player, double *x_scale, double *y_scale, double *w_scale, double *h_scale);
2590
2591 /**
2592  * @brief Enables or disables controlling the pitch of audio.
2593  * @since_tizen 5.5
2594  * @remarks This function is used for audio content only.
2595  * @remarks Enabling pitch control could increase the CPU usage on some devices.
2596  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
2597  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE and
2598  *          this will not work at all even if this was called before enabling offload.
2599  * @remarks This function could be unavailable depending on the audio codec type and
2600  *          this will return #PLAYER_ERROR_NOT_AVAILABLE.
2601  * @param[in] player   The handle to the media player
2602  * @param[in] enabled  The new audio pitch control status (default: false)
2603  * @return @c 0 on success,
2604  *         otherwise a negative error value
2605  * @retval #PLAYER_ERROR_NONE Successful
2606  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2607  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2608  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2609  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available
2610  * @pre The player state must be #PLAYER_STATE_IDLE.
2611  * @see player_audio_pitch_is_enabled()
2612  * @see player_audio_pitch_set_value()
2613  * @see player_audio_pitch_get_value()
2614  * @see player_audio_offload_set_enabled()
2615  * @see player_audio_offload_is_enabled()
2616  * @see player_set_audio_codec_type()
2617  * @see player_get_audio_codec_type()
2618  */
2619 int player_audio_pitch_set_enabled(player_h player, bool enabled);
2620
2621 /**
2622  * @brief Gets the status of controlling the pitch of audio.
2623  * @since_tizen 5.5
2624  * @remarks This function is used for audio content only.
2625  * @remarks Depending on audio codec type or by enabling audio offload,
2626  *          this function could be unavailable and this will return #PLAYER_ERROR_NOT_AVAILABLE.
2627  * @param[in]   player   The handle to the media player
2628  * @param[out]  enabled  The audio pitch control status (default: false)
2629  * @return @c 0 on success,
2630  *         otherwise a negative error value
2631  * @retval #PLAYER_ERROR_NONE Successful
2632  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2633  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2634  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available
2635  * @see player_audio_pitch_set_enabled()
2636  * @see player_audio_pitch_set_value()
2637  * @see player_audio_pitch_get_value()
2638  * @see player_audio_offload_set_enabled()
2639  * @see player_audio_offload_is_enabled()
2640  * @see player_set_audio_codec_type()
2641  * @see player_get_audio_codec_type()
2642  */
2643 int player_audio_pitch_is_enabled(player_h player, bool *enabled);
2644
2645 /**
2646  * @brief Sets the pitch of audio.
2647  * @since_tizen 5.5
2648  * @remarks This function is used for audio content only.
2649  * @remarks If audio offload is enabled by calling player_audio_offload_set_enabled(),
2650  *          this function will return #PLAYER_ERROR_NOT_AVAILABLE and
2651  *          this will not work at all even if this was called before enabling offload.
2652  * @remarks This function could be unavailable depending on the audio codec type and
2653  *          this will return #PLAYER_ERROR_NOT_AVAILABLE.
2654  * @param[in] player The handle to the media player
2655  * @param[in] value  The audio stream pitch value  \n
2656  *                   Valid range is 0.5~2. Default value is 1.
2657  * @return @c 0 on success,
2658  *         otherwise a negative error value
2659  * @retval #PLAYER_ERROR_NONE Successful
2660  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2661  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2662  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available
2663  * @pre The pitch control must be enabled by calling player_audio_pitch_set_enabled() function.
2664  * @see player_audio_pitch_set_enabled()
2665  * @see player_audio_pitch_is_enabled()
2666  * @see player_audio_pitch_get_value()
2667  * @see player_audio_offload_set_enabled()
2668  * @see player_audio_offload_is_enabled()
2669  * @see player_set_audio_codec_type()
2670  * @see player_get_audio_codec_type()
2671  */
2672 int player_audio_pitch_set_value(player_h player, float value);
2673
2674 /**
2675  * @brief Gets the pitch of audio.
2676  * @since_tizen 5.5
2677  * @remarks This function is used for audio content only.
2678  * @remarks Depending on audio codec type or by enabling audio offload,
2679  *          this function could be unavailable and this will return #PLAYER_ERROR_NOT_AVAILABLE.
2680  * @param[in]  player The handle to the media player
2681  * @param[out] value  The audio stream pitch value \n
2682  *                    Valid range is 0.5~2. Default value is 1.
2683  * @return @c 0 on success,
2684  *         otherwise a negative error value
2685  * @retval #PLAYER_ERROR_NONE Successful
2686  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2687  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2688  * @retval #PLAYER_ERROR_NOT_AVAILABLE Not available
2689  * @see player_audio_pitch_set_enabled()
2690  * @see player_audio_pitch_is_enabled()
2691  * @see player_audio_pitch_set_value()
2692  * @see player_audio_offload_set_enabled()
2693  * @see player_audio_offload_is_enabled()
2694  * @see player_set_audio_codec_type()
2695  * @see player_get_audio_codec_type()
2696  */
2697 int player_audio_pitch_get_value(player_h player, float *value);
2698
2699 /**
2700  * @brief Retrieves all supported media formats for audio offload.
2701  * @details The supported media format can vary depending on the device capabilities.
2702  * @since_tizen 5.5
2703  * @remarks This function is related to the following feature:\n
2704  *          %http://tizen.org/feature/multimedia.player.audio_offload\n
2705  * @param[in] player      The handle to the media player
2706  * @param[in] callback    The iteration callback function
2707  * @param[in] user_data   The user data to be passed to the callback function
2708  * @return @c 0 on success,
2709  *         otherwise a negative error value
2710  * @retval #PLAYER_ERROR_NONE Successful
2711  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2712  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2713  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
2714  * @see player_supported_media_format_cb()
2715  * @see player_audio_offload_set_enabled()
2716  * @see player_audio_offload_is_enabled()
2717  * @see player_audio_offload_is_activated()
2718  */
2719 int player_audio_offload_foreach_supported_format(player_h player, player_supported_media_format_cb callback, void *user_data);
2720
2721 /**
2722  * @brief Enables or disables the audio offload.
2723  * @details The player lets the hardware decode and render the sound if the audio offload is enabled.
2724  *          This will reduce the power consumption, but will disable the ability to handle output PCM.
2725  *          Please check the remarks for a list of functions which will not work if offloading is enabled.
2726  * @since_tizen 5.5
2727  * @remarks This function is related to the following feature:\n
2728  *          %http://tizen.org/feature/multimedia.player.audio_offload\n
2729  * @remarks The sound stream type of the player should be #SOUND_STREAM_TYPE_MEDIA.\n
2730  * @remarks If audio offload is enabled, functions for audio effect are not available.\n
2731  * @remarks If audio offload is enabled, the following functions will return #PLAYER_ERROR_NOT_AVAILABLE
2732  *          and they will not work at all even if they were called before enabling offload. :\n
2733  *          player_set_media_packet_audio_frame_decoded_cb()\n
2734  *          player_unset_media_packet_audio_frame_decoded_cb()\n
2735  *          player_set_audio_latency_mode()\n
2736  *          player_get_audio_latency_mode()\n
2737  *          player_set_playback_rate()\n
2738  *          player_get_current_track()\n
2739  *          player_get_track_language_code()\n
2740  *          player_get_track_count()\n
2741  *          player_select_track()\n
2742  *          player_set_replaygain_enabled()\n
2743  *          player_is_replaygain_enabled()\n
2744  *          player_audio_pitch_set_enabled()\n
2745  *          player_audio_pitch_is_enabled()\n
2746  *          player_audio_pitch_set_value()\n
2747  *          player_audio_pitch_get_value()\n
2748  * @param[in] player   The handle to the media player
2749  * @param[in] enabled  The new audio offload status (default: false)
2750  * @return @c 0 on success,
2751  *         otherwise a negative error value
2752  * @retval #PLAYER_ERROR_NONE Successful
2753  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2754  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2755  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2756  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
2757  * @pre The player state must be #PLAYER_STATE_IDLE.
2758  * @see player_set_sound_stream_info()
2759  * @see player_audio_effect_equalizer_is_available()
2760  * @see player_set_interrupted_cb()
2761  * @see player_audio_offload_foreach_supported_format()
2762  * @see player_audio_offload_is_enabled()
2763  * @see player_audio_offload_is_activated()
2764  */
2765 int player_audio_offload_set_enabled(player_h player, bool enabled);
2766
2767 /**
2768  * @brief Gets the enabling status of audio offload.
2769  * @since_tizen 5.5
2770  * @remarks This function is related to the following feature:\n
2771  *          %http://tizen.org/feature/multimedia.player.audio_offload\n
2772  * @param[in]  player   The handle to the media player
2773  * @param[out] enabled  The enabling status (default: false)
2774  * @return @c 0 on success,
2775  *         otherwise a negative error value
2776  * @retval #PLAYER_ERROR_NONE Successful
2777  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2778  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2779  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
2780  * @see player_audio_offload_foreach_supported_format()
2781  * @see player_audio_offload_set_enabled()
2782  * @see player_audio_offload_is_activated()
2783  */
2784 int player_audio_offload_is_enabled(player_h player, bool *enabled);
2785
2786 /**
2787  * @brief Gets the activation status of audio offload.
2788  * @details Audio offload could be inactivated depending on the
2789  *          audio device capability even if the audio offload feature is supported.
2790  * @since_tizen 5.5
2791  * @remarks This function is related to the following feature:\n
2792  *          %http://tizen.org/feature/multimedia.player.audio_offload\n
2793  * @param[in]   player     The handle to the media player
2794  * @param[out]  activated  The activation status
2795  * @return @c 0 on success,
2796  *         otherwise a negative error value
2797  * @retval #PLAYER_ERROR_NONE Successful
2798  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
2799  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2800  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2801  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
2802  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED
2803  * @see player_audio_offload_foreach_supported_format()
2804  * @see player_audio_offload_set_enabled()
2805  * @see player_audio_offload_is_enabled()
2806  */
2807 int player_audio_offload_is_activated(player_h player, bool *activated);
2808
2809 /**
2810  * @brief Sets the default codec type of the audio decoder.
2811  * @since_tizen 5.5
2812  * @remarks The default codec type could be different depending on the device capability.
2813  *          S/W codec type is supported basically.
2814  * @remarks If selected H/W audio codec type does not support in some cases,
2815  *          S/W audio codec type could be used instead.\n
2816  * @remarks If application use the H/W audio codec type by default,
2817  *          following functions have to be called after setting codec type
2818  *          because the availability could be changed depending on the codec capability. :\n
2819  *          player_audio_effect_equalizer_is_available()\n
2820  *          player_set_media_packet_audio_frame_decoded_cb()\n
2821  *          player_unset_media_packet_audio_frame_decoded_cb()\n
2822  *          player_set_replaygain_enabled()\n
2823  *          player_is_replaygain_enabled()\n
2824  *          player_audio_pitch_set_enabled()\n
2825  *          player_audio_pitch_is_enabled()\n
2826  *          player_audio_pitch_set_value()\n
2827  *          player_audio_pitch_get_value()\n
2828  * @param[in] player       The handle to the media player
2829  * @param[in] codec_type   The default codec type
2830  * @return @c 0 on success,
2831  *         otherwise a negative error value
2832  * @retval #PLAYER_ERROR_NONE Successful
2833  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2834  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2835  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2836  * @retval #PLAYER_ERROR_NOT_SUPPORTED_AUDIO_CODEC Not support audio codec type
2837  * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare().
2838  * @see player_get_audio_codec_type()
2839  */
2840 int player_set_audio_codec_type(player_h player, player_codec_type_e codec_type);
2841
2842 /**
2843  * @brief Gets the default codec type of the audio decoder.
2844  * @since_tizen 5.5
2845  * @param[in]  player        The handle to the media player
2846  * @param[out] codec_type    The default codec type
2847  * @return @c 0 on success,
2848  *         otherwise a negative error value
2849  * @retval #PLAYER_ERROR_NONE Successful
2850  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2851  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2852  * @see player_set_audio_codec_type()
2853  */
2854 int player_get_audio_codec_type(player_h player, player_codec_type_e *codec_type);
2855
2856 /**
2857  * @brief Sets the default codec type of the video decoder.
2858  * @since_tizen 8.0
2859  * @remarks The default codec type could be different depending on the device capability.
2860  *          Usually the H/W codec has higher priority than S/W codec if it exist.
2861  * @param[in] player       The handle to the media player
2862  * @param[in] codec_type   The codec type
2863  * @return @c 0 on success,
2864  *         otherwise a negative error value
2865  * @retval #PLAYER_ERROR_NONE Successful
2866  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2867  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2868  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
2869  * @retval #PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC Not supported video codec type
2870  * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare().
2871  * @see player_get_video_codec_type()
2872  */
2873 int player_set_video_codec_type(player_h player, player_codec_type_e codec_type);
2874
2875 /**
2876  * @brief Gets the default codec type of the video decoder.
2877  * @since_tizen 8.0
2878  * @param[in]  player        The handle to the media player
2879  * @param[out] codec_type    The default codec type
2880  * @return @c 0 on success,
2881  *         otherwise a negative error value
2882  * @retval #PLAYER_ERROR_NONE Successful
2883  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2884  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2885  * @see player_set_video_codec_type()
2886  */
2887 int player_get_video_codec_type(player_h player, player_codec_type_e *codec_type);
2888
2889 /**
2890  * @}
2891  */
2892
2893 /**
2894  * @addtogroup CAPI_MEDIA_PLAYER_STREAMING_MODULE
2895  * @{
2896  */
2897
2898 /**
2899  * @brief Sets the streaming buffering time.
2900  *  4.0
2901  * @param[in] player        The handle to the media player
2902  * @param[in] prebuffer_ms  The time duration of buffering data that must be prerolled to start playback. \n
2903  *                          The value should be more than 1000 milliseconds to ensure the normal buffering. \n
2904  *                          There are, however, two exceptions: \n
2905  *                           0: Indicate to use platform default value depending on the streaming type and network status (default) \n
2906  *                          -1: Indicate to use current value (since 5.5)
2907  * @param[in] rebuffer_ms   The time duration of buffering data that must be prerolled to resume playback
2908  *                          if player is paused for buffering internally. \n
2909  *                          The value should be more than 1000 milliseconds to ensure the normal buffering. \n
2910  *                          There are, however, two exceptions: \n
2911  *                           0: Indicate to use platform default value depending on the streaming type and network status (default) \n
2912  *                          -1: Indicate to use current value (since 5.5)
2913  * @return @c 0 on success,
2914  *         otherwise a negative error value
2915  * @retval #PLAYER_ERROR_NONE Successful
2916  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2917  * @retval #PLAYER_ERROR_INVALID_STATE Invalid state
2918  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation (since 5.5)
2919  * @pre The player state must be #PLAYER_STATE_IDLE.
2920  * @see player_get_streaming_buffering_time()
2921  * @par Example
2922  * @code
2923    #include <player.h>
2924    bool set_buffering_time(player_h p)
2925    {
2926        int err = PLAYER_ERROR_NONE;
2927
2928        // sets the prebuffer_ms to 5000 milliseconds but does not change the rebuffer_ms
2929        err =  player_set_streaming_buffering_time(p, 5000, -1);
2930        if (err != PLAYER_ERROR_NONE) {
2931           printf("Fail to set buffering time = 0x%x\n", err);
2932           return false;
2933        }
2934        return true;
2935    }
2936  * @endcode
2937  */
2938 int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int rebuffer_ms);
2939
2940 /**
2941  * @brief Gets the streaming buffering time.
2942  * @since_tizen 4.0
2943  * @param[in]  player        The handle to the media player
2944  * @param[out] prebuffer_ms  The time duration of buffering data that must be prerolled to start playback
2945  *                           If the user did not set any value by calling player_set_streaming_buffering_time() function (or if the value was set to 0),
2946  *                           the value is @c 0 which means platform default value depending on the streaming type and network status. \n
2947  *                           The value is set to time duration instead of @c 0
2948  *                           if the player state is one of: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED. (since 5.5)
2949  * @param[out] rebuffer_ms   The time duration of buffering data that must be prerolled to resume playback
2950  *                           if player is paused for buffering internally. \n
2951  *                           If the user did not set any value by calling player_set_streaming_buffering_time() function (or if the value was set to 0),
2952  *                           the value is @c 0 which means platform default value depending on the streaming type and network status. \n
2953  *                           The value is set to time duration instead of @c 0
2954  *                           if the player state is one of: #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED. (since 5.5)
2955  * @return @c 0 on success,
2956  *         otherwise a negative error value
2957  * @retval #PLAYER_ERROR_NONE Successful
2958  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2959  * @see player_set_streaming_buffering_time()
2960  */
2961 int player_get_streaming_buffering_time(player_h player, int *prebuffer_ms, int *rebuffer_ms);
2962
2963 /**
2964  * @}
2965  */
2966
2967 /**
2968  * @addtogroup CAPI_MEDIA_PLAYER_360_MODULE
2969  * @{
2970  */
2971
2972 /**
2973  * @brief Gets information whether the current content of the player is spherical.
2974  * @since_tizen 5.0
2975  * @remarks This function is related to the following features:\n
2976  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
2977  *          %http://tizen.org/feature/opengles.version.2_0\n
2978  * @param[in]   player         The handle to the media player
2979  * @param[out]  is_spherical   The value indicating whether the content is spherical
2980  * @return @c 0 on success,
2981  *         otherwise a negative error value
2982  * @retval #PLAYER_ERROR_NONE              Successful
2983  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
2984  * @retval #PLAYER_ERROR_INVALID_STATE     Invalid player state
2985  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
2986  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
2987  * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING or #PLAYER_STATE_PAUSED.
2988  */
2989 int player_360_is_content_spherical(player_h player, bool *is_spherical);
2990
2991 /**
2992  * @brief Sets the 360 video mode.
2993  * @details In case the media content is spherical, display mode can be selected by this function.
2994  * @since_tizen 5.0
2995  * @remarks This function is related to the following features:\n
2996  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
2997  *          %http://tizen.org/feature/opengles.version.2_0\n
2998  * @param[in] player   The handle to the media player
2999  * @param[in] enabled  The 360 video display status: @c true = display with 360 video mode,
3000                        @c false = display with full panorama mode. The default value is @c true.
3001  * @return @c 0 on success,
3002  *         otherwise a negative error value
3003  * @retval #PLAYER_ERROR_NONE              Successful
3004  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
3005  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
3006  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
3007  * @see player_360_is_enabled()
3008  */
3009 int player_360_set_enabled(player_h player, bool enabled);
3010
3011 /**
3012  * @brief Gets the 360 video display mode.
3013  * @since_tizen 5.0
3014  * @remarks This function is related to the following features:\n
3015  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
3016  *          %http://tizen.org/feature/opengles.version.2_0\n
3017  * @param[in]   player    The handle to the media player
3018  * @param[out]  enabled   Pointer to store current 360 video display mode:
3019  *                        (@c true = display with 360 video mode,
3020                           @c false = display with full panorama mode)
3021  * @return @c 0 on success,
3022  *         otherwise a negative error value
3023  * @retval #PLAYER_ERROR_NONE              Successful
3024  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
3025  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
3026  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
3027  * @see player_360_set_enabled()
3028  */
3029 int player_360_is_enabled(player_h player, bool *enabled);
3030
3031 /**
3032  * @brief Sets the 360 video direction of view.
3033  * @details This function is to set horizontal (yaw) and vertical (pitch) angles
3034  *          of current direction of view in radians. Default direction of view
3035  *          is taken from meta-data stored in the media. If meta-data omits
3036  *          these values, zeros are assumed to be equal to the center of the
3037  *          panorama image.
3038  * @since_tizen 5.0
3039  * @remarks This function is related to the following features:\n
3040  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
3041  *          %http://tizen.org/feature/opengles.version.2_0\n
3042  * @param[in] player   The handle to the media player
3043  * @param[in] yaw      The angle value around vertical axis. Valid values are in
3044  *                     range [-PI, PI]. Default value is 0.
3045  * @param[in] pitch    The angle value around lateral axis. Valid values are in
3046  *                     range [-PI/2, PI/2]. Default value is 0.
3047  * @return @c 0 on success,
3048  *         otherwise a negative error value
3049  * @retval #PLAYER_ERROR_NONE              Successful
3050  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
3051  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
3052  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
3053  * @see player_360_get_direction_of_view()
3054  */
3055 int player_360_set_direction_of_view(player_h player, float yaw, float pitch);
3056
3057 /**
3058  * @brief Gets the 360 video direction of view.
3059  * @details This function is to get horizontal (yaw) and vertical (pitch) angles
3060  *          of current direction of view in radians.
3061  * @since_tizen 5.0
3062  * @remarks This function is related to the following features:\n
3063  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
3064  *          %http://tizen.org/feature/opengles.version.2_0\n
3065  * @param[in]  player   The handle to the media player
3066  * @param[out] yaw      Pointer to store current value of direction of view
3067  *                      angle around vertical axis
3068  * @param[out] pitch    Pointer to store current value of direction of view
3069  *                      angle around lateral axis
3070  * @return @c 0 on success,
3071  *         otherwise a negative error value
3072  * @retval #PLAYER_ERROR_NONE              Successful
3073  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
3074  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
3075  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
3076  * @see player_360_set_direction_of_view()
3077  */
3078 int player_360_get_direction_of_view(player_h player, float *yaw, float *pitch);
3079
3080 /**
3081  * @brief Sets the zoom level of 360 video.
3082  * @details  The zoom means scaling of the flat image cut from the panorama.
3083  *           The valid range is from 1.0 to 10.0, where 1.0 is the actual image and
3084  *           values above are zoom-in factor. Default value is 1.0 - no zoom.
3085  * @since_tizen 5.0
3086  * @remarks This function is related to the following features:\n
3087  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
3088  *          %http://tizen.org/feature/opengles.version.2_0\n
3089  * @param[in] player    The handle to the media player
3090  * @param[in] level     The zoom level\n
3091  *                      Valid range is 1.0~10.0. Default value is 1.0.
3092  * @return @c 0 on success,
3093  *         otherwise a negative error value
3094  * @retval #PLAYER_ERROR_NONE              Successful
3095  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
3096  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
3097  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
3098  * @see player_360_get_zoom()
3099  */
3100 int player_360_set_zoom(player_h player, float level);
3101
3102 /**
3103  * @brief Gets the current zoom level of 360 video.
3104  * @details  The zoom means scaling of the flat image cut from the panorama.
3105  *           The valid range is from 1.0 to 10.0. Where 1.0 is actual image and
3106  *           values above are zoom-in factor. Default value is 1.0 - no zoom.
3107  * @since_tizen 5.0
3108  * @remarks This function is related to the following features:\n
3109  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
3110  *          %http://tizen.org/feature/opengles.version.2_0\n
3111  * @param[in]  player    The handle to the media player
3112  * @param[out] level     Pointer to store current value of zoom level
3113  * @return @c 0 on success,
3114  *         otherwise a negative error value
3115  * @retval #PLAYER_ERROR_NONE              Successful
3116  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
3117  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
3118  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
3119  * @see player_360_set_zoom()
3120  */
3121 int player_360_get_zoom(player_h player, float *level);
3122
3123 /**
3124  * @brief Sets the field of view information of 360 video.
3125  * @details This function is to set the field of view to decide the output frame size.
3126  * @since_tizen 5.0
3127  * @remarks values above the default ones extend the field of view to significantly
3128  *          distorted areas and will not be useful in most cases.
3129  * @remarks This function is related to the following features:\n
3130  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
3131  *          %http://tizen.org/feature/opengles.version.2_0\n
3132  * @param[in] player              The handle to the media player
3133  * @param[in] horizontal_degrees  The horizontal field of view to display in degrees\n
3134  *                                Valid range is 1~360 degrees. Default value is 120 degrees.
3135  * @param[in] vertical_degrees    The vertical field of view to display in degrees\n
3136  *                                Valid range is 1~180 degrees. Default value is 67 degrees.
3137  * @return @c 0 on success,
3138  *         otherwise a negative error value
3139  * @retval #PLAYER_ERROR_NONE              Successful
3140  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
3141  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
3142  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
3143  * @see player_360_get_field_of_view()
3144  */
3145 int player_360_set_field_of_view(player_h player, int horizontal_degrees, int vertical_degrees);
3146
3147 /**
3148  * @brief Gets the field of view information of 360 video.
3149  * @details This function is to get the field of view information.
3150  * @since_tizen 5.0
3151  * @remarks This function is related to the following features:\n
3152  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
3153  *          %http://tizen.org/feature/opengles.version.2_0\n
3154  * @param[in]  player              The handle to the media player
3155  * @param[out] horizontal_degrees  Pointer to store current value of horizontal
3156  *                                 field of view to display in degrees.
3157  * @param[out] vertical_degrees    Pointer to store current value of vertical
3158  *                                 field of view to display in degrees.
3159  * @return @c 0 on success,
3160  *         otherwise a negative error value
3161  * @retval #PLAYER_ERROR_NONE              Successful
3162  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
3163  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
3164  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
3165  * @see player_360_set_field_of_view()
3166  */
3167 int player_360_get_field_of_view(player_h player, int *horizontal_degrees, int *vertical_degrees);
3168
3169 /**
3170  * @brief Sets the zoom level with field of view information of 360 video.
3171  * @details This function is provided to reduce the distortion of zoom operation.
3172  *          The zoom means scaling of the flat image cut from the panorama
3173  *          which is decided by the field of view data.
3174  *          The zoom level valid range is from 1.0 to 10.0, where 1.0 is the actual image and
3175  *          values above are zoom-in factor. Default value is 1.0 - no zoom.
3176  * @since_tizen 5.0
3177  * @remarks The degree values above the default ones extend the field of view to significantly
3178  *          distorted areas and will not be useful in most cases.
3179  * @remarks This function is related to the following features:\n
3180  *          %http://tizen.org/feature/multimedia.player.spherical_video\n
3181  *          %http://tizen.org/feature/opengles.version.2_0\n
3182  * @param[in] player              The handle to the media player
3183  * @param[in] level               The zoom level\n
3184  *                                Valid range is 1.0~10.0. Default value is 1.0.
3185  * @param[in] horizontal_degrees  The horizontal field of view to display in degrees\n
3186  *                                Valid range is 1~360 degrees. Default value is 120 degrees.
3187  * @param[in] vertical_degrees    The vertical field of view to display in degrees\n
3188  *                                Valid range is 1~180 degrees. Default value is 67 degrees.
3189  * @return @c 0 on success,
3190  *         otherwise a negative error value
3191  * @retval #PLAYER_ERROR_NONE              Successful
3192  * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
3193  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
3194  * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature
3195  * @see player_360_set_zoom()
3196  * @see player_360_get_zoom()
3197  * @see player_360_set_field_of_view()
3198  * @see player_360_get_field_of_view()
3199  */
3200 int player_360_set_zoom_with_field_of_view(player_h player, float level, int horizontal_degrees, int vertical_degrees);
3201
3202 /**
3203  * @}
3204  */
3205
3206 #ifdef __cplusplus
3207 }
3208 #endif
3209
3210 #endif /* __TIZEN_MEDIA_PLAYER_H__ */