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_resource_manager.h>
47 #include "mm_player_pd.h"
48 #include "mm_player_streaming.h"
50 /*===========================================================================================
52 | GLOBAL DEFINITIONS AND DECLARATIONS FOR MODULE |
54 ========================================================================================== */
56 /*---------------------------------------------------------------------------
58 ---------------------------------------------------------------------------*/
59 #define MM_PLAYER_IMGB_MPLANE_MAX 4
60 #define MM_PLAYER_STREAM_COUNT_MAX 3
62 #define MM_PLAYER_CAST(x_player) ((mm_player_t *)(x_player))
64 * @x_player: MMHandleType of player
66 * Get the PD downloader of this player.
68 #define MM_PLAYER_GET_PD(x_player) (MM_PLAYER_CAST(x_player)->pd_downloader)
70 * @x_player: MMHandleType of player
72 * Get the attributes handle of this player.
74 #define MM_PLAYER_GET_ATTRS(x_player) (MM_PLAYER_CAST(x_player)->attrs)
76 #define ROTATION_USING_SINK 0
77 #define ROTATION_USING_CUSTOM 1
78 #define ROTATION_USING_FLIP 2
80 #define MM_MAX_STRING_LENGTH 4000 /* have to be less than MUSE_MSG_MAX_LENGTH */
82 #define VIDEO360_MAX_ZOOM 10.0f
84 /*---------------------------------------------------------------------------
85 | GLOBAL CONSTANT DEFINITIONS: |
86 ---------------------------------------------------------------------------*/
88 AUDIO_LATENCY_MODE_LOW = 0, /**< Low audio latency mode */
89 AUDIO_LATENCY_MODE_MID, /**< Middle audio latency mode */
90 AUDIO_LATENCY_MODE_HIGH, /**< High audio latency mode */
94 TAG_AUDIO_CODEC = 0x0001,
95 TAG_VIDEO_CODEC = 0x0002,
100 TAG_COPYRIGHT = 0x0040,
102 TAG_DESCRIPTION = 0x0100,
103 TAG_TRACK_NUMBER = 0x0200
106 enum content_attr_flag {
107 ATTR_MISSING_ONLY = 0x0001,
108 ATTR_DURATION = 0x0002,
111 ATTR_BITRATE = 0x0010,
115 enum MMPlayerSinkType {
116 MMPLAYER_VIDEO_SINK = 0x01,
117 MMPLAYER_AUDIO_SINK = 0x02,
118 MMPLAYER_TEXT_SINK = 0x04,
119 MMPLAYER_SINK_ALL = 0x07,
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,
241 /* video pipeline's element id */
242 enum VideoElementID {
243 MMPLAYER_V_BIN = 0, /* NOTE : MMPLAYER_V_BIN should be zero */
253 /* text pipeline's element id */
255 MMPLAYER_T_BIN = 0, /* NOTE : MMPLAYER_V_BIN should be zero */
257 MMPLAYER_T_VIDEO_QUEUE,
258 MMPLAYER_T_VIDEO_CONVERTER,
260 MMPLAYER_T_FAKE_SINK,
265 /* midi main pipeline's element id */
268 MMPLAYER_MIDI_PLAYER,
272 enum PlayerCommandState {
273 MMPLAYER_COMMAND_NONE,
274 MMPLAYER_COMMAND_CREATE,
275 MMPLAYER_COMMAND_DESTROY,
276 MMPLAYER_COMMAND_UNREALIZE,
277 MMPLAYER_COMMAND_START,
278 MMPLAYER_COMMAND_REALIZE,
279 MMPLAYER_COMMAND_STOP,
280 MMPLAYER_COMMAND_PAUSE,
281 MMPLAYER_COMMAND_RESUME,
285 /* Note : StreamingSrcError is error enum for streaming source which post error message
286 * using custom message made by itself. The enum value must start with zero,
287 * because the streaming source(secrtspsrc) also does.
289 enum StreamingSrcError {
290 MMPLAYER_STREAMING_ERROR_NONE = 0,
291 MMPLAYER_STREAMING_ERROR_UNSUPPORTED_AUDIO,
292 MMPLAYER_STREAMING_ERROR_UNSUPPORTED_VIDEO,
293 MMPLAYER_STREAMING_ERROR_CONNECTION_FAIL,
294 MMPLAYER_STREAMING_ERROR_DNS_FAIL,
295 MMPLAYER_STREAMING_ERROR_SERVER_DISCONNECTED,
296 MMPLAYER_STREAMING_ERROR_BAD_SERVER,
297 MMPLAYER_STREAMING_ERROR_INVALID_PROTOCOL,
298 MMPLAYER_STREAMING_ERROR_INVALID_URL,
299 MMPLAYER_STREAMING_ERROR_UNEXPECTED_MSG,
300 MMPLAYER_STREAMING_ERROR_OUT_OF_MEMORIES,
301 MMPLAYER_STREAMING_ERROR_RTSP_TIMEOUT,
302 MMPLAYER_STREAMING_ERROR_BAD_REQUEST,
303 MMPLAYER_STREAMING_ERROR_NOT_AUTHORIZED,
304 MMPLAYER_STREAMING_ERROR_PAYMENT_REQUIRED,
305 MMPLAYER_STREAMING_ERROR_FORBIDDEN,
306 MMPLAYER_STREAMING_ERROR_CONTENT_NOT_FOUND,
307 MMPLAYER_STREAMING_ERROR_METHOD_NOT_ALLOWED,
308 MMPLAYER_STREAMING_ERROR_NOT_ACCEPTABLE,
309 MMPLAYER_STREAMING_ERROR_PROXY_AUTHENTICATION_REQUIRED,
310 MMPLAYER_STREAMING_ERROR_SERVER_TIMEOUT,
311 MMPLAYER_STREAMING_ERROR_GONE,
312 MMPLAYER_STREAMING_ERROR_LENGTH_REQUIRED,
313 MMPLAYER_STREAMING_ERROR_PRECONDITION_FAILED,
314 MMPLAYER_STREAMING_ERROR_REQUEST_ENTITY_TOO_LARGE,
315 MMPLAYER_STREAMING_ERROR_REQUEST_URI_TOO_LARGE,
316 MMPLAYER_STREAMING_ERROR_UNSUPPORTED_MEDIA_TYPE,
317 MMPLAYER_STREAMING_ERROR_PARAMETER_NOT_UNDERSTOOD,
318 MMPLAYER_STREAMING_ERROR_CONFERENCE_NOT_FOUND,
319 MMPLAYER_STREAMING_ERROR_NOT_ENOUGH_BANDWIDTH,
320 MMPLAYER_STREAMING_ERROR_NO_SESSION_ID,
321 MMPLAYER_STREAMING_ERROR_METHOD_NOT_VALID_IN_THIS_STATE,
322 MMPLAYER_STREAMING_ERROR_HEADER_FIELD_NOT_VALID_FOR_SOURCE,
323 MMPLAYER_STREAMING_ERROR_INVALID_RANGE,
324 MMPLAYER_STREAMING_ERROR_PARAMETER_IS_READONLY,
325 MMPLAYER_STREAMING_ERROR_AGGREGATE_OP_NOT_ALLOWED,
326 MMPLAYER_STREAMING_ERROR_ONLY_AGGREGATE_OP_ALLOWED,
327 MMPLAYER_STREAMING_ERROR_BAD_TRANSPORT,
328 MMPLAYER_STREAMING_ERROR_DESTINATION_UNREACHABLE,
329 MMPLAYER_STREAMING_ERROR_INTERNAL_SERVER_ERROR,
330 MMPLAYER_STREAMING_ERROR_NOT_IMPLEMENTED,
331 MMPLAYER_STREAMING_ERROR_BAD_GATEWAY,
332 MMPLAYER_STREAMING_ERROR_SERVICE_UNAVAILABLE,
333 MMPLAYER_STREAMING_ERROR_GATEWAY_TIME_OUT ,
334 MMPLAYER_STREAMING_ERROR_RTSP_VERSION_NOT_SUPPORTED,
335 MMPLAYER_STREAMING_ERROR_OPTION_NOT_SUPPORTED,
339 MMPLAYER_SEEK_NONE = 0,
340 MMPLAYER_SEEK_IN_PROGRESS,
341 MMPLAYER_SEEK_COMPLETED, /* after getting async done but before posting seek complete */
345 MMPLAYER_PATH_VOD = 0,
350 /* Video360 related enums. These are duplication from video360.h from
354 VIDEO360_MODE_UNKNOWN = -1,
355 VIDEO360_MODE_MONOSCOPIC = 0,
356 VIDEO360_MODE_STEREOSCOPIC_TOP_BOTTOM = 1,
357 VIDEO360_MODE_STEREOSCOPIC_LEFT_RIGHT = 2,
358 VIDEO360_MODE_STEREOSCOPIC_STEREO_MESH = 3,
359 VIDEO360_MODE_LAST_ITEM
360 } mm_player_stereo_mode_e;
363 VIDEO360_PROJECTION_TYPE_UNKNOWN = -1,
364 VIDEO360_PROJECTION_TYPE_EQUIRECTANGULAR = 0,
365 VIDEO360_PROJECTION_TYPE_CUBEMAP = 1,
366 VIDEO360_PROJECTION_TYPE_MESH = 2,
367 VIDEO360_PROJECTION_TYPE_LAST_ITEM
368 } mm_player_projection_type_e;
370 /* Spatial audio related enums. These are duplication from mm_file.h from
374 MMFILE_AMBISONIC_TYPE_UNKNOWN = 0,
375 MMFILE_AMBISONIC_TYPE_PERIPHONIC = 1, /**< To comply with Google's Spatial Audio RFC*/
376 MMFILE_AMBISONIC_TYPE_NON_PERIPHONIC = 2,
377 } MMFILE_AMBISONIC_TYPE;
380 MMFILE_AMBISONIC_FORMAT_UNKNOWN = 0,
381 MMFILE_AMBISONIC_FORMAT_AMBIX = 1, /**< AMBIX (Channel sequence: ACN, Normalization: SN3D) */
382 MMFILE_AMBISONIC_FORMAT_AMB = 2, /**< .AMB, Tetraproc (Channel sequence: FuMa, Normalization: FuMa) */
383 MMFILE_AMBISONIC_FORMAT_UA = 3, /**< Universal Ambisonics (Channel sequence: SID, Normalization: N3D) */
384 } MMFILE_AMBISONIC_FORMAT;
387 MMFILE_AMBISONIC_ORDER_UNKNOWN = 0,
388 MMFILE_AMBISONIC_ORDER_FOA = 1, /**< First order Ambisonics */
389 MMFILE_AMBISONIC_ORDER_SOA = 2, /**< Second order Ambisonics */
390 MMFILE_AMBISONIC_ORDER_TOA = 3, /**< Third order Ambisonics */
391 } MMFILE_AMBISONIC_ORDER;
393 /*---------------------------------------------------------------------------
394 | GLOBAL DATA TYPE DEFINITIONS: |
395 ---------------------------------------------------------------------------*/
400 } MMPlayerGstElement;
403 GstTagList *tag_list;
404 MMPlayerGstElement *mainbin;
405 MMPlayerGstElement *audiobin;
406 MMPlayerGstElement *videobin;
407 MMPlayerGstElement *textbin;
408 } MMPlayerGstPipelineInfo;
413 int bluetooth; /* enable/disable */
422 } MMPlayerInputBuffer;
427 MMPlayerInputBuffer input_mem;
428 char uri[MM_MAX_URL_LEN];
429 char urgent[MM_MAX_FILENAME_LEN];
430 } MMPlayerParseProfile;
434 storage_state_e state;
436 char path[MM_MAX_URL_LEN];
437 } MMPlayerStorageInfo;
441 MMPlayerPosFormatType format;
443 } MMPlayerPendingSeek;
448 } MMPlayerSignalItem;
454 bool video_zc; // video zero-copy
456 bool media_packet_video_stream;
460 GMainContext *global_default;
461 GMainContext *thread_default;
462 } MMPlayerGMainContext;
470 gint active_pad_index;
471 gint total_track_num;
474 gulong event_probe_id;
475 } mm_player_selector_t;
480 gboolean stream_changed;
481 gboolean reconfigure;
483 GstClockTime start_time[MM_PLAYER_TRACK_TYPE_MAX]; /* updated once get SEGMENT event */
484 GstSegment segment[MM_PLAYER_TRACK_TYPE_MAX];
485 gboolean update_segment[MM_PLAYER_TRACK_TYPE_MAX];
487 } mm_player_gapless_t;
493 bool is_little_endian;
494 guint64 channel_mask;
498 } mm_player_audio_stream_buff_t;
501 * @brief data of video_bo_list
502 * @details this will be used when the sw codec is running.
508 } mm_player_video_bo_info_t;
519 } MMAdaptiveVariantInfo;
524 char *stitching_software;
525 char *projection_type_string;
526 char *stereo_mode_string;
527 mm_player_projection_type_e projection_type;
528 mm_player_stereo_mode_e stereo_mode;
530 int init_view_heading;
534 int full_pano_width_pixels;
535 int full_pano_height_pixels;
536 int cropped_area_image_width;
537 int cropped_area_image_height;
538 int cropped_area_left;
539 int cropped_area_top;
541 int ambisonic_format;
543 } mm_player_spherical_metadata_t;
547 int state; // player current state
548 int prev_state; // player previous state
549 int pending_state; // player state which is going to now
550 int target_state; // player state which user want to go to
551 guint state_change_timeout;
559 GMutex playback_lock;
561 /* next play thread */
562 GThread* next_play_thread;
563 gboolean next_play_thread_exit;
564 GCond next_play_thread_cond;
565 GMutex next_play_thread_mutex;
566 mm_player_gapless_t gapless;
569 GThread* capture_thread;
570 gboolean capture_thread_exit;
571 GCond capture_thread_cond;
572 GMutex capture_thread_mutex;
573 MMPlayerVideoCapture capture;
574 MMPlayerVideoColorspace video_cs;
575 MMVideoBuffer captured;
577 /* gst bus msg thread, create during realize */
578 GThread* bus_msg_thread;
579 gboolean bus_msg_thread_exit;
580 GCond bus_msg_thread_cond;
581 GMutex bus_msg_thread_mutex;
583 /* fakesink handling lock */
586 /* update tag lock */
587 GMutex update_tag_lock;
589 /* player attributes */
592 /* message callback */
593 MMMessageCallback msg_cb;
596 /* progressive download */
597 mm_player_pd_t *pd_downloader;
598 gchar *pd_file_save_path;
599 MMPlayerPDMode pd_mode;
601 /* streaming player */
602 mm_player_streaming_t *streamer;
603 gchar *http_file_buffering_path;
605 /* gstreamer pipeline */
606 MMPlayerGstPipelineInfo *pipeline;
609 GstPad *ghost_pad_for_videobin;
611 guint64 media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_MAX];
612 guint media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_MAX];
613 mm_player_media_stream_buffer_status_callback media_stream_buffer_status_cb[MM_PLAYER_STREAM_TYPE_MAX];
614 mm_player_media_stream_seek_data_callback media_stream_seek_data_cb[MM_PLAYER_STREAM_TYPE_MAX];
615 GMutex media_stream_cb_lock;
617 int video_num_buffers; /* total num of buffers in vcodec */
618 int video_extra_num_buffers; /* extra num of buffers in vcodec */
620 void* buffer_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
621 void* seek_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
623 /* video stream changed callback */
624 mm_player_stream_changed_callback video_stream_changed_cb;
625 void* video_stream_changed_cb_user_param;
627 /* audio stream changed callback */
628 mm_player_stream_changed_callback audio_stream_changed_cb;
629 void* audio_stream_changed_cb_user_param;
631 /* video stream callback */
632 mm_player_video_stream_callback video_stream_cb;
633 void* video_stream_cb_user_param;
635 GMutex video_bo_mutex;
636 GList* video_bo_list; /* mm_player_video_bo_info_t, bo list for decoded video data by sw codec */
638 bool video_stream_prerolled;
640 /* audio stram callback */
641 mm_player_audio_stream_callback audio_stream_cb;
642 void* audio_stream_cb_user_param;
643 bool audio_stream_sink_sync;
644 GList* audio_stream_buff_list; /* mm_player_audio_stream_buff_t, buff list of extract pcm data */
646 /* audio buffer callback */
647 mm_player_audio_stream_callback_ex audio_stream_render_cb_ex;
649 /* video capture callback*/
650 gulong video_capture_cb_probe_id;
653 MMPlayerSoundInfo sound;
658 /* video stream caps parsed by demuxer */
659 GstCaps* v_stream_caps;
661 /* audio effect infomation */
662 MMAudioEffectInfo audio_effect_info;
663 gboolean bypass_audio_effect;
665 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 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;
728 MMPlayerSeekState seek_state;
730 /* prevent to post msg over and over */
733 /* list of sink elements */
734 GList* sink_elements;
736 /* signal notifiers */
737 GList* signals[MM_PLAYER_SIGNAL_TYPE_MAX];
740 GMutex bus_msg_q_lock;
741 MMPlayerGMainContext context;
742 MMPlayerUriList uri_info;
744 gboolean is_sound_extraction;
746 gfloat playback_rate;
748 /* player state resumed by fast rewind */
749 gboolean resumed_by_rewind;
751 gboolean is_nv12_tiled;
753 /* resource manager for H/W resources */
754 mm_resource_manager_h resource_manager;
755 mm_resource_manager_res_h video_overlay_resource;
756 mm_resource_manager_res_h video_decoder_resource;
757 gboolean interrupted_by_resource;
759 gboolean is_subtitle_off;
760 gboolean is_external_subtitle_present;
761 gboolean is_external_subtitle_added_now;
762 gboolean pending_resume;
764 /* contents bitrate for buffering management */
765 guint bitrate[MM_PLAYER_STREAM_COUNT_MAX];
767 guint maximum_bitrate[MM_PLAYER_STREAM_COUNT_MAX];
768 guint total_maximum_bitrate;
770 /* prevent it from posting duplicatly*/
773 gboolean play_subtitle;
774 gboolean is_subtitle_force_drop; // set TRUE after bus_cb get EOS
776 /* PD downloader message callback and param */
777 MMMessageCallback pd_msg_cb;
778 void* pd_msg_cb_param;
780 /* adjust subtitle position store */
781 gint64 adjust_subtitle_pos;
782 GList *subtitle_language_list;
783 GCond subtitle_info_cond;
784 GMutex subtitle_info_mutex;
786 /* To store the current multiwindow status */
787 gboolean last_multiwin_status;
789 /* To store the current running audio pad index of demuxer */
790 gint demux_pad_index;
792 mm_player_selector_t selector[MM_PLAYER_TRACK_TYPE_MAX];
793 mm_player_selector_t audio_mode;
794 gboolean use_deinterleave;
795 guint max_audio_channels;
797 guint internal_text_idx;
798 guint external_text_idx;
800 MMPlayerSetMode set_mode;
802 /* initialize values */
805 /* video share sync */
806 gint64 video_share_api_delta;
807 gint64 video_share_clock_delta;
809 /* just for native app (video hub) */
810 gboolean video_hub_download_mode;
811 gboolean sync_handler;
813 /* store dump pad list */
816 /* whether a video has closed caption or not */
817 gboolean has_closed_caption;
819 GstElement *video_fakesink;
821 /* audio stream caps parsed by demuxer or set by external demuxer */
822 GstCaps* a_stream_caps;
824 /* subtitle stream caps parsed by demuxer or set by external demuxer */
825 GstCaps* s_stream_caps;
827 /* es player using feed-data callback or calling app_src_push_buffer directly*/
828 gboolean es_player_push_mode;
830 /* tmb buffer manager for s/w codec tmb_bo */
836 MMAdaptiveVariantInfo adaptive_info;
838 /* Video360 related stuff
840 gboolean is_360_feature_enabled;
841 gboolean is_content_spherical;
842 mm_player_spherical_metadata_t video360_metadata;
843 gboolean is_openal_plugin_used;
844 /* User settable values */
845 gboolean is_video360_enabled;
846 float video360_yaw_radians;
847 float video360_pitch_radians;
849 int video360_horizontal_fov;
850 int video360_vertical_fov;
855 gchar *language_code;
858 } MMPlayerLangStruct;
862 gulong probe_handle_id;
863 FILE *dump_element_file;
871 int valid_type; // validity type
872 int value_min; //<- set validity value range
876 /*===========================================================================================
878 | GLOBAL FUNCTION PROTOTYPES |
880 ========================================================================================== */
885 int _mmplayer_create_player(MMHandleType hplayer);
886 int _mmplayer_destroy(MMHandleType hplayer);
887 int _mmplayer_realize(MMHandleType hplayer);
888 int _mmplayer_unrealize(MMHandleType hplayer);
889 int _mmplayer_get_state(MMHandleType hplayer, int* pstate);
890 int _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume);
891 int _mmplayer_get_volume(MMHandleType hplayer, MMPlayerVolumeType *volume);
892 int _mmplayer_set_mute(MMHandleType hplayer, int mute);
893 int _mmplayer_get_mute(MMHandleType hplayer, int* pmute);
894 int _mmplayer_start(MMHandleType hplayer);
895 int _mmplayer_stop(MMHandleType hplayer);
896 int _mmplayer_pause(MMHandleType hplayer);
897 int _mmplayer_resume(MMHandleType hplayer);
898 int _mmplayer_set_position(MMHandleType hplayer, int format, gint64 pos);
899 int _mmplayer_get_position(MMHandleType hplayer, int format, gint64 *pos);
900 int _mmplayer_get_duration(MMHandleType hplayer, gint64 *duration);
901 int _mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int pos);
902 int _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming);
903 int _mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback callback, void *user_param);
904 int _mmplayer_set_videostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param);
905 int _mmplayer_set_audiostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param);
906 int _mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callback callback, void *user_param);
907 int _mmplayer_set_audiostream_cb(MMHandleType hplayer, mm_player_audio_stream_callback callback, void *user_param);
908 int _mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent);
909 int _mmplayer_get_subtitle_silent(MMHandleType hplayer, int* silent);
910 int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char* filepath);
911 int _mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos);
913 /* test API for tuning audio gain. this API should be
914 * deprecated before the day of final release
916 int _mmplayer_set_volume_tune(MMHandleType hplayer, MMPlayerVolumeType volume);
917 int _mmplayer_update_video_param(mm_player_t* player, char *param_name);
918 int _mmplayer_set_audiobuffer_cb(MMHandleType hplayer, mm_player_audio_stream_callback callback, void *user_param);
919 int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface_type, void *display_overlay);
920 int _mmplayer_audio_effect_custom_apply(mm_player_t *player);
922 int _mmplayer_set_audiostream_cb_ex(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param);
923 gboolean __mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype, MMMessageParamType* param);
925 int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index);
926 int _mmplayer_sync_subtitle_pipeline(mm_player_t* player);
927 int _mmplayer_set_video_hub_download_mode(MMHandleType hplayer, bool mode);
928 int _mmplayer_use_system_clock(MMHandleType hplayer);
929 int _mmplayer_set_video_share_master_clock(MMHandleType hplayer, gint64 clock, gint64 clock_delta, gint64 video_time, gint64 media_clock, gint64 audio_time);
930 int _mmplayer_get_video_share_master_clock(MMHandleType hplayer, gint64 *video_time, gint64 *media_clock, gint64 *audio_time);
931 int _mmplayer_enable_sync_handler(MMHandleType hplayer, bool enable);
932 int _mmplayer_set_file_buffering_path(MMHandleType hplayer, const char* file_path);
933 int _mmplayer_set_uri(MMHandleType hplayer, const char* uri);
934 int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_path);
935 int _mmplayer_get_next_uri(MMHandleType hplayer, char** uri);
936 int _mmplayer_has_closed_caption(MMHandleType hplayer, bool* exist);
937 void _mm_player_video_stream_internal_buffer_unref(void *buffer);
938 int _mmplayer_set_pcm_spec(MMHandleType hplayer, int samplerate, int channel);
939 int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout);
940 int _mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *extra_num);
941 int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int state);
942 int __mmplayer_gst_set_state(mm_player_t* player, GstElement * pipeline, GstState state, gboolean async, gint timeout);
943 void __mmplayer_set_state(mm_player_t* player, int state);
944 int __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command);
945 gboolean __mmplayer_dump_pipeline_state(mm_player_t* player);
946 void __mmplayer_remove_g_source_from_context(GMainContext *context, guint source_id);
947 void _mmplayer_bus_msg_thread_destroy(MMHandleType hplayer);
950 const gchar* __get_state_name(int state);
951 const gchar* __get_stream_type_name(int type);
953 gboolean __mmplayer_can_do_interrupt(mm_player_t *player);
954 gboolean __is_streaming(mm_player_t* player);
955 gboolean __is_rtsp_streaming(mm_player_t* player);
956 gboolean __is_live_streaming(mm_player_t* player);
957 gboolean __is_http_streaming(mm_player_t* player);
958 gboolean __is_http_live_streaming(mm_player_t* player);
959 gboolean __is_dash_streaming(mm_player_t* player);
960 gboolean __is_smooth_streaming(mm_player_t* player);
961 gboolean __is_http_progressive_down(mm_player_t* player);
963 gboolean __mmplayer_check_useful_message(mm_player_t *player, GstMessage * message);
964 gboolean __mmplayer_handle_gst_error(mm_player_t* player, GstMessage * message, GError* error);
965 gint __gst_handle_core_error(mm_player_t* player, int code);
966 gint __gst_handle_library_error(mm_player_t* player, int code);
967 gint __gst_handle_resource_error(mm_player_t* player, int code, GstMessage * message);
968 gint __gst_handle_stream_error(mm_player_t* player, GError* error, GstMessage * message);
969 int __mmplayer_get_video_angle(mm_player_t* player, int *user_angle, int *org_angle);
970 int _mmplayer_video_stream_release_bo(mm_player_t* player, void* bo);
971 int _mmplayer_get_adaptive_variant_info(MMHandleType hplayer, int *num, char **var_info);
972 int _mmplayer_set_max_adaptive_variant_limit(MMHandleType hplayer, int bandwidth, int width, int height);
973 int _mmplayer_get_max_adaptive_variant_limit(MMHandleType hplayer, int *bandwidth, int *width, int *height);
974 int _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only);
975 int _mmplayer_get_audio_only(MMHandleType hplayer, bool *paudio_only);
976 int _mmplayer_set_streaming_buffering_time(MMHandleType hplayer, int buffer_ms, int rebuffer_ms);
977 int _mmplayer_get_streaming_buffering_time(MMHandleType hplayer, int *buffer_ms, int *rebuffer_ms);
978 int _mmplayer_set_codec_type(MMHandleType hplayer, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type);
979 int _mmplayer_set_replaygain_enabled(MMHandleType hplayer, bool enabled);
980 int _mmplayer_is_replaygain_enabled(MMHandleType hplayer, bool *enabled);
986 #endif /* __MM_PLAYER_PRIV_H__ */