[0.6.123] add _abort_pause
[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_AUDIO_TRACK_NUM
150  *
151  * track number inside a collection (int)
152  */
153 #define MM_PLAYER_AUDIO_TRACK_NUM           "content_audio_track_num"
154 /**
155  * MM_PLAYER_TEXT_TRACK_NUM
156  *
157  * track number inside a collection (int)
158  */
159 #define MM_PLAYER_TEXT_TRACK_NUM            "content_text_track_num"
160 /**
161  * MM_PLAYER_TAG_ARTIST
162  *
163  * person(s) responsible for the recording (string)
164  */
165 #define MM_PLAYER_TAG_ARTIST                "tag_artist"
166 /**
167  * MM_PLAYER_TAG_TITLE
168  *
169  * title (string)
170  */
171 #define MM_PLAYER_TAG_TITLE                 "tag_title"
172 /**
173  * MM_PLAYER_TAG_ALBUM
174  *
175  * album containing this data (string)
176  */
177 #define MM_PLAYER_TAG_ALBUM                 "tag_album"
178 /**
179  * MM_PLAYER_TAG_GENRE
180  *
181  * genre this data belongs to (string)
182  */
183 #define MM_PLAYER_TAG_GENRE                 "tag_genre"
184 /**
185  * MM_PLAYER_TAG_AUTHOUR
186  *
187  * author (string)
188  */
189 #define MM_PLAYER_TAG_AUTHOUR               "tag_author"
190 /**
191  * MM_PLAYER_TAG_COPYRIGHT
192  *
193  * copyright notice of the data (string)
194  */
195 #define MM_PLAYER_TAG_COPYRIGHT             "tag_copyright"
196 /**
197  * MM_PLAYER_TAG_DATE
198  *
199  * date the data was created (string)
200  */
201 #define MM_PLAYER_TAG_DATE                  "tag_date"
202 /**
203  * MM_PLAYER_TAG_DESCRIPRION
204  *
205  * short text describing the content of the data (string)
206  */
207 #define MM_PLAYER_TAG_DESCRIPRION           "tag_description"
208 /**
209  * MM_PLAYER_TAG_TRACK_NUM
210  *
211  * track number inside a collection (int)
212  */
213 #define MM_PLAYER_TAG_TRACK_NUM             "tag_track_num"
214 /**
215  * MM_PLAYER_PD_MODE
216  *
217  * progressive download mode (int)
218  */
219 #define MM_PLAYER_PD_MODE                   "pd_mode"
220
221 /**
222  * MM_PLAYER_DRC_MODE
223  *
224  * dynamic resolution change mode (int)
225  */
226 #define MM_PLAYER_DRC_MODE                  "drc_mode"
227
228 /**
229  * MM_PLAYER_GAPLESS_MODE
230  *
231  * gapless playback mode (int)
232  */
233 #define MM_PLAYER_GAPLESS_MODE              "gapless_mode"
234
235 /**
236  * MM_PLAYER_ENABLE_VIDEO_DECODED_CB
237  *
238  * enable video decoded callback (int)
239  */
240 #define MM_PLAYER_ENABLE_VIDEO_DECODED_CB   "enable_video_decoded_cb"
241
242 /**
243  * MM_PLAYER_VIDEO_CODEC_TYPE
244  *
245  * video codec type (int)
246  */
247 #define MM_PLAYER_VIDEO_CODEC_TYPE          "video_codec_type"
248
249 /**
250  * MM_PLAYER_AUDIO_CODEC_TYPE
251  *
252  * audio codec type (int)
253  */
254 #define MM_PLAYER_AUDIO_CODEC_TYPE          "audio_codec_type"
255
256 #define BUFFER_MAX_PLANE_NUM (4)
257
258 typedef struct {
259         MMPixelFormatType format;              /**< image format */
260         int width;                             /**< width of video buffer */
261         int height;                            /**< height of video buffer */
262         unsigned int timestamp;                /**< timestamp of stream buffer (msec)*/
263         unsigned int length_total;             /**< total length of stream buffer (in byte)*/
264         void *data[BUFFER_MAX_PLANE_NUM];
265         void *bo[BUFFER_MAX_PLANE_NUM];        /**< TBM buffer object */
266         void *internal_buffer;                 /**< Internal buffer pointer */
267         int stride[BUFFER_MAX_PLANE_NUM];      /**< stride of plane */
268         int elevation[BUFFER_MAX_PLANE_NUM];   /**< elevation of plane */
269         int orientation;                       /**< orientation */
270 } MMPlayerVideoStreamDataType;
271
272 /**
273  * Enumerations of player state.
274  */
275 typedef enum {
276         MM_PLAYER_STATE_NULL,                           /**< Player is created, but not realized yet */
277         MM_PLAYER_STATE_READY,                          /**< Player is ready to play media */
278         MM_PLAYER_STATE_PLAYING,                        /**< Player is now playing media */
279         MM_PLAYER_STATE_PAUSED,                         /**< Player is paused while playing media */
280         MM_PLAYER_STATE_NONE,                           /**< Player is not created yet */
281         MM_PLAYER_STATE_NUM,                            /**< Number of player states */
282 } MMPlayerStateType;
283
284 /**
285  * Enumerations of position formats.
286  * Used while invoking mm_player_get_position/mm_player_set_position APIs
287  */
288 typedef enum {
289         MM_PLAYER_POS_FORMAT_TIME,                      /**< Format for time based */
290         MM_PLAYER_POS_FORMAT_PERCENT,                   /**< Format for percentage */
291         MM_PLAYER_POS_FORMAT_NUM,                       /**< Number of position formats */
292 } MMPlayerPosFormatType;
293
294 /**
295  * Enumeration for attribute values types.
296  */
297 typedef enum {
298         MM_PLAYER_ATTRS_TYPE_INVALID = -1,        /**< Type is invalid */
299         MM_PLAYER_ATTRS_TYPE_INT,                 /**< Integer type */
300         MM_PLAYER_ATTRS_TYPE_DOUBLE,              /**< Double type */
301         MM_PLAYER_ATTRS_TYPE_STRING,              /**< UTF-8 String type */
302         MM_PLAYER_ATTRS_TYPE_DATA,                /**< Pointer type */
303         MM_PLAYER_ATTRS_TYPE_ARRAY,               /**< Array type */
304         MM_PLAYER_ATTRS_TYPE_RANGE,               /**< Range type */
305         MM_PLAYER_ATTRS_TYPE_NUM,                 /**< Number of attribute type */
306 } MMPlayerAttrsType;
307
308 /**
309  * Enumeration for attribute validation type.
310  */
311 typedef enum {
312         MM_PLAYER_ATTRS_VALID_TYPE_INVALID = -1,                /**< Invalid validation type */
313         MM_PLAYER_ATTRS_VALID_TYPE_NONE,                                /**< Do not check validity */
314         MM_PLAYER_ATTRS_VALID_TYPE_INT_ARRAY,          /**< validity checking type of integer array */
315         MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE,          /**< validity checking type of integer range */
316         MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_ARRAY,                /**< validity checking type of double array */
317         MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_RANGE,       /**< validity checking type of double range */
318 } MMPlayerAttrsValidType;
319
320 /**
321  * Enumeration for attribute access flag.
322  */
323 typedef enum {
324         MM_PLAYER_ATTRS_FLAG_NONE = 0,                                  /**< None flag is set */
325         MM_PLAYER_ATTRS_FLAG_READABLE = 1 << 0,                 /**< Readable */
326         MM_PLAYER_ATTRS_FLAG_WRITABLE = 1 << 1,                 /**< Writable */
327         MM_PLAYER_ATTRS_FLAG_MODIFIED = 1 << 2,                 /**< Modified */
328
329         MM_PLAYER_ATTRS_FLAG_RW = MM_PLAYER_ATTRS_FLAG_READABLE | MM_PLAYER_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
330 } MMPlayerAttrsFlag;
331
332 /**
333  * Enumeration for progressive download
334  */
335 typedef enum {
336         MM_PLAYER_PD_MODE_NONE,
337         MM_PLAYER_PD_MODE_URI,
338         MM_PLAYER_PD_MODE_FILE  // not tested yet, because of no fixed scenario
339 } MMPlayerPDMode;
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 } MMPlayerTrackType;
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 } MMPlayerBufferingMode;
359
360 /**
361  * Edge Properties of the text.
362  */
363 typedef enum {
364         MM_PLAYER_EDGE_NO,
365         MM_PLAYER_EDGE_RAISED,
366         MM_PLAYER_EDGE_DEPRESSED,
367         MM_PLAYER_EDGE_UNIFORM,
368         MM_PLAYER_EDGE_DROPSHADOW
369 } MMPlayerSubtitleEdge;
370
371 /**
372  * Enumeration of media stream buffer status
373  */
374 typedef enum {
375         MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN,
376         MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW,
377 } MMPlayerMediaStreamBufferStatus;
378
379 /**
380  * Enumeration for stream type.
381  */
382 typedef enum {
383         MM_PLAYER_STREAM_TYPE_DEFAULT,  /**< Container type */
384         MM_PLAYER_STREAM_TYPE_AUDIO,    /**< Audio element stream type */
385         MM_PLAYER_STREAM_TYPE_VIDEO,    /**< Video element stream type */
386         MM_PLAYER_STREAM_TYPE_TEXT,     /**< Text type */
387         MM_PLAYER_STREAM_TYPE_MAX,
388 } MMPlayerStreamType;
389
390 typedef enum {
391         MM_PLAYER_CODEC_TYPE_DEFAULT = 0, /**< codec is selected by the priority */
392         MM_PLAYER_CODEC_TYPE_HW,          /**< HW codec can only be selected */
393         MM_PLAYER_CODEC_TYPE_SW,          /**< SW codec can only be selected */
394 } MMPlayerVideoCodecType;
395
396 /**
397  * Attribute validity structure
398  */
399 typedef struct {
400          MMPlayerAttrsType type;
401          MMPlayerAttrsValidType validity_type;
402          MMPlayerAttrsFlag flag;
403         /**
404           * a union that describes validity of the attribute.
405           * Only when type is 'MM_ATTRS_TYPE_INT' or 'MM_ATTRS_TYPE_DOUBLE',
406           * the attribute can have validity.
407          */
408          union {
409                 /**
410                    * Validity structure for integer array.
411                  */
412                 struct {
413                         int *array;  /**< a pointer of array */
414                         int count;   /**< size of array */
415                         int d_val;
416                 } int_array;
417                 /**
418                    * Validity structure for integer range.
419                  */
420                 struct {
421                         int min;   /**< minimum range */
422                         int max;   /**< maximum range */
423                         int d_val;
424                 } int_range;
425                 /**
426                 * Validity structure for double array.
427                 */
428                 struct {
429                         double   * array;  /**< a pointer of array */
430                         int    count;   /**< size of array */
431                         double d_val;
432                 } double_array;
433                 /**
434                 * Validity structure for double range.
435                 */
436                 struct {
437                         double   min;   /**< minimum range */
438                         double   max;   /**< maximum range */
439                         double d_val;
440                 } double_range;
441         };
442 } MMPlayerAttrsInfo;
443
444 /**
445  * Volume type.
446  *
447  * @see         mm_player_set_volume, mm_player_get_volume
448  */
449 typedef struct {
450         float   level[MM_VOLUME_CHANNEL_NUM];   /**< Relative volume factor for each channels */
451 } MMPlayerVolumeType;
452
453 /**
454  * Video stream info in external demux case
455  *
456 **/
457 typedef struct _VideoStreamInfo {
458         const char *mime;
459         unsigned int framerate_num;
460         unsigned int framerate_den;
461         unsigned int width;
462         unsigned int height;
463         unsigned char *codec_extradata;
464         unsigned int extradata_size;
465         unsigned int version;
466 } MMPlayerVideoStreamInfo;
467
468 /**
469  * Audio stream info in external demux case
470  *
471 **/
472 typedef struct _AudioStreamInfo {
473         const char *mime;
474         unsigned int channels;
475         unsigned int sample_rate;
476         unsigned char *codec_extradata;
477         unsigned int extradata_size;
478         unsigned int version;
479         unsigned int user_info;
480
481         /* for pcm */
482 //      unsigned int width;
483 //      unsigned int depth;
484 //      unsigned int endianness;
485 //      bool signedness;
486 } MMPlayerAudioStreamInfo;
487
488 /**
489  * Subtitle stream info in external demux case
490  *
491 **/
492 typedef struct _SubtitleStreamInfo {
493         const char *mime;
494         unsigned int codec_tag;
495         void *context;  //for smpte text
496 } MMPlayerSubtitleStreamInfo;
497
498 /**
499  * Audio stream callback function type.
500  *
501  * @param       stream          [in]    Reference pointer to audio frame data
502  * @param       stream_size     [in]    Size of audio frame data
503  * @param       user_param      [in]    User defined parameter which is passed when set
504  *                                                              audio stream callback
505  *
506  * @return      This callback function have to return MM_ERROR_NONE.
507  */
508 typedef bool    (*mm_player_audio_stream_callback) (void *stream, int stream_size, void *user_param);
509
510
511 /**
512  * selected subtitle track number callback function type.
513  *
514  * @param       track_num       [in]    Track number of subtitle
515  * @param       user_param      [in]    User defined parameter
516  *
517  *
518  * @return      This callback function have to return MM_ERROR_NONE.
519  */
520 typedef bool            (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
521
522 /**
523  * Buffer underrun / overflow data callback function type.
524  *
525  * @param       status     [in] buffer status
526  * @param       user_param [in] User defined parameter which is passed when set
527  *                          to enough data callback or need data callback
528  *
529  * @return      This callback function have to return MM_ERROR_NONE.
530  */
531 typedef bool    (*mm_player_media_stream_buffer_status_callback) (MMPlayerStreamType type, MMPlayerMediaStreamBufferStatus status, unsigned long long bytes, void *user_param);
532
533 /**
534  * Buffer seek data callback function type.
535  *
536  * @param       offset     [in] offset for the buffer playback
537  * @param       user_param [in] User defined parameter which is passed when set
538  *                          to seek data callback
539  *
540  * @return      This callback function have to return MM_ERROR_NONE.
541  */
542 typedef bool    (*mm_player_media_stream_seek_data_callback) (MMPlayerStreamType type, unsigned long long offset, void *user_param);
543
544 /**
545  * Called to notify the stream changed.
546  *
547  * @param user_data [in] The user data passed from the callback registration function
548  *
549  * @return      This callback function have to return MM_ERROR_NONE.
550  */
551 typedef bool    (*mm_player_stream_changed_callback) (void *user_param);
552
553
554 /*===========================================================================================
555 |                                                                                           |
556 |  GLOBAL FUNCTION PROTOTYPES                                        |
557 |                                                                                           |
558 ========================================================================================== */
559
560 /**
561  * This function creates a player object for playing multimedia contents. \n
562  * The attributes of player are created to get/set some values with application. \n
563  * And, mutex, gstreamer and other resources are initialized at this time. \n
564  * If player is created, the state will become MM_PLAYER_STATE_NULL.
565  *
566  * @param   player [out] Handle of player
567  *
568  * @return  This function returns zero on success, or negative value with error code. \n
569  *          Please refer 'mm_error.h' to know it in detail.
570  * @pre     None
571  * @post    MM_PLAYER_STATE_NULL
572  * @see     mm_player_destroy
573  * @remark  You can create multiple handles on a context at the same time. \n
574  *          However, player cannot guarantee proper operation because of limitation of resources, \n
575  *          such as audio device or display device.
576  *
577  * @par Example
578  * @code
579 char *g_err_attr_name = NULL;
580
581 if (mm_player_create(&g_player) != MM_ERROR_NONE) {
582         LOGE("failed to create player\n");
583 }
584
585 if (mm_player_set_attribute(g_player,
586                                                 &g_err_attr_name,
587                                                 "profile_uri", filename, strlen(filename),
588                                                 "display_overlay", (void*)&g_win.xid, sizeof(g_win.xid),
589                                                 NULL) != MM_ERROR_NONE) {
590         LOGE("failed to set %s attribute\n", g_err_attr_name);
591         free(g_err_attr_name);
592 }
593
594 mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
595  * @endcode
596  */
597 int mm_player_create(MMHandleType *player);
598
599 /**
600  * This function releases player object and all resources which were created by mm_player_create(). \n
601  * And, player handle will also be destroyed.
602  *
603  * @param   player [in] Handle of player
604  *
605  * @return  This function returns zero on success, or negative value with error code.
606  * @pre     Player state may be MM_PLAYER_STATE_NULL. \n
607  *          But, it can be called in any state.
608  * @post    Because handle is released, there is no any state.
609  * @see     mm_player_create
610  * @remark  This method can be called with a valid player handle from any state to \n
611  *          completely shutdown the player operation.
612  *
613  * @par Example
614  * @code
615 if (mm_player_destroy(g_player) != MM_ERROR_NONE) {
616         LOGE("failed to destroy player\n");
617 }
618  * @endcode
619  */
620 int mm_player_destroy(MMHandleType player);
621
622 /**
623  * This function parses uri and makes gstreamer pipeline by uri scheme. \n
624  * So, uri should be set before realizing with mm_player_set_attribute(). \n
625  *
626  * @param   player [in] Handle of player
627  *
628  * @return  This function returns zero on success, or negative value with error code.
629  *
630  * @pre     Player state should be MM_PLAYER_STATE_NULL.
631  * @post    player state will be MM_PLAYER_STATE_READY.
632  * @see     mm_player_unrealize
633  * @remark  None
634  * @par Example
635  * @code
636 if (mm_player_realize(g_player) != MM_ERROR_NONE) {
637         LOGE("failed to realize player\n");
638 }
639  * @endcode
640  */
641 int mm_player_realize(MMHandleType player);
642
643 /**
644  * This function uninitializes player object. So, resources and allocated memory \n
645  * will be freed. And, gstreamer pipeline is also destroyed. So, if you want to play \n
646  * other contents, player should be created again after destruction or realized with new uri.
647  *
648  * @param   player [in] Handle of player
649  *
650  * @return  This function returns zero on success, or negative value with error code.
651  * @pre     Player state may be MM_PLAYER_STATE_READY to unrealize. \n
652  *          But, it can be called in any state.
653  * @post    Player state will be MM_PLAYER_STATE_NULL.
654  * @see     mm_player_realize
655  * @remark  This method can be called with a valid player handle from any state.
656  *
657  * @par Example
658  * @code
659 if (mm_player_unrealize(g_player) != MM_ERROR_NONE) {
660         LOGE("failed to unrealize player\n");
661 }
662  * @endcode
663  */
664 int mm_player_unrealize(MMHandleType player);
665
666 /**
667  * This function is to abort pause state transition
668  * for unrealize or destroy.
669  */
670 int mm_player_abort_pause(MMHandleType player);
671
672 /**
673  * This function is to get current state of player. \n
674  * Application have to check current state before doing some action.
675  *
676  * @param player [in]  Handle of player
677  * @param state  [out] current state of player on success
678  *
679  * @return   This function returns zero on success, or negative value with error code.
680  *
681  * @see      MMPlayerStateType
682  * @remark   None
683  * @par Example
684  * @code
685 if (mm_player_get_state(g_player, &state) != MM_ERROR_NONE) {
686         LOGE("failed to get state\n");
687 }
688  * @endcode
689  */
690 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state);
691
692 /**
693  * This function is to set relative volume of player. \n
694  * So, It controls logical volume value. \n
695  * But, if developer want to change system volume, mm sound api should be used.
696  *
697  * @param       player          [in]    Handle of player
698  * @param       volume          [in]    Volume factor of each channel
699  *
700  * @return      This function returns zero on success, or negative value with error code.
701  * @see         MMPlayerVolumeType, mm_player_get_volume
702  * @remark      The range of factor range is from 0 to 1.0. (1.0 = 100%) And, default value is 1.0.
703  * @par Example
704  * @code
705 MMPlayerVolumeType volume;
706 int i = 0;
707
708 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
709         volume.level[i] = MM_VOLUME_LEVEL_MAX;
710
711 if (mm_player_set_volume(g_player, &volume) != MM_ERROR_NONE)
712 {
713     LOGE("failed to set volume\n");
714 }
715  * @endcode
716  */
717 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume);
718
719 /**
720  * This function is to get current volume factor of player.
721  *
722  * @param       player          [in]    Handle of player.
723  * @param       volume          [out]   Volume factor of each channel.
724  *
725  * @return      This function returns zero on success, or negative value with error code.
726  *
727  * @see         MMPlayerVolumeType, mm_player_set_volume
728  * @remark  None
729  * @par Example
730  * @code
731 MMPlayerVolumeType volume;
732 int i;
733
734 if (mm_player_get_volume(g_player, &volume) != MM_ERROR_NONE)
735 {
736         LOGW("failed to get volume\n");
737 }
738
739 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
740         LOGD("channel[%d] = %d \n", i, volume.level[i]);
741  * @endcode
742  */
743 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume);
744
745 /**
746  * This function is to start playing media contents. Demux(parser), codec and related plugins are decided \n
747  * at this time. And, MM_MESSAGE_BEGIN_OF_STREAM will be posted through callback function registered \n
748  * by mm_player_set_message_callback().
749  *
750  * @param       player          [in]    Handle of player
751  *
752  * @return      This function returns zero on success, or negative value with error code.
753  * @remark
754  *
755  * @pre         Player state may be MM_PLAYER_STATE_READY.
756  * @post                Player state will be MM_PLAYER_STATE_PLAYING.
757  * @see         mm_player_stop
758  * @remark  None
759  * @par Example
760  * @code
761 if (mm_player_start(g_player) != MM_ERROR_NONE)
762 {
763         LOGE("failed to start player\n");
764 }
765  * @endcode
766  */
767 int mm_player_start(MMHandleType player);
768
769 /**
770  * This function is to stop playing media contents and it's different with pause. \n
771  * If mm_player_start() is called after this, content will be started again from the beginning. \n
772  * So, it can be used to close current playback.
773  *
774  * @param       player          [in]    Handle of player
775  *
776  * @return      This function returns zero on success, or negative value with error code.
777  *
778  * @pre         Player state may be MM_PLAYER_STATE_PLAYING.
779  * @post                Player state will be MM_PLAYER_STATE_READY.
780  * @see         mm_player_start
781  * @remark  None
782  * @par Example
783  * @code
784 if (mm_player_stop(g_player) != MM_ERROR_NONE)
785 {
786         LOGE("failed to stop player\n");
787 }
788  * @endcode
789  */
790 int mm_player_stop(MMHandleType player);
791
792 /**
793  * This function is to pause playing media contents.
794  *
795  * @param       player          [in]    Handle of player.
796  *
797  * @return      This function returns zero on success, or negative value with error code.
798  *
799  * @pre         Player state may be MM_PLAYER_STATE_PLAYING.
800  * @post                Player state will be MM_PLAYER_STATE_PAUSED.
801  * @see         mm_player_resume
802  * @remark  None
803  * @par Example
804  * @code
805 if (mm_player_pause(g_player) != MM_ERROR_NONE)
806 {
807         LOGE("failed to pause player\n");
808 }
809  * @endcode
810  */
811 int mm_player_pause(MMHandleType player);
812
813 /**
814  * This function is to resume paused media contents.
815  *
816  * @param       player          [in]    Handle of player.
817  *
818  * @return      This function returns zero on success, or negative value with error code.
819  *
820  * @pre         Player state may be MM_PLAYER_STATE_PAUSED.
821  * @post                Player state will be MM_PLAYER_STATE_PLAYING.
822  * @see         mm_player_pause
823  * @remark  None
824  * @par Example
825  * @code
826 if (mm_player_resume(g_player) != MM_ERROR_NONE)
827 {
828         LOGE("failed to resume player\n");
829 }
830  * @endcode
831  */
832 int mm_player_resume(MMHandleType player);
833
834 /**
835  * This function is to set the position for playback. \n
836  * So, it can be seeked to requested position. \n
837  *
838  * @param       player          [in]    Handle of player
839  * @param       format          [in]    Format of position.
840  * @param       pos                     [in]    Position for playback
841  *
842  * @return      This function returns zero on success, or negative value with error code.
843  * @see         MMPlayerPosFormatType, mm_player_get_position
844  * @remark  the unit of time-based format is millisecond and other case is percent.
845  */
846 int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int64_t pos);
847
848 /**
849  * This function is to get current position of playback content.
850  *
851  * @param       player          [in]    Handle of player.
852  * @param       format          [in]    Format of position.
853  * @param    pos        [out] contains current position on success or zero in case of failure.
854  *
855  * @return      This function returns zero on success, or negative value with errors
856  * @see         MMPlayerPosFormatType, mm_player_set_position
857  * @remark  the unit of time-based format is millisecond and other case is percent.
858  */
859 int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, int64_t *pos);
860
861 /**
862  * This function is to get the content time duration.
863  */
864 int mm_player_get_duration(MMHandleType player, int64_t *dur);
865
866 /**
867  * This function is to get current buffer position of playback content.
868  *
869  * @param   player      [in]    Handle of player.
870  * @param   format      [in]    Format of position.
871  * @param   start_pos   [out] contains buffer start  position on success or zero in case of failure.
872  * @param   stop_pos    [out] contains buffer current  position on success or zero in case of failure.
873  *
874  * @return      This function returns zero on success, or negative value with errors
875  * @see         MMPlayerPosFormatType, mm_player_set_position
876  * @remark  the unit of time-based format is millisecond and other case is percent.
877  * @par Example
878  * @code
879 int start_pos = 0, stop_pos = 0;
880
881 mm_player_get_buffer_position(g_player, MM_PLAYER_POS_FORMAT_PERCENT, &start_pos, &stop_pos );
882
883 LOGD("buffer position: [%d] ~ [%d] \%\n", start_pos, stop_pos );
884  * @endcode
885  */
886 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *start_pos, unsigned long *stop_pos);
887
888 /**
889  * This function sets callback function for receiving messages from player.
890  * So, player can notify warning, error and normal cases to application.
891  *
892  * @param       player          [in]    Handle of player.
893  * @param       callback        [in]    Message callback function.
894  * @param       user_param      [in]    User parameter which is passed to callback function.
895  *
896  * @return      This function returns zero on success, or negative value with error code.
897  * @see         MMMessageCallback
898  * @remark  None
899  * @par Example
900  * @code
901 int msg_callback(int message, MMMessageParamType *param, void *user_param)
902 {
903         switch (message)
904         {
905                 case MM_MESSAGE_ERROR:
906                         //do something
907                         break;
908
909                 case MM_MESSAGE_END_OF_STREAM:
910                         //do something
911                         break;
912
913                 case MM_MESSAGE_STATE_CHANGED:
914                         //do something
915                         break;
916
917                 case MM_MESSAGE_BEGIN_OF_STREAM:
918                         //do something
919                         break;
920
921                 default:
922                         break;
923         }
924         return TRUE;
925 }
926
927 mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
928  * @endcode
929  */
930 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
931
932 /**
933  * This function set callback function for receiving audio stream from player. \n
934  * So, application can get raw audio data and modify it. \n
935  * But, if callback don't return or holds it for long time, performance can be deteriorated. \n
936  * It's only supported when audio stream is included in file. \n
937  * So, if there is video stream or DRM content, it can't be used.
938  *
939  * @param   player     [in] Handle of player.
940  * @param   callback   [in] Audio stream callback function.
941  * @param   user_param [in] User parameter.
942  *
943  * @return  This function returns zero on success, or negative value with error
944  *          code.
945  * @see     mm_player_audio_stream_callback
946  * @remark  It can be used for audio playback only.
947  * @par Example
948  * @code
949 bool audio_callback(void *stream, int stream_size, void *user_param)
950 {
951         LOGD("audio stream callback\n");
952         return TRUE;
953 }
954 mm_player_set_audio_stream_callback(g_player, audio_callback, NULL);
955  * @endcode
956  */
957 int mm_player_set_audio_stream_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param);
958
959 /**
960  * This function is to mute volume of player
961  *
962  * @param       player  [in]    Handle of player
963  * @param       mute    [in]    Mute(1) or not mute(0)
964  *
965  * @return      This function returns zero on success, or negative value with error code
966  * @see         mm_player_get_mute
967  * @remark  None
968  * @par Example
969  * @code
970 if (mm_player_set_mute(g_player, TRUE) != MM_ERROR_NONE)
971 {
972         LOGW("failed to set mute\n");
973 }
974  * @endcode
975  */
976 int mm_player_set_mute(MMHandleType player, int mute);
977
978 /**
979  * This function is to get mute value of player
980  *
981  * @param       player  [in]    Handle of player
982  * @param       mute    [out]   Sound is muted
983  *
984  * @return      This function returns zero on success, or negative value with error code
985  * @see         mm_player_set_mute
986  * @remark  None
987  * @par Example
988  * @code
989 int mute;
990
991 if (mm_player_get_mute(g_player, &mute) != MM_ERROR_NONE)
992 {
993         LOGW("failed to get mute\n");
994 }
995
996 LOGD("mute status:%d\n", mute);
997  * @endcode
998  */
999 int mm_player_get_mute(MMHandleType player, int *mute);
1000
1001 /**
1002  * This function is to adjust subtitle postion. So, subtitle can show at the adjusted position. \n
1003  * If pos is negative, subtitle will be displayed previous time, the other hand forward time. \n
1004  *
1005  * @param       player  [in]    Handle of player
1006  * @param       pos             [in]    postion to be adjusted
1007  *
1008  * @return      This function returns zero on success, or negative value with error
1009  *                      code
1010  * @see         mm_player_adjust_subtitle_position
1011  * @remark  None
1012  * @par Example
1013  * @code
1014 int pos;
1015
1016 pos = 5000;
1017 if (mm_player_adjust_subtitle_position(g_player, MM_PLAYER_POS_FORMAT_TIME, pos) != MM_ERROR_NONE)
1018 {
1019         LOGW("failed to adjust subtitle postion.\n");
1020 }
1021  * @endcode
1022  */
1023
1024 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos);
1025
1026 /**
1027  * This function is to set subtitle silent status. So, subtitle can show or hide during playback \n
1028  * by this value. But, one subtitle file should be set with "subtitle_uri" attribute before calling mm_player_realize(); \n
1029  * Player FW parses subtitle file and send text data including timestamp to application \n
1030  * through message callback with MM_MESSAGE_UPDATE_SUBTITLE will be. \n
1031  * So, application have to render it. And, subtitle can be supported only in a seprate file. \n
1032  * So, it's not supported for embedded case.
1033  *
1034  * @param       player  [in]    Handle of player
1035  * @param       silent  [in]    silent(integer value except 0) or not silent(0)
1036  *
1037  * @return      This function returns zero on success, or negative value with error
1038  *                      code
1039  * @see         mm_player_get_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1040  * @remark  None
1041  * @par Example
1042  * @code
1043 mm_player_set_attribute(g_player,
1044                                         &g_err_name,
1045                                         "subtitle_uri", g_subtitle_uri, strlen(g_subtitle_uri),
1046                                         NULL
1047                                         );
1048
1049 if (mm_player_set_subtitle_silent(g_player, TRUE) != MM_ERROR_NONE)
1050 {
1051         LOGW("failed to set subtitle silent\n");
1052 }
1053  * @endcode
1054  */
1055 int mm_player_set_subtitle_silent(MMHandleType player, int silent);
1056
1057 /**
1058  * This function is to get silent status of subtitle.
1059  *
1060  * @param       player  [in]    Handle of player
1061  * @param       silent  [out]   subtitle silent property
1062  *
1063  * @return      This function returns zero on success, or negative value with error
1064  *                      code
1065  * @see         mm_player_set_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1066  * @remark  None
1067  * @par Example
1068  * @code
1069 int silent = FALSE;
1070
1071 if (mm_player_get_subtitle_silent(g_player, &silent) != MM_ERROR_NONE)
1072 {
1073         LOGW("failed to set subtitle silent\n");
1074 }
1075  * @endcode
1076  */
1077 int mm_player_get_subtitle_silent(MMHandleType player, int *silent);
1078
1079 /**
1080  * This function is to set attributes into player. Multiple attributes can be set simultaneously. \n
1081  * If one of attribute fails, this function will stop at the point and let you know the name which is failed. \n
1082  *
1083  * @param   player                 [in]   Handle of player.
1084  * @param   err_attr_name          [out]  Name of attribute which is failed to set
1085  * @param   first_attribute_name   [in]   Name of the first attribute to set
1086  * @param   ...                    [in]   Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1087  *                                        But, in the case of data or string type, it should be name/value/size.
1088  *
1089  * @return  This function returns zero on success, or negative value with error code.
1090  *
1091  * @see     mm_player_get_attribute
1092  * @remark  This function must be terminated by NULL argument.
1093  *          And, if this function is failed, err_attr_name param must be free.
1094  * @par Example
1095  * @code
1096 char *g_err_attr_name = NULL;
1097
1098 if (mm_player_set_attribute(g_player,
1099                                                 &g_err_attr_name,
1100                                                 "profile_uri", filename, strlen(filename),
1101                                                 "profile_play_count", count,
1102                                                 NULL) != MM_ERROR_NONE) {
1103         LOGW("failed to set %s attribute\n", g_err_attr_name);
1104         free(g_err_attr_name);
1105 }
1106
1107  * @endcode
1108  */
1109 int mm_player_set_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1110
1111 /**
1112  * This function is to get attributes from player. Multiple attributes can be got simultaneously.
1113  *
1114  * @param   player                [in]  Handle of player.
1115  * @param   err_attr_name         [out] Name of attribute which is failed to get
1116  * @param   first_attribute_name  [in]  Name of the first attribute to get
1117  * @param   ...                   [out] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1118  *                                      But, in the case of data or string type, it should be name/value/size.
1119  *
1120  * @return  This function returns zero on success, or negative value with error
1121  *          code.
1122  * @see     mm_player_set_attribute
1123  * @remark  This function must be terminated by NULL argument.
1124  *          And, if this function is failed, err_attr_name param must be free.
1125  */
1126 int mm_player_get_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1127
1128 /**
1129  * This function is to get detail information of attribute.
1130  *
1131  * @param   player          [in]  Handle of player.
1132  * @param   attribute_name  [in]  Name of the attribute to get
1133  * @param   info            [out] Attribute infomation
1134  *
1135  * @return  This function returns zero on success, or negative value with error
1136  *          code.
1137  *
1138  * @see     mm_player_set_attribute, mm_player_get_attribute
1139  * @remark  None
1140  * @par Example
1141  * @code
1142 if (mm_player_get_attribute_info(g_player, "display_method", &method_info) != MM_ERROR_NONE) {
1143         LOGW("failed to get info\n");
1144 }
1145
1146 LOGD("type:%d \n", method_info.type); //int, double..
1147 LOGD("flag:%d \n", method_info.flag); //readable, writable..
1148 LOGD("validity type:%d \n", method_info.validity_type); //range, array..
1149
1150 if (method_info. validity_type == MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE) {
1151         LOGD("range min:%d\n", method_info.int_range.min);
1152         LOGD("range max:%d\n", method_info.int_range.max);
1153 }
1154  * @endcode
1155  */
1156 int mm_player_get_attribute_info(MMHandleType player,  const char *attribute_name, MMPlayerAttrsInfo *info);
1157
1158 /**
1159  * This function is to get download position and total size of progressive download
1160  *
1161  * @param   player      [in] Handle of player.
1162  * @param   current_pos [in] Download position currently (bytes)
1163  * @param   total_size  [in] Total size of file (bytes)
1164  *
1165  * @return  This function returns zero on success, or negative value with error code.
1166  * @par Example
1167  * @code
1168 guint64 current_pos = 0LLU;
1169 guint64 total_size = 0LLU;
1170
1171 if (mm_player_get_pd_status(g_player, &current_pos, &total_size, NULL) != MM_ERROR_NONE)
1172 {
1173         LOGD("current download pos = %llu, total size = %llu\n", current_pos, total_size);
1174 }
1175  * @endcode
1176  */
1177 int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size);
1178
1179 /**
1180  * This function sets callback function for receiving messages of PD downloader.
1181  *
1182  * @param   player     [in] Handle of player.
1183  * @param   callback   [in] Message callback function.
1184  * @param   user_param [in] User parameter which is passed to callback function.
1185  *
1186  * @return  This function returns zero on success, or negative value with error code.
1187  * @see
1188  * @remark  None
1189  * @par Example
1190  * @code
1191 int msg_callback(int message, MMMessageParamType *param, void *user_param)
1192 {
1193         switch (message)
1194         {
1195                 case MM_MESSAGE_PD_DOWNLOADER_START:
1196                         LOGD("Progressive download is started...\n");
1197                         break;
1198                 case MM_MESSAGE_PD_DOWNLOADER_END:
1199                         LOGD("Progressive download is ended...\n");
1200                         break;
1201                 default:
1202                         break;
1203         }
1204         return TRUE;
1205 }
1206
1207 mm_player_set_pd_message_callback(g_player, msg_callback, NULL);
1208  * @endcode
1209  */
1210 int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
1211
1212 /**
1213  * This function is to get the track count
1214  *
1215  * @param   player [in]  handle of player.
1216  * @param   track  [in]  type of the track type
1217  * @param   info   [out] the count of the track
1218  *
1219  * @return  This function returns zero on success, or negative value with error
1220  *          code.
1221  *
1222  * @par Example
1223  * @code
1224 gint audio_count = 0;
1225
1226 if (mm_player_get_track_count(g_player, MM_PLAYER_TRACK_TYPE_AUDIO, &audio_count) != MM_ERROR_NONE) {
1227         LOGW("failed to get audio track count\n");
1228 }
1229
1230 LOGD("audio track count : %d \n", audio_count);
1231  * @endcode
1232  */
1233 int mm_player_get_track_count(MMHandleType player,  MMPlayerTrackType type, int *count);
1234
1235 /**
1236  * This function is to select the track
1237  *
1238  * @param   player [in] handle of player.
1239  * @param   type   [in] type of the track type
1240  * @param   index  [in] the index of the track
1241  *
1242  * @return  This function returns zero on success, or negative value with error
1243  *          code.
1244  */
1245 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index);
1246 #ifdef _MULTI_TRACK
1247 /**
1248  * This function is to add the track when user want multi subtitle
1249  *
1250  * @param   player              [in]    handle of player.
1251  * @param   index               [in]    the index of the track
1252  *
1253  * @return  This function returns zero on success, or negative value with error
1254  *          code.
1255  */
1256 int mm_player_track_add_subtitle_language(MMHandleType player, int index);
1257
1258 /**
1259  * This function is to remove the track when user want multi subtitle
1260  *
1261  * @param   player  [in] handle of player.
1262  * @param   index   [in] the index of the track
1263  *
1264  * @return  This function returns zero on success, or negative value with error
1265  *          code.
1266  */
1267 int mm_player_track_remove_subtitle_language(MMHandleType player, int index);
1268
1269 /**
1270  * This function is to notify which sutitle track is in use
1271  *
1272  * @param   player    [in] handle of player.
1273  * @param   callback  [in] callback function to register
1274  * @param   user_data [in] user data to be passed to the callback function
1275  *
1276  * @return  This function returns zero on success, or negative value with error
1277  *          code.
1278  */
1279 int mm_player_track_foreach_selected_subtitle_language(MMHandleType player, mm_player_track_selected_subtitle_language_callback callback, void *user_param);
1280 #endif
1281 /**
1282  * This function is to get the track language
1283  *
1284  * @param   player [in]  handle of player.
1285  * @param   type   [in]  type of the track type
1286  * @param   index  [in]  the index of the track
1287  * @param   code   [out] language code in ISO 639-1(string)
1288  *
1289  * @return  This function returns zero on success, or negative value with error
1290  *          code.
1291  */
1292 int mm_player_get_track_language_code(MMHandleType player,  MMPlayerTrackType type, int index, char **code);
1293
1294 /**
1295  * This function is to get the current running track
1296  *
1297  * @param       player          [in]    handle of player.
1298  * @param       type                    [in]    type of the track type
1299  * @param       index           [out]    the index of the track
1300  *
1301  * @return      This function returns zero on success, or negative value with error
1302  *                      code.
1303  */
1304
1305 int mm_player_get_current_track(MMHandleType hplayer, MMPlayerTrackType type, int *index);
1306
1307 /**
1308  * This function is to set the subtitle path
1309  *
1310  * @param       player  [in]    handle of player
1311  * @param       path    [in]    subtitle path
1312  *
1313  * @return      This function returns zero on success, or negative value with error code.
1314  */
1315 int mm_player_set_external_subtitle_path(MMHandleType player, const char* path);
1316
1317 /**
1318  * This function is to set the clock which is from master player
1319  *
1320  * @param       player  [in]    handle of player
1321  * @param       clock   [in]    clock of master player
1322  * @param       clock_delta [in]        clock difference between master and slave
1323  * @param       video_time      [in]    current playing position
1324  * @param       media_clock     [in]    media clock information
1325  * @param       audio_time      [in]    audio timestamp information
1326  * @return      This function returns zero on success, or negative value with error code.
1327  */
1328 int mm_player_set_video_share_master_clock(MMHandleType player, int64_t clock, int64_t clock_delta, int64_t video_time, int64_t media_clock, int64_t audio_time);
1329 /**
1330  * This function is to get the master clock
1331  *
1332  * @param       player          [in]    handle of player
1333  * @param       video_time      [out]   current playing position
1334  * @param       media_clock     [out]   media clock information
1335  * @param       audio_time      [out]   audio timestamp information
1336  * @return      This function returns zero on success, or negative value with error code.
1337  */
1338 int mm_player_get_video_share_master_clock(MMHandleType player, int64_t *video_time, int64_t *media_clock, int64_t *audio_time);
1339
1340 /**
1341  * This function is to set download mode of video hub
1342  *
1343  * @param       player          [in]    handle of player
1344  * @param       mode            [in]    download mode
1345  * @return      This function returns zero on success, or negative value with error code.
1346  */
1347 int mm_player_set_video_hub_download_mode(MMHandleType player, bool mode);
1348
1349 /**
1350  * This function is to set using sync handler.
1351  *
1352  * @param       player          [in]    handle of player
1353  * @param       enable          [in]    enable/disable
1354  * @return      This function returns zero on success, or negative value with error code.
1355  */
1356 int mm_player_enable_sync_handler(MMHandleType player, bool enable);
1357
1358 /**
1359  * This function is to set uri.
1360  *
1361  * @param   player [in] handle of player
1362  * @param   uri    [in] uri
1363  * @return  This function returns zero on success, or negative value with error code.
1364  */
1365 int mm_player_set_uri(MMHandleType player, const char *uri);
1366
1367 /**
1368  * This function is to set next uri.
1369  *
1370  * @param   player [in] handle of player
1371  * @param   uri    [in] uri
1372  * @return  This function returns zero on success, or negative value with error code.
1373  */
1374 int mm_player_set_next_uri(MMHandleType player, const char *uri);
1375
1376 /**
1377  * This function is to get next uri.
1378  *
1379  * @param   player   [in]  handle of player
1380  * @param   uri      [out] uri
1381  * @return  This function returns zero on success, or negative value with error code.
1382  */
1383 int mm_player_get_next_uri(MMHandleType player, char **uri);
1384
1385 /**
1386  * This function is to decrease reference count of internal buffer.
1387  *
1388  * @param    buffer [in] video callback internal buffer
1389  * @return   None;
1390  */
1391 void mm_player_video_stream_internal_buffer_unref(void *buffer);
1392
1393 /**mm_player_submit_packet
1394  * This function is to submit buffer to appsrc.  \n
1395  * @param   player                      [in]    Handle of player.
1396  * @param   buf             [in]    buffer to be submit in appsrc in external feeder case.
1397  * @param   len                         [in]    length of buffer.
1398  * @param   pts                         [in]    timestamp of buffer.
1399  * @param   streamtype          [in]    stream type of buffer.
1400  * @return  This function returns zero on success, or negative value with error code.
1401  */
1402 int mm_player_submit_packet(MMHandleType player, media_packet_h packet);
1403
1404 /**mm_player_set_video_info
1405  * This function is to set caps of src pad of video appsrc in external feeder case.  \n
1406  * @param   player         [in] Handle of player.
1407  * @param   media_format_h [in] Video stream info.
1408  * @return  This function returns zero on success, or negative value with error code.
1409  */
1410 int mm_player_set_video_info(MMHandleType player, media_format_h format);
1411
1412 /**mm_player_set_audio_info
1413  * This function is to set caps of src pad of Audio appsrc in external feeder case.  \n
1414  * @param       player                       [in]    Handle of player.
1415  * @param       media_format_h               [in]    Audio stream info.
1416  * @return      This function returns zero on success, or negative value with error code.
1417  */
1418 int mm_player_set_audio_info(MMHandleType player, media_format_h format);
1419
1420 /**mm_player_set_subtitle_info
1421  * This function is to set caps of src pad of subtitle appsrc in external feeder case.  \n
1422  * @param       player                          [in]    Handle of player.
1423  * @param       subtitle_stream_info               [in]    Subtitle stream info.
1424  * @return      This function returns zero on success, or negative value with error code.
1425  */
1426 int mm_player_set_subtitle_info(MMHandleType player, MMPlayerSubtitleStreamInfo *info);
1427
1428 /**
1429  * This function set callback function for receiving need or enough data message from player.
1430  *
1431  * @param   player     [in] Handle of player.
1432  * @param   type       [in] stream type
1433  * @param   callback   [in] data callback function for stream type.
1434  * @param   user_param [in] User parameter.
1435  *
1436  * @return  This function returns zero on success, or negative value with error
1437  *          code.
1438  */
1439 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param);
1440
1441 /**
1442  * This function set callback function for receiving seek data message from player.
1443  *
1444  * @param       player          [in]    Handle of player.
1445  * @param       type            [in]    stream type
1446  * @param       callback        [in]    Seek data callback function for stream type.
1447  * @param       user_param      [in]    User parameter.
1448  *
1449  * @return      This function returns zero on success, or negative value with error
1450  *                      code.
1451  */
1452 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param);
1453
1454 /**
1455  * This function is to set max size of buffer(appsrc).
1456  *
1457  * @param       player          [in]    Handle of player.
1458  * @param       type            [in]    stream type
1459  * @param       max_size        [in]    max bytes of buffer.
1460  *
1461  * @return      This function returns zero on success, or negative value with error
1462  *                      code.
1463  */
1464 int mm_player_set_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long max_size);
1465
1466 /**
1467  * This function is to get max size of buffer(appsrc).
1468  *
1469  * @param       player          [in]    Handle of player.
1470  * @param       type            [in]    stream type
1471  * @param       max_size        [out]   max bytes of buffer.
1472  *
1473  * @return      This function returns zero on success, or negative value with error
1474  *                      code.
1475  */
1476 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long *max_size);
1477
1478 /**
1479  * This function is to set min percent of buffer(appsrc).
1480  *
1481  * @param       player          [in]    Handle of player.
1482  * @param       type            [in]    stream type
1483  * @param       min_percent     [in]    min percent of buffer.
1484  *
1485  * @return      This function returns zero on success, or negative value with error
1486  *                      code.
1487  */
1488 int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned min_percent);
1489
1490 /**
1491  * This function is to get min percent of buffer(appsrc).
1492  *
1493  * @param       player          [in]    Handle of player.
1494  * @param       type            [in]    stream type
1495  * @param       min_percent     [out]   min percent of buffer.
1496  *
1497  * @return      This function returns zero on success, or negative value with error
1498  *                      code.
1499  */
1500 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned int *min_percent);
1501
1502 /**
1503  * This function set callback function for changing audio stream from player. \n
1504  * It's only supported when audio stream is included in file. \n
1505  *
1506  * @param       player   [in] Handle of player.
1507  * @param       callback [in] Audio stream changed callback function.
1508  * @param       user_param [in] User parameter.
1509  *
1510  * @return      This function returns zero on success, or negative value with error
1511  *                      code.
1512  * @see         mm_player_stream_changed_callback
1513  * @since
1514  */
1515 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
1516
1517 /**
1518  * This function set callback function for changing video stream from player. \n
1519  * It's only supported when video stream is included in file. \n
1520  *
1521  * @param       player   [in] Handle of player.
1522  * @param       callback [in] Video stream changed callback function.
1523  * @param       user_param [in] User parameter.
1524  *
1525  * @return      This function returns zero on success, or negative value with error
1526  *                      code.
1527  * @see         mm_player_stream_changed_callback
1528  */
1529 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
1530
1531 /**
1532  * This function is to get timeout value according to the content type for muse. \n
1533  * It's only supported when video stream is included in file. \n
1534  *
1535  * @param       player  [in] Handle of player.
1536  * @param       timeout [out] timeout value (sec).
1537  *
1538  * @return      This function returns zero on success, or negative value with error
1539  *                      code.
1540  * @since 3.0
1541  */
1542 int mm_player_get_timeout(MMHandleType player, int *timeout);
1543
1544 /**
1545  * This function is to get the number of video output buffers. \n
1546  * It's only supported when video stream is included in file. \n
1547  *
1548  * @param       player  [in] Handle of player.
1549  * @param       num     [out] num of buffers.
1550  * @param       extra_num [out] extra num of buffers.
1551  *
1552  * @return      This function returns zero on success, or negative value with error
1553  *                      code.
1554  * @since 3.0
1555  */
1556 int mm_player_get_num_of_video_out_buffers(MMHandleType player, int *num, int *extra_num);
1557
1558 /**
1559  * This function is to set the dynamic resolution information. \n
1560  * It's only supported when video stream is included in file. \n
1561  *
1562  * @param       player  [in] Handle of player.
1563  * @param       drc     [in] dynamic resolution info of media stream data
1564  *
1565  * @return      This function returns zero on success, or negative value with error
1566  *                      code.
1567  * @since 3.0
1568  */
1569 int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc);
1570
1571 /**
1572  * This function is to release the video stream bo to reuse. \n
1573  * It's only supported when sw codec is used to decode video stream. \n
1574  *
1575  * @param       player  [in] Handle of player.
1576  * @param       bo     [in] bo address to be released
1577  *
1578  * @return      This function returns zero on success, or negative value with error
1579  *                      code.
1580  * @since 3.0
1581  */
1582 int mm_player_release_video_stream_bo(MMHandleType player, void* bo);
1583
1584 /**
1585  * This function is to set http file buffering path
1586  *
1587  * @param       player          [in]    handle of player
1588  * @param       file_path       [in]    file path
1589  * @return      This function returns zero on success, or negative value with error code.
1590  */
1591 int mm_player_set_file_buffering_path(MMHandleType player, const char *file_path);
1592
1593 /**
1594  * This function is to set sound stream info
1595  */
1596 int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index);
1597
1598 /**
1599  * This function is to manage the playback according to the external storage state
1600  */
1601 int mm_player_manage_external_storage_state(MMHandleType player, int id, int state);
1602
1603 /**
1604  * These functions are to set/get the max variant of HAS
1605  */
1606 int mm_player_get_adaptive_variant_info(MMHandleType player, int *num, char **var_info);
1607 int mm_player_set_max_adaptive_variant_limit(MMHandleType player, int bandwidth, int width, int height);
1608 int mm_player_get_max_adaptive_variant_limit(MMHandleType player, int *bandwidth, int *width, int *height);
1609
1610 /**
1611  * These functions are to set/get the audio only mode
1612  */
1613 int mm_player_set_audio_only(MMHandleType player, bool audio_only);
1614 int mm_player_get_audio_only(MMHandleType player, bool *audio_only);
1615
1616 /**
1617  * These functions are to set/get the streaming bufferint time
1618  */
1619 int mm_player_set_streaming_buffering_time(MMHandleType player, int buffer_ms, int rebuffer_ms);
1620 int mm_player_get_streaming_buffering_time(MMHandleType player, int *buffer_ms, int *rebuffer_ms);
1621
1622 /**
1623  * These functions are to display the 360 video content
1624  */
1625 int mm_player_360_is_content_spherical(MMHandleType player, bool *is_spherical);
1626 int mm_player_360_set_enabled(MMHandleType player, bool enabled);
1627 int mm_player_360_is_enabled(MMHandleType player, bool *enabled);
1628
1629 int mm_player_360_set_direction_of_view(MMHandleType player, float yaw, float pitch);
1630 int mm_player_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch);
1631
1632 int mm_player_360_set_zoom(MMHandleType player, float level);
1633 int mm_player_360_get_zoom(MMHandleType player, float *level);
1634
1635 int mm_player_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees);
1636 int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees);
1637
1638 /**
1639  * This function is to set codec type
1640  */
1641 int mm_player_set_codec_type(MMHandleType player, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type);
1642
1643 /**
1644  * These functions are to apply the replaygain
1645  */
1646 int mm_player_set_replaygain_enabled(MMHandleType player, bool enabled);
1647 int mm_player_is_replaygain_enabled(MMHandleType player, bool *enabled);
1648 /**
1649         @}
1650  */
1651
1652 #ifdef __cplusplus
1653         }
1654 #endif
1655
1656 #endif  /* __MM_PLAYER_H__ */