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