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