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