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