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"
655 #define BUFFER_MAX_PLANE_NUM (4)
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;
671 * Enumerations of player state.
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 */
683 * Enumerations of position formats.
684 * Used while invoking mm_player_get_position/mm_player_set_position APIs
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;
693 * Enumeration for attribute values types.
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 */
707 * Enumeration for attribute validation type.
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;
719 * Enumeration for attribute access flag.
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 */
727 MM_PLAYER_ATTRS_FLAG_RW = MM_PLAYER_ATTRS_FLAG_READABLE | MM_PLAYER_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
731 * Enumeration for progressive download
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
740 * Enumeration of track types
743 MM_PLAYER_TRACK_TYPE_AUDIO = 0,
744 MM_PLAYER_TRACK_TYPE_VIDEO,
745 MM_PLAYER_TRACK_TYPE_TEXT,
746 MM_PLAYER_TRACK_TYPE_MAX
750 * Enumeration of runtime buffering mode
753 MM_PLAYER_BUFFERING_MODE_ADAPTIVE = 0, /**< default, If buffering is occurred, player will consider the bandwidth to adjust buffer setting. */
754 MM_PLAYER_BUFFERING_MODE_FIXED, /**< player will set buffer size with this fixed size value. */
755 MM_PLAYER_BUFFERING_MODE_SLINK, /**< If buffering is occurred, player will adjust buffer setting and no more buffering will be occurred again. */
756 MM_PLAYER_BUFFERING_MODE_MAX = MM_PLAYER_BUFFERING_MODE_SLINK,
757 }MMPlayerBufferingMode;
760 * Enumeration of audio channel for video share
764 MM_PLAYER_AUDIO_CH_MONO_LEFT = 0,
765 MM_PLAYER_AUDIO_CH_MONO_RIGHT,
766 MM_PLAYER_AUDIO_CH_STEREO,
767 } MMPlayerAudioChannel;
771 MM_PLAYER_SOUND_RESOURCE_PRELISTENING_RINGTONE = 0,
772 MM_PLAYER_SOUND_RESOURCE_PRELISTENING_NOTIFICATION,
773 MM_PLAYER_SOUND_RESOURCE_PRELISTENING_ALARM,
774 MM_PLAYER_SOUND_RESOURCE_PRELISTENING_MEDIA,
775 } MMPlayerSoundResource;
779 MM_PLAYER_FOCUS_CHANGED_COMPLETED = 0,
780 MM_PLAYER_FOCUS_CHANGED_BY_MEDIA,
781 MM_PLAYER_FOCUS_CHANGED_BY_CALL,
782 MM_PLAYER_FOCUS_CHANGED_BY_EARJACK_UNPLUG,
783 MM_PLAYER_FOCUS_CHANGED_BY_RESOURCE_CONFLICT,
784 MM_PLAYER_FOCUS_CHANGED_BY_ALARM,
785 MM_PLAYER_FOCUS_CHANGED_BY_EMERGENCY,
786 MM_PLAYER_FOCUS_CHANGED_BY_NOTIFICATION,
787 MM_PLAYER_FOCUS_CHANGED_BY_UNKNOWN,
788 } MMPlayerFocusChangedMsg;
792 * Edge Properties of the text.
796 MM_PLAYER_EDGE_RAISED,
797 MM_PLAYER_EDGE_DEPRESSED,
798 MM_PLAYER_EDGE_UNIFORM,
799 MM_PLAYER_EDGE_DROPSHADOW
800 } MMPlayerSubtitleEdge;
803 * Enumeration of media stream buffer status
807 MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN,
808 MM_PLAYER_MEDIA_STREAM_BUFFER_OVERFLOW,
809 } MMPlayerMediaStreamBufferStatus;
812 * Enumeration for stream type.
816 MM_PLAYER_STREAM_TYPE_DEFAULT, /**< Container type */
817 MM_PLAYER_STREAM_TYPE_AUDIO, /**< Audio element stream type */
818 MM_PLAYER_STREAM_TYPE_VIDEO, /**< Video element stream type */
819 MM_PLAYER_STREAM_TYPE_TEXT, /**< Text type */
820 MM_PLAYER_STREAM_TYPE_MAX,
821 } MMPlayerStreamType;
824 * Attribute validity structure
827 MMPlayerAttrsType type;
828 MMPlayerAttrsValidType validity_type;
829 MMPlayerAttrsFlag flag;
831 * a union that describes validity of the attribute.
832 * Only when type is 'MM_ATTRS_TYPE_INT' or 'MM_ATTRS_TYPE_DOUBLE',
833 * the attribute can have validity.
837 * Validity structure for integer array.
840 int *array; /**< a pointer of array */
841 int count; /**< size of array */
845 * Validity structure for integer range.
848 int min; /**< minimum range */
849 int max; /**< maximum range */
853 * Validity structure for double array.
856 double * array; /**< a pointer of array */
857 int count; /**< size of array */
861 * Validity structure for double range.
864 double min; /**< minimum range */
865 double max; /**< maximum range */
874 * @see mm_player_set_volume, mm_player_get_volume
877 float level[MM_VOLUME_CHANNEL_NUM]; /**< Relative volume factor for each channels */
878 } MMPlayerVolumeType;
881 * Video stream info in external demux case
884 typedef struct _VideoStreamInfo
887 unsigned int framerate_num;
888 unsigned int framerate_den;
891 unsigned char *codec_extradata;
892 unsigned int extradata_size;
893 unsigned int version;
894 }MMPlayerVideoStreamInfo;
897 * Audio stream info in external demux case
900 typedef struct _AudioStreamInfo
903 unsigned int channels;
904 unsigned int sample_rate;
905 unsigned char *codec_extradata;
906 unsigned int extradata_size;
907 unsigned int version;
908 unsigned int user_info;
911 // unsigned int width;
912 // unsigned int depth;
913 // unsigned int endianness;
915 }MMPlayerAudioStreamInfo;
918 * Subtitle stream info in external demux case
921 typedef struct _SubtitleStreamInfo
924 unsigned int codec_tag;
925 void *context; //for smpte text
926 }MMPlayerSubtitleStreamInfo;
929 * Audio stream callback function type.
931 * @param stream [in] Reference pointer to audio frame data
932 * @param stream_size [in] Size of audio frame data
933 * @param user_param [in] User defined parameter which is passed when set
934 * audio stream callback
936 * @return This callback function have to return MM_ERROR_NONE.
938 typedef bool (*mm_player_audio_stream_callback) (void *stream, int stream_size, void *user_param);
942 * selected subtitle track number callback function type.
944 * @param track_num [in] Track number of subtitle
945 * @param user_param [in] User defined parameter
948 * @return This callback function have to return MM_ERROR_NONE.
950 typedef bool (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
953 * Buffer underrun / overflow data callback function type.
955 * @param status [in] buffer status
956 * @param user_param [in] User defined parameter which is passed when set
957 * to enough data callback or need data callback
959 * @return This callback function have to return MM_ERROR_NONE.
961 typedef bool (*mm_player_media_stream_buffer_status_callback) (MMPlayerStreamType type, MMPlayerMediaStreamBufferStatus status, void *user_param);
964 * Buffer seek data callback function type.
966 * @param offset [in] offset for the buffer playback
967 * @param user_param [in] User defined parameter which is passed when set
968 * to seek data callback
970 * @return This callback function have to return MM_ERROR_NONE.
972 typedef bool (*mm_player_media_stream_seek_data_callback) (MMPlayerStreamType type, unsigned long long offset, void *user_param);
975 * Called to notify the stream changed.
977 * @param user_data [in] The user data passed from the callback registration function
979 * @return This callback function have to return MM_ERROR_NONE.
981 typedef bool (*mm_player_stream_changed_callback) (void *user_param);
984 /*===========================================================================================
986 | GLOBAL FUNCTION PROTOTYPES |
988 ========================================================================================== */
991 * This function creates a player object for playing multimedia contents. \n
992 * The attributes of player are created to get/set some values with application. \n
993 * And, mutex, gstreamer and other resources are initialized at this time. \n
994 * If player is created, the state will become MM_PLAYER_STATE_NULL.
996 * @param player [out] Handle of player
998 * @return This function returns zero on success, or negative value with error code. \n
999 * Please refer 'mm_error.h' to know it in detail.
1001 * @post MM_PLAYER_STATE_NULL
1002 * @see mm_player_destroy
1003 * @remark You can create multiple handles on a context at the same time. \n
1004 * However, player cannot guarantee proper operation because of limitation of resources, \n
1005 * such as audio device or display device.
1009 char *g_err_attr_name = NULL;
1011 if (mm_player_create(&g_player) != MM_ERROR_NONE)
1013 debug_error("failed to create player\n");
1016 if (mm_player_set_attribute(g_player,
1018 "profile_uri", filename, strlen(filename),
1019 "display_overlay", (void*)&g_win.xid, sizeof(g_win.xid),
1020 NULL) != MM_ERROR_NONE)
1022 debug_error("failed to set %s attribute\n", g_err_attr_name);
1023 free(g_err_attr_name);
1026 mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
1029 int mm_player_create(MMHandleType *player);
1032 * This function releases player object and all resources which were created by mm_player_create(). \n
1033 * And, player handle will also be destroyed.
1035 * @param player [in] Handle of player
1037 * @return This function returns zero on success, or negative value with error code.
1038 * @pre Player state may be MM_PLAYER_STATE_NULL. \n
1039 * But, it can be called in any state.
1040 * @post Because handle is released, there is no any state.
1041 * @see mm_player_create
1042 * @remark This method can be called with a valid player handle from any state to \n
1043 * completely shutdown the player operation.
1047 if (mm_player_destroy(g_player) != MM_ERROR_NONE)
1049 debug_error("failed to destroy player\n");
1053 int mm_player_destroy(MMHandleType player);
1056 * This function parses uri and makes gstreamer pipeline by uri scheme. \n
1057 * So, uri should be set before realizing with mm_player_set_attribute(). \n
1059 * @param player [in] Handle of player
1061 * @return This function returns zero on success, or negative value with error code.
1063 * @pre Player state should be MM_PLAYER_STATE_NULL.
1064 * @post Player state will be MM_PLAYER_STATE_READY.
1065 * @see mm_player_unrealize
1069 if (mm_player_realize(g_player) != MM_ERROR_NONE)
1071 debug_error("failed to realize player\n");
1075 int mm_player_realize(MMHandleType player) ;
1078 * This function uninitializes player object. So, resources and allocated memory \n
1079 * will be freed. And, gstreamer pipeline is also destroyed. So, if you want to play \n
1080 * other contents, player should be created again after destruction or realized with new uri.
1082 * @param player [in] Handle of player
1084 * @return This function returns zero on success, or negative value with error code.
1085 * @pre Player state may be MM_PLAYER_STATE_READY to unrealize. \n
1086 * But, it can be called in any state.
1087 * @post Player state will be MM_PLAYER_STATE_NULL.
1088 * @see mm_player_realize
1089 * @remark This method can be called with a valid player handle from any state.
1093 if (mm_player_unrealize(g_player) != MM_ERROR_NONE)
1095 debug_error("failed to unrealize player\n");
1099 int mm_player_unrealize(MMHandleType player);
1102 * This function is to get current state of player. \n
1103 * Application have to check current state before doing some action.
1105 * @param player [in] Handle of player
1106 * @param state [out] current state of player on success
1108 * @return This function returns zero on success, or negative value with error code.
1110 * @see MMPlayerStateType
1114 if (mm_player_get_state(g_player, &state) != MM_ERROR_NONE)
1116 debug_error("failed to get state\n");
1120 int mm_player_get_state(MMHandleType player, MMPlayerStateType *state);
1123 * This function is to set relative volume of player. \n
1124 * So, It controls logical volume value. \n
1125 * But, if developer want to change system volume, mm sound api should be used.
1127 * @param player [in] Handle of player
1128 * @param volume [in] Volume factor of each channel
1130 * @return This function returns zero on success, or negative value with error code.
1131 * @see MMPlayerVolumeType, mm_player_get_volume
1132 * @remark The range of factor range is from 0 to 1.0. (1.0 = 100%) And, default value is 1.0.
1135 MMPlayerVolumeType volume;
1138 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
1139 volume.level[i] = MM_VOLUME_LEVEL_MAX;
1141 if (mm_player_set_volume(g_player, &volume) != MM_ERROR_NONE)
1143 debug_error("failed to set volume\n");
1147 int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume);
1150 * This function is to get current volume factor of player.
1152 * @param player [in] Handle of player.
1153 * @param volume [out] Volume factor of each channel.
1155 * @return This function returns zero on success, or negative value with error code.
1157 * @see MMPlayerVolumeType, mm_player_set_volume
1161 MMPlayerVolumeType volume;
1164 if (mm_player_get_volume(g_player, &volume) != MM_ERROR_NONE)
1166 debug_warning("failed to get volume\n");
1169 for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++)
1170 debug_log("channel[%d] = %d \n", i, volume.level[i]);
1173 int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume);
1176 * This function is to start playing media contents. Demux(parser), codec and related plugins are decided \n
1177 * at this time. And, MM_MESSAGE_BEGIN_OF_STREAM will be posted through callback function registered \n
1178 * by mm_player_set_message_callback().
1180 * @param player [in] Handle of player
1182 * @return This function returns zero on success, or negative value with error code.
1185 * @pre Player state may be MM_PLAYER_STATE_READY.
1186 * @post Player state will be MM_PLAYER_STATE_PLAYING.
1187 * @see mm_player_stop
1191 if (mm_player_start(g_player) != MM_ERROR_NONE)
1193 debug_error("failed to start player\n");
1197 int mm_player_start(MMHandleType player);
1200 * This function is to stop playing media contents and it's different with pause. \n
1201 * If mm_player_start() is called after this, content will be started again from the beginning. \n
1202 * So, it can be used to close current playback.
1204 * @param player [in] Handle of player
1206 * @return This function returns zero on success, or negative value with error code.
1208 * @pre Player state may be MM_PLAYER_STATE_PLAYING.
1209 * @post Player state will be MM_PLAYER_STATE_READY.
1210 * @see mm_player_start
1214 if (mm_player_stop(g_player) != MM_ERROR_NONE)
1216 debug_error("failed to stop player\n");
1220 int mm_player_stop(MMHandleType player);
1223 * This function is to pause playing media contents.
1225 * @param player [in] Handle of player.
1227 * @return This function returns zero on success, or negative value with error code.
1229 * @pre Player state may be MM_PLAYER_STATE_PLAYING.
1230 * @post Player state will be MM_PLAYER_STATE_PAUSED.
1231 * @see mm_player_resume
1235 if (mm_player_pause(g_player) != MM_ERROR_NONE)
1237 debug_error("failed to pause player\n");
1241 int mm_player_pause(MMHandleType player);
1244 * This function is to resume paused media contents.
1246 * @param player [in] Handle of player.
1248 * @return This function returns zero on success, or negative value with error code.
1250 * @pre Player state may be MM_PLAYER_STATE_PAUSED.
1251 * @post Player state will be MM_PLAYER_STATE_PLAYING.
1252 * @see mm_player_pause
1256 if (mm_player_resume(g_player) != MM_ERROR_NONE)
1258 debug_error("failed to resume player\n");
1262 int mm_player_resume(MMHandleType player);
1265 * This function is to set the position for playback. \n
1266 * So, it can be seeked to requested position. \n
1268 * @param player [in] Handle of player
1269 * @param format [in] Format of position.
1270 * @param pos [in] Position for playback
1272 * @return This function returns zero on success, or negative value with error code.
1273 * @see MMPlayerPosFormatType, mm_player_get_position
1274 * @remark the unit of time-based format is millisecond and other case is percent.
1277 int position = 1000; //1sec
1279 if (mm_player_set_position(g_player, MM_PLAYER_POS_FORMAT_TIME, position) != MM_ERROR_NONE)
1281 debug_error("failed to set position\n");
1285 int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos);
1288 * This function is to get current position of playback content.
1290 * @param player [in] Handle of player.
1291 * @param format [in] Format of position.
1292 * @param pos [out] contains current position on success or zero in case of failure.
1294 * @return This function returns zero on success, or negative value with errors
1295 * @see MMPlayerPosFormatType, mm_player_set_position
1296 * @remark the unit of time-based format is millisecond and other case is percent.
1302 mm_player_get_position(g_player, MM_PLAYER_POS_FORMAT_TIME, &position);
1304 mm_player_get_attribute(g_player, &g_err_name, "content_duration", &duration, NULL);
1306 debug_log("pos: [%d/%d] msec\n", position, duration);
1309 int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *pos);
1312 * This function is to get current buffer position of playback content.
1314 * @param player [in] Handle of player.
1315 * @param format [in] Format of position.
1316 * @param start_pos [out] contains buffer start position on success or zero in case of failure.
1317 * @param stop_pos [out] contains buffer current position on success or zero in case of failure.
1319 * @return This function returns zero on success, or negative value with errors
1320 * @see MMPlayerPosFormatType, mm_player_set_position
1321 * @remark the unit of time-based format is millisecond and other case is percent.
1324 int start_pos = 0, stop_pos = 0;
1326 mm_player_get_buffer_position(g_player, MM_PLAYER_POS_FORMAT_PERCENT, &start_pos, &stop_pos );
1328 debug_log("buffer position: [%d] ~ [%d] \%\n", start_pos, stop_pos );
1331 int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, unsigned long *start_pos, unsigned long *stop_pos);
1334 * This function is to activate the section repeat. If it's set, selected section will be played \n
1335 * continually before deactivating it by mm_player_deactivate_section_repeat(). \n
1336 * The unit for setting is millisecond.
1338 * @param player [in] Handle of player.
1339 * @param start_pos [in] start position.
1340 * @param end_pos [in] end position.
1342 * @return This function returns zero on success, or negative value with error code.
1343 * @see mm_player_deactivate_section_repeat
1348 int endtime = 4000; //msec
1350 mm_player_get_position(g_player, MM_PLAYER_POS_FORMAT_TIME, &position);
1352 mm_player_activate_section_repeat(g_player, position, position+endtime);
1355 int mm_player_activate_section_repeat(MMHandleType player, int start_pos, int end_pos);
1358 * This function is to deactivate the section repeat.
1360 * @param player [in] Handle of player.
1362 * @return This function returns zero on success, or negative value with error code.
1363 * @see mm_player_activate_section_repeat
1367 if ( mm_player_deactivate_section_repeat(g_player) != MM_ERROR_NONE)
1369 debug_warning("failed to deactivate section repeat\n");
1373 int mm_player_deactivate_section_repeat(MMHandleType player);
1376 * This function sets callback function for receiving messages from player.
1377 * So, player can notify warning, error and normal cases to application.
1379 * @param player [in] Handle of player.
1380 * @param callback [in] Message callback function.
1381 * @param user_param [in] User parameter which is passed to callback function.
1383 * @return This function returns zero on success, or negative value with error code.
1384 * @see MMMessageCallback
1388 int msg_callback(int message, MMMessageParamType *param, void *user_param)
1392 case MM_MESSAGE_ERROR:
1396 case MM_MESSAGE_END_OF_STREAM:
1400 case MM_MESSAGE_STATE_CHANGED:
1404 case MM_MESSAGE_BEGIN_OF_STREAM:
1414 mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
1417 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
1420 * This function set callback function for receiving audio stream from player. \n
1421 * So, application can get raw audio data and modify it. \n
1422 * But, if callback don't return or holds it for long time, performance can be deteriorated. \n
1423 * It's only supported when audio stream is included in file. \n
1424 * So, if there is video stream or DRM content, it can't be used.
1426 * @param player [in] Handle of player.
1427 * @param callback [in] Audio stream callback function.
1428 * @param user_param [in] User parameter.
1430 * @return This function returns zero on success, or negative value with error
1432 * @see mm_player_audio_stream_callback
1433 * @remark It can be used for audio playback only.
1436 bool audio_callback(void *stream, int stream_size, void *user_param)
1438 debug_log("audio stream callback\n");
1441 mm_player_set_audio_stream_callback(g_player, audio_callback, NULL);
1444 int mm_player_set_audio_stream_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param);
1447 * This function is to mute volume of player
1449 * @param player [in] Handle of player
1450 * @param mute [in] Mute(1) or not mute(0)
1452 * @return This function returns zero on success, or negative value with error code
1453 * @see mm_player_get_mute
1457 if (mm_player_set_mute(g_player, TRUE) != MM_ERROR_NONE)
1459 debug_warning("failed to set mute\n");
1463 int mm_player_set_mute(MMHandleType player, int mute);
1466 * This function is to get mute value of player
1468 * @param player [in] Handle of player
1469 * @param mute [out] Sound is muted
1471 * @return This function returns zero on success, or negative value with error code
1472 * @see mm_player_set_mute
1478 if (mm_player_get_mute(g_player, &mute) != MM_ERROR_NONE)
1480 debug_warning("failed to get mute\n");
1483 debug_log("mute status:%d\n", mute);
1486 int mm_player_get_mute(MMHandleType player, int *mute);
1489 * This function is to adjust subtitle postion. So, subtitle can show at the adjusted position. \n
1490 * If pos is negative, subtitle will be displayed previous time, the other hand forward time. \n
1492 * @param player [in] Handle of player
1493 * @param pos [in] postion to be adjusted
1495 * @return This function returns zero on success, or negative value with error
1497 * @see mm_player_adjust_subtitle_position
1504 if (mm_player_adjust_subtitle_position(g_player, MM_PLAYER_POS_FORMAT_TIME, pos) != MM_ERROR_NONE)
1506 debug_warning("failed to adjust subtitle postion.\n");
1511 int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos);
1514 * This function is to set the offset in timestamps of video so as to bring the a/v sync
1515 * @param player Handle of player
1516 * @param offset offset to be set in milliseconds(can be positive or negative both)
1517 * postive offset to make video lag
1518 * negative offset to make video lead
1520 int mm_player_adjust_video_position(MMHandleType player,int offset);
1522 * This function is to set subtitle silent status. So, subtitle can show or hide during playback \n
1523 * by this value. But, one subtitle file should be set with "subtitle_uri" attribute before calling mm_player_realize(); \n
1524 * Player FW parses subtitle file and send text data including timestamp to application \n
1525 * through message callback with MM_MESSAGE_UPDATE_SUBTITLE will be. \n
1526 * So, application have to render it. And, subtitle can be supported only in a seprate file. \n
1527 * So, it's not supported for embedded case.
1529 * @param player [in] Handle of player
1530 * @param silent [in] silent(integer value except 0) or not silent(0)
1532 * @return This function returns zero on success, or negative value with error
1534 * @see mm_player_get_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1538 mm_player_set_attribute(g_player,
1540 "subtitle_uri", g_subtitle_uri, strlen(g_subtitle_uri),
1544 if (mm_player_set_subtitle_silent(g_player, TRUE) != MM_ERROR_NONE)
1546 debug_warning("failed to set subtitle silent\n");
1550 int mm_player_set_subtitle_silent(MMHandleType player, int silent);
1553 * This function is to get silent status of subtitle.
1555 * @param player [in] Handle of player
1556 * @param silent [out] subtitle silent property
1558 * @return This function returns zero on success, or negative value with error
1560 * @see mm_player_set_subtitle_silent, MM_MESSAGE_UPDATE_SUBTITLE
1566 if (mm_player_get_subtitle_silent(g_player, &silent) != MM_ERROR_NONE)
1568 debug_warning("failed to set subtitle silent\n");
1572 int mm_player_get_subtitle_silent(MMHandleType player, int *silent);
1575 * This function is to set attributes into player. Multiple attributes can be set simultaneously. \n
1576 * If one of attribute fails, this function will stop at the point and let you know the name which is failed. \n
1578 * @param player [in] Handle of player.
1579 * @param err_attr_name [out] Name of attribute which is failed to set
1580 * @param first_attribute_name [in] Name of the first attribute to set
1581 * @param ... [in] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1582 * But, in the case of data or string type, it should be name/value/size.
1584 * @return This function returns zero on success, or negative value with error code.
1586 * @see mm_player_get_attribute
1587 * @remark This function must be terminated by NULL argument.
1588 * And, if this function is failed, err_attr_name param must be free.
1591 char *g_err_attr_name = NULL;
1593 if (mm_player_set_attribute(g_player,
1595 "profile_uri", filename, strlen(filename),
1596 "profile_play_count", count,
1597 NULL) != MM_ERROR_NONE)
1599 debug_warning("failed to set %s attribute\n", g_err_attr_name);
1600 free(g_err_attr_name);
1605 int mm_player_set_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1608 * This function is to get attributes from player. Multiple attributes can be got simultaneously.
1610 * @param player [in] Handle of player.
1611 * @param err_attr_name [out] Name of attribute which is failed to get
1612 * @param first_attribute_name [in] Name of the first attribute to get
1613 * @param ... [out] Value for the first attribute, followed optionally by more name/value pairs, terminated by NULL.
1614 * But, in the case of data or string type, it should be name/value/size.
1616 * @return This function returns zero on success, or negative value with error
1618 * @see mm_player_set_attribute
1619 * @remark This function must be terminated by NULL argument.
1620 * And, if this function is failed, err_attr_name param must be free.
1623 char *g_err_attr_name = NULL;
1625 if (mm_player_get_attribute(g_player, &g_err_attr_name, "content_duration", &duration, NULL) != MM_ERROR_NONE)
1627 debug_warning("failed to set %s attribute\n", g_err_attr_name);
1628 free(g_err_attr_name);
1632 int mm_player_get_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...)G_GNUC_NULL_TERMINATED;
1635 * This function is to get detail information of attribute.
1637 * @param player [in] Handle of player.
1638 * @param attribute_name [in] Name of the attribute to get
1639 * @param info [out] Attribute infomation
1641 * @return This function returns zero on success, or negative value with error
1644 * @see mm_player_set_attribute, mm_player_get_attribute
1648 if (mm_player_get_attribute_info (g_player, "display_method", &method_info) != MM_ERROR_NONE)
1650 debug_warning("failed to get info\n");
1653 debug_log("type:%d \n", method_info.type); //int, double..
1654 debug_log("flag:%d \n", method_info.flag); //readable, writable..
1655 debug_log("validity type:%d \n", method_info.validity_type); //range, array..
1657 if (method_info. validity_type == MM_PLAYER_ATTRS_VALID_TYPE_INT_RANGE)
1659 debug_log("range min:%d\n", method_info.int_range.min);
1660 debug_log("range max:%d\n", method_info.int_range.max);
1664 int mm_player_get_attribute_info(MMHandleType player, const char *attribute_name, MMPlayerAttrsInfo *info);
1667 * This function is to get download position and total size of progressive download
1669 * @param player [in] Handle of player.
1670 * @param current_pos [in] Download position currently (bytes)
1671 * @param total_size [in] Total size of file (bytes)
1673 * @return This function returns zero on success, or negative value with error code.
1679 guint64 current_pos = 0LLU;
1680 guint64 total_size = 0LLU;
1682 if (mm_player_get_pd_status(g_player, ¤t_pos, &total_size, NULL) != MM_ERROR_NONE)
1684 debug_log("current download pos = %llu, total size = %llu\n", current_pos, total_size);
1688 int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size);
1691 * This function sets callback function for receiving messages of PD downloader.
1693 * @param player [in] Handle of player.
1694 * @param callback [in] Message callback function.
1695 * @param user_param [in] User parameter which is passed to callback function.
1697 * @return This function returns zero on success, or negative value with error code.
1702 int msg_callback(int message, MMMessageParamType *param, void *user_param)
1706 case MM_MESSAGE_PD_DOWNLOADER_START:
1707 debug_log("Progressive download is started...\n");
1709 case MM_MESSAGE_PD_DOWNLOADER_END:
1710 debug_log("Progressive download is ended...\n");
1718 mm_player_set_pd_message_callback(g_player, msg_callback, NULL);
1721 int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
1724 * This function is to get the track count
1726 * @param player [in] handle of player.
1727 * @param track [in] type of the track type
1728 * @param info [out] the count of the track
1730 * @return This function returns zero on success, or negative value with error
1737 gint audio_count = 0;
1739 if (mm_player_get_track_count (g_player, MM_PLAYER_TRACK_TYPE_AUDIO, &audio_count) != MM_ERROR_NONE)
1741 debug_warning("failed to get audio track count\n");
1744 debug_log("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
1762 int mm_player_select_track(MMHandleType player, MMPlayerTrackType type, int index);
1765 * This function is to add the track when user want multi subtitle
1767 * @param player [in] handle of player.
1768 * @param index [in] the index of the track
1770 * @return This function returns zero on success, or negative value with error
1776 int mm_player_track_add_subtitle_language(MMHandleType player, int index);
1779 * This function is to remove the track when user want multi subtitle
1781 * @param player [in] handle of player.
1782 * @param index [in] the index of the track
1784 * @return This function returns zero on success, or negative value with error
1790 int mm_player_track_remove_subtitle_language(MMHandleType player, int index);
1793 * This function is to notify which sutitle track is in use
1795 * @param player [in] handle of player.
1796 * @param callback [in] callback function to register
1797 * @param user_data [in] user data to be passed to the callback function
1799 * @return This function returns zero on success, or negative value with error
1805 int mm_player_track_foreach_selected_subtitle_language(MMHandleType player, mm_player_track_selected_subtitle_language_callback callback, void *user_param);
1808 * This function is to get the track language
1810 * @param player [in] handle of player.
1811 * @param type [in] type of the track type
1812 * @param index [in] the index of the track
1813 * @param code [out] language code in ISO 639-1(string)
1815 * @return This function returns zero on success, or negative value with error
1821 int mm_player_get_track_language_code(MMHandleType player, MMPlayerTrackType type, int index, char **code);
1824 * This function is to get the current running track
1826 * @param player [in] handle of player.
1827 * @param type [in] type of the track type
1828 * @param index [out] the index of the track
1830 * @return This function returns zero on success, or negative value with error
1837 int mm_player_get_current_track(MMHandleType hplayer, MMPlayerTrackType type, int *index);
1840 * This function is to set the buffer size for streaming playback. \n
1842 * @param player [in] Handle of player
1843 * @param second [in] Size of initial buffer
1845 * @return This function returns zero on success, or negative value with error code.
1849 gint second = 10; //10sec
1851 if (mm_player_set_prepare_buffering_time(g_player, second) != MM_ERROR_NONE)
1853 debug_error("failed to set buffer size\n");
1858 int mm_player_set_prepare_buffering_time(MMHandleType player, int second);
1861 * This function is to set the runtime buffering mode for streaming playback. \n
1863 * @param player [in] Handle of player
1864 * @param mode [in] mode of runtime buffering
1865 * @param second [in] max size of buffering
1867 * @return This function returns zero on success, or negative value with error code.
1872 if (mm_player_set_runtime_buffering_mode(g_player, MM_PLAYER_BUFFERING_MODE_ADAPTIVE, 10) != MM_ERROR_NONE)
1874 debug_error("failed to set buffering mode\n");
1879 int mm_player_set_runtime_buffering_mode(MMHandleType player, MMPlayerBufferingMode mode, int second);
1882 * This function is to set the start position of zoom
1884 * @param player [in] handle of player
1885 * @param level [in] level of zoom
1886 * @param x [in] start x position
1887 * @param y [in] start y position
1889 * @return This function returns zero on success, or negative value with error
1895 int mm_player_set_display_zoom(MMHandleType player, float level, int x, int y);
1898 * This function is to get the start position of zoom
1900 * @param player [in] handle of player
1901 * @param type [out] current level of zoom
1902 * @param x [out] start x position
1903 * @param y [out] start y position
1905 * @return This function returns zero on success, or negative value with error
1911 int mm_player_get_display_zoom(MMHandleType player, float *level, int *x, int *y);
1914 * This function is to set the subtitle path
1916 * @param player [in] handle of player
1917 * @param path [in] subtitle path
1919 * @return This function returns zero on success, or negative value with error code.
1924 int mm_player_set_external_subtitle_path(MMHandleType player, const char* path);
1927 * This function is to change clock provider to system clock
1929 * @param player [in] handle of player
1930 * @return This function returns zero on success, or negative value with error code.
1935 int mm_player_use_system_clock(MMHandleType player);
1938 * This function is to set the clock which is from master player
1940 * @param player [in] handle of player
1941 * @param clock [in] clock of master player
1942 * @param clock_delta [in] clock difference between master and slave
1943 * @param video_time [in] current playing position
1944 * @param media_clock [in] media clock information
1945 * @param audio_time [in] audio timestamp information
1946 * @return This function returns zero on success, or negative value with error code.
1951 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);
1953 * This function is to get the master clock
1955 * @param player [in] handle of player
1956 * @param video_time [out] current playing position
1957 * @param media_clock [out] media clock information
1958 * @param audio_time [out] audio timestamp information
1959 * @return This function returns zero on success, or negative value with error code.
1964 int mm_player_get_video_share_master_clock(MMHandleType player, long long *video_time, long long *media_clock, long long *audio_time);
1966 * This function is to set audio channel
1968 * @param player [in] handle of player
1969 * @param ch [in] audio channel
1970 * @return This function returns zero on success, or negative value with error code.
1975 int mm_player_gst_set_audio_channel(MMHandleType player, MMPlayerAudioChannel ch);
1978 * This function is to get the content angle
1980 * @param player [in] handle of player
1981 * @param angle [out] orignal angle from content
1982 * @return This function returns zero on success, or negative value with error code.
1987 int mm_player_get_video_rotate_angle(MMHandleType player, int *angle);
1990 * This function is to set download mode of video hub
1992 * @param player [in] handle of player
1993 * @param mode [in] download mode
1994 * @return This function returns zero on success, or negative value with error code.
1999 int mm_player_set_video_hub_download_mode(MMHandleType player, bool mode);
2002 * This function is to set using sync handler.
2004 * @param player [in] handle of player
2005 * @param enable [in] enable/disable
2006 * @return This function returns zero on success, or negative value with error code.
2011 int mm_player_enable_sync_handler(MMHandleType player, bool enable);
2014 * This function is to set uri.
2016 * @param player [in] handle of player
2017 * @param uri [in] uri
2018 * @return This function returns zero on success, or negative value with error code.
2023 int mm_player_set_uri(MMHandleType player, const char *uri);
2026 * This function is to set next uri.
2028 * @param player [in] handle of player
2029 * @param uri [in] uri
2030 * @return This function returns zero on success, or negative value with error code.
2035 int mm_player_set_next_uri(MMHandleType player, const char *uri);
2038 * This function is to get next uri.
2040 * @param player [in] handle of player
2041 * @param uri [out] uri
2042 * @return This function returns zero on success, or negative value with error code.
2047 int mm_player_get_next_uri(MMHandleType player, char **uri);
2049 int mm_player_enable_media_packet_video_stream(MMHandleType player, bool enable);
2052 * This function is to increase reference count of internal buffer.
2054 * @param buffer [in] video callback internal buffer
2055 * @return This function returns buffer point;
2060 void * mm_player_media_packet_video_stream_internal_buffer_ref(void *buffer);
2063 * This function is to decrease reference count of internal buffer.
2065 * @param buffer [in] video callback internal buffer
2071 void mm_player_media_packet_video_stream_internal_buffer_unref(void *buffer);
2073 /**mm_player_submit_packet
2074 * This function is to submit buffer to appsrc. \n
2075 * @param player [in] Handle of player.
2076 * @param buf [in] buffer to be submit in appsrc in external feeder case.
2077 * @param len [in] length of buffer.
2078 * @param pts [in] timestamp of buffer.
2079 * @param streamtype [in] stream type of buffer.
2080 * @return This function returns zero on success, or negative value with error code.
2085 int mm_player_submit_packet(MMHandleType player, media_packet_h packet);
2087 /**mm_player_set_video_info
2088 * This function is to set caps of src pad of video appsrc in external feeder case. \n
2089 * @param player [in] Handle of player.
2090 * @param media_format_h [in] Video stream info.
2091 * @return This function returns zero on success, or negative value with error code.
2097 int mm_player_set_video_info (MMHandleType player, media_format_h format);
2099 /**mm_player_set_audio_info
2100 * This function is to set caps of src pad of Audio appsrc in external feeder case. \n
2101 * @param player [in] Handle of player.
2102 * @param media_format_h [in] Audio stream info.
2103 * @return This function returns zero on success, or negative value with error code.
2109 int mm_player_set_audio_info (MMHandleType player, media_format_h format);
2111 /**mm_player_set_subtitle_info
2112 * This function is to set caps of src pad of subtitle appsrc in external feeder case. \n
2113 * @param player [in] Handle of player.
2114 * @param subtitle_stream_info [in] Subtitle stream info.
2115 * @return This function returns zero on success, or negative value with error code.
2121 int mm_player_set_subtitle_info (MMHandleType player, MMPlayerSubtitleStreamInfo *info);
2124 * This function set callback function for receiving need or enough data message from player.
2126 * @param player [in] Handle of player.
2127 * @param type [in] stream type
2128 * @param callback [in] data callback function for stream type.
2129 * @param user_param [in] User parameter.
2131 * @return This function returns zero on success, or negative value with error
2137 int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param);
2140 * This function set callback function for receiving seek data message from player.
2142 * @param player [in] Handle of player.
2143 * @param type [in] stream type
2144 * @param callback [in] Seek data callback function for stream type.
2145 * @param user_param [in] User parameter.
2147 * @return This function returns zero on success, or negative value with error
2153 int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param);
2156 * This function is to set max size of buffer(appsrc).
2158 * @param player [in] Handle of player.
2159 * @param type [in] stream type
2160 * @param max_size [in] max bytes of buffer.
2162 * @return This function returns zero on success, or negative value with error
2168 int mm_player_set_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long max_size);
2171 * This function is to get max size of buffer(appsrc).
2173 * @param player [in] Handle of player.
2174 * @param type [in] stream type
2175 * @param max_size [out] max bytes of buffer.
2177 * @return This function returns zero on success, or negative value with error
2183 int mm_player_get_media_stream_buffer_max_size(MMHandleType player, MMPlayerStreamType type, unsigned long long *max_size);
2186 * This function is to set min percent of buffer(appsrc).
2188 * @param player [in] Handle of player.
2189 * @param type [in] stream type
2190 * @param min_percent [in] min percent of buffer.
2192 * @return This function returns zero on success, or negative value with error
2198 int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned min_percent);
2201 * This function is to get min percent of buffer(appsrc).
2203 * @param player [in] Handle of player.
2204 * @param type [in] stream type
2205 * @param min_percent [out] min percent of buffer.
2207 * @return This function returns zero on success, or negative value with error
2213 int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerStreamType type, unsigned int *min_percent);
2216 * This function set callback function for changing audio stream from player. \n
2217 * It's only supported when audio stream is included in file. \n
2219 * @param player [in] Handle of player.
2220 * @param callback [in] Audio stream changed callback function.
2221 * @param user_param [in] User parameter.
2223 * @return This function returns zero on success, or negative value with error
2225 * @see mm_player_stream_changed_callback
2228 int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
2231 * This function set callback function for changing video stream from player. \n
2232 * It's only supported when video stream is included in file. \n
2234 * @param player [in] Handle of player.
2235 * @param callback [in] Video stream changed callback function.
2236 * @param user_param [in] User parameter.
2238 * @return This function returns zero on success, or negative value with error
2240 * @see mm_player_stream_changed_callback
2243 int mm_player_set_video_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param);
2253 #endif /* __MM_PLAYER_H__ */