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