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_PRIV_H__
24 #define __MM_PLAYER_PRIV_H__
26 /*===========================================================================================
30 ========================================================================================== */
39 #include <tbm_bufmgr.h>
41 #include "mm_player.h"
42 #include "mm_player_internal.h"
43 #include "mm_player_audioeffect.h"
44 #include "mm_message.h"
45 #include "mm_player_ini.h"
46 #include "mm_player_resource.h"
47 #include "mm_player_sound_focus.h"
48 #include "mm_player_pd.h"
49 #include "mm_player_streaming.h"
51 /*===========================================================================================
53 | GLOBAL DEFINITIONS AND DECLARATIONS FOR MODULE |
55 ========================================================================================== */
57 /*---------------------------------------------------------------------------
59 ---------------------------------------------------------------------------*/
60 #define MM_PLAYER_IMGB_MPLANE_MAX 4
61 #define MM_PLAYER_STREAM_COUNT_MAX 3
63 #define MM_PLAYER_CAST(x_player) ((mm_player_t *)(x_player))
65 * @x_player: MMHandleType of player
67 * Get the PD downloader of this player.
69 #define MM_PLAYER_GET_PD(x_player) (MM_PLAYER_CAST(x_player)->pd_downloader)
71 * @x_player: MMHandleType of player
73 * Get the attributes handle of this player.
75 #define MM_PLAYER_GET_ATTRS(x_player) (MM_PLAYER_CAST(x_player)->attrs)
77 #define ROTATION_USING_SINK 0
78 #define ROTATION_USING_CUSTOM 1
79 #define ROTATION_USING_FLIP 2
81 #define MM_MAX_STRING_LENGTH 4000 /* have to be less than MUSE_MSG_MAX_LENGTH */
83 #define VIDEO360_MAX_ZOOM 10.0f
85 /*---------------------------------------------------------------------------
86 | GLOBAL CONSTANT DEFINITIONS: |
87 ---------------------------------------------------------------------------*/
89 AUDIO_LATENCY_MODE_LOW = 0, /**< Low audio latency mode */
90 AUDIO_LATENCY_MODE_MID, /**< Middle audio latency mode */
91 AUDIO_LATENCY_MODE_HIGH, /**< High audio latency mode */
95 TAG_AUDIO_CODEC = 0x0001,
96 TAG_VIDEO_CODEC = 0x0002,
101 TAG_COPYRIGHT = 0x0040,
103 TAG_DESCRIPTION = 0x0100,
104 TAG_TRACK_NUMBER = 0x0200
107 enum content_attr_flag {
108 ATTR_MISSING_ONLY = 0x0001,
109 ATTR_DURATION = 0x0002,
112 ATTR_BITRATE = 0x0010,
116 /* async mode makes trouble. alsasink sometimes fails to pause. */
123 * Enumerations of Player Uri type
125 enum MMPlayerUriType {
126 MM_PLAYER_URI_TYPE_NONE, /**< Player URI type None */
127 MM_PLAYER_URI_TYPE_URL_RTSP, /**< Player URI type RTSP */
128 MM_PLAYER_URI_TYPE_URL_HTTP, /**< Player URI type HTTP */
129 MM_PLAYER_URI_TYPE_URL_MMS, /**< Player URI type MMS */
130 MM_PLAYER_URI_TYPE_MEM, /**< Player URI type Mem */
131 MM_PLAYER_URI_TYPE_FILE, /**< Player URI type File */
132 MM_PLAYER_URI_TYPE_URL, /**< Player URI type URL */
133 MM_PLAYER_URI_TYPE_MS_BUFF, /**< Player URI type Media Stream Buffer */
134 MM_PLAYER_URI_TYPE_HLS, /**< Player URI type http live streaming */
135 MM_PLAYER_URI_TYPE_SS, /**< Player URI type Smooth streaming */
136 MM_PLAYER_URI_TYPE_DASH, /**< Player URI type Mpeg Dash */
137 MM_PLAYER_URI_TYPE_NO_PERMISSION, /**< Player URI type No Permission */
138 MM_PLAYER_URI_TYPE_TEMP, /**< Player URI type Temp */
141 typedef enum _MissingCodec {
142 MISSING_PLUGIN_NONE = 0x00,
143 MISSING_PLUGIN_AUDIO = 0x01,
144 MISSING_PLUGIN_VIDEO = 0x02
148 typedef enum _FoundCodec {
149 FOUND_PLUGIN_NONE = 0x00,
150 FOUND_PLUGIN_AUDIO = 0x01,
151 FOUND_PLUGIN_VIDEO = 0x02
155 * Enumeration of signal type
158 MM_PLAYER_SIGNAL_TYPE_AUTOPLUG = 0,
159 MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
160 MM_PLAYER_SIGNAL_TYPE_AUDIOBIN,
161 MM_PLAYER_SIGNAL_TYPE_TEXTBIN,
162 MM_PLAYER_SIGNAL_TYPE_OTHERS,
163 MM_PLAYER_SIGNAL_TYPE_ALL,
164 MM_PLAYER_SIGNAL_TYPE_MAX = MM_PLAYER_SIGNAL_TYPE_ALL,
165 } MMPlayerSignalType;
167 /* main pipeline's element id */
169 MMPLAYER_M_PIPE = 0, /* NOTE : MMPLAYER_M_PIPE should be zero */
171 MMPLAYER_M_2ND_SRC, /* 2nd Source Element for es buff src */
174 /* it could be a decodebin or could be a typefind. depends on player ini */
178 MMPLAYER_M_AUTOPLUG_V_DEC,
179 MMPLAYER_M_AUTOPLUG_A_DEC,
181 /* NOTE : we need two fakesink to autoplug without decodebin.
182 * first one will hold whole pipeline state. and second one will hold state of
183 * a sink-decodebin for an elementary stream. no metter if there's more then one
184 * elementary streams because MSL reuse it.
186 MMPLAYER_M_SRC_FAKESINK,
187 MMPLAYER_M_SRC_2ND_FAKESINK,
189 /* streaming plugin */
190 MMPLAYER_M_MUXED_S_BUFFER,
191 MMPLAYER_M_DEMUXED_S_BUFFER,
193 MMPLAYER_M_ADAPTIVE_DEMUX,
195 /* es buff src queue */
200 /* FIXIT : if there's really no usage for following IDs. remove it */
208 MMPLAYER_M_V_INPUT_SELECTOR, // video input_select
209 MMPLAYER_M_A_INPUT_SELECTOR, // audio input_select
210 MMPLAYER_M_T_INPUT_SELECTOR, // text input_select
216 MMPLAYER_M_A_DEINTERLEAVE,
217 MMPLAYER_M_A_SELECTOR,
223 /* audio pipeline's element id */
224 enum AudioElementID {
225 MMPLAYER_A_BIN = 0, /* NOTE : MMPLAYER_A_BIN should be zero */
230 MMPLAYER_A_FILTER_SEC,
231 MMPLAYER_A_CAPS_DEFAULT,
232 MMPLAYER_A_CONV_BFORMAT,
235 MMPLAYER_A_RESAMPLER,
236 MMPLAYER_A_DEINTERLEAVE,
240 /* video pipeline's element id */
241 enum VideoElementID {
242 MMPLAYER_V_BIN = 0, /* NOTE : MMPLAYER_V_BIN should be zero */
252 /* text pipeline's element id */
254 MMPLAYER_T_BIN = 0, /* NOTE : MMPLAYER_V_BIN should be zero */
256 MMPLAYER_T_VIDEO_QUEUE,
257 MMPLAYER_T_VIDEO_CONVERTER,
259 MMPLAYER_T_FAKE_SINK,
264 /* midi main pipeline's element id */
267 MMPLAYER_MIDI_PLAYER,
271 enum PlayerCommandState {
272 MMPLAYER_COMMAND_NONE,
273 MMPLAYER_COMMAND_CREATE,
274 MMPLAYER_COMMAND_DESTROY,
275 MMPLAYER_COMMAND_UNREALIZE,
276 MMPLAYER_COMMAND_START,
277 MMPLAYER_COMMAND_REALIZE,
278 MMPLAYER_COMMAND_STOP,
279 MMPLAYER_COMMAND_PAUSE,
280 MMPLAYER_COMMAND_RESUME,
284 /* Note : StreamingSrcError is error enum for streaming source which post error message
285 * using custom message made by itself. The enum value must start with zero,
286 * because the streaming source(secrtspsrc) also does.
288 enum StreamingSrcError {
289 MMPLAYER_STREAMING_ERROR_NONE = 0,
290 MMPLAYER_STREAMING_ERROR_UNSUPPORTED_AUDIO,
291 MMPLAYER_STREAMING_ERROR_UNSUPPORTED_VIDEO,
292 MMPLAYER_STREAMING_ERROR_CONNECTION_FAIL,
293 MMPLAYER_STREAMING_ERROR_DNS_FAIL,
294 MMPLAYER_STREAMING_ERROR_SERVER_DISCONNECTED,
295 MMPLAYER_STREAMING_ERROR_BAD_SERVER,
296 MMPLAYER_STREAMING_ERROR_INVALID_PROTOCOL,
297 MMPLAYER_STREAMING_ERROR_INVALID_URL,
298 MMPLAYER_STREAMING_ERROR_UNEXPECTED_MSG,
299 MMPLAYER_STREAMING_ERROR_OUT_OF_MEMORIES,
300 MMPLAYER_STREAMING_ERROR_RTSP_TIMEOUT,
301 MMPLAYER_STREAMING_ERROR_BAD_REQUEST,
302 MMPLAYER_STREAMING_ERROR_NOT_AUTHORIZED,
303 MMPLAYER_STREAMING_ERROR_PAYMENT_REQUIRED,
304 MMPLAYER_STREAMING_ERROR_FORBIDDEN,
305 MMPLAYER_STREAMING_ERROR_CONTENT_NOT_FOUND,
306 MMPLAYER_STREAMING_ERROR_METHOD_NOT_ALLOWED,
307 MMPLAYER_STREAMING_ERROR_NOT_ACCEPTABLE,
308 MMPLAYER_STREAMING_ERROR_PROXY_AUTHENTICATION_REQUIRED,
309 MMPLAYER_STREAMING_ERROR_SERVER_TIMEOUT,
310 MMPLAYER_STREAMING_ERROR_GONE,
311 MMPLAYER_STREAMING_ERROR_LENGTH_REQUIRED,
312 MMPLAYER_STREAMING_ERROR_PRECONDITION_FAILED,
313 MMPLAYER_STREAMING_ERROR_REQUEST_ENTITY_TOO_LARGE,
314 MMPLAYER_STREAMING_ERROR_REQUEST_URI_TOO_LARGE,
315 MMPLAYER_STREAMING_ERROR_UNSUPPORTED_MEDIA_TYPE,
316 MMPLAYER_STREAMING_ERROR_PARAMETER_NOT_UNDERSTOOD,
317 MMPLAYER_STREAMING_ERROR_CONFERENCE_NOT_FOUND,
318 MMPLAYER_STREAMING_ERROR_NOT_ENOUGH_BANDWIDTH,
319 MMPLAYER_STREAMING_ERROR_NO_SESSION_ID,
320 MMPLAYER_STREAMING_ERROR_METHOD_NOT_VALID_IN_THIS_STATE,
321 MMPLAYER_STREAMING_ERROR_HEADER_FIELD_NOT_VALID_FOR_SOURCE,
322 MMPLAYER_STREAMING_ERROR_INVALID_RANGE,
323 MMPLAYER_STREAMING_ERROR_PARAMETER_IS_READONLY,
324 MMPLAYER_STREAMING_ERROR_AGGREGATE_OP_NOT_ALLOWED,
325 MMPLAYER_STREAMING_ERROR_ONLY_AGGREGATE_OP_ALLOWED,
326 MMPLAYER_STREAMING_ERROR_BAD_TRANSPORT,
327 MMPLAYER_STREAMING_ERROR_DESTINATION_UNREACHABLE,
328 MMPLAYER_STREAMING_ERROR_INTERNAL_SERVER_ERROR,
329 MMPLAYER_STREAMING_ERROR_NOT_IMPLEMENTED,
330 MMPLAYER_STREAMING_ERROR_BAD_GATEWAY,
331 MMPLAYER_STREAMING_ERROR_SERVICE_UNAVAILABLE,
332 MMPLAYER_STREAMING_ERROR_GATEWAY_TIME_OUT ,
333 MMPLAYER_STREAMING_ERROR_RTSP_VERSION_NOT_SUPPORTED,
334 MMPLAYER_STREAMING_ERROR_OPTION_NOT_SUPPORTED,
338 MMPLAYER_PATH_VOD = 0,
343 /* Video360 related enums. These are duplication from video360.h from
347 VIDEO360_MODE_UNKNOWN = -1,
348 VIDEO360_MODE_MONOSCOPIC = 0,
349 VIDEO360_MODE_STEREOSCOPIC_TOP_BOTTOM = 1,
350 VIDEO360_MODE_STEREOSCOPIC_LEFT_RIGHT = 2,
351 VIDEO360_MODE_STEREOSCOPIC_STEREO_MESH = 3,
352 VIDEO360_MODE_LAST_ITEM
353 } mm_player_stereo_mode_e;
356 VIDEO360_PROJECTION_TYPE_UNKNOWN = -1,
357 VIDEO360_PROJECTION_TYPE_EQUIRECTANGULAR = 0,
358 VIDEO360_PROJECTION_TYPE_CUBEMAP = 1,
359 VIDEO360_PROJECTION_TYPE_MESH = 2,
360 VIDEO360_PROJECTION_TYPE_LAST_ITEM
361 } mm_player_projection_type_e;
363 /* Spatial audio related enums. These are duplication from mm_file.h from
367 MMFILE_AMBISONIC_TYPE_UNKNOWN = 0,
368 MMFILE_AMBISONIC_TYPE_PERIPHONIC = 1, /**< To comply with Google's Spatial Audio RFC*/
369 MMFILE_AMBISONIC_TYPE_NON_PERIPHONIC = 2,
370 } MMFILE_AMBISONIC_TYPE;
373 MMFILE_AMBISONIC_FORMAT_UNKNOWN = 0,
374 MMFILE_AMBISONIC_FORMAT_AMBIX = 1, /**< AMBIX (Channel sequence: ACN, Normalization: SN3D) */
375 MMFILE_AMBISONIC_FORMAT_AMB = 2, /**< .AMB, Tetraproc (Channel sequence: FuMa, Normalization: FuMa) */
376 MMFILE_AMBISONIC_FORMAT_UA = 3, /**< Universal Ambisonics (Channel sequence: SID, Normalization: N3D) */
377 } MMFILE_AMBISONIC_FORMAT;
380 MMFILE_AMBISONIC_ORDER_UNKNOWN = 0,
381 MMFILE_AMBISONIC_ORDER_FOA = 1, /**< First order Ambisonics */
382 MMFILE_AMBISONIC_ORDER_SOA = 2, /**< Second order Ambisonics */
383 MMFILE_AMBISONIC_ORDER_TOA = 3, /**< Third order Ambisonics */
384 } MMFILE_AMBISONIC_ORDER;
386 /*---------------------------------------------------------------------------
387 | GLOBAL DATA TYPE DEFINITIONS: |
388 ---------------------------------------------------------------------------*/
393 } MMPlayerGstElement;
396 GstTagList *tag_list;
397 MMPlayerGstElement *mainbin;
398 MMPlayerGstElement *audiobin;
399 MMPlayerGstElement *videobin;
400 MMPlayerGstElement *textbin;
401 } MMPlayerGstPipelineInfo;
406 int bluetooth; /* enable/disable */
414 } tBuffer; /* FIXIT : choose better name */
421 char uri[MM_MAX_URL_LEN];
422 char urgent[MM_MAX_FILENAME_LEN];
423 } MMPlayerParseProfile;
427 storage_state_e state;
429 } MMPlayerStorageInfo;
433 MMPlayerPosFormatType format;
435 } MMPlayerPendingSeek;
440 } MMPlayerSignalItem;
446 bool video_zc; // video zero-copy
448 bool media_packet_video_stream;
452 GMainContext *global_default;
453 GMainContext *thread_default;
454 } MMPlayerGMainContext;
462 gint active_pad_index;
463 gint total_track_num;
466 gulong event_probe_id;
467 } mm_player_selector_t;
472 gboolean stream_changed;
473 gboolean reconfigure;
475 GstClockTime start_time[MM_PLAYER_TRACK_TYPE_MAX]; /* updated once get SEGMENT event */
476 GstSegment segment[MM_PLAYER_TRACK_TYPE_MAX];
477 gboolean update_segment[MM_PLAYER_TRACK_TYPE_MAX];
479 } mm_player_gapless_t;
485 bool is_little_endian;
486 guint64 channel_mask;
490 } mm_player_audio_stream_buff_t;
493 * @brief data of video_bo_list
494 * @details this will be used when the sw codec is running.
500 } mm_player_video_bo_info_t;
511 } MMAdaptiveVariantInfo;
516 char *stitching_software;
517 char *projection_type_string;
518 char *stereo_mode_string;
519 mm_player_projection_type_e projection_type;
520 mm_player_stereo_mode_e stereo_mode;
522 int init_view_heading;
526 int full_pano_width_pixels;
527 int full_pano_height_pixels;
528 int cropped_area_image_width;
529 int cropped_area_image_height;
530 int cropped_area_left;
531 int cropped_area_top;
533 int ambisonic_format;
535 } mm_player_spherical_metadata_t;
539 int state; // player current state
540 int prev_state; // player previous state
541 int pending_state; // player state which is going to now
542 int target_state; // player state which user want to go to
543 guint state_change_timeout;
545 gboolean section_repeat;
546 gint section_repeat_start;
547 gint section_repeat_end;
556 GMutex playback_lock;
558 /* repeat thread lock */
559 GCond repeat_thread_cond;
560 GMutex repeat_thread_mutex;
561 GThread* repeat_thread;
562 gboolean repeat_thread_exit;
564 /* next play thread */
565 GThread* next_play_thread;
566 gboolean next_play_thread_exit;
567 GCond next_play_thread_cond;
568 GMutex next_play_thread_mutex;
569 mm_player_gapless_t gapless;
572 GThread* capture_thread;
573 gboolean capture_thread_exit;
574 GCond capture_thread_cond;
575 GMutex capture_thread_mutex;
576 MMPlayerVideoCapture capture;
577 MMPlayerVideoColorspace video_cs;
578 MMVideoBuffer captured;
580 /* fakesink handling lock */
583 /* update tag lock */
584 GMutex update_tag_lock;
586 /* player attributes */
589 /* message callback */
590 MMMessageCallback msg_cb;
593 /* progressive download */
594 mm_player_pd_t *pd_downloader;
595 gchar *pd_file_save_path;
596 MMPlayerPDMode pd_mode;
598 /* streaming player */
599 mm_player_streaming_t *streamer;
600 gchar *http_file_buffering_path;
602 /* gstreamer pipeline */
603 MMPlayerGstPipelineInfo *pipeline;
606 GstPad *ghost_pad_for_videobin;
608 guint64 media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_MAX];
609 guint media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_MAX];
610 mm_player_media_stream_buffer_status_callback media_stream_buffer_status_cb[MM_PLAYER_STREAM_TYPE_MAX];
611 mm_player_media_stream_seek_data_callback media_stream_seek_data_cb[MM_PLAYER_STREAM_TYPE_MAX];
612 GMutex media_stream_cb_lock;
614 int video_num_buffers; /* total num of buffers in vcodec */
615 int video_extra_num_buffers; /* extra num of buffers in vcodec */
617 void* buffer_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
618 void* seek_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
620 /* video stream changed callback */
621 mm_player_stream_changed_callback video_stream_changed_cb;
622 void* video_stream_changed_cb_user_param;
624 /* audio stream changed callback */
625 mm_player_stream_changed_callback audio_stream_changed_cb;
626 void* audio_stream_changed_cb_user_param;
628 /* video stream callback */
629 mm_player_video_stream_callback video_stream_cb;
630 void* video_stream_cb_user_param;
632 GMutex video_bo_mutex;
633 GList* video_bo_list; /* mm_player_video_bo_info_t, bo list for decoded video data by sw codec */
635 bool video_stream_prerolled;
637 /* audio stram callback */
638 mm_player_audio_stream_callback audio_stream_cb;
639 void* audio_stream_cb_user_param;
640 bool audio_stream_sink_sync;
641 GList* audio_stream_buff_list; /* mm_player_audio_stream_buff_t, buff list of extract pcm data */
643 /* audio buffer callback */
644 mm_player_audio_stream_callback_ex audio_stream_render_cb_ex;
646 /* video capture callback*/
647 gulong video_capture_cb_probe_id;
650 MMPlayerSoundInfo sound;
655 /* video stream caps parsed by demuxer */
656 GstCaps* v_stream_caps;
658 /* audio effect infomation */
659 MMAudioEffectInfo audio_effect_info;
660 gboolean bypass_audio_effect;
662 gulong audio_cb_probe_id;
667 /* content profile */
668 MMPlayerParseProfile profile;
669 MMPlayerStorageInfo storage_info[MMPLAYER_PATH_MAX];
671 /* streaming service type */
672 MMStreamingType streaming_type;
676 gboolean have_dynamic_pad;
677 GList* parsers; // list of linked parser name
678 GList* audio_decoders; // list of linked audio name
679 gboolean no_more_pad;
680 gint num_dynamic_pad;
681 gboolean has_many_types;
683 /* progress callback timer */
684 /* FIXIT : since duplicated functionality with get_position
685 * this function will be deprecated after fixing all application
686 * which are using it.
688 guint progress_timer;
690 /* timer for sending delayed EOS */
693 /* last point (msec) that player is paused or seeking */
694 gint64 last_position;
699 /* data size of http streaming */
700 guint64 http_content_size;
703 gchar last_error_msg[1024]; /* FIXIT : should it be dynamic ? */
705 gboolean smooth_streaming;
707 gint videodec_linked;
708 gint audiodec_linked;
709 gint videosink_linked;
710 gint audiosink_linked;
711 gint textsink_linked;
713 /* missing plugin during autoplugging */
714 MissingCodec not_supported_codec;
716 /* unlinked audio/video mime type */
717 gchar *unlinked_video_mime;
718 gchar *unlinked_audio_mime;
719 gchar *unlinked_demuxer_mime;
721 /* found codec during autoplugging */
722 FoundCodec can_support_codec;
724 gboolean not_found_demuxer;
726 /* support seek even though player is not start */
727 MMPlayerPendingSeek pending_seek;
731 /* prevent to post msg over and over */
734 /* list of sink elements */
735 GList* sink_elements;
737 /* signal notifiers */
738 GList* signals[MM_PLAYER_SIGNAL_TYPE_MAX];
740 MMPlayerGMainContext context;
741 MMPlayerUriList uri_info;
743 gboolean is_sound_extraction;
745 gfloat playback_rate;
747 /* player state resumed by fast rewind */
748 gboolean resumed_by_rewind;
750 gboolean is_nv12_tiled;
752 /* resource manager for H/W resources */
753 MMPlayerResourceManager resource_manager[RESOURCE_TYPE_MAX];
755 /* sound focus for being compatible with legacy session policy internally */
756 MMPlayerSoundFocus sound_focus;
758 gboolean is_subtitle_off;
759 gboolean is_external_subtitle_present;
760 gboolean is_external_subtitle_added_now;
761 gboolean pending_resume;
763 /* contents bitrate for buffering management */
764 guint bitrate[MM_PLAYER_STREAM_COUNT_MAX];
766 guint updated_bitrate_count;
767 guint maximum_bitrate[MM_PLAYER_STREAM_COUNT_MAX];
768 guint total_maximum_bitrate;
769 guint updated_maximum_bitrate_count;
771 /* prevent it from posting duplicatly*/
774 /* timeout source for lazy pause */
775 guint resume_event_id;
776 guint resumable_cancel_id;
778 gboolean play_subtitle;
779 gboolean is_subtitle_force_drop; // set TRUE after bus_cb get EOS
781 /* PD downloader message callback and param */
782 MMMessageCallback pd_msg_cb;
783 void* pd_msg_cb_param;
785 /* adjust subtitle position store */
786 gint64 adjust_subtitle_pos;
787 GList *subtitle_language_list;
789 /* To store the current multiwindow status */
790 gboolean last_multiwin_status;
792 /* To store the current running audio pad index of demuxer */
793 gint demux_pad_index;
795 mm_player_selector_t selector[MM_PLAYER_TRACK_TYPE_MAX];
796 mm_player_selector_t audio_mode;
797 gboolean use_deinterleave;
798 guint max_audio_channels;
800 guint internal_text_idx;
801 guint external_text_idx;
803 MMPlayerSetMode set_mode;
805 /* initialize values */
808 /* video share sync */
809 gint64 video_share_api_delta;
810 gint64 video_share_clock_delta;
812 /* just for native app (video hub) */
813 gboolean video_hub_download_mode;
814 gboolean sync_handler;
816 /* store dump pad list */
819 /* whether a video has closed caption or not */
820 gboolean has_closed_caption;
822 GstElement *video_fakesink;
824 /* audio stream caps parsed by demuxer or set by external demuxer */
825 GstCaps* a_stream_caps;
827 /* subtitle stream caps parsed by demuxer or set by external demuxer */
828 GstCaps* s_stream_caps;
830 /* es player using feed-data callback or calling app_src_push_buffer directly*/
831 gboolean es_player_push_mode;
833 /* tmb buffer manager for s/w codec tmb_bo */
839 MMAdaptiveVariantInfo adaptive_info;
841 /* Video360 related stuff
843 bool is_content_spherical;
844 mm_player_spherical_metadata_t video360_metadata;
845 bool is_openal_plugin_used;
846 bool is_video360_plugin_used;
847 /* User settable values */
848 bool is_video360_enabled;
849 float video360_yaw_radians;
850 float video360_pitch_radians;
852 int video360_horizontal_fov;
853 int video360_vertical_fov;
858 gchar *language_code;
861 } MMPlayerLangStruct;
865 gulong probe_handle_id;
866 FILE *dump_element_file;
874 int valid_type; // validity type
875 int value_min; //<- set validity value range
879 /*===========================================================================================
881 | GLOBAL FUNCTION PROTOTYPES |
883 ========================================================================================== */
888 int _mmplayer_create_player(MMHandleType hplayer);
889 int _mmplayer_destroy(MMHandleType hplayer);
890 int _mmplayer_realize(MMHandleType hplayer);
891 int _mmplayer_unrealize(MMHandleType hplayer);
892 int _mmplayer_get_state(MMHandleType hplayer, int* pstate);
893 int _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume);
894 int _mmplayer_get_volume(MMHandleType hplayer, MMPlayerVolumeType *volume);
895 int _mmplayer_set_mute(MMHandleType hplayer, int mute);
896 int _mmplayer_get_mute(MMHandleType hplayer, int* pmute);
897 int _mmplayer_start(MMHandleType hplayer);
898 int _mmplayer_stop(MMHandleType hplayer);
899 int _mmplayer_pause(MMHandleType hplayer);
900 int _mmplayer_resume(MMHandleType hplayer);
901 int _mmplayer_set_position(MMHandleType hplayer, int format, int pos);
902 int _mmplayer_get_position(MMHandleType hplayer, int format, unsigned long *pos);
903 int _mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int pos);
904 int _mmplayer_adjust_video_postion(MMHandleType hplayer, int offset);
905 int _mmplayer_activate_section_repeat(MMHandleType hplayer, unsigned long start, unsigned long end);
906 int _mmplayer_deactivate_section_repeat(MMHandleType hplayer);
907 int _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming);
908 int _mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback callback, void *user_param);
909 int _mmplayer_set_videostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param);
910 int _mmplayer_set_audiostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param);
911 int _mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callback callback, void *user_param);
912 int _mmplayer_set_audiostream_cb(MMHandleType hplayer, mm_player_audio_stream_callback callback, void *user_param);
913 int _mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent);
914 int _mmplayer_get_subtitle_silent(MMHandleType hplayer, int* silent);
915 int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char* filepath);
916 int _mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos);
918 /* test API for tuning audio gain. this API should be
919 * deprecated before the day of final release
921 int _mmplayer_set_volume_tune(MMHandleType hplayer, MMPlayerVolumeType volume);
922 int _mmplayer_update_video_param(mm_player_t* player, char *param_name);
923 int _mmplayer_set_audiobuffer_cb(MMHandleType hplayer, mm_player_audio_stream_callback callback, void *user_param);
924 int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface_type, void *display_overlay);
925 int _mmplayer_audio_effect_custom_apply(mm_player_t *player);
927 int _mmplayer_set_audiostream_cb_ex(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param);
928 gboolean __mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype, MMMessageParamType* param);
930 int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index);
931 int _mmplayer_sync_subtitle_pipeline(mm_player_t* player);
932 int _mmplayer_set_video_hub_download_mode(MMHandleType hplayer, bool mode);
933 int _mmplayer_use_system_clock(MMHandleType hplayer);
934 int _mmplayer_set_video_share_master_clock(MMHandleType hplayer, long long clock, long long clock_delta, long long video_time, long long media_clock, long long audio_time);
935 int _mmplayer_get_video_share_master_clock(MMHandleType hplayer, long long *video_time, long long *media_clock, long long *audio_time);
936 int _mmplayer_get_video_rotate_angle(MMHandleType hplayer, int *angle);
937 int _mmplayer_enable_sync_handler(MMHandleType hplayer, bool enable);
938 int _mmplayer_set_file_buffering_path(MMHandleType hplayer, const char* file_path);
939 int _mmplayer_set_uri(MMHandleType hplayer, const char* uri);
940 int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_path);
941 int _mmplayer_get_next_uri(MMHandleType hplayer, char** uri);
942 int _mmplayer_has_closed_caption(MMHandleType hplayer, bool* exist);
943 void _mm_player_video_stream_internal_buffer_unref(void *buffer);
944 int _mmplayer_set_pcm_spec(MMHandleType hplayer, int samplerate, int channel);
945 int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout);
946 int _mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *extra_num);
947 int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int state);
948 int __mmplayer_gst_set_state(mm_player_t* player, GstElement * pipeline, GstState state, gboolean async, gint timeout);
949 int __mmplayer_set_state(mm_player_t* player, int state);
950 int __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command);
951 gboolean __mmplayer_dump_pipeline_state(mm_player_t* player);
952 void __mmplayer_remove_g_source_from_context(GMainContext *context, guint source_id);
954 const gchar * __get_state_name(int state);
955 gboolean __mmplayer_can_do_interrupt(mm_player_t *player);
956 gboolean __is_streaming(mm_player_t* player);
957 gboolean __is_rtsp_streaming(mm_player_t* player);
958 gboolean __is_live_streaming(mm_player_t* player);
959 gboolean __is_http_streaming(mm_player_t* player);
960 gboolean __is_http_live_streaming(mm_player_t* player);
961 gboolean __is_dash_streaming(mm_player_t* player);
962 gboolean __is_smooth_streaming(mm_player_t* player);
963 gboolean __is_http_progressive_down(mm_player_t* player);
965 gboolean __mmplayer_check_useful_message(mm_player_t *player, GstMessage * message);
966 gboolean __mmplayer_handle_gst_error(mm_player_t* player, GstMessage * message, GError* error);
967 gint __gst_handle_core_error(mm_player_t* player, int code);
968 gint __gst_handle_library_error(mm_player_t* player, int code);
969 gint __gst_handle_resource_error(mm_player_t* player, int code, GstMessage * message);
970 gint __gst_handle_stream_error(mm_player_t* player, GError* error, GstMessage * message);
971 int _mmplayer_sound_register_with_pid(MMHandleType hplayer, int pid);
972 int _mmplayer_get_client_pid(MMHandleType hplayer, int* pid);
973 int __mmplayer_get_video_angle(mm_player_t* player, int *user_angle, int *org_angle);
974 int _mmplayer_video_stream_release_bo(mm_player_t* player, void* bo);
975 int _mmplayer_get_adaptive_variant_info(MMHandleType hplayer, int *num, char **var_info);
976 int _mmplayer_set_max_adaptive_variant_limit(MMHandleType hplayer, int bandwidth, int width, int height);
977 int _mmplayer_get_max_adaptive_variant_limit(MMHandleType hplayer, int *bandwidth, int *width, int *height);
978 int _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only);
979 int _mmplayer_get_audio_only(MMHandleType hplayer, bool *paudio_only);
980 int _mmplayer_set_streaming_buffering_time(MMHandleType hplayer, int buffer_ms, int rebuffer_ms);
981 int _mmplayer_get_streaming_buffering_time(MMHandleType hplayer, int *buffer_ms, int *rebuffer_ms);
987 #endif /* __MM_PLAYER_PRIV_H__ */