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