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