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