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 MM_MAX_STRING_LENGTH 4000 /* have to be less than MUSE_MSG_MAX_LENGTH */
78 #define VIDEO360_MAX_ZOOM 10.0f
80 /*---------------------------------------------------------------------------
81 | GLOBAL CONSTANT DEFINITIONS: |
82 ---------------------------------------------------------------------------*/
84 AUDIO_LATENCY_MODE_LOW = 0, /**< Low audio latency mode */
85 AUDIO_LATENCY_MODE_MID, /**< Middle audio latency mode */
86 AUDIO_LATENCY_MODE_HIGH, /**< High audio latency mode */
90 TAG_AUDIO_CODEC = 0x0001,
91 TAG_VIDEO_CODEC = 0x0002,
96 TAG_COPYRIGHT = 0x0040,
98 TAG_DESCRIPTION = 0x0100,
99 TAG_TRACK_NUMBER = 0x0200
102 enum content_attr_flag {
103 ATTR_MISSING_ONLY = 0x0001,
104 ATTR_DURATION = 0x0002,
107 ATTR_BITRATE = 0x0010,
111 enum MMPlayerSinkType {
112 MMPLAYER_VIDEO_SINK = 0x01,
113 MMPLAYER_AUDIO_SINK = 0x02,
114 MMPLAYER_TEXT_SINK = 0x04,
115 MMPLAYER_SINK_ALL = 0x07,
119 * Enumerations of Player Uri type
121 enum MMPlayerUriType {
122 MM_PLAYER_URI_TYPE_NONE, /**< Player URI type None */
123 MM_PLAYER_URI_TYPE_URL_RTSP, /**< Player URI type RTSP */
124 MM_PLAYER_URI_TYPE_URL_HTTP, /**< Player URI type HTTP */
125 MM_PLAYER_URI_TYPE_URL_MMS, /**< Player URI type MMS */
126 MM_PLAYER_URI_TYPE_MEM, /**< Player URI type Mem */
127 MM_PLAYER_URI_TYPE_FILE, /**< Player URI type File */
128 MM_PLAYER_URI_TYPE_URL, /**< Player URI type URL */
129 MM_PLAYER_URI_TYPE_MS_BUFF, /**< Player URI type Media Stream Buffer */
130 MM_PLAYER_URI_TYPE_HLS, /**< Player URI type http live streaming */
131 MM_PLAYER_URI_TYPE_SS, /**< Player URI type Smooth streaming */
132 MM_PLAYER_URI_TYPE_DASH, /**< Player URI type Mpeg Dash */
133 MM_PLAYER_URI_TYPE_NO_PERMISSION, /**< Player URI type No Permission */
134 MM_PLAYER_URI_TYPE_TEMP, /**< Player URI type Temp */
137 typedef enum _MissingCodec {
138 MISSING_PLUGIN_NONE = 0x00,
139 MISSING_PLUGIN_AUDIO = 0x01,
140 MISSING_PLUGIN_VIDEO = 0x02
144 typedef enum _FoundCodec {
145 FOUND_PLUGIN_NONE = 0x00,
146 FOUND_PLUGIN_AUDIO = 0x01,
147 FOUND_PLUGIN_VIDEO = 0x02
151 * Enumeration of signal type
154 MM_PLAYER_SIGNAL_TYPE_AUTOPLUG = 0,
155 MM_PLAYER_SIGNAL_TYPE_VIDEOBIN,
156 MM_PLAYER_SIGNAL_TYPE_AUDIOBIN,
157 MM_PLAYER_SIGNAL_TYPE_TEXTBIN,
158 MM_PLAYER_SIGNAL_TYPE_OTHERS,
159 MM_PLAYER_SIGNAL_TYPE_ALL,
160 MM_PLAYER_SIGNAL_TYPE_MAX = MM_PLAYER_SIGNAL_TYPE_ALL,
161 } MMPlayerSignalType;
163 /* main pipeline's element id */
165 MMPLAYER_M_PIPE = 0, /* NOTE : MMPLAYER_M_PIPE should be zero */
167 MMPLAYER_M_2ND_SRC, /* 2nd Source Element for es buff src */
170 /* it could be a decodebin or could be a typefind. depends on player ini */
174 MMPLAYER_M_AUTOPLUG_V_DEC,
175 MMPLAYER_M_AUTOPLUG_A_DEC,
177 /* NOTE : we need two fakesink to autoplug without decodebin.
178 * first one will hold whole pipeline state. and second one will hold state of
179 * a sink-decodebin for an elementary stream. no metter if there's more then one
180 * elementary streams because MSL reuse it.
182 MMPLAYER_M_SRC_FAKESINK,
183 MMPLAYER_M_SRC_2ND_FAKESINK,
185 /* streaming plugin */
186 MMPLAYER_M_MUXED_S_BUFFER,
187 MMPLAYER_M_DEMUXED_S_BUFFER,
189 MMPLAYER_M_ADAPTIVE_DEMUX,
191 /* es buff src queue */
196 /* FIXIT : if there's really no usage for following IDs. remove it */
204 MMPLAYER_M_V_INPUT_SELECTOR, // video input_select
205 MMPLAYER_M_A_INPUT_SELECTOR, // audio input_select
206 MMPLAYER_M_T_INPUT_SELECTOR, // text input_select
212 MMPLAYER_M_A_DEINTERLEAVE,
213 MMPLAYER_M_A_SELECTOR,
219 /* audio pipeline's element id */
220 enum AudioElementID {
221 MMPLAYER_A_BIN = 0, /* NOTE : MMPLAYER_A_BIN should be zero */
226 MMPLAYER_A_FILTER_SEC,
227 MMPLAYER_A_CAPS_DEFAULT,
228 MMPLAYER_A_CONV_BFORMAT,
231 MMPLAYER_A_RESAMPLER,
232 MMPLAYER_A_DEINTERLEAVE,
237 /* video pipeline's element id */
238 enum VideoElementID {
239 MMPLAYER_V_BIN = 0, /* NOTE : MMPLAYER_V_BIN should be zero */
249 /* text pipeline's element id */
251 MMPLAYER_T_BIN = 0, /* NOTE : MMPLAYER_V_BIN should be zero */
253 MMPLAYER_T_VIDEO_QUEUE,
254 MMPLAYER_T_VIDEO_CONVERTER,
256 MMPLAYER_T_FAKE_SINK,
261 /* midi main pipeline's element id */
264 MMPLAYER_MIDI_PLAYER,
268 enum PlayerCommandState {
269 MMPLAYER_COMMAND_NONE,
270 MMPLAYER_COMMAND_CREATE,
271 MMPLAYER_COMMAND_DESTROY,
272 MMPLAYER_COMMAND_UNREALIZE,
273 MMPLAYER_COMMAND_START,
274 MMPLAYER_COMMAND_REALIZE,
275 MMPLAYER_COMMAND_STOP,
276 MMPLAYER_COMMAND_PAUSE,
277 MMPLAYER_COMMAND_RESUME,
281 /* Note : StreamingSrcError is error enum for streaming source which post error message
282 * using custom message made by itself. The enum value must start with zero,
283 * because the streaming source(secrtspsrc) also does.
285 enum StreamingSrcError {
286 MMPLAYER_STREAMING_ERROR_NONE = 0,
287 MMPLAYER_STREAMING_ERROR_UNSUPPORTED_AUDIO,
288 MMPLAYER_STREAMING_ERROR_UNSUPPORTED_VIDEO,
289 MMPLAYER_STREAMING_ERROR_CONNECTION_FAIL,
290 MMPLAYER_STREAMING_ERROR_DNS_FAIL,
291 MMPLAYER_STREAMING_ERROR_SERVER_DISCONNECTED,
292 MMPLAYER_STREAMING_ERROR_BAD_SERVER,
293 MMPLAYER_STREAMING_ERROR_INVALID_PROTOCOL,
294 MMPLAYER_STREAMING_ERROR_INVALID_URL,
295 MMPLAYER_STREAMING_ERROR_UNEXPECTED_MSG,
296 MMPLAYER_STREAMING_ERROR_OUT_OF_MEMORIES,
297 MMPLAYER_STREAMING_ERROR_RTSP_TIMEOUT,
298 MMPLAYER_STREAMING_ERROR_BAD_REQUEST,
299 MMPLAYER_STREAMING_ERROR_NOT_AUTHORIZED,
300 MMPLAYER_STREAMING_ERROR_PAYMENT_REQUIRED,
301 MMPLAYER_STREAMING_ERROR_FORBIDDEN,
302 MMPLAYER_STREAMING_ERROR_CONTENT_NOT_FOUND,
303 MMPLAYER_STREAMING_ERROR_METHOD_NOT_ALLOWED,
304 MMPLAYER_STREAMING_ERROR_NOT_ACCEPTABLE,
305 MMPLAYER_STREAMING_ERROR_PROXY_AUTHENTICATION_REQUIRED,
306 MMPLAYER_STREAMING_ERROR_SERVER_TIMEOUT,
307 MMPLAYER_STREAMING_ERROR_GONE,
308 MMPLAYER_STREAMING_ERROR_LENGTH_REQUIRED,
309 MMPLAYER_STREAMING_ERROR_PRECONDITION_FAILED,
310 MMPLAYER_STREAMING_ERROR_REQUEST_ENTITY_TOO_LARGE,
311 MMPLAYER_STREAMING_ERROR_REQUEST_URI_TOO_LARGE,
312 MMPLAYER_STREAMING_ERROR_UNSUPPORTED_MEDIA_TYPE,
313 MMPLAYER_STREAMING_ERROR_PARAMETER_NOT_UNDERSTOOD,
314 MMPLAYER_STREAMING_ERROR_CONFERENCE_NOT_FOUND,
315 MMPLAYER_STREAMING_ERROR_NOT_ENOUGH_BANDWIDTH,
316 MMPLAYER_STREAMING_ERROR_NO_SESSION_ID,
317 MMPLAYER_STREAMING_ERROR_METHOD_NOT_VALID_IN_THIS_STATE,
318 MMPLAYER_STREAMING_ERROR_HEADER_FIELD_NOT_VALID_FOR_SOURCE,
319 MMPLAYER_STREAMING_ERROR_INVALID_RANGE,
320 MMPLAYER_STREAMING_ERROR_PARAMETER_IS_READONLY,
321 MMPLAYER_STREAMING_ERROR_AGGREGATE_OP_NOT_ALLOWED,
322 MMPLAYER_STREAMING_ERROR_ONLY_AGGREGATE_OP_ALLOWED,
323 MMPLAYER_STREAMING_ERROR_BAD_TRANSPORT,
324 MMPLAYER_STREAMING_ERROR_DESTINATION_UNREACHABLE,
325 MMPLAYER_STREAMING_ERROR_INTERNAL_SERVER_ERROR,
326 MMPLAYER_STREAMING_ERROR_NOT_IMPLEMENTED,
327 MMPLAYER_STREAMING_ERROR_BAD_GATEWAY,
328 MMPLAYER_STREAMING_ERROR_SERVICE_UNAVAILABLE,
329 MMPLAYER_STREAMING_ERROR_GATEWAY_TIME_OUT ,
330 MMPLAYER_STREAMING_ERROR_RTSP_VERSION_NOT_SUPPORTED,
331 MMPLAYER_STREAMING_ERROR_OPTION_NOT_SUPPORTED,
335 MMPLAYER_SEEK_NONE = 0,
336 MMPLAYER_SEEK_IN_PROGRESS,
337 MMPLAYER_SEEK_COMPLETED, /* after getting async done but before posting seek complete */
341 MMPLAYER_PATH_VOD = 0,
346 /* Video360 related enums. These are duplication from video360.h from
350 VIDEO360_MODE_UNKNOWN = -1,
351 VIDEO360_MODE_MONOSCOPIC = 0,
352 VIDEO360_MODE_STEREOSCOPIC_TOP_BOTTOM = 1,
353 VIDEO360_MODE_STEREOSCOPIC_LEFT_RIGHT = 2,
354 VIDEO360_MODE_STEREOSCOPIC_STEREO_MESH = 3,
355 VIDEO360_MODE_LAST_ITEM
356 } mm_player_stereo_mode_e;
359 VIDEO360_PROJECTION_TYPE_UNKNOWN = -1,
360 VIDEO360_PROJECTION_TYPE_EQUIRECTANGULAR = 0,
361 VIDEO360_PROJECTION_TYPE_CUBEMAP = 1,
362 VIDEO360_PROJECTION_TYPE_MESH = 2,
363 VIDEO360_PROJECTION_TYPE_LAST_ITEM
364 } mm_player_projection_type_e;
366 /* Spatial audio related enums. These are duplication from mm_file.h from
370 MMFILE_AMBISONIC_TYPE_UNKNOWN = 0,
371 MMFILE_AMBISONIC_TYPE_PERIPHONIC = 1, /**< To comply with Google's Spatial Audio RFC*/
372 MMFILE_AMBISONIC_TYPE_NON_PERIPHONIC = 2,
373 } MMFILE_AMBISONIC_TYPE;
376 MMFILE_AMBISONIC_FORMAT_UNKNOWN = 0,
377 MMFILE_AMBISONIC_FORMAT_AMBIX = 1, /**< AMBIX (Channel sequence: ACN, Normalization: SN3D) */
378 MMFILE_AMBISONIC_FORMAT_AMB = 2, /**< .AMB, Tetraproc (Channel sequence: FuMa, Normalization: FuMa) */
379 MMFILE_AMBISONIC_FORMAT_UA = 3, /**< Universal Ambisonics (Channel sequence: SID, Normalization: N3D) */
380 } MMFILE_AMBISONIC_FORMAT;
383 MMFILE_AMBISONIC_ORDER_UNKNOWN = 0,
384 MMFILE_AMBISONIC_ORDER_FOA = 1, /**< First order Ambisonics */
385 MMFILE_AMBISONIC_ORDER_SOA = 2, /**< Second order Ambisonics */
386 MMFILE_AMBISONIC_ORDER_TOA = 3, /**< Third order Ambisonics */
387 } MMFILE_AMBISONIC_ORDER;
389 /*---------------------------------------------------------------------------
390 | GLOBAL DATA TYPE DEFINITIONS: |
391 ---------------------------------------------------------------------------*/
396 } MMPlayerGstElement;
399 GstTagList *tag_list;
400 MMPlayerGstElement *mainbin;
401 MMPlayerGstElement *audiobin;
402 MMPlayerGstElement *videobin;
403 MMPlayerGstElement *textbin;
404 } MMPlayerGstPipelineInfo;
409 int bluetooth; /* enable/disable */
418 } MMPlayerInputBuffer;
423 MMPlayerInputBuffer input_mem;
424 char uri[MM_MAX_URL_LEN];
425 char urgent[MM_MAX_FILENAME_LEN];
426 } MMPlayerParseProfile;
430 storage_state_e state;
432 char path[MM_MAX_URL_LEN];
433 } MMPlayerStorageInfo;
438 } MMPlayerPendingSeek;
443 } MMPlayerSignalItem;
449 bool video_zc; // video zero-copy
451 bool media_packet_video_stream;
455 GMainContext *global_default;
456 GMainContext *thread_default;
457 } MMPlayerGMainContext;
472 gint active_pad_index;
473 gint total_track_num;
476 gulong event_probe_id;
477 } mm_player_selector_t;
482 gboolean stream_changed;
483 gboolean reconfigure;
485 GstClockTime start_time[MM_PLAYER_TRACK_TYPE_MAX]; /* updated once get SEGMENT event */
486 GstSegment segment[MM_PLAYER_TRACK_TYPE_MAX];
487 gboolean update_segment[MM_PLAYER_TRACK_TYPE_MAX];
489 } mm_player_gapless_t;
495 bool is_little_endian;
496 guint64 channel_mask;
500 } mm_player_audio_stream_buff_t;
503 * @brief data of video_bo_list
504 * @details this will be used when the sw codec is running.
510 } mm_player_video_bo_info_t;
521 } MMAdaptiveVariantInfo;
526 char *stitching_software;
527 char *projection_type_string;
528 char *stereo_mode_string;
529 mm_player_projection_type_e projection_type;
530 mm_player_stereo_mode_e stereo_mode;
532 int init_view_heading;
536 int full_pano_width_pixels;
537 int full_pano_height_pixels;
538 int cropped_area_image_width;
539 int cropped_area_image_height;
540 int cropped_area_left;
541 int cropped_area_top;
543 int ambisonic_format;
545 } mm_player_spherical_metadata_t;
549 int state; // player current state
550 int prev_state; // player previous state
551 int pending_state; // player state which is going to now
552 int target_state; // player state which user want to go to
553 guint state_change_timeout;
561 GMutex playback_lock;
563 /* next play thread */
564 GThread* next_play_thread;
565 gboolean next_play_thread_exit;
566 GCond next_play_thread_cond;
567 GMutex next_play_thread_mutex;
568 mm_player_gapless_t gapless;
571 GThread* capture_thread;
572 gboolean capture_thread_exit;
573 GCond capture_thread_cond;
574 GMutex capture_thread_mutex;
575 MMPlayerVideoCapture capture;
576 MMPlayerVideoColorspace video_cs;
577 MMVideoBuffer captured;
579 /* gst bus msg thread, create during realize */
580 GThread* bus_msg_thread;
581 gboolean bus_msg_thread_exit;
582 GCond bus_msg_thread_cond;
583 GMutex bus_msg_thread_mutex;
585 /* fakesink handling lock */
588 /* update tag lock */
589 GMutex update_tag_lock;
591 /* player attributes */
594 /* message callback */
595 MMMessageCallback msg_cb;
598 /* progressive download */
599 mm_player_pd_t *pd_downloader;
600 gchar *pd_file_save_path;
601 MMPlayerPDMode pd_mode;
603 /* streaming player */
604 mm_player_streaming_t *streamer;
605 gchar *http_file_buffering_path;
607 /* gstreamer pipeline */
608 MMPlayerGstPipelineInfo *pipeline;
611 GstPad *ghost_pad_for_videobin;
613 guint64 media_stream_buffer_max_size[MM_PLAYER_STREAM_TYPE_MAX];
614 guint media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_MAX];
615 mm_player_media_stream_buffer_status_callback media_stream_buffer_status_cb[MM_PLAYER_STREAM_TYPE_MAX];
616 mm_player_media_stream_seek_data_callback media_stream_seek_data_cb[MM_PLAYER_STREAM_TYPE_MAX];
617 GMutex media_stream_cb_lock;
619 int video_num_buffers; /* total num of buffers in vcodec */
620 int video_extra_num_buffers; /* extra num of buffers in vcodec */
622 void* buffer_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
623 void* seek_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
625 /* video stream changed callback */
626 mm_player_stream_changed_callback video_stream_changed_cb;
627 void* video_stream_changed_cb_user_param;
629 /* audio stream changed callback */
630 mm_player_stream_changed_callback audio_stream_changed_cb;
631 void* audio_stream_changed_cb_user_param;
633 /* video stream callback */
634 mm_player_video_stream_callback video_stream_cb;
635 void* video_stream_cb_user_param;
637 GMutex video_bo_mutex;
638 GList* video_bo_list; /* mm_player_video_bo_info_t, bo list for decoded video data by sw codec */
640 bool video_stream_prerolled;
642 /* audio stram callback */
643 mm_player_audio_stream_callback audio_stream_cb;
644 void* audio_stream_cb_user_param;
645 bool audio_stream_sink_sync;
646 GList* audio_stream_buff_list; /* mm_player_audio_stream_buff_t, buff list of extract pcm data */
648 /* audio buffer callback */
649 mm_player_audio_stream_callback_ex audio_stream_render_cb_ex;
651 /* video capture callback*/
652 gulong video_capture_cb_probe_id;
655 MMPlayerSoundInfo sound;
660 /* video stream caps parsed by demuxer */
661 GstCaps* v_stream_caps;
663 /* audio effect infomation */
664 MMAudioEffectInfo audio_effect_info;
665 gboolean bypass_audio_effect;
667 gulong audio_cb_probe_id;
669 /* content profile */
670 MMPlayerParseProfile profile;
671 MMPlayerStorageInfo storage_info[MMPLAYER_PATH_MAX];
673 /* streaming service type */
674 MMStreamingType streaming_type;
678 gboolean have_dynamic_pad;
679 GList* parsers; // list of linked parser name
680 GList* audio_decoders; // list of linked audio name
681 gboolean no_more_pad;
682 gint num_dynamic_pad;
683 gboolean has_many_types;
685 /* progress callback timer */
686 /* FIXIT : since duplicated functionality with get_position
687 * this function will be deprecated after fixing all application
688 * which are using it.
690 guint progress_timer;
692 /* timer for sending delayed EOS */
695 /* last point that player is paused or seeking */
696 gint64 last_position;
701 /* data size of http streaming */
702 guint64 http_content_size;
705 gchar last_error_msg[1024]; /* FIXIT : should it be dynamic ? */
707 gboolean smooth_streaming;
709 gint videodec_linked;
710 gint audiodec_linked;
711 gint videosink_linked;
712 gint audiosink_linked;
713 gint textsink_linked;
715 /* missing plugin during autoplugging */
716 MissingCodec not_supported_codec;
718 /* unlinked audio/video mime type */
719 gchar *unlinked_video_mime;
720 gchar *unlinked_audio_mime;
721 gchar *unlinked_demuxer_mime;
723 /* found codec during autoplugging */
724 FoundCodec can_support_codec;
726 gboolean not_found_demuxer;
728 /* support seek even though player is not start */
729 MMPlayerPendingSeek pending_seek;
730 MMPlayerSeekState seek_state;
732 /* prevent to post msg over and over */
735 /* list of sink elements */
736 GList* sink_elements;
738 /* signal notifiers */
739 GList* signals[MM_PLAYER_SIGNAL_TYPE_MAX];
742 GMutex bus_msg_q_lock;
743 MMPlayerGMainContext context;
744 MMPlayerUriList uri_info;
746 gboolean is_sound_extraction;
748 gfloat playback_rate;
750 /* player state resumed by fast rewind */
751 gboolean resumed_by_rewind;
753 gboolean is_nv12_tiled;
755 /* resource manager for H/W resources */
756 mm_resource_manager_h resource_manager;
757 mm_resource_manager_res_h video_overlay_resource;
758 mm_resource_manager_res_h video_decoder_resource;
759 gboolean interrupted_by_resource;
761 gboolean is_subtitle_off;
762 gboolean is_external_subtitle_present;
763 gboolean is_external_subtitle_added_now;
764 gboolean pending_resume;
766 /* contents bitrate for buffering management */
767 guint bitrate[MM_PLAYER_STREAM_COUNT_MAX];
769 guint maximum_bitrate[MM_PLAYER_STREAM_COUNT_MAX];
770 guint total_maximum_bitrate;
772 /* prevent it from posting duplicatly*/
775 gboolean play_subtitle;
776 gboolean is_subtitle_force_drop; // set TRUE after bus_cb get EOS
778 /* PD downloader message callback and param */
779 MMMessageCallback pd_msg_cb;
780 void* pd_msg_cb_param;
782 /* adjust subtitle position store */
783 gint64 adjust_subtitle_pos;
784 GList *subtitle_language_list;
785 GCond subtitle_info_cond;
786 GMutex subtitle_info_mutex;
788 /* To store the current multiwindow status */
789 gboolean last_multiwin_status;
791 /* To store the current running audio pad index of demuxer */
792 gint demux_pad_index;
794 mm_player_selector_t selector[MM_PLAYER_TRACK_TYPE_MAX];
795 mm_player_selector_t audio_mode;
796 gboolean use_deinterleave;
797 guint max_audio_channels;
799 guint internal_text_idx;
800 guint external_text_idx;
802 MMPlayerSetMode set_mode;
804 /* initialize values */
807 /* video share sync */
808 gint64 video_share_api_delta;
809 gint64 video_share_clock_delta;
811 /* just for native app (video hub) */
812 gboolean video_hub_download_mode;
813 gboolean sync_handler;
815 /* store dump pad list */
818 /* whether a video has closed caption or not */
819 gboolean has_closed_caption;
821 GstElement *video_fakesink;
823 /* audio stream caps parsed by demuxer or set by external demuxer */
824 GstCaps* a_stream_caps;
826 /* subtitle stream caps parsed by demuxer or set by external demuxer */
827 GstCaps* s_stream_caps;
829 /* es player using feed-data callback or calling app_src_push_buffer directly*/
830 gboolean es_player_push_mode;
832 /* tmb buffer manager for s/w codec tmb_bo */
838 MMAdaptiveVariantInfo adaptive_info;
840 /* Video360 related stuff
842 gboolean is_360_feature_enabled;
843 gboolean is_content_spherical;
844 mm_player_spherical_metadata_t video360_metadata;
845 gboolean is_openal_plugin_used;
846 /* User settable values */
847 gboolean is_video360_enabled;
848 float video360_yaw_radians;
849 float video360_pitch_radians;
851 int video360_horizontal_fov;
852 int video360_vertical_fov;
854 /* Video ROI area scale value */
855 MMPlayerVideoROI video_roi;
859 gchar *language_code;
862 } MMPlayerLangStruct;
866 gulong probe_handle_id;
867 FILE *dump_element_file;
875 int valid_type; // validity type
876 int value_min; //<- set validity value range
880 /*===========================================================================================
882 | GLOBAL FUNCTION PROTOTYPES |
884 ========================================================================================== */
889 int _mmplayer_create_player(MMHandleType hplayer);
890 int _mmplayer_destroy(MMHandleType hplayer);
891 int _mmplayer_realize(MMHandleType hplayer);
892 int _mmplayer_unrealize(MMHandleType hplayer);
893 int _mmplayer_get_state(MMHandleType hplayer, int* pstate);
894 int _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume);
895 int _mmplayer_get_volume(MMHandleType hplayer, MMPlayerVolumeType *volume);
896 int _mmplayer_set_mute(MMHandleType hplayer, int mute);
897 int _mmplayer_get_mute(MMHandleType hplayer, int* pmute);
898 int _mmplayer_start(MMHandleType hplayer);
899 int _mmplayer_stop(MMHandleType hplayer);
900 int _mmplayer_pause(MMHandleType hplayer);
901 int _mmplayer_abort_pause(MMHandleType hplayer);
902 int _mmplayer_resume(MMHandleType hplayer);
903 int _mmplayer_set_position(MMHandleType hplayer, gint64 pos);
904 int _mmplayer_get_position(MMHandleType hplayer, gint64 *pos);
905 int _mmplayer_get_duration(MMHandleType hplayer, gint64 *duration);
906 int _mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int pos);
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);
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);
921 int _mmplayer_set_audiostream_cb_ex(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param);
922 int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index);
923 int _mmplayer_sync_subtitle_pipeline(mm_player_t* player);
924 int _mmplayer_set_video_hub_download_mode(MMHandleType hplayer, bool mode);
925 int _mmplayer_use_system_clock(MMHandleType hplayer);
926 int _mmplayer_set_video_share_master_clock(MMHandleType hplayer, gint64 clock, gint64 clock_delta, gint64 video_time, gint64 media_clock, gint64 audio_time);
927 int _mmplayer_get_video_share_master_clock(MMHandleType hplayer, gint64 *video_time, gint64 *media_clock, gint64 *audio_time);
928 int _mmplayer_enable_sync_handler(MMHandleType hplayer, bool enable);
929 int _mmplayer_set_file_buffering_path(MMHandleType hplayer, const char* file_path);
930 int _mmplayer_set_uri(MMHandleType hplayer, const char* uri);
931 int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_path);
932 int _mmplayer_get_next_uri(MMHandleType hplayer, char** uri);
933 int _mmplayer_has_closed_caption(MMHandleType hplayer, bool* exist);
934 void _mm_player_video_stream_internal_buffer_unref(void *buffer);
935 int _mmplayer_set_pcm_spec(MMHandleType hplayer, int samplerate, int channel);
936 int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout);
937 int _mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *extra_num);
938 int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int state);
939 int _mmplayer_video_stream_release_bo(mm_player_t* player, void* bo);
940 int _mmplayer_get_adaptive_variant_info(MMHandleType hplayer, int *num, char **var_info);
941 int _mmplayer_set_max_adaptive_variant_limit(MMHandleType hplayer, int bandwidth, int width, int height);
942 int _mmplayer_get_max_adaptive_variant_limit(MMHandleType hplayer, int *bandwidth, int *width, int *height);
943 int _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only);
944 int _mmplayer_get_audio_only(MMHandleType hplayer, bool *paudio_only);
945 int _mmplayer_set_streaming_buffering_time(MMHandleType hplayer, int buffer_ms, int rebuffer_ms);
946 int _mmplayer_get_streaming_buffering_time(MMHandleType hplayer, int *buffer_ms, int *rebuffer_ms);
947 int _mmplayer_set_codec_type(MMHandleType hplayer, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type);
948 int _mmplayer_set_replaygain_enabled(MMHandleType hplayer, bool enabled);
949 int _mmplayer_is_replaygain_enabled(MMHandleType hplayer, bool *enabled);
950 int _mmplayer_set_video_roi_area(MMHandleType hplayer, double scale_x, double scale_y, double scale_width, double scale_height);
951 int _mmplayer_get_video_roi_area(MMHandleType hplayer, double *scale_x, double *scale_y, double *scale_width, double *scale_height);
954 void __mmplayer_bus_msg_thread_destroy(MMHandleType hplayer);
956 void __mmplayer_set_state(mm_player_t* player, int state);
957 int __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command);
958 gboolean __mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag);
959 void __mmplayer_cancel_eos_timer(mm_player_t* player);
960 void __mmplayer_audio_stream_clear_buffer(mm_player_t* player, gboolean send_all);
961 gboolean __mmplayer_configure_audio_callback(mm_player_t* player);
962 MMStreamingType __mmplayer_get_stream_service_type(mm_player_t* player);
963 int __mmplayer_get_video_angle(mm_player_t* player, int *display_angle, int *orientations);
964 gboolean __mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink);
965 void __mmplayer_add_signal_connection(mm_player_t* player, GObject* object, MMPlayerSignalType type, const gchar* signal, GCallback cb_funct, gpointer u_data);
966 void __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data);
967 gint __mmplayer_gst_decode_autoplug_select(GstElement *bin, GstPad* pad, GstCaps* caps, GstElementFactory* factory, gpointer data);
968 gboolean __mmplayer_try_to_plug_decodebin(mm_player_t* player, GstPad *srcpad, const GstCaps *caps);
969 void __mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data);
970 GstElement* __mmplayer_create_decodebin(mm_player_t* player);
971 int __mmplayer_gst_element_add_bucket_to_bin(GstBin* bin, GList* element_bucket);
972 int __mmplayer_gst_element_link_bucket(GList* element_bucket);
973 void __mmplayer_typefind_have_type(GstElement *tf, guint probability, GstCaps *caps, gpointer data);
974 int __mmplayer_parse_profile(const char *uri, void *param, MMPlayerParseProfile* data);
981 #endif /* __MM_PLAYER_PRIV_H__ */