Merge "[0.6.173] support audio pitch control" into tizen
[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 } MMPlayerVideoStreamDataType;
289
290 /**
291  * Enumerations of player state.
292  */
293 typedef enum {
294         MM_PLAYER_STATE_NULL,                           /**< Player is created, but not realized yet */
295         MM_PLAYER_STATE_READY,                          /**< Player is ready to play media */
296         MM_PLAYER_STATE_PLAYING,                        /**< Player is now playing media */
297         MM_PLAYER_STATE_PAUSED,                         /**< Player is paused while playing media */
298         MM_PLAYER_STATE_NONE,                           /**< Player is not created yet */
299         MM_PLAYER_STATE_NUM,                            /**< Number of player states */
300 } MMPlayerStateType;
301
302 /**
303  * Enumerations of position formats.
304  */
305 typedef enum {
306         MM_PLAYER_POS_FORMAT_TIME,                      /**< Format for time based */
307         MM_PLAYER_POS_FORMAT_PERCENT,                   /**< Format for percentage */
308         MM_PLAYER_POS_FORMAT_NUM,                       /**< Number of position formats */
309 } MMPlayerPosFormatType;
310
311 /**
312  * Enumeration for attribute values types.
313  */
314 typedef enum {
315         MM_PLAYER_ATTRS_TYPE_INVALID = -1,        /**< Type is invalid */
316         MM_PLAYER_ATTRS_TYPE_INT,                 /**< Integer type */
317         MM_PLAYER_ATTRS_TYPE_DOUBLE,              /**< Double type */
318         MM_PLAYER_ATTRS_TYPE_STRING,              /**< UTF-8 String type */
319         MM_PLAYER_ATTRS_TYPE_DATA,                /**< Pointer type */
320         MM_PLAYER_ATTRS_TYPE_ARRAY,               /**< Array type */
321         MM_PLAYER_ATTRS_TYPE_RANGE,               /**< Range type */
322         MM_PLAYER_ATTRS_TYPE_NUM,                 /**< Number of attribute type */
323 } MMPlayerAttrsType;
324
325 /**
326  * Enumeration for attribute validation type.
327  */
328 typedef enum {
329         MM_PLAYER_ATTRS_VALID_TYPE_INVALID = -1,                /**< Invalid validation type */
330         MM_PLAYER_ATTRS_VALID_TYPE_NONE,                                /**< Do not check validity */
331         MM_PLAYER_ATTRS_VALID_TYPE_INT_ARRAY,          /**< validity checking type of integer array */
332         MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE,          /**< validity checking type of integer range */
333         MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_ARRAY,                /**< validity checking type of double array */
334         MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_RANGE,       /**< validity checking type of double range */
335 } MMPlayerAttrsValidType;
336
337 /**
338  * Enumeration for attribute access flag.
339  */
340 typedef enum {
341         MM_PLAYER_ATTRS_FLAG_NONE = 0,                                  /**< None flag is set */
342         MM_PLAYER_ATTRS_FLAG_READABLE = 1 << 0,                 /**< Readable */
343         MM_PLAYER_ATTRS_FLAG_WRITABLE = 1 << 1,                 /**< Writable */
344         MM_PLAYER_ATTRS_FLAG_MODIFIED = 1 << 2,                 /**< Modified */
345
346         MM_PLAYER_ATTRS_FLAG_RW = MM_PLAYER_ATTRS_FLAG_READABLE | MM_PLAYER_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
347 } MMPlayerAttrsFlag;
348
349 /**
350  * Enumeration of track types
351  */
352 typedef enum {
353         MM_PLAYER_TRACK_TYPE_AUDIO = 0,
354         MM_PLAYER_TRACK_TYPE_VIDEO,
355         MM_PLAYER_TRACK_TYPE_TEXT,
356         MM_PLAYER_TRACK_TYPE_MAX
357 } MMPlayerTrackType;
358
359 /**
360  * Enumeration of runtime buffering mode
361  */
362 typedef enum {
363         MM_PLAYER_BUFFERING_MODE_ADAPTIVE = 0,  /**< default, If buffering is occurred, player will consider the bandwidth to adjust buffer setting. */
364         MM_PLAYER_BUFFERING_MODE_FIXED,                 /**< player will set buffer size with this fixed size value. */
365         MM_PLAYER_BUFFERING_MODE_MAX,
366 } MMPlayerBufferingMode;
367
368 /**
369  * Edge Properties of the text.
370  */
371 typedef enum {
372         MM_PLAYER_EDGE_NO,
373         MM_PLAYER_EDGE_RAISED,
374         MM_PLAYER_EDGE_DEPRESSED,
375         MM_PLAYER_EDGE_UNIFORM,
376         MM_PLAYER_EDGE_DROPSHADOW
377 } MMPlayerSubtitleEdge;
378
379 /**
380  * Enumeration of media stream buffer status
381  */
382 typedef enum {
383         MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN,
384         MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW,
385 } MMPlayerMediaStreamBufferStatus;
386
387 /**
388  * Enumeration for stream type.
389  */
390 typedef enum {
391         MM_PLAYER_STREAM_TYPE_DEFAULT,  /**< Container type */
392         MM_PLAYER_STREAM_TYPE_AUDIO,    /**< Audio element stream type */
393         MM_PLAYER_STREAM_TYPE_VIDEO,    /**< Video element stream type */
394         MM_PLAYER_STREAM_TYPE_TEXT,     /**< Text type */
395         MM_PLAYER_STREAM_TYPE_MAX,
396 } MMPlayerStreamType;
397
398 typedef enum {
399         MM_PLAYER_CODEC_TYPE_DEFAULT = 0, /**< codec is selected by the priority */
400         MM_PLAYER_CODEC_TYPE_HW,          /**< HW codec can only be selected */
401         MM_PLAYER_CODEC_TYPE_SW,          /**< SW codec can only be selected */
402 } MMPlayerVideoCodecType;
403
404 /**
405  * Attribute validity structure
406  */
407 typedef struct {
408          MMPlayerAttrsType type;
409          MMPlayerAttrsValidType validity_type;
410          MMPlayerAttrsFlag flag;
411         /**
412           * a union that describes validity of the attribute.
413           * Only when type is 'MM_ATTRS_TYPE_INT' or 'MM_ATTRS_TYPE_DOUBLE',
414           * the attribute can have validity.
415          */
416          union {
417                 /**
418                    * Validity structure for integer array.
419                  */
420                 struct {
421                         int *array;  /**< a pointer of array */
422                         int count;   /**< size of array */
423                         int d_val;
424                 } int_array;
425                 /**
426                    * Validity structure for integer range.
427                  */
428                 struct {
429                         int min;   /**< minimum range */
430                         int max;   /**< maximum range */
431                         int d_val;
432                 } int_range;
433                 /**
434                 * Validity structure for double array.
435                 */
436                 struct {
437                         double *array;  /**< a pointer of array */
438                         int count;   /**< size of array */
439                         double d_val;
440                 } double_array;
441                 /**
442                 * Validity structure for double range.
443                 */
444                 struct {
445                         double min;   /**< minimum range */
446                         double max;   /**< maximum range */
447                         double d_val;
448                 } double_range;
449         };
450 } MMPlayerAttrsInfo;
451
452 /**
453  * Volume type.
454  *
455  * @see         mm_player_set_volume, mm_player_get_volume
456  */
457 typedef struct {
458         float level[MM_VOLUME_CHANNEL_NUM];     /**< Relative volume factor for each channels */
459 } MMPlayerVolumeType;
460
461 /**
462  * Video stream info in external demux case
463  *
464 **/
465 typedef struct _VideoStreamInfo {
466         const char *mime;
467         unsigned int framerate_num;
468         unsigned int framerate_den;
469         unsigned int width;
470         unsigned int height;
471         unsigned char *codec_extradata;
472         unsigned int extradata_size;
473         unsigned int version;
474 } MMPlayerVideoStreamInfo;
475
476 /**
477  * Audio stream info in external demux case
478  *
479 **/
480 typedef struct _AudioStreamInfo {
481         const char *mime;
482         unsigned int channels;
483         unsigned int sample_rate;
484         unsigned char *codec_extradata;
485         unsigned int extradata_size;
486         unsigned int version;
487         unsigned int user_info;
488
489         /* for pcm */
490 //      unsigned int width;
491 //      unsigned int depth;
492 //      unsigned int endianness;
493 //      bool signedness;
494 } MMPlayerAudioStreamInfo;
495
496 /**
497  * Subtitle stream info in external demux case
498  *
499 **/
500 typedef struct _SubtitleStreamInfo {
501         const char *mime;
502         unsigned int codec_tag;
503         void *context;  //for smpte text
504 } MMPlayerSubtitleStreamInfo;
505
506 /**
507  * selected subtitle track number callback function type.
508  *
509  * @param       track_num       [in]    Track number of subtitle
510  * @param       user_param      [in]    User defined parameter
511  *
512  *
513  * @return      This callback function have to return MM_ERROR_NONE.
514  */
515 typedef bool (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
516
517 /**
518  * Buffer underrun / overflow data callback function type.
519  *
520  * @param       status     [in] buffer status
521  * @param       user_param [in] User defined parameter which is passed when set
522  *                          to enough data callback or need data callback
523  *
524  * @return      This callback function have to return MM_ERROR_NONE.
525  */
526 typedef bool (*mm_player_media_stream_buffer_status_callback)(MMPlayerStreamType type, MMPlayerMediaStreamBufferStatus status, unsigned long long bytes, void *user_param);
527
528 /**
529  * Buffer seek data callback function type.
530  *
531  * @param       offset     [in] offset for the buffer playback
532  * @param       user_param [in] User defined parameter which is passed when set
533  *                          to seek data callback
534  *
535  * @return      This callback function have to return MM_ERROR_NONE.
536  */
537 typedef bool (*mm_player_media_stream_seek_data_callback)(MMPlayerStreamType type, unsigned long long offset, void *user_param);
538
539 /**
540  * Called to notify the stream changed.
541  *
542  * @param user_data [in] The user data passed from the callback registration function
543  *
544  * @return      This callback function have to return MM_ERROR_NONE.
545  */
546 typedef bool (*mm_player_stream_changed_callback)(void *user_param);
547
548
549 /*===========================================================================================
550 |                                                                                           |
551 |  GLOBAL FUNCTION PROTOTYPES                                        |
552 |                                                                                           |
553 ========================================================================================== */
554
555 /**
556  * This function creates a player object for playing multimedia contents. \n
557  * The attributes of player are created to get/set some values with application. \n
558  * And, mutex, gstreamer and other resources are initialized at this time. \n
559  * If player is created, the state will become MM_PLAYER_STATE_NULL.
560  *
561  * @param   player [out] Handle of player
562  *
563  * @return  This function returns zero on success, or negative value with error code. \n
564  *          Please refer 'mm_error.h' to know it in detail.
565  * @pre     None
566  * @post    MM_PLAYER_STATE_NULL
567  * @see     mm_player_destroy
568  * @remark  You can create multiple handles on a context at the same time. \n
569  *          However, player cannot guarantee proper operation because of limitation of resources, \n
570  *          such as audio device or display device.
571  *
572  * @par Example
573  * @code
574 char *g_err_attr_name = NULL;
575
576 if (mm_player_create(&g_player) != MM_ERROR_NONE) {
577         LOGE("failed to create player\n");
578 }
579
580 if (mm_player_set_attribute(g_player,
581                                                 &g_err_attr_name,
582                                                 "profile_uri", filename, strlen(filename),
583                                                 "display_overlay", (void *)&g_win.xid, sizeof(g_win.xid),
584                                                 NULL) != MM_ERROR_NONE) {
585         LOGE("failed to set %s attribute\n", g_err_attr_name);
586         free(g_err_attr_name);
587 }
588
589 mm_player_set_message_callback(g_player, msg_callback, (void *)g_player);
590  * @endcode
591  */
592 int mm_player_create(MMHandleType *player);
593
594 /**
595  * This function releases player object and all resources which were created by mm_player_create(). \n
596  * And, player handle will also be destroyed.
597  *
598  * @param   player [in] Handle of player
599  *
600  * @return  This function returns zero on success, or negative value with error code.
601  * @pre     Player state may be MM_PLAYER_STATE_NULL. \n
602  *          But, it can be called in any state.
603  * @post    Because handle is released, there is no any state.
604  * @see     mm_player_create
605  * @remark  This method can be called with a valid player handle from any state to \n
606  *          completely shutdown the player operation.
607  *
608  * @par Example
609  * @code
610 if (mm_player_destroy(g_player) != MM_ERROR_NONE) {
611         LOGE("failed to destroy player\n");
612 }
613  * @endcode
614  */
615 int mm_player_destroy(MMHandleType player);
616
617 /**
618  * This function parses uri and makes gstreamer pipeline by uri scheme. \n
619  * So, uri should be set before realizing with mm_player_set_attribute(). \n
620  *
621  * @param   player [in] Handle of player
622  *
623  * @return  This function returns zero on success, or negative value with error code.
624  *
625  * @pre     Player state should be MM_PLAYER_STATE_NULL.
626  * @post    player state will be MM_PLAYER_STATE_READY.
627  * @see     mm_player_unrealize
628  * @remark  None
629  * @par Example
630  * @code
631 if (mm_player_realize(g_player) != MM_ERROR_NONE) {
632         LOGE("failed to realize player\n");
633 }
634  * @endcode
635  */
636 int mm_player_realize(MMHandleType player);
637
638 /**
639  * This function uninitializes player object. So, resources and allocated memory \n
640  * will be freed. And, gstreamer pipeline is also destroyed. So, if you want to play \n
641  * other contents, player should be created again after destruction or realized with new uri.
642  *
643  * @param   player [in] Handle of player
644  *
645  * @return  This function returns zero on success, or negative value with error code.
646  * @pre     Player state may be MM_PLAYER_STATE_READY to unrealize. \n
647  *          But, it can be called in any state.
648  * @post    Player state will be MM_PLAYER_STATE_NULL.
649  * @see     mm_player_realize
650  * @remark  This method can be called with a valid player handle from any state.
651  *
652  * @par Example
653  * @code
654 if (mm_player_unrealize(g_player) != MM_ERROR_NONE) {
655         LOGE("failed to unrealize player\n");
656 }
657  * @endcode
658  */
659 int mm_player_unrealize(MMHandleType player);
660
661 /**
662  * This function is to abort pause state transition
663  * for unrealize or destroy.
664  */
665 int mm_player_abort_pause(MMHandleType player);
666
667 /**
668  * This function is to get current state of player. \n
669  * Application have to check current state before doing some action.
670  *
671  * @param player [in]  Handle of player
672  * @param state  [out] current state of player on success
673  *
674  * @return   This function returns zero on success, or negative value with error code.
675  *
676  * @see      MMPlayerStateType
677  * @remark   None
678  * @par Example
679  * @code
680 if (mm_player_get_state(g_player, &state) != MM_ERROR_NONE) {
681         LOGE("failed to get state\n");
682 }
683  * @endcode
684  */
685 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state);
686
687 /**
688  * This function is to set relative volume of player. \n
689  * So, It controls logical volume value. \n
690  * But, if developer want to change system volume, mm sound api should be used.
691  *
692  * @param       player          [in]    Handle of player
693  * @param       volume          [in]    Volume factor of each channel
694  *
695  * @return      This function returns zero on success, or negative value with error code.
696  * @see         MMPlayerVolumeType, mm_player_get_volume
697  * @remark      The range of factor range is from 0 to 1.0. (1.0 = 100%) And, default value is 1.0.
698  * @par Example
699  * @code
700 MMPlayerVolumeType volume;
701 int i = 0;
702
703 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
704         volume.level[i] = MM_VOLUME_LEVEL_MAX;
705
706 if (mm_player_set_volume(g_player, &volume) != MM_ERROR_NONE)
707 {
708     LOGE("failed to set volume\n");
709 }
710  * @endcode
711  */
712 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume);
713
714 /**
715  * This function is to get current volume factor of player.
716  *
717  * @param       player          [in]    Handle of player.
718  * @param       volume          [out]   Volume factor of each channel.
719  *
720  * @return      This function returns zero on success, or negative value with error code.
721  *
722  * @see         MMPlayerVolumeType, mm_player_set_volume
723  * @remark  None
724  * @par Example
725  * @code
726 MMPlayerVolumeType volume;
727 int i;
728
729 if (mm_player_get_volume(g_player, &volume) != MM_ERROR_NONE)
730 {
731         LOGW("failed to get volume\n");
732 }
733
734 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
735         LOGD("channel[%d] = %d \n", i, volume.level[i]);
736  * @endcode
737  */
738 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume);
739
740 /**
741  * This function is to start playing media contents. Demux(parser), codec and related plugins are decided \n
742  * at this time. And, MM_MESSAGE_BEGIN_OF_STREAM will be posted through callback function registered \n
743  * by mm_player_set_message_callback().
744  *
745  * @param       player          [in]    Handle of player
746  *
747  * @return      This function returns zero on success, or negative value with error code.
748  * @remark
749  *
750  * @pre         Player state may be MM_PLAYER_STATE_READY.
751  * @post                Player state will be MM_PLAYER_STATE_PLAYING.
752  * @see         mm_player_stop
753  * @remark  None
754  * @par Example
755  * @code
756 if (mm_player_start(g_player) != MM_ERROR_NONE)
757 {
758         LOGE("failed to start player\n");
759 }
760  * @endcode
761  */
762 int mm_player_start(MMHandleType player);
763
764 /**
765  * This function is to stop playing media contents and it's different with pause. \n
766  * If mm_player_start() is called after this, content will be started again from the beginning. \n
767  * So, it can be used to close current playback.
768  *
769  * @param       player          [in]    Handle of player
770  *
771  * @return      This function returns zero on success, or negative value with error code.
772  *
773  * @pre         Player state may be MM_PLAYER_STATE_PLAYING.
774  * @post                Player state will be MM_PLAYER_STATE_READY.
775  * @see         mm_player_start
776  * @remark  None
777  * @par Example
778  * @code
779 if (mm_player_stop(g_player) != MM_ERROR_NONE)
780 {
781         LOGE("failed to stop player\n");
782 }
783  * @endcode
784  */
785 int mm_player_stop(MMHandleType player);
786
787 /**
788  * This function is to pause playing media contents.
789  *
790  * @param       player          [in]    Handle of player.
791  *
792  * @return      This function returns zero on success, or negative value with error code.
793  *
794  * @pre         Player state may be MM_PLAYER_STATE_PLAYING.
795  * @post                Player state will be MM_PLAYER_STATE_PAUSED.
796  * @see         mm_player_resume
797  * @remark  None
798  * @par Example
799  * @code
800 if (mm_player_pause(g_player) != MM_ERROR_NONE)
801 {
802         LOGE("failed to pause player\n");
803 }
804  * @endcode
805  */
806 int mm_player_pause(MMHandleType player);
807
808 /**
809  * This function is to resume paused media contents.
810  *
811  * @param       player          [in]    Handle of player.
812  *
813  * @return      This function returns zero on success, or negative value with error code.
814  *
815  * @pre         Player state may be MM_PLAYER_STATE_PAUSED.
816  * @post                Player state will be MM_PLAYER_STATE_PLAYING.
817  * @see         mm_player_pause
818  * @remark  None
819  * @par Example
820  * @code
821 if (mm_player_resume(g_player) != MM_ERROR_NONE)
822 {
823         LOGE("failed to resume player\n");
824 }
825  * @endcode
826  */
827 int mm_player_resume(MMHandleType player);
828
829 /**
830  * This function is to set the position for playback. \n
831  * So, it can be seeked to requested position. \n
832  *
833  * @param       player          [in]    Handle of player
834  * @param       pos                     [in]    Position for playback
835  *
836  * @return      This function returns zero on success, or negative value with error code.
837  * @see         mm_player_get_position
838  * @remark  the unit of time-based format is millisecond and other case is percent.
839  */
840 int mm_player_set_position(MMHandleType player, int64_t pos);
841
842 /**
843  * This function is to get current position of playback content.
844  *
845  * @param       player          [in]    Handle of player.
846  * @param       format          [in]    Format of position.
847  * @param    pos        [out] contains current position on success or zero in case of failure.
848  *
849  * @return      This function returns zero on success, or negative value with errors
850  * @see         mm_player_set_position
851  * @remark  the unit of time-based format is millisecond and other case is percent.
852  */
853 int mm_player_get_position(MMHandleType player, int64_t *pos);
854
855 /**
856  * This function is to get the content time duration.
857  */
858 int mm_player_get_duration(MMHandleType player, int64_t *dur);
859
860 /**
861  * This function is to get current buffer position of playback content.
862  *
863  * @param   player      [in]    Handle of player.
864  * @param   format      [in]    Format of position.
865  * @param   start_pos   [out] contains buffer start  position on success or zero in case of failure.
866  * @param   stop_pos    [out] contains buffer current  position on success or zero in case of failure.
867  *
868  * @return      This function returns zero on success, or negative value with errors
869  * @see         MMPlayerPosFormatType, mm_player_set_position
870  * @remark  the unit of time-based format is millisecond and other case is percent.
871  * @par Example
872  * @code
873 int start_pos = 0, stop_pos = 0;
874
875 mm_player_get_buffer_position(g_player, &start_pos, &end_pos );
876
877 LOGD("buffer position: [%d] ~ [%d] \%\n", start_pos, end_pos );
878  * @endcode
879  */
880 int mm_player_get_buffer_position(MMHandleType player, int *start_pos, int *end_pos);
881
882 /**
883  * This function sets callback function for receiving messages from player.
884  * So, player can notify warning, error and normal cases to application.
885  *
886  * @param       player          [in]    Handle of player.
887  * @param       callback        [in]    Message callback function.
888  * @param       user_param      [in]    User parameter which is passed to callback function.
889  *
890  * @return      This function returns zero on success, or negative value with error code.
891  * @see         MMMessageCallback
892  * @remark  None
893  * @par Example
894  * @code
895 int msg_callback(int message, MMMessageParamType *param, void *user_param)
896 {
897         switch (message)
898         {
899                 case MM_MESSAGE_ERROR:
900                         //do something
901                         break;
902
903                 case MM_MESSAGE_END_OF_STREAM:
904                         //do something
905                         break;
906
907                 case MM_MESSAGE_STATE_CHANGED:
908                         //do something
909                         break;
910
911                 case MM_MESSAGE_BEGIN_OF_STREAM:
912                         //do something
913                         break;
914
915                 default:
916                         break;
917         }
918         return TRUE;
919 }
920
921 mm_player_set_message_callback(g_player, msg_callback, (void *)g_player);
922  * @endcode
923  */
924 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
925
926 /**
927  * This function is to mute volume of player
928  *
929  * @param       player  [in]    Handle of player
930  * @param       mute    [in]    Mute(1) or not mute(0)
931  *
932  * @return      This function returns zero on success, or negative value with error code
933  * @see         mm_player_get_mute
934  * @remark  None
935  * @par Example
936  * @code
937 if (mm_player_set_mute(g_player, TRUE) != MM_ERROR_NONE)
938 {
939         LOGW("failed to set mute\n");
940 }
941  * @endcode
942  */
943 int mm_player_set_mute(MMHandleType player, int mute);
944
945 /**
946  * This function is to get mute value of player
947  *
948  * @param       player  [in]    Handle of player
949  * @param       mute    [out]   Sound is muted
950  *
951  * @return      This function returns zero on success, or negative value with error code
952  * @see         mm_player_set_mute
953  * @remark  None
954  * @par Example
955  * @code
956 int mute;
957
958 if (mm_player_get_mute(g_player, &mute) != MM_ERROR_NONE)
959 {
960         LOGW("failed to get mute\n");
961 }
962
963 LOGD("mute status:%d\n", mute);
964  * @endcode
965  */
966 int mm_player_get_mute(MMHandleType player, int *mute);
967
968 /**
969  * This function is to adjust subtitle postion. So, subtitle can show at the adjusted position. \n
970  * If pos is negative, subtitle will be displayed previous time, the other hand forward time. \n
971  *
972  * @param       player  [in]    Handle of player
973  * @param       pos             [in]    postion to be adjusted
974  *
975  * @return      This function returns zero on success, or negative value with error
976  *                      code
977  * @see         mm_player_adjust_subtitle_position
978  * @remark  None
979  * @par Example
980  * @code
981 int pos;
982
983 pos = 5000;
984 if (mm_player_adjust_subtitle_position(g_player, MM_PLAYER_POS_FORMAT_TIME, pos) != MM_ERROR_NONE)
985 {
986         LOGW("failed to adjust subtitle postion.\n");
987 }
988  * @endcode
989  */
990
991 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos);
992
993 /**
994  * This function is to set subtitle silent status. So, subtitle can show or hide during playback \n
995  * by this value. But, one subtitle file should be set with "subtitle_uri" attribute before calling mm_player_realize(); \n
996  * Player FW parses subtitle file and send text data including timestamp to application \n
997  * through message callback with MM_MESSAGE_UPDATE_SUBTITLE will be. \n
998  * So, application have to render it. And, subtitle can be supported only in a seprate file. \n
999  * So, it's not supported for embedded case.
1000  *
1001  * @param       player  [in]    Handle of player
1002  * @param       silent  [in]    silent(integer value except 0) or not silent(0)
1003  *
1004  * @return      This function returns zero on success, or negative value with error
1005  *                      code
1006  * @see         mm_player_get_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1007  * @remark  None
1008  * @par Example
1009  * @code
1010 mm_player_set_attribute(g_player,
1011                                         &g_err_name,
1012                                         "subtitle_uri", g_subtitle_uri, strlen(g_subtitle_uri),
1013                                         NULL
1014                                         );
1015
1016 if (mm_player_set_subtitle_silent(g_player, TRUE) != MM_ERROR_NONE)
1017 {
1018         LOGW("failed to set subtitle silent\n");
1019 }
1020  * @endcode
1021  */
1022 int mm_player_set_subtitle_silent(MMHandleType player, int silent);
1023
1024 /**
1025  * This function is to get silent status of subtitle.
1026  *
1027  * @param       player  [in]    Handle of player
1028  * @param       silent  [out]   subtitle silent property
1029  *
1030  * @return      This function returns zero on success, or negative value with error
1031  *                      code
1032  * @see         mm_player_set_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1033  * @remark  None
1034  * @par Example
1035  * @code
1036 int silent = FALSE;
1037
1038 if (mm_player_get_subtitle_silent(g_player, &silent) != MM_ERROR_NONE)
1039 {
1040         LOGW("failed to set subtitle silent\n");
1041 }
1042  * @endcode
1043  */
1044 int mm_player_get_subtitle_silent(MMHandleType player, int *silent);
1045
1046 /**
1047  * This function is to set attributes into player. Multiple attributes can be set simultaneously. \n
1048  * If one of attribute fails, this function will stop at the point and let you know the name which is failed. \n
1049  *
1050  * @param   player                 [in]   Handle of player.
1051  * @param   err_attr_name          [out]  Name of attribute which is failed to set
1052  * @param   first_attribute_name   [in]   Name of the first attribute to set
1053  * @param   ...                    [in]   Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1054  *                                        But, in the case of data or string type, it should be name/value/size.
1055  *
1056  * @return  This function returns zero on success, or negative value with error code.
1057  *
1058  * @see     mm_player_get_attribute
1059  * @remark  This function must be terminated by NULL argument.
1060  *          And, if this function is failed, err_attr_name param must be free.
1061  * @par Example
1062  * @code
1063 char *g_err_attr_name = NULL;
1064
1065 if (mm_player_set_attribute(g_player,
1066                                                 &g_err_attr_name,
1067                                                 "profile_uri", filename, strlen(filename),
1068                                                 "profile_play_count", count,
1069                                                 NULL) != MM_ERROR_NONE) {
1070         LOGW("failed to set %s attribute\n", g_err_attr_name);
1071         free(g_err_attr_name);
1072 }
1073
1074  * @endcode
1075  */
1076 int mm_player_set_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1077
1078 /**
1079  * This function is to get attributes from player. Multiple attributes can be got simultaneously.
1080  *
1081  * @param   player                [in]  Handle of player.
1082  * @param   err_attr_name         [out] Name of attribute which is failed to get
1083  * @param   first_attribute_name  [in]  Name of the first attribute to get
1084  * @param   ...                   [out] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1085  *                                      But, in the case of data or string type, it should be name/value/size.
1086  *
1087  * @return  This function returns zero on success, or negative value with error
1088  *          code.
1089  * @see     mm_player_set_attribute
1090  * @remark  This function must be terminated by NULL argument.
1091  *          And, if this function is failed, err_attr_name param must be free.
1092  */
1093 int mm_player_get_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1094
1095 /**
1096  * This function is to get detail information of attribute.
1097  *
1098  * @param   player          [in]  Handle of player.
1099  * @param   attribute_name  [in]  Name of the attribute to get
1100  * @param   info            [out] Attribute infomation
1101  *
1102  * @return  This function returns zero on success, or negative value with error
1103  *          code.
1104  *
1105  * @see     mm_player_set_attribute, mm_player_get_attribute
1106  * @remark  None
1107  * @par Example
1108  * @code
1109 if (mm_player_get_attribute_info(g_player, "display_method", &method_info) != MM_ERROR_NONE) {
1110         LOGW("failed to get info\n");
1111 }
1112
1113 LOGD("type:%d \n", method_info.type); //int, double..
1114 LOGD("flag:%d \n", method_info.flag); //readable, writable..
1115 LOGD("validity type:%d \n", method_info.validity_type); //range, array..
1116
1117 if (method_info. validity_type == MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE) {
1118         LOGD("range min:%d\n", method_info.int_range.min);
1119         LOGD("range max:%d\n", method_info.int_range.max);
1120 }
1121  * @endcode
1122  */
1123 int mm_player_get_attribute_info(MMHandleType player,  const char *attribute_name, MMPlayerAttrsInfo *info);
1124
1125 /**
1126  * This function is to get the track count
1127  *
1128  * @param   player [in]  handle of player.
1129  * @param   track  [in]  type of the track type
1130  * @param   info   [out] the count of the track
1131  *
1132  * @return  This function returns zero on success, or negative value with error
1133  *          code.
1134  *
1135  * @par Example
1136  * @code
1137 gint audio_count = 0;
1138
1139 if (mm_player_get_track_count(g_player, MM_PLAYER_TRACK_TYPE_AUDIO, &audio_count) != MM_ERROR_NONE) {
1140         LOGW("failed to get audio track count\n");
1141 }
1142
1143 LOGD("audio track count : %d \n", audio_count);
1144  * @endcode
1145  */
1146 int mm_player_get_track_count(MMHandleType player,  MMPlayerTrackType type, int *count);
1147
1148 /**
1149  * This function is to select the track
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  *
1155  * @return  This function returns zero on success, or negative value with error
1156  *          code.
1157  */
1158 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index);
1159
1160 /**
1161  * This function is to get the track language
1162  *
1163  * @param   player [in]  handle of player.
1164  * @param   type   [in]  type of the track type
1165  * @param   index  [in]  the index of the track
1166  * @param   code   [out] language code in ISO 639-1(string)
1167  *
1168  * @return  This function returns zero on success, or negative value with error
1169  *          code.
1170  */
1171 int mm_player_get_track_language_code(MMHandleType player,  MMPlayerTrackType type, int index, char **code);
1172
1173 /**
1174  * This function is to get the current running track
1175  *
1176  * @param       player          [in]    handle of player.
1177  * @param       type                    [in]    type of the track type
1178  * @param       index           [out]    the index of the track
1179  *
1180  * @return      This function returns zero on success, or negative value with error
1181  *                      code.
1182  */
1183
1184 int mm_player_get_current_track(MMHandleType hplayer, MMPlayerTrackType type, int *index);
1185
1186 /**
1187  * This function is to set the subtitle path
1188  *
1189  * @param       player  [in]    handle of player
1190  * @param       path    [in]    subtitle path
1191  *
1192  * @return      This function returns zero on success, or negative value with error code.
1193  */
1194 int mm_player_set_external_subtitle_path(MMHandleType player, const char *path);
1195
1196 /**
1197  * This function is to set uri.
1198  *
1199  * @param   player [in] handle of player
1200  * @param   uri    [in] uri
1201  * @return  This function returns zero on success, or negative value with error code.
1202  */
1203 int mm_player_set_uri(MMHandleType player, const char *uri);
1204
1205 /**
1206  * This function is to set next uri.
1207  *
1208  * @param   player [in] handle of player
1209  * @param   uri    [in] uri
1210  * @return  This function returns zero on success, or negative value with error code.
1211  */
1212 int mm_player_set_next_uri(MMHandleType player, const char *uri);
1213
1214 /**
1215  * This function is to get next uri.
1216  *
1217  * @param   player   [in]  handle of player
1218  * @param   uri      [out] uri
1219  * @return  This function returns zero on success, or negative value with error code.
1220  */
1221 int mm_player_get_next_uri(MMHandleType player, char **uri);
1222
1223 /**
1224  * This function is to decrease reference count of internal buffer.
1225  *
1226  * @param    buffer [in] video callback internal buffer
1227  * @return   None;
1228  */
1229 void mm_player_video_stream_internal_buffer_unref(void *buffer);
1230
1231 /**mm_player_submit_packet
1232  * This function is to submit buffer to appsrc.  \n
1233  * @param   player                      [in]    Handle of player.
1234  * @param   buf             [in]    buffer to be submit in appsrc in external feeder case.
1235  * @param   len                         [in]    length of buffer.
1236  * @param   pts                         [in]    timestamp of buffer.
1237  * @param   streamtype          [in]    stream type of buffer.
1238  * @return  This function returns zero on success, or negative value with error code.
1239  */
1240 int mm_player_submit_packet(MMHandleType player, media_packet_h packet);
1241
1242 /**mm_player_set_video_info
1243  * This function is to set caps of src pad of video appsrc in external feeder case.  \n
1244  * @param   player         [in] Handle of player.
1245  * @param   media_format_h [in] Video stream info.
1246  * @return  This function returns zero on success, or negative value with error code.
1247  */
1248 int mm_player_set_video_info(MMHandleType player, media_format_h format);
1249
1250 /**mm_player_set_audio_info
1251  * This function is to set caps of src pad of Audio appsrc in external feeder case.  \n
1252  * @param       player                       [in]    Handle of player.
1253  * @param       media_format_h               [in]    Audio stream info.
1254  * @return      This function returns zero on success, or negative value with error code.
1255  */
1256 int mm_player_set_audio_info(MMHandleType player, media_format_h format);
1257
1258 /**mm_player_set_subtitle_info
1259  * This function is to set caps of src pad of subtitle appsrc in external feeder case.  \n
1260  * @param       player                          [in]    Handle of player.
1261  * @param       subtitle_stream_info               [in]    Subtitle stream info.
1262  * @return      This function returns zero on success, or negative value with error code.
1263  */
1264 int mm_player_set_subtitle_info(MMHandleType player, MMPlayerSubtitleStreamInfo *info);
1265
1266 /**
1267  * This function set callback function for receiving need or enough data message from player.
1268  *
1269  * @param   player     [in] Handle of player.
1270  * @param   type       [in] stream type
1271  * @param   callback   [in] data callback function for stream type.
1272  * @param   user_param [in] User parameter.
1273  *
1274  * @return  This function returns zero on success, or negative value with error
1275  *          code.
1276  */
1277 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void *user_param);
1278
1279 /**
1280  * This function set callback function for receiving seek data message from player.
1281  *
1282  * @param       player          [in]    Handle of player.
1283  * @param       type            [in]    stream type
1284  * @param       callback        [in]    Seek data callback function for stream type.
1285  * @param       user_param      [in]    User parameter.
1286  *
1287  * @return      This function returns zero on success, or negative value with error
1288  *                      code.
1289  */
1290 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void *user_param);
1291
1292 /**
1293  * This function is to set max size of buffer(appsrc).
1294  *
1295  * @param       player          [in]    Handle of player.
1296  * @param       type            [in]    stream type
1297  * @param       max_size        [in]    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_set_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long max_size);
1303
1304 /**
1305  * This function is to get max size of buffer(appsrc).
1306  *
1307  * @param       player          [in]    Handle of player.
1308  * @param       type            [in]    stream type
1309  * @param       max_size        [out]   max bytes of buffer.
1310  *
1311  * @return      This function returns zero on success, or negative value with error
1312  *                      code.
1313  */
1314 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long *max_size);
1315
1316 /**
1317  * This function is to set min percent of buffer(appsrc).
1318  *
1319  * @param       player          [in]    Handle of player.
1320  * @param       type            [in]    stream type
1321  * @param       min_percent     [in]    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_set_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned min_percent);
1327
1328 /**
1329  * This function is to get min percent of buffer(appsrc).
1330  *
1331  * @param       player          [in]    Handle of player.
1332  * @param       type            [in]    stream type
1333  * @param       min_percent     [out]   min percent of buffer.
1334  *
1335  * @return      This function returns zero on success, or negative value with error
1336  *                      code.
1337  */
1338 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned int *min_percent);
1339
1340 /**
1341  * This function set callback function for changing audio stream from player. \n
1342  * It's only supported when audio stream is included in file. \n
1343  *
1344  * @param       player   [in] Handle of player.
1345  * @param       callback [in] Audio stream changed callback function.
1346  * @param       user_param [in] User parameter.
1347  *
1348  * @return      This function returns zero on success, or negative value with error
1349  *                      code.
1350  * @see         mm_player_stream_changed_callback
1351  * @since
1352  */
1353 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
1354
1355 /**
1356  * This function set callback function for changing video stream from player. \n
1357  * It's only supported when video stream is included in file. \n
1358  *
1359  * @param       player   [in] Handle of player.
1360  * @param       callback [in] Video stream changed callback function.
1361  * @param       user_param [in] User parameter.
1362  *
1363  * @return      This function returns zero on success, or negative value with error
1364  *                      code.
1365  * @see         mm_player_stream_changed_callback
1366  */
1367 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
1368
1369 /**
1370  * This function is to get timeout value according to the content type for muse. \n
1371  * It's only supported when video stream is included in file. \n
1372  *
1373  * @param       player  [in] Handle of player.
1374  * @param       timeout [out] timeout value (sec).
1375  *
1376  * @return      This function returns zero on success, or negative value with error
1377  *                      code.
1378  * @since 3.0
1379  */
1380 int mm_player_get_timeout(MMHandleType player, int *timeout);
1381
1382 /**
1383  * This function is to get the number of video output buffers. \n
1384  * It's only supported when video stream is included in file. \n
1385  *
1386  * @param       player  [in] Handle of player.
1387  * @param       num     [out] num of buffers.
1388  * @param       extra_num [out] extra num of buffers.
1389  *
1390  * @return      This function returns zero on success, or negative value with error
1391  *                      code.
1392  * @since 3.0
1393  */
1394 int mm_player_get_num_of_video_out_buffers(MMHandleType player, int *num, int *extra_num);
1395
1396 /**
1397  * This function is to set the dynamic resolution information. \n
1398  * It's only supported when video stream is included in file. \n
1399  *
1400  * @param       player  [in] Handle of player.
1401  * @param       drc     [in] dynamic resolution info of media stream data
1402  *
1403  * @return      This function returns zero on success, or negative value with error
1404  *                      code.
1405  * @since 3.0
1406  */
1407 int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc);
1408
1409 /**
1410  * This function is to release the video stream bo to reuse. \n
1411  * It's only supported when sw codec is used to decode video stream. \n
1412  *
1413  * @param       player  [in] Handle of player.
1414  * @param       bo     [in] bo address to be released
1415  *
1416  * @return      This function returns zero on success, or negative value with error
1417  *                      code.
1418  * @since 3.0
1419  */
1420 int mm_player_release_video_stream_bo(MMHandleType player, void *bo);
1421
1422 /**
1423  * This function is to set sound stream info
1424  */
1425 int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index);
1426
1427 /**
1428  * This function is to manage the playback according to the external storage state
1429  */
1430 int mm_player_manage_external_storage_state(MMHandleType player, int id, int state);
1431
1432 /**
1433  * These functions are to set/get the max variant of HAS
1434  */
1435 int mm_player_get_adaptive_variant_info(MMHandleType player, int *num, char **var_info);
1436 int mm_player_set_max_adaptive_variant_limit(MMHandleType player, int bandwidth, int width, int height);
1437 int mm_player_get_max_adaptive_variant_limit(MMHandleType player, int *bandwidth, int *width, int *height);
1438
1439 /**
1440  * These functions are to set/get the audio only mode
1441  */
1442 int mm_player_set_audio_only(MMHandleType player, bool audio_only);
1443 int mm_player_get_audio_only(MMHandleType player, bool *audio_only);
1444
1445 /**
1446  * These functions are to get the streaming bufferint time
1447  */
1448 int mm_player_get_streaming_buffering_time(MMHandleType player, int *prebuffer_ms, int *rebuffer_ms);
1449
1450 /**
1451  * These functions are to display the 360 video content
1452  */
1453 int mm_player_360_is_content_spherical(MMHandleType player, bool *is_spherical);
1454 int mm_player_360_set_enabled(MMHandleType player, bool enabled);
1455 int mm_player_360_is_enabled(MMHandleType player, bool *enabled);
1456
1457 int mm_player_360_set_direction_of_view(MMHandleType player, float yaw, float pitch);
1458 int mm_player_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch);
1459
1460 int mm_player_360_set_zoom(MMHandleType player, float level);
1461 int mm_player_360_get_zoom(MMHandleType player, float *level);
1462
1463 int mm_player_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees);
1464 int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees);
1465
1466 /**
1467  * This function is to set codec type
1468  */
1469 int mm_player_set_codec_type(MMHandleType player, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type);
1470
1471 /**
1472  * These functions are to apply the replaygain
1473  */
1474 int mm_player_set_replaygain_enabled(MMHandleType player, bool enabled);
1475 int mm_player_is_replaygain_enabled(MMHandleType player, bool *enabled);
1476
1477 /**
1478  * This function is to set/get video content ROI area
1479  */
1480 int mm_player_set_video_roi_area(MMHandleType player, double scale_x, double scale_y, double scale_width, double scale_height);
1481 int mm_player_get_video_roi_area(MMHandleType player, double *scale_x, double *scale_y, double *scale_width, double *scale_height);
1482
1483 /**
1484         @}
1485  */
1486
1487 #ifdef __cplusplus
1488         }
1489 #endif
1490
1491 #endif  /* __MM_PLAYER_H__ */