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