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