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