3d0e34efaa7f75f2b7aeac9331a02b4d96e52eb0
[platform/core/multimedia/libmm-player.git] / src / include / mm_player.h
1 /*
2  * libmm-player
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>,
7  * Seungbae Shin <seungbae.shin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23 #ifndef __MM_PLAYER_H__
24 #define __MM_PLAYER_H__
25
26
27 /*===========================================================================================
28 |                                                                                           |
29 |  INCLUDE FILES                                        |
30 |                                                                                           |
31 ========================================================================================== */
32
33 #include <glib.h>
34
35 #include <mm_types.h>
36 #include <mm_message.h>
37 #include <media_packet.h>
38
39 #ifdef __cplusplus
40         extern "C" {
41 #endif
42
43 /*===========================================================================================
44 |                                                                                           |
45 |  GLOBAL DEFINITIONS AND DECLARATIONS                                        |
46 |                                                                                           |
47 ========================================================================================== */
48
49 /**
50  * MM_PLAYER_URI:
51  *
52  * uri to play (string)
53  *
54  */
55 #define MM_PLAYER_CONTENT_URI               "profile_uri"
56 /**
57  * MM_PLAYER_VIDEO_ROTATION
58  *
59  * can change video angle (int)
60  * @see MMDisplayRotationType
61  */
62 #define MM_PLAYER_VIDEO_ROTATION            "display_rotation"
63 /**
64  * MM_PLAYER_VIDEO_WIDTH:
65  *
66  * get the video width (int), It's guaranteed after calling mm_player_start() or
67  * receiving MM_MESSAGE_BEGIN_OF_STREAM.
68  *
69  */
70 #define MM_PLAYER_VIDEO_WIDTH               "content_video_width"
71 /**
72  * MM_PLAYER_VIDEO_HEIGHT:
73  *
74  * get the video height (int), It's guaranteed after calling mm_player_start() or
75  * receiving MM_MESSAGE_BEGIN_OF_STREAM.
76  *
77  */
78 #define MM_PLAYER_VIDEO_HEIGHT              "content_video_height"
79 /**
80  * MM_PLAYER_VIDEO_EVAS_SURFACE_SINK:
81  *
82  * get the video evas surface sink plugin name (string), It's guaranteed after calling mm_player_create()
83  *
84  */
85 #define MM_PLAYER_VIDEO_EVAS_SURFACE_SINK          "display_evas_surface_sink"
86 /**
87  * MM_PLAYER_MEM_SRC:
88  *
89  * set memory pointer to play (data)
90  *
91  */
92 #define MM_PLAYER_MEMORY_SRC                "profile_user_param"
93 /**
94  * MM_PLAYER_PLAYBACK_COUNT
95  *
96  * can set playback count (int), Default value is 1 and -1 is for infinity playing until releasing it.
97  *
98  */
99 #define MM_PLAYER_PLAYBACK_COUNT            "profile_play_count"
100 /**
101  * MM_PLAYER_SUBTITLE_URI
102  *
103  * set the subtitle path (string)
104  */
105 #define MM_PLAYER_SUBTITLE_URI              "subtitle_uri"
106 /**
107  * MM_PLAYER_STREAMING_USER_AGENT
108  *
109  * set the streaming user agent (string)
110  */
111 #define MM_PLAYER_STREAMING_USER_AGENT      "streaming_user_agent"
112 /**
113  * MM_PLAYER_STREAMING_COOKIE
114  *
115  * set the streaming cookie (int)
116  */
117 #define MM_PLAYER_STREAMING_COOKIE          "streaming_cookie"
118 /**
119  * MM_PLAYER_VIDEO_CODEC
120  *
121  * codec the video data is stored in (string)
122  */
123 #define MM_PLAYER_VIDEO_CODEC               "content_video_codec"
124 /**
125  * MM_PLAYER_AUDIO_CODEC
126  *
127  * codec the audio data is stored in (string)
128  */
129 #define MM_PLAYER_AUDIO_CODEC               "content_audio_codec"
130 /**
131  * MM_PLAYER_AUDIO_BITRATE
132  *
133  * set the streaming proxy port (int)
134  */
135 #define MM_PLAYER_AUDIO_BITRATE             "content_audio_bitrate"
136 /**
137  * MM_PLAYER_AUDIO_CHANNEL
138  *
139  * the number of audio channel (int)
140  */
141 #define MM_PLAYER_AUDIO_CHANNEL             "content_audio_channels"
142 /**
143  * MM_PLAYER_AUDIO_SAMPLERATE
144  *
145  * audio samplerate  (int)
146  */
147 #define MM_PLAYER_AUDIO_SAMPLERATE          "content_audio_samplerate"
148 /**
149  * MM_PLAYER_TEXT_TRACK_NUM
150  *
151  * track number inside a collection (int)
152  */
153 #define MM_PLAYER_TEXT_TRACK_NUM            "content_text_track_num"
154 /**
155  * MM_PLAYER_TAG_ARTIST
156  *
157  * person(s) responsible for the recording (string)
158  */
159 #define MM_PLAYER_TAG_ARTIST                "tag_artist"
160 /**
161  * MM_PLAYER_TAG_TITLE
162  *
163  * title (string)
164  */
165 #define MM_PLAYER_TAG_TITLE                 "tag_title"
166 /**
167  * MM_PLAYER_TAG_ALBUM
168  *
169  * album containing this data (string)
170  */
171 #define MM_PLAYER_TAG_ALBUM                 "tag_album"
172 /**
173  * MM_PLAYER_TAG_GENRE
174  *
175  * genre this data belongs to (string)
176  */
177 #define MM_PLAYER_TAG_GENRE                 "tag_genre"
178 /**
179  * MM_PLAYER_TAG_AUTHOUR
180  *
181  * author (string)
182  */
183 #define MM_PLAYER_TAG_AUTHOUR               "tag_author"
184 /**
185  * MM_PLAYER_TAG_COPYRIGHT
186  *
187  * copyright notice of the data (string)
188  */
189 #define MM_PLAYER_TAG_COPYRIGHT             "tag_copyright"
190 /**
191  * MM_PLAYER_TAG_DATE
192  *
193  * date the data was created (string)
194  */
195 #define MM_PLAYER_TAG_DATE                  "tag_date"
196 /**
197  * MM_PLAYER_TAG_DESCRIPRION
198  *
199  * short text describing the content of the data (string)
200  */
201 #define MM_PLAYER_TAG_DESCRIPRION           "tag_description"
202 /**
203  * MM_PLAYER_TAG_TRACK_NUM
204  *
205  * track number inside a collection (int)
206  */
207 #define MM_PLAYER_TAG_TRACK_NUM             "tag_track_num"
208
209 /**
210  * MM_PLAYER_DRC_MODE
211  *
212  * dynamic resolution change mode (int)
213  */
214 #define MM_PLAYER_DRC_MODE                  "drc_mode"
215
216 /**
217  * MM_PLAYER_GAPLESS_MODE
218  *
219  * gapless playback mode (int)
220  */
221 #define MM_PLAYER_GAPLESS_MODE              "gapless_mode"
222
223 /**
224  * MM_PLAYER_ENABLE_VIDEO_DECODED_CB
225  *
226  * enable video decoded callback (int)
227  */
228 #define MM_PLAYER_ENABLE_VIDEO_DECODED_CB   "enable_video_decoded_cb"
229
230 /**
231  * MM_PLAYER_VIDEO_CODEC_TYPE
232  *
233  * video codec type (int)
234  */
235 #define MM_PLAYER_VIDEO_CODEC_TYPE          "video_codec_type"
236
237 /**
238  * MM_PLAYER_AUDIO_CODEC_TYPE
239  *
240  * audio codec type (int)
241  */
242 #define MM_PLAYER_AUDIO_CODEC_TYPE          "audio_codec_type"
243
244 /**
245  * MM_PLAYER_PREBUFFER_MS
246  *
247  * prebuffer ms (int)
248  */
249 #define MM_PLAYER_PREBUFFER_MS              "prebuffer_ms"
250
251 /**
252  * MM_PLAYER_REBUFFER_MS
253  *
254  * rebuffer ms (int)
255  */
256 #define MM_PLAYER_REBUFFER_MS               "rebuffer_ms"
257 /**
258  * MM_PLAYER_AUDIO_OFFLOAD (int)
259  */
260 #define MM_PLAYER_AUDIO_OFFLOAD             "audio_offload"
261
262 /**
263  * MM_PLAYER_PITCH_CONTROL (int)
264  */
265 #define MM_PLAYER_PITCH_CONTROL             "pitch_control"
266
267 /**
268  * MM_PLAYER_PITCH_VALUE (double)
269  */
270 #define MM_PLAYER_PITCH_VALUE               "pitch_value"
271
272
273 #define BUFFER_MAX_PLANE_NUM (4)
274
275 typedef struct {
276         MMPixelFormatType format;              /**< image format */
277         int width;                             /**< width of video buffer */
278         int height;                            /**< height of video buffer */
279         unsigned int timestamp;                /**< timestamp of stream buffer (msec)*/
280         unsigned int length_total;             /**< total length of stream buffer (in byte)*/
281         void *data[BUFFER_MAX_PLANE_NUM];
282         void *bo[BUFFER_MAX_PLANE_NUM];        /**< TBM buffer object */
283         void *internal_buffer;                 /**< Internal buffer pointer */
284         int stride[BUFFER_MAX_PLANE_NUM];      /**< stride of plane */
285         int elevation[BUFFER_MAX_PLANE_NUM];   /**< elevation of plane */
286         int orientation;                       /**< orientation */
287         int bo_size;                           /**< TBM buffer object size */
288         int plane_num;                         /**< number of Plane */
289 } mmplayer_video_decoded_data_info_t;
290
291 /**
292  * Enumerations of player state.
293  */
294 typedef enum {
295         MM_PLAYER_STATE_NULL,                           /**< Player is created, but not realized yet */
296         MM_PLAYER_STATE_READY,                          /**< Player is ready to play media */
297         MM_PLAYER_STATE_PLAYING,                        /**< Player is now playing media */
298         MM_PLAYER_STATE_PAUSED,                         /**< Player is paused while playing media */
299         MM_PLAYER_STATE_NONE,                           /**< Player is not created yet */
300         MM_PLAYER_STATE_NUM,                            /**< Number of player states */
301 } mmplayer_state_e;
302
303 /**
304  * Enumeration for attribute values types.
305  */
306 typedef enum {
307         MM_PLAYER_ATTRS_TYPE_INVALID = -1,        /**< Type is invalid */
308         MM_PLAYER_ATTRS_TYPE_INT,                 /**< Integer type */
309         MM_PLAYER_ATTRS_TYPE_DOUBLE,              /**< Double type */
310         MM_PLAYER_ATTRS_TYPE_STRING,              /**< UTF-8 String type */
311         MM_PLAYER_ATTRS_TYPE_DATA,                /**< Pointer type */
312         MM_PLAYER_ATTRS_TYPE_ARRAY,               /**< Array type */
313         MM_PLAYER_ATTRS_TYPE_RANGE,               /**< Range type */
314         MM_PLAYER_ATTRS_TYPE_NUM,                 /**< Number of attribute type */
315 } mmplayer_attrs_type_e;
316
317 /**
318  * Enumeration for attribute validation type.
319  */
320 typedef enum {
321         MM_PLAYER_ATTRS_VALID_TYPE_INVALID = -1,                /**< Invalid validation type */
322         MM_PLAYER_ATTRS_VALID_TYPE_NONE,                                /**< Do not check validity */
323         MM_PLAYER_ATTRS_VALID_TYPE_INT_ARRAY,          /**< validity checking type of integer array */
324         MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE,          /**< validity checking type of integer range */
325         MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_ARRAY,                /**< validity checking type of double array */
326         MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_RANGE,       /**< validity checking type of double range */
327 } mmplayer_attrs_valid_type_e;
328
329 /**
330  * Enumeration for attribute access flag.
331  */
332 typedef enum {
333         MM_PLAYER_ATTRS_FLAG_NONE = 0,                                  /**< None flag is set */
334         MM_PLAYER_ATTRS_FLAG_READABLE = 1 << 0,                 /**< Readable */
335         MM_PLAYER_ATTRS_FLAG_WRITABLE = 1 << 1,                 /**< Writable */
336         MM_PLAYER_ATTRS_FLAG_MODIFIED = 1 << 2,                 /**< Modified */
337
338         MM_PLAYER_ATTRS_FLAG_RW = MM_PLAYER_ATTRS_FLAG_READABLE | MM_PLAYER_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
339 } mmplayer_attrs_flag_e;
340
341 /**
342  * Enumeration of track types
343  */
344 typedef enum {
345         MM_PLAYER_TRACK_TYPE_AUDIO = 0,
346         MM_PLAYER_TRACK_TYPE_VIDEO,
347         MM_PLAYER_TRACK_TYPE_TEXT,
348         MM_PLAYER_TRACK_TYPE_MAX
349 } mmplayer_track_type_e;
350
351 /**
352  * Enumeration of runtime buffering mode
353  */
354 typedef enum {
355         MM_PLAYER_BUFFERING_MODE_ADAPTIVE = 0,  /**< default, If buffering is occurred, player will consider the bandwidth to adjust buffer setting. */
356         MM_PLAYER_BUFFERING_MODE_FIXED,                 /**< player will set buffer size with this fixed size value. */
357         MM_PLAYER_BUFFERING_MODE_MAX,
358 } mmplayer_buffering_mode_e;
359
360 /**
361  * Enumeration of media stream buffer status
362  */
363 typedef enum {
364         MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN,
365         MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW,
366 } mmplayer_media_stream_buffer_status_e;
367
368 /**
369  * Enumeration for stream type.
370  */
371 typedef enum {
372         MM_PLAYER_STREAM_TYPE_DEFAULT,  /**< Container type */
373         MM_PLAYER_STREAM_TYPE_AUDIO,    /**< Audio element stream type */
374         MM_PLAYER_STREAM_TYPE_VIDEO,    /**< Video element stream type */
375         MM_PLAYER_STREAM_TYPE_TEXT,     /**< Text type */
376         MM_PLAYER_STREAM_TYPE_MAX,
377 } mmplayer_stream_type_e;
378
379 typedef enum {
380         MM_PLAYER_CODEC_TYPE_DEFAULT = 0, /**< codec is selected by the priority */
381         MM_PLAYER_CODEC_TYPE_HW,          /**< HW codec can only be selected */
382         MM_PLAYER_CODEC_TYPE_SW,          /**< SW codec can only be selected */
383 } mmplayer_video_codec_type_e;
384
385 typedef enum {
386         MM_PLAYER_AUDIO_EXTRACT_DEFAULT                  = 0x00,   /**< Sync with the playback clock and multichannel audio stream */
387         MM_PLAYER_AUDIO_EXTRACT_NO_SYNC_WITH_CLOCK       = 0x01,   /**< No sync with the playback clock */
388         MM_PLAYER_AUDIO_EXTRACT_DEINTERLEAVE             = 0x02,   /**< Splits one interleaved multichannel audio stream into many mono audio streams */
389         MM_PLAYER_AUDIO_EXTRACT_NO_SYNC_AND_DEINTERLEAVE = MM_PLAYER_AUDIO_EXTRACT_NO_SYNC_WITH_CLOCK | MM_PLAYER_AUDIO_EXTRACT_DEINTERLEAVE,
390 } mmplayer_audio_extract_opt_e;
391
392 /**
393  * Attribute validity structure
394  */
395 typedef struct {
396          mmplayer_attrs_type_e type;
397          mmplayer_attrs_valid_type_e validity_type;
398          mmplayer_attrs_flag_e flag;
399         /**
400           * a union that describes validity of the attribute.
401           * Only when type is 'MM_ATTRS_TYPE_INT' or 'MM_ATTRS_TYPE_DOUBLE',
402           * the attribute can have validity.
403          */
404          union {
405                 /**
406                    * Validity structure for integer array.
407                  */
408                 struct {
409                         int *array;  /**< a pointer of array */
410                         int count;   /**< size of array */
411                         int d_val;
412                 } int_array;
413                 /**
414                    * Validity structure for integer range.
415                  */
416                 struct {
417                         int min;   /**< minimum range */
418                         int max;   /**< maximum range */
419                         int d_val;
420                 } int_range;
421                 /**
422                 * Validity structure for double array.
423                 */
424                 struct {
425                         double *array;  /**< a pointer of array */
426                         int count;   /**< size of array */
427                         double d_val;
428                 } double_array;
429                 /**
430                 * Validity structure for double range.
431                 */
432                 struct {
433                         double min;   /**< minimum range */
434                         double max;   /**< maximum range */
435                         double d_val;
436                 } double_range;
437         };
438 } mmplayer_attrs_info_t;
439
440 /**
441  * Volume type.
442  *
443  * @see         mm_player_set_volume, mm_player_get_volume
444  */
445 typedef struct {
446         float level[MM_VOLUME_CHANNEL_NUM];     /**< Relative volume factor for each channels */
447 } mmplayer_volume_type_t;
448
449 /**
450  * Video stream info in external demux case
451  *
452 **/
453 typedef struct {
454         const char *mime;
455         unsigned int framerate_num;
456         unsigned int framerate_den;
457         unsigned int width;
458         unsigned int height;
459         unsigned char *codec_extradata;
460         unsigned int extradata_size;
461         unsigned int version;
462 } mmplayer_video_stream_info_t;
463
464 /**
465  * Audio stream info in external demux case
466  *
467 **/
468 typedef struct {
469         const char *mime;
470         unsigned int channels;
471         unsigned int sample_rate;
472         unsigned char *codec_extradata;
473         unsigned int extradata_size;
474         unsigned int version;
475         unsigned int user_info;
476
477         /* for pcm */
478 //      unsigned int width;
479 //      unsigned int depth;
480 //      unsigned int endianness;
481 //      bool signedness;
482 } mmplayer_audio_stream_info_t;
483
484 /**
485  * Subtitle stream info in external demux case
486  *
487 **/
488 typedef struct _SubtitleStreamInfo {
489         const char *mime;
490         unsigned int codec_tag;
491         void *context;  //for smpte text
492 } mmplayer_subtitle_stream_info_t;
493
494 /**
495  * selected subtitle track number callback function type.
496  *
497  * @param       track_num       [in]    Track number of subtitle
498  * @param       user_param      [in]    User defined parameter
499  *
500  *
501  * @return      This callback function have to return MM_ERROR_NONE.
502  */
503 typedef bool (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
504
505 /**
506  * Buffer underrun / overflow data callback function type.
507  *
508  * @param       status     [in] buffer status
509  * @param       user_param [in] User defined parameter which is passed when set
510  *                          to enough data callback or need data callback
511  *
512  * @return      This callback function have to return MM_ERROR_NONE.
513  */
514 typedef bool (*mm_player_media_stream_buffer_status_callback)(mmplayer_stream_type_e type, mmplayer_media_stream_buffer_status_e status, unsigned long long bytes, void *user_param);
515
516 /**
517  * Buffer seek data callback function type.
518  *
519  * @param       offset     [in] offset for the buffer playback
520  * @param       user_param [in] User defined parameter which is passed when set
521  *                          to seek data callback
522  *
523  * @return      This callback function have to return MM_ERROR_NONE.
524  */
525 typedef bool (*mm_player_media_stream_seek_data_callback)(mmplayer_stream_type_e type, unsigned long long offset, void *user_param);
526
527 /**
528  * Called to notify the stream changed.
529  *
530  * @param user_data [in] The user data passed from the callback registration function
531  *
532  * @return      This callback function have to return MM_ERROR_NONE.
533  */
534 typedef bool (*mm_player_stream_changed_callback)(void *user_param);
535
536
537 /*===========================================================================================
538 |                                                                                           |
539 |  GLOBAL FUNCTION PROTOTYPES                                        |
540 |                                                                                           |
541 ========================================================================================== */
542
543 /**
544  * This function creates a player object for playing multimedia contents. \n
545  * The attributes of player are created to get/set some values with application. \n
546  * And, mutex, gstreamer and other resources are initialized at this time. \n
547  * If player is created, the state will become MM_PLAYER_STATE_NULL.
548  *
549  * @param   player [out] Handle of player
550  *
551  * @return  This function returns zero on success, or negative value with error code. \n
552  *          Please refer 'mm_error.h' to know it in detail.
553  * @pre     None
554  * @post    MM_PLAYER_STATE_NULL
555  * @see     mm_player_destroy
556  * @remark  You can create multiple handles on a context at the same time. \n
557  *          However, player cannot guarantee proper operation because of limitation of resources, \n
558  *          such as audio device or display device.
559  *
560  * @par Example
561  * @code
562 char *g_err_attr_name = NULL;
563
564 if (mm_player_create(&g_player) != MM_ERROR_NONE) {
565         LOGE("failed to create player\n");
566 }
567
568 if (mm_player_set_attribute(g_player,
569                                                 &g_err_attr_name,
570                                                 "profile_uri", filename, strlen(filename),
571                                                 "display_overlay", (void *)&g_win.xid, sizeof(g_win.xid),
572                                                 NULL) != MM_ERROR_NONE) {
573         LOGE("failed to set %s attribute\n", g_err_attr_name);
574         free(g_err_attr_name);
575 }
576
577 mm_player_set_message_callback(g_player, msg_callback, (void *)g_player);
578  * @endcode
579  */
580 int mm_player_create(MMHandleType *player);
581
582 /**
583  * This function releases player object and all resources which were created by mm_player_create(). \n
584  * And, player handle will also be destroyed.
585  *
586  * @param   player [in] Handle of player
587  *
588  * @return  This function returns zero on success, or negative value with error code.
589  * @pre     Player state may be MM_PLAYER_STATE_NULL. \n
590  *          But, it can be called in any state.
591  * @post    Because handle is released, there is no any state.
592  * @see     mm_player_create
593  * @remark  This method can be called with a valid player handle from any state to \n
594  *          completely shutdown the player operation.
595  *
596  * @par Example
597  * @code
598 if (mm_player_destroy(g_player) != MM_ERROR_NONE) {
599         LOGE("failed to destroy player\n");
600 }
601  * @endcode
602  */
603 int mm_player_destroy(MMHandleType player);
604
605 /**
606  * This function parses uri and makes gstreamer pipeline by uri scheme. \n
607  * So, uri should be set before realizing with mm_player_set_attribute(). \n
608  *
609  * @param   player [in] Handle of player
610  *
611  * @return  This function returns zero on success, or negative value with error code.
612  *
613  * @pre     Player state should be MM_PLAYER_STATE_NULL.
614  * @post    player state will be MM_PLAYER_STATE_READY.
615  * @see     mm_player_unrealize
616  * @remark  None
617  * @par Example
618  * @code
619 if (mm_player_realize(g_player) != MM_ERROR_NONE) {
620         LOGE("failed to realize player\n");
621 }
622  * @endcode
623  */
624 int mm_player_realize(MMHandleType player);
625
626 /**
627  * This function uninitializes player object. So, resources and allocated memory \n
628  * will be freed. And, gstreamer pipeline is also destroyed. So, if you want to play \n
629  * other contents, player should be created again after destruction or realized with new uri.
630  *
631  * @param   player [in] Handle of player
632  *
633  * @return  This function returns zero on success, or negative value with error code.
634  * @pre     Player state may be MM_PLAYER_STATE_READY to unrealize. \n
635  *          But, it can be called in any state.
636  * @post    Player state will be MM_PLAYER_STATE_NULL.
637  * @see     mm_player_realize
638  * @remark  This method can be called with a valid player handle from any state.
639  *
640  * @par Example
641  * @code
642 if (mm_player_unrealize(g_player) != MM_ERROR_NONE) {
643         LOGE("failed to unrealize player\n");
644 }
645  * @endcode
646  */
647 int mm_player_unrealize(MMHandleType player);
648
649 /**
650  * This function is to abort pause state transition
651  * for unrealize or destroy.
652  */
653 int mm_player_abort_pause(MMHandleType player);
654
655 /**
656  * This function is to get current state of player. \n
657  * Application have to check current state before doing some action.
658  *
659  * @param player [in]  Handle of player
660  * @param state  [out] current state of player on success
661  *
662  * @return   This function returns zero on success, or negative value with error code.
663  *
664  * @see      mmplayer_state_e
665  * @remark   None
666  * @par Example
667  * @code
668 if (mm_player_get_state(g_player, &state) != MM_ERROR_NONE) {
669         LOGE("failed to get state\n");
670 }
671  * @endcode
672  */
673 int mm_player_get_state(MMHandleType player, mmplayer_state_e *state);
674
675 /**
676  * This function is to set relative volume of player. \n
677  * So, It controls logical volume value. \n
678  * But, if developer want to change system volume, mm sound api should be used.
679  *
680  * @param       player          [in]    Handle of player
681  * @param       volume          [in]    Volume factor of each channel
682  *
683  * @return      This function returns zero on success, or negative value with error code.
684  * @see         mmplayer_volume_type_t, mm_player_get_volume
685  * @remark      The range of factor range is from 0 to 1.0. (1.0 = 100%) And, default value is 1.0.
686  * @par Example
687  * @code
688 mmplayer_volume_type_t volume;
689 int i = 0;
690
691 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
692         volume.level[i] = MM_VOLUME_LEVEL_MAX;
693
694 if (mm_player_set_volume(g_player, &volume) != MM_ERROR_NONE)
695 {
696     LOGE("failed to set volume\n");
697 }
698  * @endcode
699  */
700 int mm_player_set_volume(MMHandleType player, mmplayer_volume_type_t *volume);
701
702 /**
703  * This function is to get current volume factor of player.
704  *
705  * @param       player          [in]    Handle of player.
706  * @param       volume          [out]   Volume factor of each channel.
707  *
708  * @return      This function returns zero on success, or negative value with error code.
709  *
710  * @see         mmplayer_volume_type_t, mm_player_set_volume
711  * @remark  None
712  * @par Example
713  * @code
714 mmplayer_volume_type_t volume;
715 int i;
716
717 if (mm_player_get_volume(g_player, &volume) != MM_ERROR_NONE)
718 {
719         LOGW("failed to get volume\n");
720 }
721
722 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
723         LOGD("channel[%d] = %d \n", i, volume.level[i]);
724  * @endcode
725  */
726 int mm_player_get_volume(MMHandleType player, mmplayer_volume_type_t *volume);
727
728 /**
729  * This function is to start playing media contents. Demux(parser), codec and related plugins are decided \n
730  * at this time. And, MM_MESSAGE_BEGIN_OF_STREAM will be posted through callback function registered \n
731  * by mm_player_set_message_callback().
732  *
733  * @param       player          [in]    Handle of player
734  *
735  * @return      This function returns zero on success, or negative value with error code.
736  * @remark
737  *
738  * @pre         Player state may be MM_PLAYER_STATE_READY.
739  * @post                Player state will be MM_PLAYER_STATE_PLAYING.
740  * @see         mm_player_stop
741  * @remark  None
742  * @par Example
743  * @code
744 if (mm_player_start(g_player) != MM_ERROR_NONE)
745 {
746         LOGE("failed to start player\n");
747 }
748  * @endcode
749  */
750 int mm_player_start(MMHandleType player);
751
752 /**
753  * This function is to stop playing media contents and it's different with pause. \n
754  * If mm_player_start() is called after this, content will be started again from the beginning. \n
755  * So, it can be used to close current playback.
756  *
757  * @param       player          [in]    Handle of player
758  *
759  * @return      This function returns zero on success, or negative value with error code.
760  *
761  * @pre         Player state may be MM_PLAYER_STATE_PLAYING.
762  * @post                Player state will be MM_PLAYER_STATE_READY.
763  * @see         mm_player_start
764  * @remark  None
765  * @par Example
766  * @code
767 if (mm_player_stop(g_player) != MM_ERROR_NONE)
768 {
769         LOGE("failed to stop player\n");
770 }
771  * @endcode
772  */
773 int mm_player_stop(MMHandleType player);
774
775 /**
776  * This function is to pause playing media contents.
777  *
778  * @param       player          [in]    Handle of player.
779  *
780  * @return      This function returns zero on success, or negative value with error code.
781  *
782  * @pre         Player state may be MM_PLAYER_STATE_PLAYING.
783  * @post                Player state will be MM_PLAYER_STATE_PAUSED.
784  * @see         mm_player_resume
785  * @remark  None
786  * @par Example
787  * @code
788 if (mm_player_pause(g_player) != MM_ERROR_NONE)
789 {
790         LOGE("failed to pause player\n");
791 }
792  * @endcode
793  */
794 int mm_player_pause(MMHandleType player);
795
796 /**
797  * This function is to resume paused media contents.
798  *
799  * @param       player          [in]    Handle of player.
800  *
801  * @return      This function returns zero on success, or negative value with error code.
802  *
803  * @pre         Player state may be MM_PLAYER_STATE_PAUSED.
804  * @post                Player state will be MM_PLAYER_STATE_PLAYING.
805  * @see         mm_player_pause
806  * @remark  None
807  * @par Example
808  * @code
809 if (mm_player_resume(g_player) != MM_ERROR_NONE)
810 {
811         LOGE("failed to resume player\n");
812 }
813  * @endcode
814  */
815 int mm_player_resume(MMHandleType player);
816
817 /**
818  * This function is to set the position for playback. \n
819  * So, it can be seeked to requested position. \n
820  *
821  * @param       player          [in]    Handle of player
822  * @param       pos                     [in]    Position for playback
823  *
824  * @return      This function returns zero on success, or negative value with error code.
825  * @see         mm_player_get_position
826  * @remark  the unit of time-based format is millisecond and other case is percent.
827  */
828 int mm_player_set_position(MMHandleType player, int64_t pos);
829
830 /**
831  * This function is to get current position of playback content.
832  *
833  * @param       player          [in]    Handle of player.
834  * @param       format          [in]    Format of position.
835  * @param    pos        [out] contains current position on success or zero in case of failure.
836  *
837  * @return      This function returns zero on success, or negative value with errors
838  * @see         mm_player_set_position
839  * @remark  the unit of time-based format is millisecond and other case is percent.
840  */
841 int mm_player_get_position(MMHandleType player, int64_t *pos);
842
843 /**
844  * This function is to get the content time duration.
845  */
846 int mm_player_get_duration(MMHandleType player, int64_t *dur);
847
848 /**
849  * This function is to get current buffer position of playback content.
850  *
851  * @param   player      [in]    Handle of player.
852  * @param   format      [in]    Format of position.
853  * @param   start_pos   [out] contains buffer start  position on success or zero in case of failure.
854  * @param   stop_pos    [out] contains buffer current  position on success or zero in case of failure.
855  *
856  * @return      This function returns zero on success, or negative value with errors
857  * @see         mm_player_set_position
858  * @remark  the unit of time-based format is millisecond and other case is percent.
859  * @par Example
860  * @code
861 int start_pos = 0, stop_pos = 0;
862
863 mm_player_get_buffer_position(g_player, &start_pos, &end_pos );
864
865 LOGD("buffer position: [%d] ~ [%d] \%\n", start_pos, end_pos );
866  * @endcode
867  */
868 int mm_player_get_buffer_position(MMHandleType player, int *start_pos, int *end_pos);
869
870 /**
871  * This function sets callback function for receiving messages from player.
872  * So, player can notify warning, error and normal cases to application.
873  *
874  * @param       player          [in]    Handle of player.
875  * @param       callback        [in]    Message callback function.
876  * @param       user_param      [in]    User parameter which is passed to callback function.
877  *
878  * @return      This function returns zero on success, or negative value with error code.
879  * @see         MMMessageCallback
880  * @remark  None
881  * @par Example
882  * @code
883 int msg_callback(int message, MMMessageParamType *param, void *user_param)
884 {
885         switch (message)
886         {
887                 case MM_MESSAGE_ERROR:
888                         //do something
889                         break;
890
891                 case MM_MESSAGE_END_OF_STREAM:
892                         //do something
893                         break;
894
895                 case MM_MESSAGE_STATE_CHANGED:
896                         //do something
897                         break;
898
899                 case MM_MESSAGE_BEGIN_OF_STREAM:
900                         //do something
901                         break;
902
903                 default:
904                         break;
905         }
906         return TRUE;
907 }
908
909 mm_player_set_message_callback(g_player, msg_callback, (void *)g_player);
910  * @endcode
911  */
912 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
913
914 /**
915  * This function is to mute volume of player
916  *
917  * @param       player  [in]    Handle of player
918  * @param       mute    [in]    Mute(1) or not mute(0)
919  *
920  * @return      This function returns zero on success, or negative value with error code
921  * @see         mm_player_get_mute
922  * @remark  None
923  * @par Example
924  * @code
925 if (mm_player_set_mute(g_player, TRUE) != MM_ERROR_NONE)
926 {
927         LOGW("failed to set mute\n");
928 }
929  * @endcode
930  */
931 int mm_player_set_mute(MMHandleType player, int mute);
932
933 /**
934  * This function is to get mute value of player
935  *
936  * @param       player  [in]    Handle of player
937  * @param       mute    [out]   Sound is muted
938  *
939  * @return      This function returns zero on success, or negative value with error code
940  * @see         mm_player_set_mute
941  * @remark  None
942  * @par Example
943  * @code
944 int mute;
945
946 if (mm_player_get_mute(g_player, &mute) != MM_ERROR_NONE)
947 {
948         LOGW("failed to get mute\n");
949 }
950
951 LOGD("mute status:%d\n", mute);
952  * @endcode
953  */
954 int mm_player_get_mute(MMHandleType player, int *mute);
955
956 /**
957  * This function is to adjust subtitle postion. So, subtitle can show at the adjusted position. \n
958  * If pos is negative, subtitle will be displayed previous time, the other hand forward time. \n
959  *
960  * @param       player  [in]    Handle of player
961  * @param       pos             [in]    postion to be adjusted
962  *
963  * @return      This function returns zero on success, or negative value with error
964  *                      code
965  * @see         mm_player_adjust_subtitle_position
966  * @remark  None
967  * @par Example
968  * @code
969 int pos;
970
971 pos = 5000;
972 if (mm_player_adjust_subtitle_position(g_player, pos) != MM_ERROR_NONE)
973 {
974         LOGW("failed to adjust subtitle postion.\n");
975 }
976  * @endcode
977  */
978
979 int mm_player_adjust_subtitle_position(MMHandleType player, int pos);
980
981 /**
982  * This function is to set subtitle silent status. So, subtitle can show or hide during playback \n
983  * by this value. But, one subtitle file should be set with "subtitle_uri" attribute before calling mm_player_realize(); \n
984  * Player FW parses subtitle file and send text data including timestamp to application \n
985  * through message callback with MM_MESSAGE_UPDATE_SUBTITLE will be. \n
986  * So, application have to render it. And, subtitle can be supported only in a seprate file. \n
987  * So, it's not supported for embedded case.
988  *
989  * @param       player  [in]    Handle of player
990  * @param       silent  [in]    silent(integer value except 0) or not silent(0)
991  *
992  * @return      This function returns zero on success, or negative value with error
993  *                      code
994  * @see         mm_player_get_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
995  * @remark  None
996  * @par Example
997  * @code
998 mm_player_set_attribute(g_player,
999                                         &g_err_name,
1000                                         "subtitle_uri", g_subtitle_uri, strlen(g_subtitle_uri),
1001                                         NULL
1002                                         );
1003
1004 if (mm_player_set_subtitle_silent(g_player, TRUE) != MM_ERROR_NONE)
1005 {
1006         LOGW("failed to set subtitle silent\n");
1007 }
1008  * @endcode
1009  */
1010 int mm_player_set_subtitle_silent(MMHandleType player, int silent);
1011
1012 /**
1013  * This function is to get silent status of subtitle.
1014  *
1015  * @param       player  [in]    Handle of player
1016  * @param       silent  [out]   subtitle silent property
1017  *
1018  * @return      This function returns zero on success, or negative value with error
1019  *                      code
1020  * @see         mm_player_set_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1021  * @remark  None
1022  * @par Example
1023  * @code
1024 int silent = FALSE;
1025
1026 if (mm_player_get_subtitle_silent(g_player, &silent) != MM_ERROR_NONE)
1027 {
1028         LOGW("failed to set subtitle silent\n");
1029 }
1030  * @endcode
1031  */
1032 int mm_player_get_subtitle_silent(MMHandleType player, int *silent);
1033
1034 /**
1035  * This function is to set attributes into player. Multiple attributes can be set simultaneously. \n
1036  * If one of attribute fails, this function will stop at the point and let you know the name which is failed. \n
1037  *
1038  * @param   player                 [in]   Handle of player.
1039  * @param   err_attr_name          [out]  Name of attribute which is failed to set
1040  * @param   first_attribute_name   [in]   Name of the first attribute to set
1041  * @param   ...                    [in]   Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1042  *                                        But, in the case of data or string type, it should be name/value/size.
1043  *
1044  * @return  This function returns zero on success, or negative value with error code.
1045  *
1046  * @see     mm_player_get_attribute
1047  * @remark  This function must be terminated by NULL argument.
1048  *          And, if this function is failed, err_attr_name param must be free.
1049  * @par Example
1050  * @code
1051 char *g_err_attr_name = NULL;
1052
1053 if (mm_player_set_attribute(g_player,
1054                                                 &g_err_attr_name,
1055                                                 "profile_uri", filename, strlen(filename),
1056                                                 "profile_play_count", count,
1057                                                 NULL) != MM_ERROR_NONE) {
1058         LOGW("failed to set %s attribute\n", g_err_attr_name);
1059         free(g_err_attr_name);
1060 }
1061
1062  * @endcode
1063  */
1064 int mm_player_set_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1065
1066 /**
1067  * This function is to get attributes from player. Multiple attributes can be got simultaneously.
1068  *
1069  * @param   player                [in]  Handle of player.
1070  * @param   err_attr_name         [out] Name of attribute which is failed to get
1071  * @param   first_attribute_name  [in]  Name of the first attribute to get
1072  * @param   ...                   [out] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1073  *                                      But, in the case of data or string type, it should be name/value/size.
1074  *
1075  * @return  This function returns zero on success, or negative value with error
1076  *          code.
1077  * @see     mm_player_set_attribute
1078  * @remark  This function must be terminated by NULL argument.
1079  *          And, if this function is failed, err_attr_name param must be free.
1080  */
1081 int mm_player_get_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1082
1083 /**
1084  * This function is to get detail information of attribute.
1085  *
1086  * @param   player          [in]  Handle of player.
1087  * @param   attribute_name  [in]  Name of the attribute to get
1088  * @param   info            [out] Attribute infomation
1089  *
1090  * @return  This function returns zero on success, or negative value with error
1091  *          code.
1092  *
1093  * @see     mm_player_set_attribute, mm_player_get_attribute
1094  * @remark  None
1095  * @par Example
1096  * @code
1097 if (mm_player_get_attribute_info(g_player, "display_method", &method_info) != MM_ERROR_NONE) {
1098         LOGW("failed to get info\n");
1099 }
1100
1101 LOGD("type:%d \n", method_info.type); //int, double..
1102 LOGD("flag:%d \n", method_info.flag); //readable, writable..
1103 LOGD("validity type:%d \n", method_info.validity_type); //range, array..
1104
1105 if (method_info. validity_type == MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE) {
1106         LOGD("range min:%d\n", method_info.int_range.min);
1107         LOGD("range max:%d\n", method_info.int_range.max);
1108 }
1109  * @endcode
1110  */
1111 int mm_player_get_attribute_info(MMHandleType player,  const char *attribute_name, mmplayer_attrs_info_t *info);
1112
1113 /**
1114  * This function is to get the track count
1115  *
1116  * @param   player [in]  handle of player.
1117  * @param   track  [in]  type of the track type
1118  * @param   info   [out] the count of the track
1119  *
1120  * @return  This function returns zero on success, or negative value with error
1121  *          code.
1122  *
1123  * @par Example
1124  * @code
1125 gint audio_count = 0;
1126
1127 if (mm_player_get_track_count(g_player, MM_PLAYER_TRACK_TYPE_AUDIO, &audio_count) != MM_ERROR_NONE) {
1128         LOGW("failed to get audio track count\n");
1129 }
1130
1131 LOGD("audio track count : %d \n", audio_count);
1132  * @endcode
1133  */
1134 int mm_player_get_track_count(MMHandleType player,  mmplayer_track_type_e type, int *count);
1135
1136 /**
1137  * This function is to select the track
1138  *
1139  * @param   player [in] handle of player.
1140  * @param   type   [in] type of the track type
1141  * @param   index  [in] the index of the track
1142  *
1143  * @return  This function returns zero on success, or negative value with error
1144  *          code.
1145  */
1146 int mm_player_select_track(MMHandleType player, mmplayer_track_type_e type, int index);
1147
1148 /**
1149  * This function is to get the track language
1150  *
1151  * @param   player [in]  handle of player.
1152  * @param   type   [in]  type of the track type
1153  * @param   index  [in]  the index of the track
1154  * @param   code   [out] language code in ISO 639-1(string)
1155  *
1156  * @return  This function returns zero on success, or negative value with error
1157  *          code.
1158  */
1159 int mm_player_get_track_language_code(MMHandleType player,  mmplayer_track_type_e type, int index, char **code);
1160
1161 /**
1162  * This function is to get the current running track
1163  *
1164  * @param       player          [in]    handle of player.
1165  * @param       type                    [in]    type of the track type
1166  * @param       index           [out]    the index of the track
1167  *
1168  * @return      This function returns zero on success, or negative value with error
1169  *                      code.
1170  */
1171
1172 int mm_player_get_current_track(MMHandleType hplayer, mmplayer_track_type_e type, int *index);
1173
1174 /**
1175  * This function is to set the subtitle path
1176  *
1177  * @param       player  [in]    handle of player
1178  * @param       path    [in]    subtitle path
1179  *
1180  * @return      This function returns zero on success, or negative value with error code.
1181  */
1182 int mm_player_set_external_subtitle_path(MMHandleType player, const char *path);
1183
1184 /**
1185  * This function is to set uri.
1186  *
1187  * @param   player [in] handle of player
1188  * @param   uri    [in] uri
1189  * @return  This function returns zero on success, or negative value with error code.
1190  */
1191 int mm_player_set_uri(MMHandleType player, const char *uri);
1192
1193 /**
1194  * This function is to set next uri.
1195  *
1196  * @param   player [in] handle of player
1197  * @param   uri    [in] uri
1198  * @return  This function returns zero on success, or negative value with error code.
1199  */
1200 int mm_player_set_next_uri(MMHandleType player, const char *uri);
1201
1202 /**
1203  * This function is to get next uri.
1204  *
1205  * @param   player   [in]  handle of player
1206  * @param   uri      [out] uri
1207  * @return  This function returns zero on success, or negative value with error code.
1208  */
1209 int mm_player_get_next_uri(MMHandleType player, char **uri);
1210
1211 /**
1212  * This function is to decrease reference count of internal buffer.
1213  *
1214  * @param    buffer [in] video callback internal buffer
1215  * @return   None;
1216  */
1217 void mm_player_video_stream_internal_buffer_unref(void *buffer);
1218
1219 /**mm_player_submit_packet
1220  * This function is to submit buffer to appsrc.  \n
1221  * @param   player                      [in]    Handle of player.
1222  * @param   buf             [in]    buffer to be submit in appsrc in external feeder case.
1223  * @param   len                         [in]    length of buffer.
1224  * @param   pts                         [in]    timestamp of buffer.
1225  * @param   streamtype          [in]    stream type of buffer.
1226  * @return  This function returns zero on success, or negative value with error code.
1227  */
1228 int mm_player_submit_packet(MMHandleType player, media_packet_h packet);
1229
1230 /**mm_player_set_video_info
1231  * This function is to set caps of src pad of video appsrc in external feeder case.  \n
1232  * @param   player         [in] Handle of player.
1233  * @param   media_format_h [in] Video stream info.
1234  * @return  This function returns zero on success, or negative value with error code.
1235  */
1236 int mm_player_set_video_info(MMHandleType player, media_format_h format);
1237
1238 /**mm_player_set_audio_info
1239  * This function is to set caps of src pad of Audio appsrc in external feeder case.  \n
1240  * @param       player                       [in]    Handle of player.
1241  * @param       media_format_h               [in]    Audio stream info.
1242  * @return      This function returns zero on success, or negative value with error code.
1243  */
1244 int mm_player_set_audio_info(MMHandleType player, media_format_h format);
1245
1246 /**mm_player_set_subtitle_info
1247  * This function is to set caps of src pad of subtitle appsrc in external feeder case.  \n
1248  * @param       player                          [in]    Handle of player.
1249  * @param       subtitle_stream_info               [in]    Subtitle stream info.
1250  * @return      This function returns zero on success, or negative value with error code.
1251  */
1252 int mm_player_set_subtitle_info(MMHandleType player, mmplayer_subtitle_stream_info_t *info);
1253
1254 /**
1255  * This function set callback function for receiving need or enough data message from player.
1256  *
1257  * @param   player     [in] Handle of player.
1258  * @param   type       [in] stream type
1259  * @param   callback   [in] data callback function for stream type.
1260  * @param   user_param [in] User parameter.
1261  *
1262  * @return  This function returns zero on success, or negative value with error
1263  *          code.
1264  */
1265 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, mmplayer_stream_type_e type, mm_player_media_stream_buffer_status_callback callback, void *user_param);
1266
1267 /**
1268  * This function set callback function for receiving seek data message from player.
1269  *
1270  * @param       player          [in]    Handle of player.
1271  * @param       type            [in]    stream type
1272  * @param       callback        [in]    Seek data callback function for stream type.
1273  * @param       user_param      [in]    User parameter.
1274  *
1275  * @return      This function returns zero on success, or negative value with error
1276  *                      code.
1277  */
1278 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, mmplayer_stream_type_e type, mm_player_media_stream_seek_data_callback callback, void *user_param);
1279
1280 /**
1281  * This function is to set max size of buffer(appsrc).
1282  *
1283  * @param       player          [in]    Handle of player.
1284  * @param       type            [in]    stream type
1285  * @param       max_size        [in]    max bytes of buffer.
1286  *
1287  * @return      This function returns zero on success, or negative value with error
1288  *                      code.
1289  */
1290 int mm_player_set_media_stream_buffer_max_size(MMHandleType player, mmplayer_stream_type_e type, unsigned long long max_size);
1291
1292 /**
1293  * This function is to get max size of buffer(appsrc).
1294  *
1295  * @param       player          [in]    Handle of player.
1296  * @param       type            [in]    stream type
1297  * @param       max_size        [out]   max bytes of buffer.
1298  *
1299  * @return      This function returns zero on success, or negative value with error
1300  *                      code.
1301  */
1302 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, mmplayer_stream_type_e type, unsigned long long *max_size);
1303
1304 /**
1305  * This function is to set min percent of buffer(appsrc).
1306  *
1307  * @param       player          [in]    Handle of player.
1308  * @param       type            [in]    stream type
1309  * @param       min_percent     [in]    min percent of buffer.
1310  *
1311  * @return      This function returns zero on success, or negative value with error
1312  *                      code.
1313  */
1314 int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, mmplayer_stream_type_e type, unsigned min_percent);
1315
1316 /**
1317  * This function is to get min percent of buffer(appsrc).
1318  *
1319  * @param       player          [in]    Handle of player.
1320  * @param       type            [in]    stream type
1321  * @param       min_percent     [out]   min percent of buffer.
1322  *
1323  * @return      This function returns zero on success, or negative value with error
1324  *                      code.
1325  */
1326 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, mmplayer_stream_type_e type, unsigned int *min_percent);
1327
1328 /**
1329  * This function set callback function for changing audio stream from player. \n
1330  * It's only supported when audio stream is included in file. \n
1331  *
1332  * @param       player   [in] Handle of player.
1333  * @param       callback [in] Audio stream changed callback function.
1334  * @param       user_param [in] User parameter.
1335  *
1336  * @return      This function returns zero on success, or negative value with error
1337  *                      code.
1338  * @see         mm_player_stream_changed_callback
1339  * @since
1340  */
1341 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
1342
1343 /**
1344  * This function set callback function for changing video stream from player. \n
1345  * It's only supported when video stream is included in file. \n
1346  *
1347  * @param       player   [in] Handle of player.
1348  * @param       callback [in] Video stream changed callback function.
1349  * @param       user_param [in] User parameter.
1350  *
1351  * @return      This function returns zero on success, or negative value with error
1352  *                      code.
1353  * @see         mm_player_stream_changed_callback
1354  */
1355 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
1356
1357 /**
1358  * This function is to get timeout value according to the content type for muse. \n
1359  * It's only supported when video stream is included in file. \n
1360  *
1361  * @param       player  [in] Handle of player.
1362  * @param       timeout [out] timeout value (sec).
1363  *
1364  * @return      This function returns zero on success, or negative value with error
1365  *                      code.
1366  * @since 3.0
1367  */
1368 int mm_player_get_timeout(MMHandleType player, int *timeout);
1369
1370 /**
1371  * This function is to get the number of video output buffers. \n
1372  * It's only supported when video stream is included in file. \n
1373  *
1374  * @param       player  [in] Handle of player.
1375  * @param       num     [out] num of buffers.
1376  * @param       extra_num [out] extra num of buffers.
1377  *
1378  * @return      This function returns zero on success, or negative value with error
1379  *                      code.
1380  * @since 3.0
1381  */
1382 int mm_player_get_num_of_video_out_buffers(MMHandleType player, int *num, int *extra_num);
1383
1384 /**
1385  * This function is to set the dynamic resolution information. \n
1386  * It's only supported when video stream is included in file. \n
1387  *
1388  * @param       player  [in] Handle of player.
1389  * @param       drc     [in] dynamic resolution info of media stream data
1390  *
1391  * @return      This function returns zero on success, or negative value with error
1392  *                      code.
1393  * @since 3.0
1394  */
1395 int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc);
1396
1397 /**
1398  * This function is to release the video stream bo to reuse. \n
1399  * It's only supported when sw codec is used to decode video stream. \n
1400  *
1401  * @param       player  [in] Handle of player.
1402  * @param       bo     [in] bo address to be released
1403  *
1404  * @return      This function returns zero on success, or negative value with error
1405  *                      code.
1406  * @since 3.0
1407  */
1408 int mm_player_release_video_stream_bo(MMHandleType player, void *bo);
1409
1410 /**
1411  * This function is to set sound stream info
1412  */
1413 int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index);
1414
1415 /**
1416  * This function is to manage the playback according to the external storage state
1417  */
1418 int mm_player_manage_external_storage_state(MMHandleType player, int id, int state);
1419
1420 /**
1421  * These functions are to set/get the max variant of HAS
1422  */
1423 int mm_player_get_adaptive_variant_info(MMHandleType player, int *num, char **var_info);
1424 int mm_player_set_max_adaptive_variant_limit(MMHandleType player, int bandwidth, int width, int height);
1425 int mm_player_get_max_adaptive_variant_limit(MMHandleType player, int *bandwidth, int *width, int *height);
1426
1427 /**
1428  * These functions are to set/get the audio only mode
1429  */
1430 int mm_player_set_audio_only(MMHandleType player, bool audio_only);
1431 int mm_player_get_audio_only(MMHandleType player, bool *audio_only);
1432
1433 /**
1434  * These functions are to get the streaming bufferint time
1435  */
1436 int mm_player_get_streaming_buffering_time(MMHandleType player, int *prebuffer_ms, int *rebuffer_ms);
1437
1438 /**
1439  * These functions are to display the 360 video content
1440  */
1441 int mm_player_360_is_content_spherical(MMHandleType player, bool *is_spherical);
1442 int mm_player_360_set_enabled(MMHandleType player, bool enabled);
1443 int mm_player_360_is_enabled(MMHandleType player, bool *enabled);
1444
1445 int mm_player_360_set_direction_of_view(MMHandleType player, float yaw, float pitch);
1446 int mm_player_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch);
1447
1448 int mm_player_360_set_zoom(MMHandleType player, float level);
1449 int mm_player_360_get_zoom(MMHandleType player, float *level);
1450
1451 int mm_player_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees);
1452 int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees);
1453
1454 /**
1455  * This function is to set codec type
1456  */
1457 int mm_player_set_codec_type(MMHandleType player, mmplayer_stream_type_e stream_type, mmplayer_video_codec_type_e codec_type);
1458
1459 /**
1460  * These functions are to apply the replaygain
1461  */
1462 int mm_player_set_replaygain_enabled(MMHandleType player, bool enabled);
1463 int mm_player_is_replaygain_enabled(MMHandleType player, bool *enabled);
1464
1465 /**
1466  * This function is to set/get video content ROI area
1467  */
1468 int mm_player_set_video_roi_area(MMHandleType player, double scale_x, double scale_y, double scale_width, double scale_height);
1469 int mm_player_get_video_roi_area(MMHandleType player, double *scale_x, double *scale_y, double *scale_width, double *scale_height);
1470
1471 /**
1472         @}
1473  */
1474
1475 #ifdef __cplusplus
1476         }
1477 #endif
1478
1479 #endif  /* __MM_PLAYER_H__ */