4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
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>
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 #ifndef __MM_PLAYER_H__
24 #define __MM_PLAYER_H__
27 /*===========================================================================================
31 ========================================================================================== */
36 #include <mm_message.h>
37 #include <media_packet.h>
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.
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.
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.
64 Player can have 5 states, and each state can be changed by calling
65 described functions on "Figure1. State of Player".
68 @image html player_state.jpg "Figure1. State of Player" width=12cm
69 @image latex player_state.jpg "Figure1. State of Player" width=12cm
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.
78 Note that "None" and Null" state could be reached from any state
79 by calling mm_player_destroy() and mm_player_unrealize().
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>
90 <td>mm_player_create()</td>
96 <td>mm_player_destroy()</td>
102 <td>mm_player_realize()</td>
108 <td>mm_player_unrealize()</td>
114 <td>mm_player_start()</td>
120 <td>mm_player_stop()</td>
126 <td>mm_player_pause()</td>
132 <td>mm_player_resume()</td>
138 <td>mm_player_set_message_callback()</td>
144 <td>mm_player_get_state()</td>
150 <td>mm_player_set_volume()</td>
156 <td>mm_player_get_volume()</td>
162 <td>mm_player_set_position()</td>
168 <td>mm_player_get_position()</td>
174 <td>mm_player_get_attribute()</td>
180 <td>mm_player_set_attribute()</td>
188 Following are the attributes supported in player which may be set after initialization. \n
189 Those are handled as a string.
199 <td>"profile_uri"</td>
204 <td>"content_duration"</td>
209 <td>"content_video_width"</td>
214 <td>"content_video_height"</td>
219 <td>"display_evas_do_scaling"</td>
224 <td>"display_evas_surface_sink"</td>
229 <td>"profile_user_param"</td>
234 <td>"profile_play_count"</td>
239 <td>"streaming_type"</td>
244 <td>"streaming_udp_timeout"</td>
249 <td>"streaming_user_agent"</td>
254 <td>"streaming_wap_profile"</td>
259 <td>"streaming_network_bandwidth"</td>
264 <td>"streaming_cookie"</td>
269 <td>"streaming_proxy_ip"</td>
274 <td>"streaming_proxy_port"</td>
279 <td>"streaming_timeout"</td>
284 <td>"display_overlay"</td>
289 <td>"display_rotation"</td>
294 <td>"subtitle_uri"</td>
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.
312 <td>"content_video_found"</td>
317 <td>"content_video_codec"</td>
322 <td>"content_video_track_num"</td>
327 <td>"content_audio_found"</td>
332 <td>"content_audio_codec"</td>
337 <td>"content_audio_bitrate"</td>
342 <td>"content_audio_channels"</td>
347 <td>"content_audio_samplerate"</td>
352 <td>"content_audio_track_num"</td>
357 <td>"content_text_track_num"</td>
362 <td>"tag_artist"</td>
382 <td>"tag_author"</td>
387 <td>"tag_copyright"</td>
397 <td>"tag_description"</td>
402 <td>"tag_track_num"</td>
411 /*===========================================================================================
413 | GLOBAL DEFINITIONS AND DECLARATIONS |
415 ========================================================================================== */
420 * uri to play (string)
423 #define MM_PLAYER_CONTENT_URI "profile_uri"
425 * MM_PLAYER_CONTENT_DURATION:
427 * get the duration (int) as millisecond, It's guaranteed after calling mm_player_start() or
428 * receiving MM_MESSAGE_BEGIN_OF_STREAM.
431 #define MM_PLAYER_CONTENT_DURATION "content_duration"
433 * MM_PLAYER_VIDEO_ROTATION
435 * can change video angle (int)
436 * @see MMDisplayRotationType
438 #define MM_PLAYER_VIDEO_ROTATION "display_rotation"
440 * MM_PLAYER_VIDEO_WIDTH:
442 * get the video width (int), It's guaranteed after calling mm_player_start() or
443 * receiving MM_MESSAGE_BEGIN_OF_STREAM.
446 #define MM_PLAYER_VIDEO_WIDTH "content_video_width"
448 * MM_PLAYER_VIDEO_HEIGHT:
450 * get the video height (int), It's guaranteed after calling mm_player_start() or
451 * receiving MM_MESSAGE_BEGIN_OF_STREAM.
454 #define MM_PLAYER_VIDEO_HEIGHT "content_video_height"
456 * MM_PLAYER_VIDEO_EVAS_SURFACE_DO_SCALING:
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.
463 #define MM_PLAYER_VIDEO_EVAS_SURFACE_DO_SCALING "display_evas_do_scaling"
465 * MM_PLAYER_VIDEO_EVAS_SURFACE_SINK:
467 * get the video evas surface sink plugin name (string), It's guaranteed after calling mm_player_create()
470 #define MM_PLAYER_VIDEO_EVAS_SURFACE_SINK "display_evas_surface_sink"
474 * set memory pointer to play (data)
477 #define MM_PLAYER_MEMORY_SRC "profile_user_param"
479 * MM_PLAYER_PLAYBACK_COUNT
481 * can set playback count (int), Default value is 1 and -1 is for infinity playing until releasing it.
484 #define MM_PLAYER_PLAYBACK_COUNT "profile_play_count"
486 * MM_PLAYER_SUBTITLE_URI
488 * set the subtitle path (string)
490 #define MM_PLAYER_SUBTITLE_URI "subtitle_uri"
492 * MM_PLAYER_STREAMING_TYPE
494 * set the streaming type (int)
495 * @see MMStreamingType
497 #define MM_PLAYER_STREAMING_TYPE "streaming_type"
499 * MM_PLAYER_STREAMING_UDP_TIMEOUT
501 * set the streaming udp timeout(int)
503 #define MM_PLAYER_STREAMING_UDP_TIMEOUT "streaming_udp_timeout"
505 * MM_PLAYER_STREAMING_USER_AGENT
507 * set the streaming user agent (string)
509 #define MM_PLAYER_STREAMING_USER_AGENT "streaming_user_agent"
511 * MM_PLAYER_STREAMING_WAP_PROFILE
513 * set the streaming wap profile (int)
515 #define MM_PLAYER_STREAMING_WAP_PROFILE "streaming_wap_profile"
517 * MM_PLAYER_STREAMING_NET_BANDWIDTH
519 * set the streaming network bandwidth (int)
521 #define MM_PLAYER_STREAMING_NET_BANDWIDTH "streaming_network_bandwidth"
523 * MM_PLAYER_STREAMING_COOKIE
525 * set the streaming cookie (int)
527 #define MM_PLAYER_STREAMING_COOKIE "streaming_cookie"
529 * MM_PLAYER_STREAMING_PROXY_IP
531 * set the streaming proxy ip (string)
533 #define MM_PLAYER_STREAMING_PROXY_IP "streaming_proxy_ip"
535 * MM_PLAYER_STREAMING_PROXY_PORT
537 * set the streaming proxy port (int)
539 #define MM_PLAYER_STREAMING_PROXY_PORT "streaming_proxy_port"
541 * MM_PLAYER_STREAMING_TIMEOUT
543 * set the streaming timeout (int)
545 #define MM_PLAYER_STREAMING_TIMEOUT "streaming_timeout"
547 * MM_PLAYER_VIDEO_CODEC
549 * codec the video data is stored in (string)
551 #define MM_PLAYER_VIDEO_CODEC "content_video_codec"
553 * MM_PLAYER_VIDEO_TRACK_NUM
555 * track number inside a collection (int)
557 #define MM_PLAYER_VIDEO_TRACK_NUM "content_video_track_num"
559 * MM_PLAYER_AUDIO_CODEC
561 * codec the audio data is stored in (string)
563 #define MM_PLAYER_AUDIO_CODEC "content_audio_codec"
565 * MM_PLAYER_AUDIO_BITRATE
567 * set the streaming proxy port (int)
569 #define MM_PLAYER_AUDIO_BITRATE "content_audio_bitrate"
571 * MM_PLAYER_AUDIO_CHANNEL
573 * the number of audio channel (int)
575 #define MM_PLAYER_AUDIO_CHANNEL "content_audio_channels"
577 * MM_PLAYER_AUDIO_SAMPLERATE
579 * audio samplerate (int)
581 #define MM_PLAYER_AUDIO_SAMPLERATE "content_audio_samplerate"
583 * MM_PLAYER_AUDIO_TRACK_NUM
585 * track number inside a collection (int)
587 #define MM_PLAYER_AUDIO_TRACK_NUM "content_audio_track_num"
589 * MM_PLAYER_TEXT_TRACK_NUM
591 * track number inside a collection (int)
593 #define MM_PLAYER_TEXT_TRACK_NUM "content_text_track_num"
595 * MM_PLAYER_TAG_ARTIST
597 * person(s) responsible for the recording (string)
599 #define MM_PLAYER_TAG_ARTIST "tag_artist"
601 * MM_PLAYER_TAG_ARTIST
605 #define MM_PLAYER_TAG_TITLE "tag_title"
607 * MM_PLAYER_TAG_ARTIST
609 * album containing this data (string)
611 #define MM_PLAYER_TAG_ALBUM "tag_album"
613 * MM_PLAYER_TAG_ARTIST
615 * genre this data belongs to (string)
617 #define MM_PLAYER_TAG_GENRE "tag_genre"
619 * MM_PLAYER_TAG_ARTIST
623 #define MM_PLAYER_TAG_AUTHOUR "tag_author"
625 * MM_PLAYER_TAG_ARTIST
627 * copyright notice of the data (string)
629 #define MM_PLAYER_TAG_COPYRIGHT "tag_copyright"
631 * MM_PLAYER_TAG_ARTIST
633 * date the data was created (string)
635 #define MM_PLAYER_TAG_DATE "tag_date"
637 * MM_PLAYER_TAG_ARTIST
639 * short text describing the content of the data (string)
641 #define MM_PLAYER_TAG_DESCRIPRION "tag_description"
643 * MM_PLAYER_TAG_ARTIST
645 * track number inside a collection (int)
647 #define MM_PLAYER_TAG_TRACK_NUM "tag_track_num"
651 * progressive download mode (int)
653 #define MM_PLAYER_PD_MODE "pd_mode"
658 * dynamic resolution change mode (int)
660 #define MM_PLAYER_DRC_MODE "drc_mode"
663 * MM_PLAYER_GAPLESS_MODE
665 * gapless playback mode (int)
667 #define MM_PLAYER_GAPLESS_MODE "gapless_mode"
670 * MM_PLAYER_ENABLE_VIDEO_DECODED_CB
672 * enable video decoded callback (int)
674 #define MM_PLAYER_ENABLE_VIDEO_DECODED_CB "enable_video_decoded_cb"
677 * MM_PLAYER_VIDEO_CODEC_TYPE
679 * video codec type (int)
681 #define MM_PLAYER_VIDEO_CODEC_TYPE "video_codec_type"
684 * MM_PLAYER_AUDIO_CODEC_TYPE
686 * audio codec type (int)
688 #define MM_PLAYER_AUDIO_CODEC_TYPE "audio_codec_type"
690 #define BUFFER_MAX_PLANE_NUM (4)
693 MMPixelFormatType format; /**< image format */
694 int width; /**< width of video buffer */
695 int height; /**< height of video buffer */
696 unsigned int timestamp; /**< timestamp of stream buffer (msec)*/
697 unsigned int length_total; /**< total length of stream buffer (in byte)*/
698 void *data[BUFFER_MAX_PLANE_NUM];
699 void *bo[BUFFER_MAX_PLANE_NUM]; /**< TBM buffer object */
700 void *internal_buffer; /**< Internal buffer pointer */
701 int stride[BUFFER_MAX_PLANE_NUM]; /**< stride of plane */
702 int elevation[BUFFER_MAX_PLANE_NUM]; /**< elevation of plane */
703 } MMPlayerVideoStreamDataType;
706 * Enumerations of player state.
709 MM_PLAYER_STATE_NULL, /**< Player is created, but not realized yet */
710 MM_PLAYER_STATE_READY, /**< Player is ready to play media */
711 MM_PLAYER_STATE_PLAYING, /**< Player is now playing media */
712 MM_PLAYER_STATE_PAUSED, /**< Player is paused while playing media */
713 MM_PLAYER_STATE_NONE, /**< Player is not created yet */
714 MM_PLAYER_STATE_NUM, /**< Number of player states */
718 * Enumerations of position formats.
719 * Used while invoking mm_player_get_position/mm_player_set_position APIs
722 MM_PLAYER_POS_FORMAT_TIME, /**< Format for time based */
723 MM_PLAYER_POS_FORMAT_PERCENT, /**< Format for percentage */
724 MM_PLAYER_POS_FORMAT_NUM, /**< Number of position formats */
725 } MMPlayerPosFormatType;
728 * Enumeration for attribute values types.
731 MM_PLAYER_ATTRS_TYPE_INVALID = -1, /**< Type is invalid */
732 MM_PLAYER_ATTRS_TYPE_INT, /**< Integer type */
733 MM_PLAYER_ATTRS_TYPE_DOUBLE, /**< Double type */
734 MM_PLAYER_ATTRS_TYPE_STRING, /**< UTF-8 String type */
735 MM_PLAYER_ATTRS_TYPE_DATA, /**< Pointer type */
736 MM_PLAYER_ATTRS_TYPE_ARRAY, /**< Array type */
737 MM_PLAYER_ATTRS_TYPE_RANGE, /**< Range type */
738 MM_PLAYER_ATTRS_TYPE_NUM, /**< Number of attribute type */
742 * Enumeration for attribute validation type.
745 MM_PLAYER_ATTRS_VALID_TYPE_INVALID = -1, /**< Invalid validation type */
746 MM_PLAYER_ATTRS_VALID_TYPE_NONE, /**< Do not check validity */
747 MM_PLAYER_ATTRS_VALID_TYPE_INT_ARRAY, /**< validity checking type of integer array */
748 MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE, /**< validity checking type of integer range */
749 MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_ARRAY, /**< validity checking type of double array */
750 MM_PLAYER_ATTRS_VALID_TYPE_DOUBLE_RANGE, /**< validity checking type of double range */
751 } MMPlayerAttrsValidType;
754 * Enumeration for attribute access flag.
757 MM_PLAYER_ATTRS_FLAG_NONE = 0, /**< None flag is set */
758 MM_PLAYER_ATTRS_FLAG_READABLE = 1 << 0, /**< Readable */
759 MM_PLAYER_ATTRS_FLAG_WRITABLE = 1 << 1, /**< Writable */
760 MM_PLAYER_ATTRS_FLAG_MODIFIED = 1 << 2, /**< Modified */
762 MM_PLAYER_ATTRS_FLAG_RW = MM_PLAYER_ATTRS_FLAG_READABLE | MM_PLAYER_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
766 * Enumeration for progressive download
769 MM_PLAYER_PD_MODE_NONE,
770 MM_PLAYER_PD_MODE_URI,
771 MM_PLAYER_PD_MODE_FILE // not tested yet, because of no fixed scenario
775 * Enumeration of track types
778 MM_PLAYER_TRACK_TYPE_AUDIO = 0,
779 MM_PLAYER_TRACK_TYPE_VIDEO,
780 MM_PLAYER_TRACK_TYPE_TEXT,
781 MM_PLAYER_TRACK_TYPE_MAX
785 * Enumeration of runtime buffering mode
788 MM_PLAYER_BUFFERING_MODE_ADAPTIVE = 0, /**< default, If buffering is occurred, player will consider the bandwidth to adjust buffer setting. */
789 MM_PLAYER_BUFFERING_MODE_FIXED, /**< player will set buffer size with this fixed size value. */
790 MM_PLAYER_BUFFERING_MODE_MAX,
791 } MMPlayerBufferingMode;
794 MM_PLAYER_FOCUS_CHANGED_COMPLETED = 0,
795 MM_PLAYER_FOCUS_CHANGED_BY_MEDIA,
796 MM_PLAYER_FOCUS_CHANGED_BY_CALL,
797 MM_PLAYER_FOCUS_CHANGED_BY_EARJACK_UNPLUG,
798 MM_PLAYER_FOCUS_CHANGED_BY_RESOURCE_CONFLICT,
799 MM_PLAYER_FOCUS_CHANGED_BY_ALARM,
800 MM_PLAYER_FOCUS_CHANGED_BY_EMERGENCY,
801 MM_PLAYER_FOCUS_CHANGED_BY_NOTIFICATION,
802 MM_PLAYER_FOCUS_CHANGED_BY_UNKNOWN,
803 } MMPlayerFocusChangedMsg;
807 * Edge Properties of the text.
811 MM_PLAYER_EDGE_RAISED,
812 MM_PLAYER_EDGE_DEPRESSED,
813 MM_PLAYER_EDGE_UNIFORM,
814 MM_PLAYER_EDGE_DROPSHADOW
815 } MMPlayerSubtitleEdge;
818 * Enumeration of media stream buffer status
821 MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN,
822 MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW,
823 } MMPlayerMediaStreamBufferStatus;
826 * Enumeration for stream type.
829 MM_PLAYER_STREAM_TYPE_DEFAULT, /**< Container type */
830 MM_PLAYER_STREAM_TYPE_AUDIO, /**< Audio element stream type */
831 MM_PLAYER_STREAM_TYPE_VIDEO, /**< Video element stream type */
832 MM_PLAYER_STREAM_TYPE_TEXT, /**< Text type */
833 MM_PLAYER_STREAM_TYPE_MAX,
834 } MMPlayerStreamType;
837 MM_PLAYER_CODEC_TYPE_DEFAULT = 0, /**< codec is selected by the priority */
838 MM_PLAYER_CODEC_TYPE_HW, /**< HW codec can only be selected */
839 MM_PLAYER_CODEC_TYPE_SW, /**< SW codec can only be selected */
840 } MMPlayerVideoCodecType;
843 * Attribute validity structure
846 MMPlayerAttrsType type;
847 MMPlayerAttrsValidType validity_type;
848 MMPlayerAttrsFlag flag;
850 * a union that describes validity of the attribute.
851 * Only when type is 'MM_ATTRS_TYPE_INT' or 'MM_ATTRS_TYPE_DOUBLE',
852 * the attribute can have validity.
856 * Validity structure for integer array.
859 int *array; /**< a pointer of array */
860 int count; /**< size of array */
864 * Validity structure for integer range.
867 int min; /**< minimum range */
868 int max; /**< maximum range */
872 * Validity structure for double array.
875 double * array; /**< a pointer of array */
876 int count; /**< size of array */
880 * Validity structure for double range.
883 double min; /**< minimum range */
884 double max; /**< maximum range */
893 * @see mm_player_set_volume, mm_player_get_volume
896 float level[MM_VOLUME_CHANNEL_NUM]; /**< Relative volume factor for each channels */
897 } MMPlayerVolumeType;
900 * Video stream info in external demux case
903 typedef struct _VideoStreamInfo {
905 unsigned int framerate_num;
906 unsigned int framerate_den;
909 unsigned char *codec_extradata;
910 unsigned int extradata_size;
911 unsigned int version;
912 } MMPlayerVideoStreamInfo;
915 * Audio stream info in external demux case
918 typedef struct _AudioStreamInfo {
920 unsigned int channels;
921 unsigned int sample_rate;
922 unsigned char *codec_extradata;
923 unsigned int extradata_size;
924 unsigned int version;
925 unsigned int user_info;
928 // unsigned int width;
929 // unsigned int depth;
930 // unsigned int endianness;
932 } MMPlayerAudioStreamInfo;
935 * Subtitle stream info in external demux case
938 typedef struct _SubtitleStreamInfo {
940 unsigned int codec_tag;
941 void *context; //for smpte text
942 } MMPlayerSubtitleStreamInfo;
945 * Audio stream callback function type.
947 * @param stream [in] Reference pointer to audio frame data
948 * @param stream_size [in] Size of audio frame data
949 * @param user_param [in] User defined parameter which is passed when set
950 * audio stream callback
952 * @return This callback function have to return MM_ERROR_NONE.
954 typedef bool (*mm_player_audio_stream_callback) (void *stream, int stream_size, void *user_param);
958 * selected subtitle track number callback function type.
960 * @param track_num [in] Track number of subtitle
961 * @param user_param [in] User defined parameter
964 * @return This callback function have to return MM_ERROR_NONE.
966 typedef bool (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
969 * Buffer underrun / overflow data callback function type.
971 * @param status [in] buffer status
972 * @param user_param [in] User defined parameter which is passed when set
973 * to enough data callback or need data callback
975 * @return This callback function have to return MM_ERROR_NONE.
977 typedef bool (*mm_player_media_stream_buffer_status_callback) (MMPlayerStreamType type, MMPlayerMediaStreamBufferStatus status, unsigned long long bytes, void *user_param);
980 * Buffer seek data callback function type.
982 * @param offset [in] offset for the buffer playback
983 * @param user_param [in] User defined parameter which is passed when set
984 * to seek data callback
986 * @return This callback function have to return MM_ERROR_NONE.
988 typedef bool (*mm_player_media_stream_seek_data_callback) (MMPlayerStreamType type, unsigned long long offset, void *user_param);
991 * Called to notify the stream changed.
993 * @param user_data [in] The user data passed from the callback registration function
995 * @return This callback function have to return MM_ERROR_NONE.
997 typedef bool (*mm_player_stream_changed_callback) (void *user_param);
1000 /*===========================================================================================
1002 | GLOBAL FUNCTION PROTOTYPES |
1004 ========================================================================================== */
1007 * This function creates a player object for playing multimedia contents. \n
1008 * The attributes of player are created to get/set some values with application. \n
1009 * And, mutex, gstreamer and other resources are initialized at this time. \n
1010 * If player is created, the state will become MM_PLAYER_STATE_NULL.
1012 * @param player [out] Handle of player
1014 * @return This function returns zero on success, or negative value with error code. \n
1015 * Please refer 'mm_error.h' to know it in detail.
1017 * @post MM_PLAYER_STATE_NULL
1018 * @see mm_player_destroy
1019 * @remark You can create multiple handles on a context at the same time. \n
1020 * However, player cannot guarantee proper operation because of limitation of resources, \n
1021 * such as audio device or display device.
1025 char *g_err_attr_name = NULL;
1027 if (mm_player_create(&g_player) != MM_ERROR_NONE) {
1028 LOGE("failed to create player\n");
1031 if (mm_player_set_attribute(g_player,
1033 "profile_uri", filename, strlen(filename),
1034 "display_overlay", (void*)&g_win.xid, sizeof(g_win.xid),
1035 NULL) != MM_ERROR_NONE) {
1036 LOGE("failed to set %s attribute\n", g_err_attr_name);
1037 free(g_err_attr_name);
1040 mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
1043 int mm_player_create(MMHandleType *player);
1046 * This function releases player object and all resources which were created by mm_player_create(). \n
1047 * And, player handle will also be destroyed.
1049 * @param player [in] Handle of player
1051 * @return This function returns zero on success, or negative value with error code.
1052 * @pre Player state may be MM_PLAYER_STATE_NULL. \n
1053 * But, it can be called in any state.
1054 * @post Because handle is released, there is no any state.
1055 * @see mm_player_create
1056 * @remark This method can be called with a valid player handle from any state to \n
1057 * completely shutdown the player operation.
1061 if (mm_player_destroy(g_player) != MM_ERROR_NONE) {
1062 LOGE("failed to destroy player\n");
1066 int mm_player_destroy(MMHandleType player);
1069 * This function parses uri and makes gstreamer pipeline by uri scheme. \n
1070 * So, uri should be set before realizing with mm_player_set_attribute(). \n
1072 * @param player [in] Handle of player
1074 * @return This function returns zero on success, or negative value with error code.
1076 * @pre Player state should be MM_PLAYER_STATE_NULL.
1077 * @post player state will be MM_PLAYER_STATE_READY.
1078 * @see mm_player_unrealize
1082 if (mm_player_realize(g_player) != MM_ERROR_NONE) {
1083 LOGE("failed to realize player\n");
1087 int mm_player_realize(MMHandleType player);
1090 * This function uninitializes player object. So, resources and allocated memory \n
1091 * will be freed. And, gstreamer pipeline is also destroyed. So, if you want to play \n
1092 * other contents, player should be created again after destruction or realized with new uri.
1094 * @param player [in] Handle of player
1096 * @return This function returns zero on success, or negative value with error code.
1097 * @pre Player state may be MM_PLAYER_STATE_READY to unrealize. \n
1098 * But, it can be called in any state.
1099 * @post Player state will be MM_PLAYER_STATE_NULL.
1100 * @see mm_player_realize
1101 * @remark This method can be called with a valid player handle from any state.
1105 if (mm_player_unrealize(g_player) != MM_ERROR_NONE) {
1106 LOGE("failed to unrealize player\n");
1110 int mm_player_unrealize(MMHandleType player);
1113 * This function is to get current state of player. \n
1114 * Application have to check current state before doing some action.
1116 * @param player [in] Handle of player
1117 * @param state [out] current state of player on success
1119 * @return This function returns zero on success, or negative value with error code.
1121 * @see MMPlayerStateType
1125 if (mm_player_get_state(g_player, &state) != MM_ERROR_NONE) {
1126 LOGE("failed to get state\n");
1130 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state);
1133 * This function is to set relative volume of player. \n
1134 * So, It controls logical volume value. \n
1135 * But, if developer want to change system volume, mm sound api should be used.
1137 * @param player [in] Handle of player
1138 * @param volume [in] Volume factor of each channel
1140 * @return This function returns zero on success, or negative value with error code.
1141 * @see MMPlayerVolumeType, mm_player_get_volume
1142 * @remark The range of factor range is from 0 to 1.0. (1.0 = 100%) And, default value is 1.0.
1145 MMPlayerVolumeType volume;
1148 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
1149 volume.level[i] = MM_VOLUME_LEVEL_MAX;
1151 if (mm_player_set_volume(g_player, &volume) != MM_ERROR_NONE)
1153 LOGE("failed to set volume\n");
1157 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume);
1160 * This function is to get current volume factor of player.
1162 * @param player [in] Handle of player.
1163 * @param volume [out] Volume factor of each channel.
1165 * @return This function returns zero on success, or negative value with error code.
1167 * @see MMPlayerVolumeType, mm_player_set_volume
1171 MMPlayerVolumeType volume;
1174 if (mm_player_get_volume(g_player, &volume) != MM_ERROR_NONE)
1176 LOGW("failed to get volume\n");
1179 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
1180 LOGD("channel[%d] = %d \n", i, volume.level[i]);
1183 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume);
1186 * This function is to start playing media contents. Demux(parser), codec and related plugins are decided \n
1187 * at this time. And, MM_MESSAGE_BEGIN_OF_STREAM will be posted through callback function registered \n
1188 * by mm_player_set_message_callback().
1190 * @param player [in] Handle of player
1192 * @return This function returns zero on success, or negative value with error code.
1195 * @pre Player state may be MM_PLAYER_STATE_READY.
1196 * @post Player state will be MM_PLAYER_STATE_PLAYING.
1197 * @see mm_player_stop
1201 if (mm_player_start(g_player) != MM_ERROR_NONE)
1203 LOGE("failed to start player\n");
1207 int mm_player_start(MMHandleType player);
1210 * This function is to stop playing media contents and it's different with pause. \n
1211 * If mm_player_start() is called after this, content will be started again from the beginning. \n
1212 * So, it can be used to close current playback.
1214 * @param player [in] Handle of player
1216 * @return This function returns zero on success, or negative value with error code.
1218 * @pre Player state may be MM_PLAYER_STATE_PLAYING.
1219 * @post Player state will be MM_PLAYER_STATE_READY.
1220 * @see mm_player_start
1224 if (mm_player_stop(g_player) != MM_ERROR_NONE)
1226 LOGE("failed to stop player\n");
1230 int mm_player_stop(MMHandleType player);
1233 * This function is to pause playing media contents.
1235 * @param player [in] Handle of player.
1237 * @return This function returns zero on success, or negative value with error code.
1239 * @pre Player state may be MM_PLAYER_STATE_PLAYING.
1240 * @post Player state will be MM_PLAYER_STATE_PAUSED.
1241 * @see mm_player_resume
1245 if (mm_player_pause(g_player) != MM_ERROR_NONE)
1247 LOGE("failed to pause player\n");
1251 int mm_player_pause(MMHandleType player);
1254 * This function is to resume paused media contents.
1256 * @param player [in] Handle of player.
1258 * @return This function returns zero on success, or negative value with error code.
1260 * @pre Player state may be MM_PLAYER_STATE_PAUSED.
1261 * @post Player state will be MM_PLAYER_STATE_PLAYING.
1262 * @see mm_player_pause
1266 if (mm_player_resume(g_player) != MM_ERROR_NONE)
1268 LOGE("failed to resume player\n");
1272 int mm_player_resume(MMHandleType player);
1275 * This function is to set the position for playback. \n
1276 * So, it can be seeked to requested position. \n
1278 * @param player [in] Handle of player
1279 * @param format [in] Format of position.
1280 * @param pos [in] Position for playback
1282 * @return This function returns zero on success, or negative value with error code.
1283 * @see MMPlayerPosFormatType, mm_player_get_position
1284 * @remark the unit of time-based format is millisecond and other case is percent.
1287 int position = 1000; //1sec
1289 if (mm_player_set_position(g_player, MM_PLAYER_POS_FORMAT_TIME, position) != MM_ERROR_NONE)
1291 LOGE("failed to set position\n");
1295 int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos);
1298 * This function is to get current position of playback content.
1300 * @param player [in] Handle of player.
1301 * @param format [in] Format of position.
1302 * @param pos [out] contains current position on success or zero in case of failure.
1304 * @return This function returns zero on success, or negative value with errors
1305 * @see MMPlayerPosFormatType, mm_player_set_position
1306 * @remark the unit of time-based format is millisecond and other case is percent.
1312 mm_player_get_position(g_player, MM_PLAYER_POS_FORMAT_TIME, &position);
1314 mm_player_get_attribute(g_player, &g_err_name, "content_duration", &duration, NULL);
1316 LOGD("pos: [%d/%d] msec\n", position, duration);
1319 int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *pos);
1322 * This function is to get current buffer position of playback content.
1324 * @param player [in] Handle of player.
1325 * @param format [in] Format of position.
1326 * @param start_pos [out] contains buffer start position on success or zero in case of failure.
1327 * @param stop_pos [out] contains buffer current position on success or zero in case of failure.
1329 * @return This function returns zero on success, or negative value with errors
1330 * @see MMPlayerPosFormatType, mm_player_set_position
1331 * @remark the unit of time-based format is millisecond and other case is percent.
1334 int start_pos = 0, stop_pos = 0;
1336 mm_player_get_buffer_position(g_player, MM_PLAYER_POS_FORMAT_PERCENT, &start_pos, &stop_pos );
1338 LOGD("buffer position: [%d] ~ [%d] \%\n", start_pos, stop_pos );
1341 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *start_pos, unsigned long *stop_pos);
1344 * This function is to activate the section repeat. If it's set, selected section will be played \n
1345 * continually before deactivating it by mm_player_deactivate_section_repeat(). \n
1346 * The unit for setting is millisecond.
1348 * @param player [in] Handle of player.
1349 * @param start_pos [in] start position.
1350 * @param end_pos [in] end position.
1352 * @return This function returns zero on success, or negative value with error code.
1353 * @see mm_player_deactivate_section_repeat
1358 int endtime = 4000; //msec
1360 mm_player_get_position(g_player, MM_PLAYER_POS_FORMAT_TIME, &position);
1362 mm_player_activate_section_repeat(g_player, position, position+endtime);
1365 int mm_player_activate_section_repeat(MMHandleType player, int start_pos, int end_pos);
1368 * This function is to deactivate the section repeat.
1370 * @param player [in] Handle of player.
1372 * @return This function returns zero on success, or negative value with error code.
1373 * @see mm_player_activate_section_repeat
1377 if ( mm_player_deactivate_section_repeat(g_player) != MM_ERROR_NONE)
1379 LOGW("failed to deactivate section repeat\n");
1383 int mm_player_deactivate_section_repeat(MMHandleType player);
1386 * This function sets callback function for receiving messages from player.
1387 * So, player can notify warning, error and normal cases to application.
1389 * @param player [in] Handle of player.
1390 * @param callback [in] Message callback function.
1391 * @param user_param [in] User parameter which is passed to callback function.
1393 * @return This function returns zero on success, or negative value with error code.
1394 * @see MMMessageCallback
1398 int msg_callback(int message, MMMessageParamType *param, void *user_param)
1402 case MM_MESSAGE_ERROR:
1406 case MM_MESSAGE_END_OF_STREAM:
1410 case MM_MESSAGE_STATE_CHANGED:
1414 case MM_MESSAGE_BEGIN_OF_STREAM:
1424 mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
1427 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
1430 * This function set callback function for receiving audio stream from player. \n
1431 * So, application can get raw audio data and modify it. \n
1432 * But, if callback don't return or holds it for long time, performance can be deteriorated. \n
1433 * It's only supported when audio stream is included in file. \n
1434 * So, if there is video stream or DRM content, it can't be used.
1436 * @param player [in] Handle of player.
1437 * @param callback [in] Audio stream callback function.
1438 * @param user_param [in] User parameter.
1440 * @return This function returns zero on success, or negative value with error
1442 * @see mm_player_audio_stream_callback
1443 * @remark It can be used for audio playback only.
1446 bool audio_callback(void *stream, int stream_size, void *user_param)
1448 LOGD("audio stream callback\n");
1451 mm_player_set_audio_stream_callback(g_player, audio_callback, NULL);
1454 int mm_player_set_audio_stream_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param);
1457 * This function is to mute volume of player
1459 * @param player [in] Handle of player
1460 * @param mute [in] Mute(1) or not mute(0)
1462 * @return This function returns zero on success, or negative value with error code
1463 * @see mm_player_get_mute
1467 if (mm_player_set_mute(g_player, TRUE) != MM_ERROR_NONE)
1469 LOGW("failed to set mute\n");
1473 int mm_player_set_mute(MMHandleType player, int mute);
1476 * This function is to get mute value of player
1478 * @param player [in] Handle of player
1479 * @param mute [out] Sound is muted
1481 * @return This function returns zero on success, or negative value with error code
1482 * @see mm_player_set_mute
1488 if (mm_player_get_mute(g_player, &mute) != MM_ERROR_NONE)
1490 LOGW("failed to get mute\n");
1493 LOGD("mute status:%d\n", mute);
1496 int mm_player_get_mute(MMHandleType player, int *mute);
1499 * This function is to adjust subtitle postion. So, subtitle can show at the adjusted position. \n
1500 * If pos is negative, subtitle will be displayed previous time, the other hand forward time. \n
1502 * @param player [in] Handle of player
1503 * @param pos [in] postion to be adjusted
1505 * @return This function returns zero on success, or negative value with error
1507 * @see mm_player_adjust_subtitle_position
1514 if (mm_player_adjust_subtitle_position(g_player, MM_PLAYER_POS_FORMAT_TIME, pos) != MM_ERROR_NONE)
1516 LOGW("failed to adjust subtitle postion.\n");
1521 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos);
1524 * This function is to set the offset in timestamps of video so as to bring the a/v sync
1525 * @param player Handle of player
1526 * @param offset offset to be set in milliseconds(can be positive or negative both)
1527 * postive offset to make video lag
1528 * negative offset to make video lead
1530 int mm_player_adjust_video_position(MMHandleType player, int offset);
1532 * This function is to set subtitle silent status. So, subtitle can show or hide during playback \n
1533 * by this value. But, one subtitle file should be set with "subtitle_uri" attribute before calling mm_player_realize(); \n
1534 * Player FW parses subtitle file and send text data including timestamp to application \n
1535 * through message callback with MM_MESSAGE_UPDATE_SUBTITLE will be. \n
1536 * So, application have to render it. And, subtitle can be supported only in a seprate file. \n
1537 * So, it's not supported for embedded case.
1539 * @param player [in] Handle of player
1540 * @param silent [in] silent(integer value except 0) or not silent(0)
1542 * @return This function returns zero on success, or negative value with error
1544 * @see mm_player_get_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1548 mm_player_set_attribute(g_player,
1550 "subtitle_uri", g_subtitle_uri, strlen(g_subtitle_uri),
1554 if (mm_player_set_subtitle_silent(g_player, TRUE) != MM_ERROR_NONE)
1556 LOGW("failed to set subtitle silent\n");
1560 int mm_player_set_subtitle_silent(MMHandleType player, int silent);
1563 * This function is to get silent status of subtitle.
1565 * @param player [in] Handle of player
1566 * @param silent [out] subtitle silent property
1568 * @return This function returns zero on success, or negative value with error
1570 * @see mm_player_set_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1576 if (mm_player_get_subtitle_silent(g_player, &silent) != MM_ERROR_NONE)
1578 LOGW("failed to set subtitle silent\n");
1582 int mm_player_get_subtitle_silent(MMHandleType player, int *silent);
1585 * This function is to set attributes into player. Multiple attributes can be set simultaneously. \n
1586 * If one of attribute fails, this function will stop at the point and let you know the name which is failed. \n
1588 * @param player [in] Handle of player.
1589 * @param err_attr_name [out] Name of attribute which is failed to set
1590 * @param first_attribute_name [in] Name of the first attribute to set
1591 * @param ... [in] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1592 * But, in the case of data or string type, it should be name/value/size.
1594 * @return This function returns zero on success, or negative value with error code.
1596 * @see mm_player_get_attribute
1597 * @remark This function must be terminated by NULL argument.
1598 * And, if this function is failed, err_attr_name param must be free.
1601 char *g_err_attr_name = NULL;
1603 if (mm_player_set_attribute(g_player,
1605 "profile_uri", filename, strlen(filename),
1606 "profile_play_count", count,
1607 NULL) != MM_ERROR_NONE) {
1608 LOGW("failed to set %s attribute\n", g_err_attr_name);
1609 free(g_err_attr_name);
1614 int mm_player_set_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1617 * This function is to get attributes from player. Multiple attributes can be got simultaneously.
1619 * @param player [in] Handle of player.
1620 * @param err_attr_name [out] Name of attribute which is failed to get
1621 * @param first_attribute_name [in] Name of the first attribute to get
1622 * @param ... [out] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1623 * But, in the case of data or string type, it should be name/value/size.
1625 * @return This function returns zero on success, or negative value with error
1627 * @see mm_player_set_attribute
1628 * @remark This function must be terminated by NULL argument.
1629 * And, if this function is failed, err_attr_name param must be free.
1632 char *g_err_attr_name = NULL;
1634 if (mm_player_get_attribute(g_player, &g_err_attr_name, "content_duration", &duration, NULL) != MM_ERROR_NONE) {
1635 LOGW("failed to set %s attribute\n", g_err_attr_name);
1636 free(g_err_attr_name);
1640 int mm_player_get_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1643 * This function is to get detail information of attribute.
1645 * @param player [in] Handle of player.
1646 * @param attribute_name [in] Name of the attribute to get
1647 * @param info [out] Attribute infomation
1649 * @return This function returns zero on success, or negative value with error
1652 * @see mm_player_set_attribute, mm_player_get_attribute
1656 if (mm_player_get_attribute_info(g_player, "display_method", &method_info) != MM_ERROR_NONE) {
1657 LOGW("failed to get info\n");
1660 LOGD("type:%d \n", method_info.type); //int, double..
1661 LOGD("flag:%d \n", method_info.flag); //readable, writable..
1662 LOGD("validity type:%d \n", method_info.validity_type); //range, array..
1664 if (method_info. validity_type == MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE) {
1665 LOGD("range min:%d\n", method_info.int_range.min);
1666 LOGD("range max:%d\n", method_info.int_range.max);
1670 int mm_player_get_attribute_info(MMHandleType player, const char *attribute_name, MMPlayerAttrsInfo *info);
1673 * This function is to get download position and total size of progressive download
1675 * @param player [in] Handle of player.
1676 * @param current_pos [in] Download position currently (bytes)
1677 * @param total_size [in] Total size of file (bytes)
1679 * @return This function returns zero on success, or negative value with error code.
1682 guint64 current_pos = 0LLU;
1683 guint64 total_size = 0LLU;
1685 if (mm_player_get_pd_status(g_player, ¤t_pos, &total_size, NULL) != MM_ERROR_NONE)
1687 LOGD("current download pos = %llu, total size = %llu\n", current_pos, total_size);
1691 int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size);
1694 * This function sets callback function for receiving messages of PD downloader.
1696 * @param player [in] Handle of player.
1697 * @param callback [in] Message callback function.
1698 * @param user_param [in] User parameter which is passed to callback function.
1700 * @return This function returns zero on success, or negative value with error code.
1705 int msg_callback(int message, MMMessageParamType *param, void *user_param)
1709 case MM_MESSAGE_PD_DOWNLOADER_START:
1710 LOGD("Progressive download is started...\n");
1712 case MM_MESSAGE_PD_DOWNLOADER_END:
1713 LOGD("Progressive download is ended...\n");
1721 mm_player_set_pd_message_callback(g_player, msg_callback, NULL);
1724 int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
1727 * This function is to get the track count
1729 * @param player [in] handle of player.
1730 * @param track [in] type of the track type
1731 * @param info [out] the count of the track
1733 * @return This function returns zero on success, or negative value with error
1738 gint audio_count = 0;
1740 if (mm_player_get_track_count(g_player, MM_PLAYER_TRACK_TYPE_AUDIO, &audio_count) != MM_ERROR_NONE) {
1741 LOGW("failed to get audio track count\n");
1744 LOGD("audio track count : %d \n", audio_count);
1747 int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType type, int *count);
1750 * This function is to select the track
1752 * @param player [in] handle of player.
1753 * @param type [in] type of the track type
1754 * @param index [in] the index of the track
1756 * @return This function returns zero on success, or negative value with error
1759 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index);
1762 * This function is to add the track when user want multi subtitle
1764 * @param player [in] handle of player.
1765 * @param index [in] the index of the track
1767 * @return This function returns zero on success, or negative value with error
1770 int mm_player_track_add_subtitle_language(MMHandleType player, int index);
1773 * This function is to remove the track when user want multi subtitle
1775 * @param player [in] handle of player.
1776 * @param index [in] the index of the track
1778 * @return This function returns zero on success, or negative value with error
1781 int mm_player_track_remove_subtitle_language(MMHandleType player, int index);
1784 * This function is to notify which sutitle track is in use
1786 * @param player [in] handle of player.
1787 * @param callback [in] callback function to register
1788 * @param user_data [in] user data to be passed to the callback function
1790 * @return This function returns zero on success, or negative value with error
1793 int mm_player_track_foreach_selected_subtitle_language(MMHandleType player, mm_player_track_selected_subtitle_language_callback callback, void *user_param);
1796 * This function is to get the track language
1798 * @param player [in] handle of player.
1799 * @param type [in] type of the track type
1800 * @param index [in] the index of the track
1801 * @param code [out] language code in ISO 639-1(string)
1803 * @return This function returns zero on success, or negative value with error
1806 int mm_player_get_track_language_code(MMHandleType player, MMPlayerTrackType type, int index, char **code);
1809 * This function is to get the current running track
1811 * @param player [in] handle of player.
1812 * @param type [in] type of the track type
1813 * @param index [out] the index of the track
1815 * @return This function returns zero on success, or negative value with error
1819 int mm_player_get_current_track(MMHandleType hplayer, MMPlayerTrackType type, int *index);
1822 * This function is to set the subtitle path
1824 * @param player [in] handle of player
1825 * @param path [in] subtitle path
1827 * @return This function returns zero on success, or negative value with error code.
1829 int mm_player_set_external_subtitle_path(MMHandleType player, const char* path);
1832 * This function is to set the clock which is from master player
1834 * @param player [in] handle of player
1835 * @param clock [in] clock of master player
1836 * @param clock_delta [in] clock difference between master and slave
1837 * @param video_time [in] current playing position
1838 * @param media_clock [in] media clock information
1839 * @param audio_time [in] audio timestamp information
1840 * @return This function returns zero on success, or negative value with error code.
1842 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);
1844 * This function is to get the master clock
1846 * @param player [in] handle of player
1847 * @param video_time [out] current playing position
1848 * @param media_clock [out] media clock information
1849 * @param audio_time [out] audio timestamp information
1850 * @return This function returns zero on success, or negative value with error code.
1852 int mm_player_get_video_share_master_clock(MMHandleType player, long long *video_time, long long *media_clock, long long *audio_time);
1855 * This function is to set download mode of video hub
1857 * @param player [in] handle of player
1858 * @param mode [in] download mode
1859 * @return This function returns zero on success, or negative value with error code.
1861 int mm_player_set_video_hub_download_mode(MMHandleType player, bool mode);
1864 * This function is to set using sync handler.
1866 * @param player [in] handle of player
1867 * @param enable [in] enable/disable
1868 * @return This function returns zero on success, or negative value with error code.
1870 int mm_player_enable_sync_handler(MMHandleType player, bool enable);
1873 * This function is to set uri.
1875 * @param player [in] handle of player
1876 * @param uri [in] uri
1877 * @return This function returns zero on success, or negative value with error code.
1879 int mm_player_set_uri(MMHandleType player, const char *uri);
1882 * This function is to set next uri.
1884 * @param player [in] handle of player
1885 * @param uri [in] uri
1886 * @return This function returns zero on success, or negative value with error code.
1888 int mm_player_set_next_uri(MMHandleType player, const char *uri);
1891 * This function is to get next uri.
1893 * @param player [in] handle of player
1894 * @param uri [out] uri
1895 * @return This function returns zero on success, or negative value with error code.
1897 int mm_player_get_next_uri(MMHandleType player, char **uri);
1900 * This function is to decrease reference count of internal buffer.
1902 * @param buffer [in] video callback internal buffer
1905 void mm_player_video_stream_internal_buffer_unref(void *buffer);
1907 /**mm_player_submit_packet
1908 * This function is to submit buffer to appsrc. \n
1909 * @param player [in] Handle of player.
1910 * @param buf [in] buffer to be submit in appsrc in external feeder case.
1911 * @param len [in] length of buffer.
1912 * @param pts [in] timestamp of buffer.
1913 * @param streamtype [in] stream type of buffer.
1914 * @return This function returns zero on success, or negative value with error code.
1916 int mm_player_submit_packet(MMHandleType player, media_packet_h packet);
1918 /**mm_player_set_video_info
1919 * This function is to set caps of src pad of video appsrc in external feeder case. \n
1920 * @param player [in] Handle of player.
1921 * @param media_format_h [in] Video stream info.
1922 * @return This function returns zero on success, or negative value with error code.
1924 int mm_player_set_video_info(MMHandleType player, media_format_h format);
1926 /**mm_player_set_audio_info
1927 * This function is to set caps of src pad of Audio appsrc in external feeder case. \n
1928 * @param player [in] Handle of player.
1929 * @param media_format_h [in] Audio stream info.
1930 * @return This function returns zero on success, or negative value with error code.
1932 int mm_player_set_audio_info(MMHandleType player, media_format_h format);
1934 /**mm_player_set_subtitle_info
1935 * This function is to set caps of src pad of subtitle appsrc in external feeder case. \n
1936 * @param player [in] Handle of player.
1937 * @param subtitle_stream_info [in] Subtitle stream info.
1938 * @return This function returns zero on success, or negative value with error code.
1940 int mm_player_set_subtitle_info(MMHandleType player, MMPlayerSubtitleStreamInfo *info);
1943 * This function set callback function for receiving need or enough data message from player.
1945 * @param player [in] Handle of player.
1946 * @param type [in] stream type
1947 * @param callback [in] data callback function for stream type.
1948 * @param user_param [in] User parameter.
1950 * @return This function returns zero on success, or negative value with error
1953 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param);
1956 * This function set callback function for receiving seek data message from player.
1958 * @param player [in] Handle of player.
1959 * @param type [in] stream type
1960 * @param callback [in] Seek data callback function for stream type.
1961 * @param user_param [in] User parameter.
1963 * @return This function returns zero on success, or negative value with error
1966 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param);
1969 * This function is to set max size of buffer(appsrc).
1971 * @param player [in] Handle of player.
1972 * @param type [in] stream type
1973 * @param max_size [in] max bytes of buffer.
1975 * @return This function returns zero on success, or negative value with error
1978 int mm_player_set_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long max_size);
1981 * This function is to get max size of buffer(appsrc).
1983 * @param player [in] Handle of player.
1984 * @param type [in] stream type
1985 * @param max_size [out] max bytes of buffer.
1987 * @return This function returns zero on success, or negative value with error
1990 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long *max_size);
1993 * This function is to set min percent of buffer(appsrc).
1995 * @param player [in] Handle of player.
1996 * @param type [in] stream type
1997 * @param min_percent [in] min percent of buffer.
1999 * @return This function returns zero on success, or negative value with error
2002 int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned min_percent);
2005 * This function is to get min percent of buffer(appsrc).
2007 * @param player [in] Handle of player.
2008 * @param type [in] stream type
2009 * @param min_percent [out] min percent of buffer.
2011 * @return This function returns zero on success, or negative value with error
2014 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned int *min_percent);
2017 * This function set callback function for changing audio stream from player. \n
2018 * It's only supported when audio stream is included in file. \n
2020 * @param player [in] Handle of player.
2021 * @param callback [in] Audio stream changed callback function.
2022 * @param user_param [in] User parameter.
2024 * @return This function returns zero on success, or negative value with error
2026 * @see mm_player_stream_changed_callback
2029 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
2032 * This function set callback function for changing video stream from player. \n
2033 * It's only supported when video stream is included in file. \n
2035 * @param player [in] Handle of player.
2036 * @param callback [in] Video stream changed callback function.
2037 * @param user_param [in] User parameter.
2039 * @return This function returns zero on success, or negative value with error
2041 * @see mm_player_stream_changed_callback
2043 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
2046 * This function is to get timeout value according to the content type for muse. \n
2047 * It's only supported when video stream is included in file. \n
2049 * @param player [in] Handle of player.
2050 * @param timeout [out] timeout value (sec).
2052 * @return This function returns zero on success, or negative value with error
2056 int mm_player_get_timeout(MMHandleType player, int *timeout);
2059 * This function is to get the number of video output buffers. \n
2060 * It's only supported when video stream is included in file. \n
2062 * @param player [in] Handle of player.
2063 * @param num [out] num of buffers.
2064 * @param extra_num [out] extra num of buffers.
2066 * @return This function returns zero on success, or negative value with error
2070 int mm_player_get_num_of_video_out_buffers(MMHandleType player, int *num, int *extra_num);
2073 * This function is to set the dynamic resolution information. \n
2074 * It's only supported when video stream is included in file. \n
2076 * @param player [in] Handle of player.
2077 * @param drc [in] dynamic resolution info of media stream data
2079 * @return This function returns zero on success, or negative value with error
2083 int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc);
2086 * This function is to release the video stream bo to reuse. \n
2087 * It's only supported when sw codec is used to decode video stream. \n
2089 * @param player [in] Handle of player.
2090 * @param bo [in] bo address to be released
2092 * @return This function returns zero on success, or negative value with error
2096 int mm_player_release_video_stream_bo(MMHandleType player, void* bo);
2099 * This function is to set http file buffering path
2101 * @param player [in] handle of player
2102 * @param file_path [in] file path
2103 * @return This function returns zero on success, or negative value with error code.
2105 int mm_player_set_file_buffering_path(MMHandleType player, const char *file_path);
2108 * This function is to set sound stream info
2110 int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index);
2113 * This function is to manage the playback according to the external storage state
2115 int mm_player_manage_external_storage_state(MMHandleType player, int id, int state);
2118 * These functions are to set/get the max variant of HAS
2120 int mm_player_get_adaptive_variant_info(MMHandleType player, int *num, char **var_info);
2121 int mm_player_set_max_adaptive_variant_limit(MMHandleType player, int bandwidth, int width, int height);
2122 int mm_player_get_max_adaptive_variant_limit(MMHandleType player, int *bandwidth, int *width, int *height);
2125 * These functions are to set/get the audio only mode
2127 int mm_player_set_audio_only(MMHandleType player, bool audio_only);
2128 int mm_player_get_audio_only(MMHandleType player, bool *audio_only);
2131 * These functions are to set/get the streaming bufferint time
2133 int mm_player_set_streaming_buffering_time(MMHandleType player, int buffer_ms, int rebuffer_ms);
2134 int mm_player_get_streaming_buffering_time(MMHandleType player, int *buffer_ms, int *rebuffer_ms);
2137 * These functions are to display the 360 video content
2139 int mm_player_360_is_content_spherical(MMHandleType player, bool *is_spherical);
2140 int mm_player_360_set_enabled(MMHandleType player, bool enabled);
2141 int mm_player_360_is_enabled(MMHandleType player, bool *enabled);
2143 int mm_player_360_set_direction_of_view(MMHandleType player, float yaw, float pitch);
2144 int mm_player_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch);
2146 int mm_player_360_set_zoom(MMHandleType player, float level);
2147 int mm_player_360_get_zoom(MMHandleType player, float *level);
2149 int mm_player_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees);
2150 int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees);
2153 * This function is to set codec type
2155 int mm_player_set_codec_type(MMHandleType player, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type);
2158 * These functions are to apply the replaygain
2160 int mm_player_set_replaygain_enabled(MMHandleType player, bool enabled);
2161 int mm_player_is_replaygain_enabled(MMHandleType player, bool *enabled);
2170 #endif /* __MM_PLAYER_H__ */