Add error check for itc crash
[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 #define BUFFER_MAX_PLANE_NUM (4)
656
657 typedef struct {
658         MMPixelFormatType format;                       /**< image format */
659         int width;                                              /**< width of video buffer */
660         int height;                                             /**< height of video buffer */
661         unsigned int timestamp;                         /**< timestamp of stream buffer (msec)*/
662         unsigned int length_total;                      /**< total length of stream buffer (in byte)*/
663         void *data[BUFFER_MAX_PLANE_NUM];
664         void *bo[BUFFER_MAX_PLANE_NUM];  /**< TBM buffer object */
665         void *internal_buffer;                          /**< Internal buffer pointer */
666         int stride[BUFFER_MAX_PLANE_NUM];               /**< stride of plane */
667         int elevation[BUFFER_MAX_PLANE_NUM];    /**< elevation of plane */
668 }MMPlayerVideoStreamDataType;
669
670 /**
671  * Enumerations of player state.
672  */
673 typedef enum {
674         MM_PLAYER_STATE_NULL,                           /**< Player is created, but not realized yet */
675         MM_PLAYER_STATE_READY,                          /**< Player is ready to play media */
676         MM_PLAYER_STATE_PLAYING,                        /**< Player is now playing media */
677         MM_PLAYER_STATE_PAUSED,                         /**< Player is paused while playing media */
678         MM_PLAYER_STATE_NONE,                           /**< Player is not created yet */
679         MM_PLAYER_STATE_NUM,                            /**< Number of player states */
680 } MMPlayerStateType;
681
682 /**
683  * Enumerations of position formats.
684  * Used while invoking mm_player_get_position/mm_player_set_position APIs
685  */
686 typedef enum {
687         MM_PLAYER_POS_FORMAT_TIME,                      /**< Format for time based */
688         MM_PLAYER_POS_FORMAT_PERCENT,                   /**< Format for percentage */
689         MM_PLAYER_POS_FORMAT_NUM,                       /**< Number of position formats */
690 } MMPlayerPosFormatType;
691
692 /**
693  * Enumeration for attribute values types.
694  */
695 typedef enum {
696  MM_PLAYER_ATTRS_TYPE_INVALID = -1,        /**< Type is invalid */
697  MM_PLAYER_ATTRS_TYPE_INT,                 /**< Integer type */
698  MM_PLAYER_ATTRS_TYPE_DOUBLE,              /**< Double type */
699  MM_PLAYER_ATTRS_TYPE_STRING,              /**< UTF-8 String type */
700  MM_PLAYER_ATTRS_TYPE_DATA,                /**< Pointer type */
701  MM_PLAYER_ATTRS_TYPE_ARRAY,               /**< Array type */
702  MM_PLAYER_ATTRS_TYPE_RANGE,               /**< Range type */
703  MM_PLAYER_ATTRS_TYPE_NUM,                 /**< Number of attribute type */
704 } MMPlayerAttrsType;
705
706 /**
707  * Enumeration for attribute validation type.
708  */
709 typedef enum {
710  MM_PLAYER_ATTRS_VALID_TYPE_INVALID = -1,               /**< Invalid validation type */
711  MM_PLAYER_ATTRS_VALID_TYPE_NONE,                               /**< Do not check validity */
712  MM_PLAYER_ATTRS_VALID_TYPE_INT_ARRAY,          /**< validity checking type of integer array */
713  MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE,          /**< validity checking type of integer range */
714  MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_ARRAY,               /**< validity checking type of double array */
715  MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_RANGE,       /**< validity checking type of double range */
716 } MMPlayerAttrsValidType;
717
718 /**
719  * Enumeration for attribute access flag.
720  */
721 typedef enum {
722  MM_PLAYER_ATTRS_FLAG_NONE = 0,                                 /**< None flag is set */
723  MM_PLAYER_ATTRS_FLAG_READABLE = 1 << 0,                        /**< Readable */
724  MM_PLAYER_ATTRS_FLAG_WRITABLE = 1 << 1,                        /**< Writable */
725  MM_PLAYER_ATTRS_FLAG_MODIFIED = 1 << 2,                        /**< Modified */
726
727  MM_PLAYER_ATTRS_FLAG_RW = MM_PLAYER_ATTRS_FLAG_READABLE | MM_PLAYER_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
728 } MMPlayerAttrsFlag;
729
730 /**
731  * Enumeration for progressive download
732  */
733 typedef enum {
734         MM_PLAYER_PD_MODE_NONE,
735         MM_PLAYER_PD_MODE_URI,
736         MM_PLAYER_PD_MODE_FILE  // not tested yet, because of no fixed scenario
737 }MMPlayerPDMode;
738
739 /**
740  * Enumeration of track types
741  */
742 typedef enum {
743         MM_PLAYER_TRACK_TYPE_AUDIO = 0,
744 #if (defined _USE_M_V_INPUT_SELECTOR_ || defined TEST_ES)
745         MM_PLAYER_TRACK_TYPE_VIDEO,
746 #endif
747         MM_PLAYER_TRACK_TYPE_TEXT,
748         MM_PLAYER_TRACK_TYPE_MAX
749 }MMPlayerTrackType;
750
751 /**
752  * Enumeration of runtime buffering mode
753  */
754 typedef enum {
755         MM_PLAYER_BUFFERING_MODE_ADAPTIVE = 0,  /**< default, If buffering is occurred, player will consider the bandwidth to adjust buffer setting. */
756         MM_PLAYER_BUFFERING_MODE_FIXED,                 /**< player will set buffer size with this fixed size value. */
757         MM_PLAYER_BUFFERING_MODE_SLINK,                 /**< If buffering is occurred, player will adjust buffer setting and no more buffering will be occurred again. */
758         MM_PLAYER_BUFFERING_MODE_MAX = MM_PLAYER_BUFFERING_MODE_SLINK,
759 }MMPlayerBufferingMode;
760
761 /**
762  * Enumeration of audio channel for video share
763  */
764 typedef enum
765 {
766         MM_PLAYER_AUDIO_CH_MONO_LEFT = 0,
767         MM_PLAYER_AUDIO_CH_MONO_RIGHT,
768         MM_PLAYER_AUDIO_CH_STEREO,
769 } MMPlayerAudioChannel;
770
771 typedef enum
772 {
773         MM_PLAYER_SOUND_RESOURCE_PRELISTENING_RINGTONE = 0,
774         MM_PLAYER_SOUND_RESOURCE_PRELISTENING_NOTIFICATION,
775         MM_PLAYER_SOUND_RESOURCE_PRELISTENING_ALARM,
776         MM_PLAYER_SOUND_RESOURCE_PRELISTENING_MEDIA,
777 } MMPlayerSoundResource;
778
779
780 /**
781  * Edge Properties of the text.
782  */
783 typedef enum {
784         MM_PLAYER_EDGE_NO,
785         MM_PLAYER_EDGE_RAISED,
786         MM_PLAYER_EDGE_DEPRESSED,
787         MM_PLAYER_EDGE_UNIFORM,
788         MM_PLAYER_EDGE_DROPSHADOW
789 } MMPlayerSubtitleEdge;
790
791 /**
792  * Enumeration of media stream buffer status
793  */
794 typedef enum
795 {
796         MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN,
797         MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW,
798 } MMPlayerMediaStreamBufferStatus;
799
800 /**
801  * Enumeration for stream type.
802  */
803 typedef enum
804 {
805         MM_PLAYER_STREAM_TYPE_DEFAULT,  /**< Container type */
806         MM_PLAYER_STREAM_TYPE_AUDIO,    /**< Audio element stream type */
807         MM_PLAYER_STREAM_TYPE_VIDEO,    /**< Video element stream type */
808         MM_PLAYER_STREAM_TYPE_TEXT,     /**< Text type */
809         MM_PLAYER_STREAM_TYPE_MAX,
810 } MMPlayerStreamType;
811
812 /**
813  * Attribute validity structure
814  */
815 typedef struct {
816          MMPlayerAttrsType type;
817          MMPlayerAttrsValidType validity_type;
818          MMPlayerAttrsFlag flag;
819         /**
820           * a union that describes validity of the attribute.
821           * Only when type is 'MM_ATTRS_TYPE_INT' or 'MM_ATTRS_TYPE_DOUBLE',
822           * the attribute can have validity.
823          */
824          union {
825                 /**
826                    * Validity structure for integer array.
827                  */
828                 struct {
829                         int *array;  /**< a pointer of array */
830                         int count;   /**< size of array */
831                         int d_val;
832                 } int_array;
833                 /**
834                    * Validity structure for integer range.
835                  */
836                 struct {
837                         int min;   /**< minimum range */
838                         int max;   /**< maximum range */
839                         int d_val;
840                 } int_range;
841                 /**
842                 * Validity structure for double array.
843                 */
844                 struct {
845                         double   * array;  /**< a pointer of array */
846                         int    count;   /**< size of array */
847                         double d_val;
848                 } double_array;
849                 /**
850                 * Validity structure for double range.
851                 */
852                 struct {
853                         double   min;   /**< minimum range */
854                         double   max;   /**< maximum range */
855                         double d_val;
856                 } double_range;
857         };
858 } MMPlayerAttrsInfo;
859
860 /**
861  * Volume type.
862  *
863  * @see         mm_player_set_volume, mm_player_get_volume
864  */
865 typedef struct {
866         float   level[MM_VOLUME_CHANNEL_NUM];   /**< Relative volume factor for each channels */
867 } MMPlayerVolumeType;
868
869 #ifdef TEST_ES
870 /**
871  * Video stream info in external demux case
872  *
873 **/
874 typedef struct _VideoStreamInfo
875 {
876         const char *mime;
877         unsigned int framerate_num;
878         unsigned int framerate_den;
879         unsigned int width;
880         unsigned int height;
881         unsigned char *codec_extradata;
882         unsigned int extradata_size;
883         unsigned int version;
884 }MMPlayerVideoStreamInfo;
885
886 /**
887  * Audio stream info in external demux case
888  *
889 **/
890 typedef struct _AudioStreamInfo
891 {
892         const char *mime;
893         unsigned int channels;
894         unsigned int sample_rate;
895         unsigned char *codec_extradata;
896         unsigned int extradata_size;
897         unsigned int version;
898         unsigned int user_info;
899
900         /* for pcm */
901 //      unsigned int width;
902 //      unsigned int depth;
903 //      unsigned int endianness;
904 //      bool signedness;
905 }MMPlayerAudioStreamInfo;
906
907 /**
908  * Subtitle stream info in external demux case
909  *
910 **/
911 typedef struct _SubtitleStreamInfo
912 {
913         const char *mime;
914         unsigned int codec_tag;
915         void *context;  //for smpte text
916 }MMPlayerSubtitleStreamInfo;
917
918 #endif
919
920 /**
921  * Audio stream callback function type.
922  *
923  * @param       stream          [in]    Reference pointer to audio frame data
924  * @param       stream_size     [in]    Size of audio frame data
925  * @param       user_param      [in]    User defined parameter which is passed when set
926  *                                                              audio stream callback
927  *
928  * @return      This callback function have to return MM_ERROR_NONE.
929  */
930 typedef bool    (*mm_player_audio_stream_callback) (void *stream, int stream_size, void *user_param);
931
932
933 /**
934  * selected subtitle track number callback function type.
935  *
936  * @param       track_num       [in]    Track number of subtitle
937  * @param       user_param      [in]    User defined parameter
938  *
939  *
940  * @return      This callback function have to return MM_ERROR_NONE.
941  */
942 typedef bool            (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
943
944 /**
945  * Buffer underrun / overflow data callback function type.
946  *
947  * @param       status     [in] buffer status
948  * @param       user_param [in] User defined parameter which is passed when set
949  *                              to enough data callback or need data callback
950  *
951  * @return      This callback function have to return MM_ERROR_NONE.
952  */
953 typedef bool    (*mm_player_media_stream_buffer_status_callback) (MMPlayerStreamType type, MMPlayerMediaStreamBufferStatus status, void *user_param);
954
955 /**
956  * Buffer seek data callback function type.
957  *
958  * @param       offset     [in] offset for the buffer playback
959  * @param       user_param [in] User defined parameter which is passed when set
960  *                              to seek data callback
961  *
962  * @return      This callback function have to return MM_ERROR_NONE.
963  */
964 typedef bool    (*mm_player_media_stream_seek_data_callback) (MMPlayerStreamType type, unsigned long long offset, void *user_param);
965
966 /**
967  * Called to notify the stream changed.
968  *
969  * @param user_data [in] The user data passed from the callback registration function
970  *
971  * @return      This callback function have to return MM_ERROR_NONE.
972  */
973 typedef bool    (*mm_player_stream_changed_callback) (void *user_param);
974
975
976 /*===========================================================================================
977 |                                                                                           |
978 |  GLOBAL FUNCTION PROTOTYPES                                        |
979 |                                                                                           |
980 ========================================================================================== */
981
982 /**
983  * This function creates a player object for playing multimedia contents. \n
984  * The attributes of player are created to get/set some values with application. \n
985  * And, mutex, gstreamer and other resources are initialized at this time. \n
986  * If player is created, the state will become MM_PLAYER_STATE_NULL.
987  *
988  * @param       player          [out]   Handle of player
989  *
990  * @return      This function returns zero on success, or negative value with error code. \n
991  *                      Please refer 'mm_error.h' to know it in detail.
992  * @pre         None
993  * @post        MM_PLAYER_STATE_NULL
994  * @see         mm_player_destroy
995  * @remark      You can create multiple handles on a context at the same time. \n
996  *                      However, player cannot guarantee proper operation because of limitation of resources, \n
997  *                      such as audio device or display device.
998  *
999  * @par Example
1000  * @code
1001 char *g_err_attr_name = NULL;
1002
1003 if (mm_player_create(&g_player) != MM_ERROR_NONE)
1004 {
1005         debug_error("failed to create player\n");
1006 }
1007
1008 if (mm_player_set_attribute(g_player,
1009                                                 &g_err_attr_name,
1010                                                 "profile_uri", filename, strlen(filename),
1011                                                 "display_overlay", (void*)&g_win.xid, sizeof(g_win.xid),
1012                                                 NULL) != MM_ERROR_NONE)
1013 {
1014         debug_error("failed to set %s attribute\n", g_err_attr_name);
1015         free(g_err_attr_name);
1016 }
1017
1018 mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
1019  * @endcode
1020  */
1021 int mm_player_create(MMHandleType *player);
1022
1023 /**
1024  * This function releases player object and all resources which were created by mm_player_create(). \n
1025  * And, player handle will also be destroyed.
1026  *
1027  * @param       player          [in]    Handle of player
1028  *
1029  * @return      This function returns zero on success, or negative value with error code.
1030  * @pre         Player state may be MM_PLAYER_STATE_NULL. \n
1031  *                      But, it can be called in any state.
1032  * @post                Because handle is released, there is no any state.
1033  * @see         mm_player_create
1034  * @remark      This method can be called with a valid player handle from any state to \n
1035  *                      completely shutdown the player operation.
1036  *
1037  * @par Example
1038  * @code
1039 if (mm_player_destroy(g_player) != MM_ERROR_NONE)
1040 {
1041         debug_error("failed to destroy player\n");
1042 }
1043  * @endcode
1044  */
1045 int mm_player_destroy(MMHandleType player);
1046
1047 /**
1048  * This function parses uri and makes gstreamer pipeline by uri scheme. \n
1049  * So, uri should be set before realizing with mm_player_set_attribute(). \n
1050  *
1051  * @param       player          [in]    Handle of player
1052  *
1053  * @return      This function returns zero on success, or negative value with error code.
1054  *
1055  * @pre         Player state should be MM_PLAYER_STATE_NULL.
1056  * @post                Player state will be MM_PLAYER_STATE_READY.
1057  * @see         mm_player_unrealize
1058  * @remark      None
1059  * @par Example
1060  * @code
1061 if (mm_player_realize(g_player) != MM_ERROR_NONE)
1062 {
1063         debug_error("failed to realize player\n");
1064 }
1065  * @endcode
1066  */
1067 int mm_player_realize(MMHandleType player) ;
1068
1069 /**
1070  * This function uninitializes player object. So, resources and allocated memory \n
1071  * will be freed. And, gstreamer pipeline is also destroyed. So, if you want to play \n
1072  * other contents, player should be created again after destruction or realized with new uri.
1073  *
1074  * @param       player          [in]    Handle of player
1075  *
1076  * @return      This function returns zero on success, or negative value with error code.
1077  * @pre         Player state may be MM_PLAYER_STATE_READY to unrealize. \n
1078  *                      But, it can be called in any state.
1079  * @post                Player state will be MM_PLAYER_STATE_NULL.
1080  * @see         mm_player_realize
1081  * @remark      This method can be called with a valid player handle from any state.
1082  *
1083  * @par Example
1084  * @code
1085 if (mm_player_unrealize(g_player) != MM_ERROR_NONE)
1086 {
1087         debug_error("failed to unrealize player\n");
1088 }
1089  * @endcode
1090  */
1091 int mm_player_unrealize(MMHandleType player);
1092
1093 /**
1094  * This function is to get current state of player. \n
1095  * Application have to check current state before doing some action.
1096  *
1097  * @param       player          [in]    Handle of player
1098  * @param       state       [out] current state of player on success
1099  *
1100  * @return      This function returns zero on success, or negative value with error code.
1101  *
1102  * @see         MMPlayerStateType
1103  * @remark      None
1104  * @par Example
1105  * @code
1106 if (mm_player_get_state(g_player, &state) != MM_ERROR_NONE)
1107 {
1108         debug_error("failed to get state\n");
1109 }
1110  * @endcode
1111  */
1112 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state);
1113
1114 /**
1115  * This function is to set relative volume of player. \n
1116  * So, It controls logical volume value. \n
1117  * But, if developer want to change system volume, mm sound api should be used.
1118  *
1119  * @param       player          [in]    Handle of player
1120  * @param       volume          [in]    Volume factor of each channel
1121  *
1122  * @return      This function returns zero on success, or negative value with error code.
1123  * @see         MMPlayerVolumeType, mm_player_get_volume
1124  * @remark      The range of factor range is from 0 to 1.0. (1.0 = 100%) And, default value is 1.0.
1125  * @par Example
1126  * @code
1127 MMPlayerVolumeType volume;
1128 int i = 0;
1129
1130 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
1131         volume.level[i] = MM_VOLUME_LEVEL_MAX;
1132
1133 if (mm_player_set_volume(g_player, &volume) != MM_ERROR_NONE)
1134 {
1135     debug_error("failed to set volume\n");
1136 }
1137  * @endcode
1138  */
1139 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume);
1140
1141 /**
1142  * This function is to get current volume factor of player.
1143  *
1144  * @param       player          [in]    Handle of player.
1145  * @param       volume          [out]   Volume factor of each channel.
1146  *
1147  * @return      This function returns zero on success, or negative value with error code.
1148  *
1149  * @see         MMPlayerVolumeType, mm_player_set_volume
1150  * @remark      None
1151  * @par Example
1152  * @code
1153 MMPlayerVolumeType volume;
1154 int i;
1155
1156 if (mm_player_get_volume(g_player, &volume) != MM_ERROR_NONE)
1157 {
1158         debug_warning("failed to get volume\n");
1159 }
1160
1161 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
1162         debug_log("channel[%d] = %d \n", i, volume.level[i]);
1163  * @endcode
1164  */
1165 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume);
1166
1167 /**
1168  * This function is to start playing media contents. Demux(parser), codec and related plugins are decided \n
1169  * at this time. And, MM_MESSAGE_BEGIN_OF_STREAM will be posted through callback function registered \n
1170  * by mm_player_set_message_callback().
1171  *
1172  * @param       player          [in]    Handle of player
1173  *
1174  * @return      This function returns zero on success, or negative value with error code.
1175  * @remark
1176  *
1177  * @pre         Player state may be MM_PLAYER_STATE_READY.
1178  * @post                Player state will be MM_PLAYER_STATE_PLAYING.
1179  * @see         mm_player_stop
1180  * @remark      None
1181  * @par Example
1182  * @code
1183 if (mm_player_start(g_player) != MM_ERROR_NONE)
1184 {
1185         debug_error("failed to start player\n");
1186 }
1187  * @endcode
1188  */
1189 int mm_player_start(MMHandleType player);
1190
1191 /**
1192  * This function is to stop playing media contents and it's different with pause. \n
1193  * If mm_player_start() is called after this, content will be started again from the beginning. \n
1194  * So, it can be used to close current playback.
1195  *
1196  * @param       player          [in]    Handle of player
1197  *
1198  * @return      This function returns zero on success, or negative value with error code.
1199  *
1200  * @pre         Player state may be MM_PLAYER_STATE_PLAYING.
1201  * @post                Player state will be MM_PLAYER_STATE_READY.
1202  * @see         mm_player_start
1203  * @remark      None
1204  * @par Example
1205  * @code
1206 if (mm_player_stop(g_player) != MM_ERROR_NONE)
1207 {
1208         debug_error("failed to stop player\n");
1209 }
1210  * @endcode
1211  */
1212 int mm_player_stop(MMHandleType player);
1213
1214 /**
1215  * This function is to pause playing media contents.
1216  *
1217  * @param       player          [in]    Handle of player.
1218  *
1219  * @return      This function returns zero on success, or negative value with error code.
1220  *
1221  * @pre         Player state may be MM_PLAYER_STATE_PLAYING.
1222  * @post                Player state will be MM_PLAYER_STATE_PAUSED.
1223  * @see         mm_player_resume
1224  * @remark      None
1225  * @par Example
1226  * @code
1227 if (mm_player_pause(g_player) != MM_ERROR_NONE)
1228 {
1229         debug_error("failed to pause player\n");
1230 }
1231  * @endcode
1232  */
1233 int mm_player_pause(MMHandleType player);
1234
1235 /**
1236  * This function is to resume paused media contents.
1237  *
1238  * @param       player          [in]    Handle of player.
1239  *
1240  * @return      This function returns zero on success, or negative value with error code.
1241  *
1242  * @pre         Player state may be MM_PLAYER_STATE_PAUSED.
1243  * @post                Player state will be MM_PLAYER_STATE_PLAYING.
1244  * @see         mm_player_pause
1245  * @remark      None
1246  * @par Example
1247  * @code
1248 if (mm_player_resume(g_player) != MM_ERROR_NONE)
1249 {
1250         debug_error("failed to resume player\n");
1251 }
1252  * @endcode
1253  */
1254 int mm_player_resume(MMHandleType player);
1255
1256 /**
1257  * This function is to set the position for playback. \n
1258  * So, it can be seeked to requested position. \n
1259  *
1260  * @param       player          [in]    Handle of player
1261  * @param       format          [in]    Format of position.
1262  * @param       pos                     [in]    Position for playback
1263  *
1264  * @return      This function returns zero on success, or negative value with error code.
1265  * @see         MMPlayerPosFormatType, mm_player_get_position
1266  * @remark  the unit of time-based format is millisecond and other case is percent.
1267  * @par Example
1268  * @code
1269 int position = 1000; //1sec
1270
1271 if (mm_player_set_position(g_player, MM_PLAYER_POS_FORMAT_TIME, position) != MM_ERROR_NONE)
1272 {
1273         debug_error("failed to set position\n");
1274 }
1275  * @endcode
1276  */
1277 int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos);
1278
1279 /**
1280  * This function is to get current position of playback content.
1281  *
1282  * @param       player          [in]    Handle of player.
1283  * @param       format          [in]    Format of position.
1284  * @param    pos        [out] contains current position on success or zero in case of failure.
1285  *
1286  * @return      This function returns zero on success, or negative value with errors
1287  * @see         MMPlayerPosFormatType, mm_player_set_position
1288  * @remark      the unit of time-based format is millisecond and other case is percent.
1289  * @par Example
1290  * @code
1291 int position = 0;
1292 int duration = 0;
1293
1294 mm_player_get_position(g_player, MM_PLAYER_POS_FORMAT_TIME, &position);
1295
1296 mm_player_get_attribute(g_player, &g_err_name, "content_duration", &duration, NULL);
1297
1298 debug_log("pos: [%d/%d] msec\n", position, duration);
1299  * @endcode
1300  */
1301 int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, int *pos);
1302
1303 /**
1304  * This function is to get current buffer position of playback content.
1305  *
1306  * @param       player          [in]    Handle of player.
1307  * @param       format          [in]    Format of position.
1308  * @param       start_pos               [out] contains buffer start  position on success or zero in case of failure.
1309  * @param       stop_pos        [out] contains buffer current  position on success or zero in case of failure.
1310  *
1311  * @return      This function returns zero on success, or negative value with errors
1312  * @see         MMPlayerPosFormatType, mm_player_set_position
1313  * @remark      the unit of time-based format is millisecond and other case is percent.
1314  * @par Example
1315  * @code
1316 int start_pos = 0, stop_pos = 0;
1317
1318 mm_player_get_buffer_position(g_player, MM_PLAYER_POS_FORMAT_PERCENT, &start_pos, &stop_pos );
1319
1320 debug_log("buffer position: [%d] ~ [%d] \%\n", start_pos, stop_pos );
1321  * @endcode
1322  */
1323 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, int *start_pos, int *stop_pos);
1324
1325 /**
1326  * This function is to activate the section repeat. If it's set, selected section will be played \n
1327  * continually before deactivating it by mm_player_deactivate_section_repeat(). \n
1328  * The unit for setting is millisecond.
1329  *
1330  * @param       player          [in]    Handle of player.
1331  * @param       start_pos               [in]    start position.
1332  * @param       end_pos                 [in]    end position.
1333  *
1334  * @return      This function returns zero on success, or negative value with error code.
1335  * @see         mm_player_deactivate_section_repeat
1336  * @remark      None
1337  * @par Example
1338  * @code
1339 int position;
1340 int endtime = 4000; //msec
1341
1342 mm_player_get_position(g_player, MM_PLAYER_POS_FORMAT_TIME, &position);
1343
1344 mm_player_activate_section_repeat(g_player, position, position+endtime);
1345  * @endcode
1346  */
1347 int mm_player_activate_section_repeat(MMHandleType player, int start_pos, int end_pos);
1348
1349 /**
1350  * This function is to deactivate the section repeat.
1351  *
1352  * @param       player          [in]    Handle of player.
1353  *
1354  * @return      This function returns zero on success, or negative value with error code.
1355  * @see         mm_player_activate_section_repeat
1356  * @remark      None
1357  * @par Example
1358  * @code
1359 if ( mm_player_deactivate_section_repeat(g_player) != MM_ERROR_NONE)
1360 {
1361         debug_warning("failed to deactivate section repeat\n");
1362 }
1363  * @endcode
1364  */
1365 int mm_player_deactivate_section_repeat(MMHandleType player);
1366
1367 /**
1368  * This function sets callback function for receiving messages from player.
1369  * So, player can notify warning, error and normal cases to application.
1370  *
1371  * @param       player          [in]    Handle of player.
1372  * @param       callback        [in]    Message callback function.
1373  * @param       user_param      [in]    User parameter which is passed to callback function.
1374  *
1375  * @return      This function returns zero on success, or negative value with error code.
1376  * @see         MMMessageCallback
1377  * @remark      None
1378  * @par Example
1379  * @code
1380 int msg_callback(int message, MMMessageParamType *param, void *user_param)
1381 {
1382         switch (message)
1383         {
1384                 case MM_MESSAGE_ERROR:
1385                         //do something
1386                         break;
1387
1388                 case MM_MESSAGE_END_OF_STREAM:
1389                         //do something
1390                         break;
1391
1392                 case MM_MESSAGE_STATE_CHANGED:
1393                         //do something
1394                         break;
1395
1396                 case MM_MESSAGE_BEGIN_OF_STREAM:
1397                         //do something
1398                         break;
1399
1400                 default:
1401                         break;
1402         }
1403         return TRUE;
1404 }
1405
1406 mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
1407  * @endcode
1408  */
1409 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
1410
1411 /**
1412  * This function set callback function for receiving audio stream from player. \n
1413  * So, application can get raw audio data and modify it. \n
1414  * But, if callback don't return or holds it for long time, performance can be deteriorated. \n
1415  * It's only supported when audio stream is included in file. \n
1416  * So, if there is video stream or DRM content, it can't be used.
1417  *
1418  * @param       player          [in]    Handle of player.
1419  * @param       callback                [in]    Audio stream callback function.
1420  * @param       user_param      [in]    User parameter.
1421  *
1422  * @return      This function returns zero on success, or negative value with error
1423  *                      code.
1424  * @see         mm_player_audio_stream_callback
1425  * @remark      It can be used for audio playback only.
1426  * @par Example
1427  * @code
1428 bool audio_callback(void *stream, int stream_size, void *user_param)
1429 {
1430         debug_log("audio stream callback\n");
1431         return TRUE;
1432 }
1433 mm_player_set_audio_stream_callback(g_player, audio_callback, NULL);
1434  * @endcode
1435  */
1436  int mm_player_set_audio_stream_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param);
1437
1438 /**
1439  * This function is to mute volume of player
1440  *
1441  * @param       player  [in]    Handle of player
1442  * @param       mute    [in]    Mute(1) or not mute(0)
1443  *
1444  * @return      This function returns zero on success, or negative value with error code
1445  * @see         mm_player_get_mute
1446  * @remark      None
1447  * @par Example
1448  * @code
1449 if (mm_player_set_mute(g_player, TRUE) != MM_ERROR_NONE)
1450 {
1451         debug_warning("failed to set mute\n");
1452 }
1453  * @endcode
1454  */
1455 int mm_player_set_mute(MMHandleType player, int mute);
1456
1457 /**
1458  * This function is to get mute value of player
1459  *
1460  * @param       player  [in]    Handle of player
1461  * @param       mute    [out]   Sound is muted
1462  *
1463  * @return      This function returns zero on success, or negative value with error code
1464  * @see         mm_player_set_mute
1465  * @remark      None
1466  * @par Example
1467  * @code
1468 int mute;
1469
1470 if (mm_player_get_mute(g_player, &mute) != MM_ERROR_NONE)
1471 {
1472         debug_warning("failed to get mute\n");
1473 }
1474
1475 debug_log("mute status:%d\n", mute);
1476  * @endcode
1477  */
1478 int mm_player_get_mute(MMHandleType player, int *mute);
1479
1480 /**
1481  * This function is to adjust subtitle postion. So, subtitle can show at the adjusted position. \n
1482  * If pos is negative, subtitle will be displayed previous time, the other hand forward time. \n
1483  *
1484  * @param       player  [in]    Handle of player
1485  * @param       pos             [in]    postion to be adjusted
1486  *
1487  * @return      This function returns zero on success, or negative value with error
1488  *                      code
1489  * @see         mm_player_adjust_subtitle_position
1490  * @remark      None
1491  * @par Example
1492  * @code
1493 int pos;
1494
1495 pos = 5000;
1496 if (mm_player_adjust_subtitle_position(g_player, MM_PLAYER_POS_FORMAT_TIME, pos) != MM_ERROR_NONE)
1497 {
1498         debug_warning("failed to adjust subtitle postion.\n");
1499 }
1500  * @endcode
1501  */
1502
1503 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos);
1504
1505 /**
1506  * This function is to set the offset in timestamps of video so as to bring the a/v sync
1507  * @param      player          Handle of player
1508  * @param      offset          offset to be set in milliseconds(can be positive or negative both)
1509  * postive offset to make video lag
1510  * negative offset to make video lead
1511  */
1512 int mm_player_adjust_video_position(MMHandleType player,int offset);
1513 /**
1514  * This function is to set subtitle silent status. So, subtitle can show or hide during playback \n
1515  * by this value. But, one subtitle file should be set with "subtitle_uri" attribute before calling mm_player_realize(); \n
1516  * Player FW parses subtitle file and send text data including timestamp to application \n
1517  * through message callback with MM_MESSAGE_UPDATE_SUBTITLE will be. \n
1518  * So, application have to render it. And, subtitle can be supported only in a seprate file. \n
1519  * So, it's not supported for embedded case.
1520  *
1521  * @param       player  [in]    Handle of player
1522  * @param       silent  [in]    silent(integer value except 0) or not silent(0)
1523  *
1524  * @return      This function returns zero on success, or negative value with error
1525  *                      code
1526  * @see         mm_player_get_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1527  * @remark      None
1528  * @par Example
1529  * @code
1530 mm_player_set_attribute(g_player,
1531                                         &g_err_name,
1532                                         "subtitle_uri", g_subtitle_uri, strlen(g_subtitle_uri),
1533                                         NULL
1534                                         );
1535
1536 if (mm_player_set_subtitle_silent(g_player, TRUE) != MM_ERROR_NONE)
1537 {
1538         debug_warning("failed to set subtitle silent\n");
1539 }
1540  * @endcode
1541  */
1542 int mm_player_set_subtitle_silent(MMHandleType player, int silent);
1543
1544 /**
1545  * This function is to get silent status of subtitle.
1546  *
1547  * @param       player  [in]    Handle of player
1548  * @param       silent  [out]   subtitle silent property
1549  *
1550  * @return      This function returns zero on success, or negative value with error
1551  *                      code
1552  * @see         mm_player_set_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1553  * @remark      None
1554  * @par Example
1555  * @code
1556 int silent = FALSE;
1557
1558 if (mm_player_get_subtitle_silent(g_player, &silent) != MM_ERROR_NONE)
1559 {
1560         debug_warning("failed to set subtitle silent\n");
1561 }
1562  * @endcode
1563  */
1564 int mm_player_get_subtitle_silent(MMHandleType player, int *silent);
1565
1566 /**
1567  * This function is to set attributes into player. Multiple attributes can be set simultaneously. \n
1568  * If one of attribute fails, this function will stop at the point and let you know the name which is failed. \n
1569  *
1570  * @param       player                          [in]    Handle of player.
1571  * @param       err_attr_name                   [out]  Name of attribute which is failed to set
1572  * @param       first_attribute_name    [in]    Name of the first attribute to set
1573  * @param   ...                                 [in]    Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1574  *                                                                       But, in the case of data or string type, it should be name/value/size.
1575  *
1576  * @return      This function returns zero on success, or negative value with error code.
1577  *
1578  * @see         mm_player_get_attribute
1579  * @remark      This function must be terminated by NULL argument.
1580  *                      And, if this function is failed, err_attr_name param must be free.
1581  * @par Example
1582  * @code
1583 char *g_err_attr_name = NULL;
1584
1585 if (mm_player_set_attribute(g_player,
1586                                                 &g_err_attr_name,
1587                                                 "profile_uri", filename, strlen(filename),
1588                                                 "profile_play_count", count,
1589                                                 NULL) != MM_ERROR_NONE)
1590 {
1591         debug_warning("failed to set %s attribute\n", g_err_attr_name);
1592         free(g_err_attr_name);
1593 }
1594
1595  * @endcode
1596  */
1597 int mm_player_set_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1598
1599 /**
1600  * This function is to get attributes from player. Multiple attributes can be got simultaneously.
1601  *
1602  * @param       player                          [in]    Handle of player.
1603  * @param       err_attr_name                   [out]  Name of attribute which is failed to get
1604  * @param       first_attribute_name    [in]    Name of the first attribute to get
1605  * @param       ...                                     [out] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1606  *                                                                       But, in the case of data or string type, it should be name/value/size.
1607  *
1608  * @return      This function returns zero on success, or negative value with error
1609  *                      code.
1610  * @see         mm_player_set_attribute
1611  * @remark      This function must be terminated by NULL argument.
1612  *                      And, if this function is failed, err_attr_name param must be free.
1613  * @par Example
1614  * @code
1615 char *g_err_attr_name = NULL;
1616
1617 if (mm_player_get_attribute(g_player, &g_err_attr_name, "content_duration", &duration, NULL) != MM_ERROR_NONE)
1618 {
1619         debug_warning("failed to set %s attribute\n", g_err_attr_name);
1620         free(g_err_attr_name);
1621 }
1622  * @endcode
1623  */
1624 int mm_player_get_attribute(MMHandleType player,  char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1625
1626 /**
1627  * This function is to get detail information of attribute.
1628  *
1629  * @param       player                           [in]   Handle of player.
1630  * @param   attribute_name               [in]   Name of the attribute to get
1631  * @param   info                                 [out]  Attribute infomation
1632  *
1633  * @return      This function returns zero on success, or negative value with error
1634  *                      code.
1635  *
1636  * @see         mm_player_set_attribute, mm_player_get_attribute
1637  * @remark      None
1638  * @par Example
1639  * @code
1640 if (mm_player_get_attribute_info (g_player, "display_method", &method_info) != MM_ERROR_NONE)
1641 {
1642         debug_warning("failed to get info\n");
1643 }
1644
1645 debug_log("type:%d \n", method_info.type); //int, double..
1646 debug_log("flag:%d \n", method_info.flag); //readable, writable..
1647 debug_log("validity type:%d \n", method_info.validity_type); //range, array..
1648
1649 if (method_info. validity_type == MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE)
1650 {
1651         debug_log("range min:%d\n", method_info.int_range.min);
1652         debug_log("range max:%d\n", method_info.int_range.max);
1653 }
1654  * @endcode
1655  */
1656 int mm_player_get_attribute_info(MMHandleType player,  const char *attribute_name, MMPlayerAttrsInfo *info);
1657
1658 /**
1659  * This function is to get download position and total size of progressive download
1660  *
1661  * @param       player          [in]    Handle of player.
1662  * @param       current_pos     [in]    Download position currently (bytes)
1663  * @param       total_size      [in]    Total size of file (bytes)
1664  *
1665  * @return      This function returns zero on success, or negative value with error code.
1666  *
1667  * @see
1668  * @remark
1669  * @par Example
1670  * @code
1671 guint64 current_pos = 0LLU;
1672 guint64 total_size = 0LLU;
1673
1674 if (mm_player_get_pd_status(g_player, &current_pos, &total_size, NULL) != MM_ERROR_NONE)
1675 {
1676         debug_log("current download pos = %llu, total size = %llu\n", current_pos, total_size);
1677 }
1678  * @endcode
1679  */
1680 int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size);
1681
1682 /**
1683  * This function sets callback function for receiving messages of PD downloader.
1684  *
1685  * @param       player          [in]    Handle of player.
1686  * @param       callback                [in]    Message callback function.
1687  * @param       user_param      [in]    User parameter which is passed to callback function.
1688  *
1689  * @return      This function returns zero on success, or negative value with error code.
1690  * @see
1691  * @remark      None
1692  * @par Example
1693  * @code
1694 int msg_callback(int message, MMMessageParamType *param, void *user_param)
1695 {
1696         switch (message)
1697         {
1698                 case MM_MESSAGE_PD_DOWNLOADER_START:
1699                         debug_log("Progressive download is started...\n");
1700                         break;
1701                 case MM_MESSAGE_PD_DOWNLOADER_END:
1702                         debug_log("Progressive download is ended...\n");
1703                         break;
1704                 default:
1705                         break;
1706         }
1707         return TRUE;
1708 }
1709
1710 mm_player_set_pd_message_callback(g_player, msg_callback, NULL);
1711  * @endcode
1712  */
1713 int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
1714
1715 /**
1716  * This function is to get the track count
1717  *
1718  * @param       player          [in]    handle of player.
1719  * @param       track                   [in]    type of the track type
1720  * @param       info                    [out]   the count of the track
1721  *
1722  * @return      This function returns zero on success, or negative value with error
1723  *                      code.
1724  *
1725  * @see
1726  * @remark      None
1727  * @par Example
1728  * @code
1729 gint audio_count = 0;
1730
1731 if (mm_player_get_track_count (g_player, MM_PLAYER_TRACK_TYPE_AUDIO, &audio_count) != MM_ERROR_NONE)
1732 {
1733         debug_warning("failed to get audio track count\n");
1734 }
1735
1736 debug_log("audio track count : %d \n", audio_count);
1737  * @endcode
1738  */
1739 int mm_player_get_track_count(MMHandleType player,  MMPlayerTrackType type, int *count);
1740
1741 /**
1742  * This function is to select the track
1743  *
1744  * @param       player          [in]    handle of player.
1745  * @param       type                    [in]    type of the track type
1746  * @param       index           [in]    the index of the track
1747  *
1748  * @return      This function returns zero on success, or negative value with error
1749  *                      code.
1750  *
1751  * @see
1752  * @remark      None
1753  */
1754 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index);
1755 #ifdef _MULTI_TRACK
1756 /**
1757  * This function is to add the track when user want multi subtitle
1758  *
1759  * @param       player          [in]    handle of player.
1760  * @param       index           [in]    the index of the track
1761  *
1762  * @return      This function returns zero on success, or negative value with error
1763  *                      code.
1764  *
1765  * @see
1766  * @remark      None
1767  */
1768 int mm_player_track_add_subtitle_language(MMHandleType player, int index);
1769
1770 /**
1771  * This function is to remove the track when user want multi subtitle
1772  *
1773  * @param       player          [in]    handle of player.
1774  * @param       index           [in]    the index of the track
1775  *
1776  * @return      This function returns zero on success, or negative value with error
1777  *                      code.
1778  *
1779  * @see
1780  * @remark      None
1781  */
1782 int mm_player_track_remove_subtitle_language(MMHandleType player, int index);
1783
1784 /**
1785  * This function is to notify which sutitle track is in use
1786  *
1787  * @param       player          [in]    handle of player.
1788  * @param       callback                        [in]    callback function to register
1789  * @param       user_data       [in]    user data to be passed to the callback function
1790  *
1791  * @return      This function returns zero on success, or negative value with error
1792  *                      code.
1793  *
1794  * @see
1795  * @remark      None
1796  */
1797 int mm_player_track_foreach_selected_subtitle_language(MMHandleType player, mm_player_track_selected_subtitle_language_callback callback, void *user_param);
1798 #endif
1799 /**
1800  * This function is to get the track language
1801  *
1802  * @param       player          [in]    handle of player.
1803  * @param       type                    [in]    type of the track type
1804  * @param       index           [in]    the index of the track
1805  * @param       code                    [out] language code in ISO 639-1(string)
1806  *
1807  * @return      This function returns zero on success, or negative value with error
1808  *                      code.
1809  *
1810  * @see
1811  * @remark      None
1812  */
1813 int mm_player_get_track_language_code(MMHandleType player,  MMPlayerTrackType type, int index, char **code);
1814
1815 /**
1816  * This function is to get the current running track
1817  *
1818  * @param       player          [in]    handle of player.
1819  * @param       type                    [in]    type of the track type
1820  * @param       index           [out]    the index of the track
1821  *
1822  * @return      This function returns zero on success, or negative value with error
1823  *                      code.
1824  *
1825  * @see
1826  * @remark      None
1827  */
1828
1829 int mm_player_get_current_track(MMHandleType hplayer, MMPlayerTrackType type, int *index);
1830
1831 /**
1832  * This function is to set the buffer size for streaming playback. \n
1833  *
1834  * @param       player          [in]    Handle of player
1835  * @param       second          [in]    Size of initial buffer
1836  *
1837  * @return      This function returns zero on success, or negative value with error code.
1838  * @remark  None
1839  * @par Example
1840  * @code
1841 gint second = 10; //10sec
1842
1843 if (mm_player_set_prepare_buffering_time(g_player, second) != MM_ERROR_NONE)
1844 {
1845         debug_error("failed to set buffer size\n");
1846 }
1847  * @endcode
1848  */
1849
1850 int mm_player_set_prepare_buffering_time(MMHandleType player, int second);
1851
1852 /**
1853  * This function is to set the runtime buffering mode for streaming playback. \n
1854  *
1855  * @param       player          [in]    Handle of player
1856  * @param       mode            [in]    mode of runtime buffering
1857  * @param       second          [in]    max size of buffering
1858  *
1859  * @return      This function returns zero on success, or negative value with error code.
1860  * @remark  None
1861  * @par Example
1862  * @code
1863
1864 if (mm_player_set_runtime_buffering_mode(g_player, MM_PLAYER_BUFFERING_MODE_ADAPTIVE, 10) != MM_ERROR_NONE)
1865 {
1866         debug_error("failed to set buffering mode\n");
1867 }
1868  * @endcode
1869  */
1870
1871 int mm_player_set_runtime_buffering_mode(MMHandleType player, MMPlayerBufferingMode mode, int second);
1872
1873 /**
1874  * This function is to set the start position of zoom
1875  *
1876  * @param       player          [in]    handle of player
1877  * @param       level           [in]    level of zoom
1878  * @param       x               [in]    start x position
1879  * @param       y               [in]    start y position
1880  *
1881  * @return      This function returns zero on success, or negative value with error
1882  *                      code.
1883  *
1884  * @see
1885  * @remark      None
1886  */
1887 int mm_player_set_display_zoom(MMHandleType player, float level, int x, int y);
1888
1889 /**
1890  * This function is to get the start position of zoom
1891  *
1892  * @param       player           [in]    handle of player
1893  * @param       type            [out]    current level of zoom
1894  * @param       x               [out]    start x position
1895  * @param       y               [out]    start y position
1896  *
1897  * @return      This function returns zero on success, or negative value with error
1898  *                      code.
1899  *
1900  * @see
1901  * @remark      None
1902  */
1903 int mm_player_get_display_zoom(MMHandleType player, float *level, int *x, int *y);
1904
1905 /**
1906  * This function is to set the subtitle path
1907  *
1908  * @param       player  [in]    handle of player
1909  * @param       path    [in]    subtitle path
1910  *
1911  * @return      This function returns zero on success, or negative value with error code.
1912  *
1913  * @see
1914  * @remark      None
1915  */
1916 int mm_player_set_external_subtitle_path(MMHandleType player, const char* path);
1917
1918 /**
1919  * This function is to change clock provider to system clock
1920  *
1921  * @param       player  [in]    handle of player
1922  * @return      This function returns zero on success, or negative value with error code.
1923  *
1924  * @see
1925  * @remark      None
1926  */
1927 int mm_player_use_system_clock(MMHandleType player);
1928
1929 /**
1930  * This function is to set the clock which is from master player
1931  *
1932  * @param       player  [in]    handle of player
1933  * @param       clock   [in]    clock of master player
1934  * @param       clock_delta [in]        clock difference between master and slave
1935  * @param       video_time      [in]    current playing position
1936  * @param       media_clock     [in]    media clock information
1937  * @param       audio_time      [in]    audio timestamp information
1938  * @return      This function returns zero on success, or negative value with error code.
1939  *
1940  * @see
1941  * @remark      None
1942  */
1943 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);
1944 /**
1945  * This function is to get the master clock
1946  *
1947  * @param       player          [in]    handle of player
1948  * @param       video_time      [out]   current playing position
1949  * @param       media_clock     [out]   media clock information
1950  * @param       audio_time      [out]   audio timestamp information
1951  * @return      This function returns zero on success, or negative value with error code.
1952  *
1953  * @see
1954  * @remark      None
1955  */
1956 int mm_player_get_video_share_master_clock(MMHandleType player, long long *video_time, long long *media_clock, long long *audio_time);
1957 /**
1958  * This function is to set audio channel
1959  *
1960  * @param       player          [in]    handle of player
1961  * @param       ch                      [in]    audio channel
1962  * @return      This function returns zero on success, or negative value with error code.
1963  *
1964  * @see
1965  * @remark      None
1966  */
1967 int mm_player_gst_set_audio_channel(MMHandleType player, MMPlayerAudioChannel ch);
1968
1969 /**
1970  * This function is to get the content angle
1971  *
1972  * @param       player          [in]    handle of player
1973  * @param       angle           [out]   orignal angle from content
1974  * @return      This function returns zero on success, or negative value with error code.
1975  *
1976  * @see
1977  * @remark      None
1978  */
1979 int mm_player_get_video_rotate_angle(MMHandleType player, int *angle);
1980
1981 /**
1982  * This function is to set download mode of video hub
1983  *
1984  * @param       player          [in]    handle of player
1985  * @param       mode            [in]    download mode
1986  * @return      This function returns zero on success, or negative value with error code.
1987  *
1988  * @see
1989  * @remark      None
1990  */
1991 int mm_player_set_video_hub_download_mode(MMHandleType player, bool mode);
1992
1993 /**
1994  * This function is to set using sync handler.
1995  *
1996  * @param       player          [in]    handle of player
1997  * @param       enable          [in]    enable/disable
1998  * @return      This function returns zero on success, or negative value with error code.
1999  *
2000  * @see
2001  * @remark      None
2002  */
2003 int mm_player_enable_sync_handler(MMHandleType player, bool enable);
2004
2005 /**
2006  * This function is to set uri.
2007  *
2008  * @param       player          [in]    handle of player
2009  * @param       uri             [in]    uri
2010  * @return      This function returns zero on success, or negative value with error code.
2011  *
2012  * @see
2013  * @remark      None
2014  */
2015 int mm_player_set_uri(MMHandleType player, const char *uri);
2016
2017 /**
2018  * This function is to set next uri.
2019  *
2020  * @param       player          [in]    handle of player
2021  * @param       uri             [in]    uri
2022  * @return      This function returns zero on success, or negative value with error code.
2023  *
2024  * @see
2025  * @remark      None
2026  */
2027 int mm_player_set_next_uri(MMHandleType player, const char *uri);
2028
2029 /**
2030  * This function is to get next uri.
2031  *
2032  * @param       player          [in]    handle of player
2033  * @param       uri             [out]   uri
2034  * @return      This function returns zero on success, or negative value with error code.
2035  *
2036  * @see
2037  * @remark      None
2038  */
2039 int mm_player_get_next_uri(MMHandleType player, char **uri);
2040
2041 int mm_player_enable_media_packet_video_stream(MMHandleType player, bool enable);
2042
2043 /**
2044  * This function is to increase reference count of internal buffer.
2045  *
2046  * @param       buffer          [in]   video callback internal buffer
2047  * @return      This function returns buffer point;
2048  *
2049  * @see
2050  * @remark      None
2051  */
2052 void * mm_player_media_packet_video_stream_internal_buffer_ref(void *buffer);
2053
2054 /**
2055  * This function is to decrease reference count of internal buffer.
2056  *
2057  * @param       buffer          [in]   video callback internal buffer
2058  * @return      None;
2059  *
2060  * @see
2061  * @remark      None
2062  */
2063 void mm_player_media_packet_video_stream_internal_buffer_unref(void *buffer);
2064
2065 #ifdef TEST_ES
2066
2067 /**mm_player_submit_packet
2068  * This function is to submit buffer to appsrc.  \n
2069  * @param       player                  [in]    Handle of player.
2070  * @param       buf             [in]    buffer to be submit in appsrc in external feeder case.
2071  * @param       len                             [in]    length of buffer.
2072  * @param       pts                             [in]    timestamp of buffer.
2073  * @param       streamtype              [in]    stream type of buffer.
2074  * @return      This function returns zero on success, or negative value with error code.
2075  * @par Example
2076  *
2077  * @endcode
2078  */
2079 int mm_player_submit_packet(MMHandleType player, media_packet_h packet);
2080
2081 /**mm_player_set_video_info
2082  * This function is to set caps of src pad of video appsrc in external feeder case.  \n
2083  * @param       player                          [in]    Handle of player.
2084  * @param       media_format_h                  [in]    Video stream info.
2085  * @return      This function returns zero on success, or negative value with error code.
2086  * @par Example
2087  *
2088  * @endcode
2089  */
2090
2091 int mm_player_set_video_info (MMHandleType player, media_format_h format);
2092
2093 /**mm_player_set_audio_info
2094  * This function is to set caps of src pad of Audio appsrc in external feeder case.  \n
2095  * @param       player                       [in]    Handle of player.
2096  * @param       media_format_h               [in]    Audio stream info.
2097  * @return      This function returns zero on success, or negative value with error code.
2098  * @par Example
2099  *
2100  * @endcode
2101  */
2102
2103 int mm_player_set_audio_info (MMHandleType player, media_format_h format);
2104
2105 /**mm_player_set_subtitle_info
2106  * This function is to set caps of src pad of subtitle appsrc in external feeder case.  \n
2107  * @param       player                          [in]    Handle of player.
2108  * @param       subtitle_stream_info               [in]    Subtitle stream info.
2109  * @return      This function returns zero on success, or negative value with error code.
2110  * @par Example
2111  *
2112  * @endcode
2113  */
2114
2115 int mm_player_set_subtitle_info (MMHandleType player, MMPlayerSubtitleStreamInfo *info);
2116
2117 /**
2118  * This function set callback function for receiving need or enough data message from player.
2119  *
2120  * @param       player          [in]    Handle of player.
2121  * @param       type            [in]    stream type
2122  * @param       callback        [in]    data callback function for stream type.
2123  * @param       user_param      [in]    User parameter.
2124  *
2125  * @return      This function returns zero on success, or negative value with error
2126  *                      code.
2127  * @remark
2128  * @see
2129  * @since
2130  */
2131 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param);
2132
2133 /**
2134  * This function set callback function for receiving seek data message from player.
2135  *
2136  * @param       player          [in]    Handle of player.
2137  * @param       type            [in]    stream type
2138  * @param       callback        [in]    Seek data callback function for stream type.
2139  * @param       user_param      [in]    User parameter.
2140  *
2141  * @return      This function returns zero on success, or negative value with error
2142  *                      code.
2143  * @remark
2144  * @see
2145  * @since
2146  */
2147 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param);
2148
2149 /**
2150  * This function is to set max size of buffer(appsrc).
2151  *
2152  * @param       player          [in]    Handle of player.
2153  * @param       type            [in]    stream type
2154  * @param       max_size        [in]    max bytes of buffer.
2155  *
2156  * @return      This function returns zero on success, or negative value with error
2157  *                      code.
2158  * @remark
2159  * @see
2160  * @since
2161  */
2162 int mm_player_set_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long max_size);
2163
2164 /**
2165  * This function is to get max size of buffer(appsrc).
2166  *
2167  * @param       player          [in]    Handle of player.
2168  * @param       type            [in]    stream type
2169  * @param       max_size        [out]   max bytes of buffer.
2170  *
2171  * @return      This function returns zero on success, or negative value with error
2172  *                      code.
2173  * @remark
2174  * @see
2175  * @since
2176  */
2177 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long *max_size);
2178
2179 /**
2180  * This function is to set min percent of buffer(appsrc).
2181  *
2182  * @param       player          [in]    Handle of player.
2183  * @param       type            [in]    stream type
2184  * @param       min_percent     [in]    min percent of buffer.
2185  *
2186  * @return      This function returns zero on success, or negative value with error
2187  *                      code.
2188  * @remark
2189  * @see
2190  * @since
2191  */
2192 int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned min_percent);
2193
2194 /**
2195  * This function is to get min percent of buffer(appsrc).
2196  *
2197  * @param       player          [in]    Handle of player.
2198  * @param       type            [in]    stream type
2199  * @param       min_percent     [out]   min percent of buffer.
2200  *
2201  * @return      This function returns zero on success, or negative value with error
2202  *                      code.
2203  * @remark
2204  * @see
2205  * @since
2206  */
2207 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned int *min_percent);
2208
2209 /**
2210  * This function set callback function for changing audio stream from player. \n
2211  * It's only supported when audio stream is included in file. \n
2212  *
2213  * @param       player   [in] Handle of player.
2214  * @param       callback [in] Audio stream changed callback function.
2215  * @param       user_param [in] User parameter.
2216  *
2217  * @return      This function returns zero on success, or negative value with error
2218  *                      code.
2219  * @see         mm_player_stream_changed_callback
2220  * @since
2221  */
2222 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
2223
2224 /**
2225  * This function set callback function for changing video stream from player. \n
2226  * It's only supported when video stream is included in file. \n
2227  *
2228  * @param       player   [in] Handle of player.
2229  * @param       callback [in] Video stream changed callback function.
2230  * @param       user_param [in] User parameter.
2231  *
2232  * @return      This function returns zero on success, or negative value with error
2233  *                      code.
2234  * @see         mm_player_stream_changed_callback
2235  * @since
2236  */
2237 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
2238
2239 #endif
2240
2241 /**
2242         @}
2243  */
2244
2245 #ifdef __cplusplus
2246         }
2247 #endif
2248
2249 #endif  /* __MM_PLAYER_H__ */