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