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