[0.6.90] Fix getting orientation bug when capture video
[platform/core/multimedia/libmm-player.git] / src / include / mm_player_priv.h
old mode 100755 (executable)
new mode 100644 (file)
index 050a5b2..73e0154
 /*===========================================================================================
 |                                                                                                                                                                                      |
 |  INCLUDE FILES                                                                                                                                                       |
-|                                                                                                                                                                                      |
+|                                                                                                                                                                              |
 ========================================================================================== */
 #include <glib.h>
 #include <gst/gst.h>
 #include <mm_attrs.h>
-#include <mm_debug.h>
 #include <math.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <tbm_bufmgr.h>
+#include <storage.h>
 #include "mm_player.h"
 #include "mm_player_internal.h"
 #include "mm_player_audioeffect.h"
 #include "mm_message.h"
 #include "mm_player_ini.h"
-#include "mm_player_asm.h"
+#include <mm_resource_manager.h>
+#include "mm_player_sound_focus.h"
 #include "mm_player_pd.h"
 #include "mm_player_streaming.h"
 
 /*===========================================================================================
 |                                                                                                                                                                                      |
 |  GLOBAL DEFINITIONS AND DECLARATIONS FOR MODULE                                                                                      |
-|                                                                                                                                                                                      |
+|                                                                                                                                                                                      |
 ========================================================================================== */
 
 /*---------------------------------------------------------------------------
 |    GLOBAL #defines:                                                                                                          |
 ---------------------------------------------------------------------------*/
-
 #define MM_PLAYER_IMGB_MPLANE_MAX      4
 #define MM_PLAYER_STREAM_COUNT_MAX     3
 
-#define MM_PLAYER_CAST(x_player)               ((mm_player_t *)(x_player))
+#define MM_PLAYER_CAST(x_player)               ((mm_player_t *)(x_player))
 /**
  * @x_player: MMHandleType of player
  *
  */
 #define MM_PLAYER_GET_ATTRS(x_player)  (MM_PLAYER_CAST(x_player)->attrs)
 
+#define ROTATION_USING_SINK     0
+#define ROTATION_USING_CUSTOM   1
+#define ROTATION_USING_FLIP     2
+
+#define MM_MAX_STRING_LENGTH    4000 /* have to be less than MUSE_MSG_MAX_LENGTH */
+
+#define VIDEO360_MAX_ZOOM      10.0f
+
 /*---------------------------------------------------------------------------
 |    GLOBAL CONSTANT DEFINITIONS:                                                                                      |
 ---------------------------------------------------------------------------*/
-enum latency_mode
-{
-    AUDIO_LATENCY_MODE_LOW = 0,     /**< Low audio latency mode */
-    AUDIO_LATENCY_MODE_MID,         /**< Middle audio latency mode */
-    AUDIO_LATENCY_MODE_HIGH,        /**< High audio latency mode */
+enum latency_mode {
+       AUDIO_LATENCY_MODE_LOW = 0,     /**< Low audio latency mode */
+       AUDIO_LATENCY_MODE_MID,         /**< Middle audio latency mode */
+       AUDIO_LATENCY_MODE_HIGH,        /**< High audio latency mode */
 };
 
-enum tag_info
-{
+enum tag_info {
        TAG_AUDIO_CODEC = 0x0001,
        TAG_VIDEO_CODEC = 0x0002,
        TAG_ARTIST              = 0x0004,
@@ -98,8 +104,7 @@ enum tag_info
        TAG_TRACK_NUMBER = 0x0200
 };
 
-enum content_attr_flag
-{
+enum content_attr_flag {
        ATTR_MISSING_ONLY = 0x0001,
        ATTR_DURATION = 0x0002,
        ATTR_AUDIO  = 0x0004,
@@ -109,8 +114,7 @@ enum content_attr_flag
 };
 
 /* async mode makes trouble. alsasink sometimes fails to pause. */
-enum alassink_sync
-{
+enum alassink_sync {
        ALSASINK_SYNC,
        ALSASINK_ASYNC
 };
@@ -119,37 +123,33 @@ enum alassink_sync
  * Enumerations of Player Uri type
  */
 enum MMPlayerUriType {
-       MM_PLAYER_URI_TYPE_NONE,                /**< Player URI type None */
-       MM_PLAYER_URI_TYPE_URL_RTSP,    /**< Player URI type RTSP */
-       MM_PLAYER_URI_TYPE_URL_WFD,  /**< Player URI type WFD */
-       MM_PLAYER_URI_TYPE_URL_HTTP,/**< Player URI type HTTP */
-       MM_PLAYER_URI_TYPE_URL_MMS,/**< Player URI type MMS */
-       MM_PLAYER_URI_TYPE_MEM,         /**< Player URI type Mem */
-       MM_PLAYER_URI_TYPE_FILE,                /**< Player URI type File */
-       MM_PLAYER_URI_TYPE_URL,                 /**< Player URI type URL */
-       MM_PLAYER_URI_TYPE_BUFF,                /**< Player URI type Buffer */
-       MM_PLAYER_URI_TYPE_ES_BUFF,             /**< Player URI type ES Buffer */
-       MM_PLAYER_URI_TYPE_HLS,                 /**< Player URI type http live streaming */
-       MM_PLAYER_URI_TYPE_SS,                  /**< Player URI type Smooth streaming */
+       MM_PLAYER_URI_TYPE_NONE,                        /**< Player URI type None */
+       MM_PLAYER_URI_TYPE_URL_RTSP,            /**< Player URI type RTSP */
+       MM_PLAYER_URI_TYPE_URL_HTTP,            /**< Player URI type HTTP */
+       MM_PLAYER_URI_TYPE_URL_MMS,                     /**< Player URI type MMS */
+       MM_PLAYER_URI_TYPE_MEM,                         /**< Player URI type Mem */
+       MM_PLAYER_URI_TYPE_FILE,                        /**< Player URI type File */
+       MM_PLAYER_URI_TYPE_URL,                         /**< Player URI type URL */
+       MM_PLAYER_URI_TYPE_MS_BUFF,                     /**< Player URI type Media Stream Buffer */
+       MM_PLAYER_URI_TYPE_HLS,                         /**< Player URI type http live streaming */
+       MM_PLAYER_URI_TYPE_SS,                          /**< Player URI type Smooth streaming */
        MM_PLAYER_URI_TYPE_DASH,                        /**< Player URI type Mpeg Dash */
-       MM_PLAYER_URI_TYPE_NO_PERMISSION,/**< Player URI type No Permission  */
+       MM_PLAYER_URI_TYPE_NO_PERMISSION,       /**< Player URI type No Permission  */
        MM_PLAYER_URI_TYPE_TEMP,                        /**< Player URI type Temp */
 };
 
-typedef enum _MissingCodec
-{
-       MISSING_PLUGIN_NONE                     = 0x00,
-       MISSING_PLUGIN_AUDIO                    = 0x01,
-       MISSING_PLUGIN_VIDEO                    = 0x02
-}MissingCodec;
+typedef enum _MissingCodec {
+       MISSING_PLUGIN_NONE = 0x00,
+       MISSING_PLUGIN_AUDIO = 0x01,
+       MISSING_PLUGIN_VIDEO = 0x02
+} MissingCodec;
 
 
-typedef enum _FoundCodec
-{
-       FOUND_PLUGIN_NONE                       = 0x00,
-       FOUND_PLUGIN_AUDIO                      = 0x01,
-       FOUND_PLUGIN_VIDEO                      = 0x02
-}FoundCodec;
+typedef enum _FoundCodec {
+       FOUND_PLUGIN_NONE = 0x00,
+       FOUND_PLUGIN_AUDIO = 0x01,
+       FOUND_PLUGIN_VIDEO = 0x02
+} FoundCodec;
 
 /**
  * Enumeration of signal type
@@ -162,11 +162,10 @@ typedef enum {
        MM_PLAYER_SIGNAL_TYPE_OTHERS,
        MM_PLAYER_SIGNAL_TYPE_ALL,
        MM_PLAYER_SIGNAL_TYPE_MAX = MM_PLAYER_SIGNAL_TYPE_ALL,
-}MMPlayerSignalType;
+} MMPlayerSignalType;
 
 /* main pipeline's element id */
-enum MainElementID
-{
+enum MainElementID {
        MMPLAYER_M_PIPE = 0, /* NOTE : MMPLAYER_M_PIPE should be zero */
        MMPLAYER_M_SRC,
        MMPLAYER_M_2ND_SRC,     /* 2nd Source Element for es buff src */
@@ -191,6 +190,7 @@ enum MainElementID
        MMPLAYER_M_MUXED_S_BUFFER,
        MMPLAYER_M_DEMUXED_S_BUFFER,
        MMPLAYER_M_ID3DEMUX,
+       MMPLAYER_M_ADAPTIVE_DEMUX,
 
        /* es buff src queue */
        MMPLAYER_M_V_BUFFER,
@@ -205,6 +205,7 @@ enum MainElementID
        MMPLAYER_M_DEMUX,
        MMPLAYER_M_SUBPARSE,
        MMPLAYER_M_DEMUX_EX,
+       MMPLAYER_M_V_INPUT_SELECTOR,    // video input_select
        MMPLAYER_M_A_INPUT_SELECTOR,    // audio input_select
        MMPLAYER_M_T_INPUT_SELECTOR,    // text input_select
        MMPLAYER_M_A_TEE,
@@ -215,20 +216,21 @@ enum MainElementID
        MMPLAYER_M_A_DEINTERLEAVE,
        MMPLAYER_M_A_SELECTOR,
        MMPLAYER_M_V_SINK,
+       MMPLAYER_M_V_CONV,
        MMPLAYER_M_NUM
 };
 
 /* audio pipeline's element id */
-enum AudioElementID
-{
+enum AudioElementID {
        MMPLAYER_A_BIN = 0, /* NOTE : MMPLAYER_A_BIN should be zero */
        MMPLAYER_A_TP,
        MMPLAYER_A_CONV,
        MMPLAYER_A_VOL,
        MMPLAYER_A_FILTER,
        MMPLAYER_A_FILTER_SEC,
-       MMPLAYER_A_VSP,
        MMPLAYER_A_CAPS_DEFAULT,
+       MMPLAYER_A_CONV_BFORMAT,
+       MMPLAYER_A_CAPS_360,
        MMPLAYER_A_SINK,
        MMPLAYER_A_RESAMPLER,
        MMPLAYER_A_DEINTERLEAVE,
@@ -236,20 +238,19 @@ enum AudioElementID
 };
 
 /* video pipeline's element id */
-enum VideoElementID
-{
+enum VideoElementID {
        MMPLAYER_V_BIN = 0, /* NOTE : MMPLAYER_V_BIN should be zero */
        MMPLAYER_V_FLIP,
        MMPLAYER_V_CONV,
        MMPLAYER_V_SCALE,
        MMPLAYER_V_CAPS,
        MMPLAYER_V_SINK,
+       MMPLAYER_V_360,
        MMPLAYER_V_NUM
 };
 
 /* text pipeline's element id */
-enum TextElementID
-{
+enum TextElementID {
        MMPLAYER_T_BIN = 0, /* NOTE : MMPLAYER_V_BIN should be zero */
        MMPLAYER_T_QUEUE,
        MMPLAYER_T_VIDEO_QUEUE,
@@ -261,15 +262,13 @@ enum TextElementID
 };
 
 /* midi main pipeline's element id */
-enum MidiElementID
-{
+enum MidiElementID {
        MMPLAYER_MIDI_PIPE,
        MMPLAYER_MIDI_PLAYER,
        MMPLAYER_MIDI_NUM
 };
 
-enum PlayerCommandState
-{
+enum PlayerCommandState {
        MMPLAYER_COMMAND_NONE,
        MMPLAYER_COMMAND_CREATE,
        MMPLAYER_COMMAND_DESTROY,
@@ -286,8 +285,7 @@ enum PlayerCommandState
  *     using custom message made by itself. The enum value must start with zero,
  *     because the streaming source(secrtspsrc) also does.
  */
-enum StreamingSrcError
-{
+enum StreamingSrcError {
        MMPLAYER_STREAMING_ERROR_NONE = 0,
        MMPLAYER_STREAMING_ERROR_UNSUPPORTED_AUDIO,
        MMPLAYER_STREAMING_ERROR_UNSUPPORTED_VIDEO,
@@ -336,27 +334,73 @@ enum StreamingSrcError
        MMPLAYER_STREAMING_ERROR_OPTION_NOT_SUPPORTED,
 };
 
+typedef enum {
+       MMPLAYER_PATH_VOD = 0,
+       MMPLAYER_PATH_TEXT,
+       MMPLAYER_PATH_MAX
+} MMPlayerPathType;
+
+/* Video360 related enums. These are duplication from video360.h from
+ * gst-plugins-tizen.
+ * */
+typedef enum {
+       VIDEO360_MODE_UNKNOWN = -1,
+       VIDEO360_MODE_MONOSCOPIC = 0,
+       VIDEO360_MODE_STEREOSCOPIC_TOP_BOTTOM = 1,
+       VIDEO360_MODE_STEREOSCOPIC_LEFT_RIGHT = 2,
+       VIDEO360_MODE_STEREOSCOPIC_STEREO_MESH = 3,
+       VIDEO360_MODE_LAST_ITEM
+} mm_player_stereo_mode_e;
+
+typedef enum {
+       VIDEO360_PROJECTION_TYPE_UNKNOWN = -1,
+       VIDEO360_PROJECTION_TYPE_EQUIRECTANGULAR = 0,
+       VIDEO360_PROJECTION_TYPE_CUBEMAP = 1,
+       VIDEO360_PROJECTION_TYPE_MESH = 2,
+       VIDEO360_PROJECTION_TYPE_LAST_ITEM
+} mm_player_projection_type_e;
+
+/* Spatial audio related enums. These are duplication from mm_file.h from
+ * libmm-fileinfo.
+ * */
+typedef enum {
+       MMFILE_AMBISONIC_TYPE_UNKNOWN = 0,
+       MMFILE_AMBISONIC_TYPE_PERIPHONIC = 1,           /**< To comply with Google's Spatial Audio RFC*/
+       MMFILE_AMBISONIC_TYPE_NON_PERIPHONIC = 2,
+} MMFILE_AMBISONIC_TYPE;
+
+typedef enum {
+       MMFILE_AMBISONIC_FORMAT_UNKNOWN = 0,
+       MMFILE_AMBISONIC_FORMAT_AMBIX = 1,              /**< AMBIX (Channel sequence: ACN, Normalization: SN3D) */
+       MMFILE_AMBISONIC_FORMAT_AMB = 2,                /**< .AMB, Tetraproc (Channel sequence: FuMa, Normalization: FuMa) */
+       MMFILE_AMBISONIC_FORMAT_UA = 3,                 /**< Universal Ambisonics (Channel sequence: SID, Normalization: N3D) */
+} MMFILE_AMBISONIC_FORMAT;
+
+typedef enum {
+       MMFILE_AMBISONIC_ORDER_UNKNOWN = 0,
+       MMFILE_AMBISONIC_ORDER_FOA = 1,                 /**< First order Ambisonics */
+       MMFILE_AMBISONIC_ORDER_SOA = 2,                 /**< Second order Ambisonics */
+       MMFILE_AMBISONIC_ORDER_TOA = 3,                 /**< Third order Ambisonics */
+} MMFILE_AMBISONIC_ORDER;
+
 /*---------------------------------------------------------------------------
 |    GLOBAL DATA TYPE DEFINITIONS:                                                                                     |
 ---------------------------------------------------------------------------*/
 
-typedef struct
-{
+typedef struct {
        int id;
        GstElement *gst;
 } MMPlayerGstElement;
 
-typedef struct
-{
-       GstTagList                      *tag_list;
-       MMPlayerGstElement      *mainbin;
-       MMPlayerGstElement      *audiobin;
-       MMPlayerGstElement      *videobin;
-       MMPlayerGstElement      *textbin;
+typedef struct {
+       GstTagList *tag_list;
+       MMPlayerGstElement *mainbin;
+       MMPlayerGstElement *audiobin;
+       MMPlayerGstElement *videobin;
+       MMPlayerGstElement *textbin;
 } MMPlayerGstPipelineInfo;
 
-typedef struct
-{
+typedef struct {
        float volume;
        int mute;
        int bluetooth;  /* enable/disable */
@@ -379,10 +423,17 @@ typedef struct {
 } MMPlayerParseProfile;
 
 typedef struct {
+       storage_type_e type;
+       storage_state_e state;
+       int id;
+       char path[MM_MAX_URL_LEN];
+} MMPlayerStorageInfo;
+
+typedef struct {
        bool is_pending;
        MMPlayerPosFormatType format;
        unsigned long pos;
-}MMPlayerPendingSeek;
+} MMPlayerPendingSeek;
 
 typedef struct {
        GObject* obj;
@@ -396,17 +447,12 @@ typedef struct {
        bool video_zc; // video zero-copy
        bool subtitle_off;
        bool media_packet_video_stream;
-}MMPlayerSetMode;
-
-typedef struct {
-       GMainContext *global_default;
-       GMainContext *thread_default;
-}MMPlayerGMainContext;
+} MMPlayerSetMode;
 
 typedef struct {
        gint uri_idx;
        GList *uri_list;
-}MMPlayerUriList;
+} MMPlayerUriList;
 
 typedef struct {
        gint active_pad_index;
@@ -416,29 +462,75 @@ typedef struct {
        gulong event_probe_id;
 } mm_player_selector_t;
 
-/* Things needed to be done after output device has changed */
-typedef struct {
-       gboolean need_async;
-       gboolean need_seek;
-       gboolean need_pause_and_resume;
-       guint cb_score;
-       guint required_cb_score;
-       guint id;
-} mm_player_post_proc_t;
-
 typedef struct {
        gboolean running;
 
        gboolean stream_changed;
        gboolean reconfigure;
 
-       GstClockTime next_pts;          /* latest decoded buffer's pts+duration */
-       GstClockTime start_time;        /* updated once get SEGMENT event */
+       GstClockTime start_time[MM_PLAYER_TRACK_TYPE_MAX];      /* updated once get SEGMENT event */
+       GstSegment segment[MM_PLAYER_TRACK_TYPE_MAX];
+       gboolean update_segment[MM_PLAYER_TRACK_TYPE_MAX];
 
-       gulong audio_data_probe_id;
 } mm_player_gapless_t;
 
 typedef struct {
+       int channel;
+       int bitrate;
+       int depth;
+       bool is_little_endian;
+       guint64 channel_mask;
+       void *pcm_data;
+       int data_size;
+       int buff_size;
+} mm_player_audio_stream_buff_t;
+
+/**
+ * @brief data of video_bo_list
+ * @details this will be used when the sw codec is running.
+ * @since_tizen 3.0
+ */
+typedef struct {
+       gboolean using;
+       void* bo;
+} mm_player_video_bo_info_t;
+
+typedef struct {
+       gint bandwidth;
+       gint width;
+       gint height;
+} VariantData;
+
+typedef struct {
+       GList* var_list;
+       VariantData limit;
+} MMAdaptiveVariantInfo;
+
+typedef struct {
+       int is_spherical;
+       int is_stitched;
+       char *stitching_software;
+       char *projection_type_string;
+       char *stereo_mode_string;
+       mm_player_projection_type_e projection_type;
+       mm_player_stereo_mode_e stereo_mode;
+       int source_count;
+       int init_view_heading;
+       int init_view_pitch;
+       int init_view_roll;
+       int timestamp;
+       int full_pano_width_pixels;
+       int full_pano_height_pixels;
+       int cropped_area_image_width;
+       int cropped_area_image_height;
+       int cropped_area_left;
+       int cropped_area_top;
+       int ambisonic_type;
+       int ambisonic_format;
+       int ambisonic_order;
+} mm_player_spherical_metadata_t;
+
+typedef struct {
        /* STATE */
        int state;                                      // player current state
        int prev_state;                         // player previous state
@@ -481,16 +573,25 @@ typedef struct {
        MMPlayerVideoColorspace video_cs;
        MMVideoBuffer captured;
 
+       /* gst bus msg thread, create during realize */
+       GThread* bus_msg_thread;
+       gboolean bus_msg_thread_exit;
+       GCond bus_msg_thread_cond;
+       GMutex bus_msg_thread_mutex;
+       gint bus_msg_timeout; /* ms */
+
        /* fakesink handling lock */
        GMutex fsink_lock;
 
+       /* update tag lock */
+       GMutex update_tag_lock;
+
        /* player attributes */
        MMHandleType attrs;
 
        /* message callback */
        MMMessageCallback msg_cb;
        void* msg_cb_param;
-       GMutex msg_cb_lock;
 
        /* progressive download */
        mm_player_pd_t *pd_downloader;
@@ -499,6 +600,7 @@ typedef struct {
 
        /* streaming player */
        mm_player_streaming_t *streamer;
+       gchar *http_file_buffering_path;
 
        /* gstreamer pipeline */
        MMPlayerGstPipelineInfo *pipeline;
@@ -510,8 +612,13 @@ typedef struct {
        guint media_stream_buffer_min_percent[MM_PLAYER_STREAM_TYPE_MAX];
        mm_player_media_stream_buffer_status_callback media_stream_buffer_status_cb[MM_PLAYER_STREAM_TYPE_MAX];
        mm_player_media_stream_seek_data_callback media_stream_seek_data_cb[MM_PLAYER_STREAM_TYPE_MAX];
+       GMutex media_stream_cb_lock;
+
+       int video_num_buffers;  /* total num of buffers in vcodec */
+       int video_extra_num_buffers; /* extra num of buffers in vcodec */
 
-       void* buffer_cb_user_param;
+       void* buffer_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
+       void* seek_cb_user_param[MM_PLAYER_STREAM_TYPE_MAX];
 
        /* video stream changed callback */
        mm_player_stream_changed_callback video_stream_changed_cb;
@@ -524,12 +631,17 @@ typedef struct {
        /* video stream callback */
        mm_player_video_stream_callback video_stream_cb;
        void* video_stream_cb_user_param;
-       int use_video_stream;
+       GCond video_bo_cond;
+       GMutex video_bo_mutex;
+       GList* video_bo_list; /* mm_player_video_bo_info_t, bo list for decoded video data by sw codec */
+       int video_bo_size;
+       bool video_stream_prerolled;
 
        /* audio stram callback */
        mm_player_audio_stream_callback audio_stream_cb;
        void* audio_stream_cb_user_param;
        bool audio_stream_sink_sync;
+       GList* audio_stream_buff_list; /* mm_player_audio_stream_buff_t, buff list of extract pcm data */
 
        /* audio buffer callback */
        mm_player_audio_stream_callback_ex audio_stream_render_cb_ex;
@@ -537,10 +649,6 @@ typedef struct {
        /* video capture callback*/
        gulong video_capture_cb_probe_id;
 
-       /* video frame render error callback */
-       mm_player_video_frame_render_error_callback video_frame_render_error_cb;
-       void* video_frame_render_error_cb_user_param;
-
        /* sound info */
        MMPlayerSoundInfo       sound;
 
@@ -555,13 +663,13 @@ typedef struct {
        gboolean bypass_audio_effect;
 
        gulong audio_cb_probe_id;
-       gulong video_cb_probe_id;
 
        /* for appsrc */
        tBuffer mem_buf;
 
        /* content profile */
        MMPlayerParseProfile profile;
+       MMPlayerStorageInfo storage_info[MMPLAYER_PATH_MAX];
 
        /* streaming service type */
        MMStreamingType streaming_type;
@@ -608,7 +716,7 @@ typedef struct {
        /* missing plugin during autoplugging */
        MissingCodec not_supported_codec;
 
-       /*unlinked audio/video mime type */
+       /* unlinked audio/video mime type */
        gchar *unlinked_video_mime;
        gchar *unlinked_audio_mime;
        gchar *unlinked_demuxer_mime;
@@ -631,8 +739,7 @@ typedef struct {
 
        /* signal notifiers */
        GList* signals[MM_PLAYER_SIGNAL_TYPE_MAX];
-       guint bus_watcher;
-       MMPlayerGMainContext context;
+       GMainContext *global_default;
        MMPlayerUriList uri_info;
 
        gboolean is_sound_extraction;
@@ -643,12 +750,20 @@ typedef struct {
        gboolean resumed_by_rewind;
 
        gboolean is_nv12_tiled;
-       gboolean is_drm_file;
 
-       MMPlayerASM sm;
+       /* resource manager for H/W resources */
+       mm_resource_manager_h resource_manager;
+       mm_resource_manager_res_h video_overlay_resource;
+       mm_resource_manager_res_h video_decoder_resource;
+       gboolean interrupted_by_resource;
+
+       /* sound focus for being compatible with legacy session policy internally */
+       MMPlayerSoundFocus sound_focus;
 
        gboolean is_subtitle_off;
        gboolean is_external_subtitle_present;
+       gboolean is_external_subtitle_added_now;
+       gboolean pending_resume;
 
        /* contents bitrate for buffering management */
        guint bitrate[MM_PLAYER_STREAM_COUNT_MAX];
@@ -662,14 +777,10 @@ typedef struct {
        gboolean sent_bos;
 
        /* timeout source for lazy pause */
-       guint lazy_pause_event_id;
        guint resume_event_id;
        guint resumable_cancel_id;
 
-       gboolean keep_detecting_vcodec;
-
        gboolean play_subtitle;
-       gboolean use_textoverlay;
        gboolean is_subtitle_force_drop;        // set TRUE after bus_cb get EOS
 
        /* PD downloader message callback and param */
@@ -679,6 +790,8 @@ typedef struct {
        /* adjust subtitle position store */
        gint64 adjust_subtitle_pos;
        GList *subtitle_language_list;
+       GCond subtitle_info_cond;
+       GMutex subtitle_info_mutex;
 
        /* To store the current multiwindow status */
        gboolean last_multiwin_status;
@@ -696,16 +809,9 @@ typedef struct {
 
        MMPlayerSetMode set_mode;
 
-       /* decodbin usage */
-       gboolean use_decodebin;
-
        /* initialize values */
        mm_player_ini_t ini;
 
-       /* check to use h/w codec */
-       GstCaps* state_tune_caps;
-       gboolean ignore_asyncdone;
-
        /* video share sync */
        gint64 video_share_api_delta;
        gint64 video_share_clock_delta;
@@ -717,10 +823,6 @@ typedef struct {
        /* store dump pad list */
        GList* dump_list;
 
-
-       /* audio/video deivce change handling */
-       mm_player_post_proc_t post_proc;
-
        /* whether a video has closed caption or not */
        gboolean has_closed_caption;
 
@@ -732,7 +834,7 @@ typedef struct {
        /* subtitle stream caps parsed by demuxer or set by external demuxer */
        GstCaps* s_stream_caps;
 
-       /*es player using feed-data callback or calling app_src_push_buffer directly*/
+       /* es player using feed-data callback or calling app_src_push_buffer directly*/
        gboolean es_player_push_mode;
 
        /* tmb buffer manager for s/w codec tmb_bo */
@@ -740,23 +842,38 @@ typedef struct {
 
        int pcm_samplerate;
        int pcm_channel;
+
+       MMAdaptiveVariantInfo adaptive_info;
+
+       /* Video360 related stuff
+        * */
+       bool is_content_spherical;
+       mm_player_spherical_metadata_t video360_metadata;
+       bool is_openal_plugin_used;
+       bool is_video360_plugin_used;
+       /* User settable values */
+       bool is_video360_enabled;
+       float video360_yaw_radians;
+       float video360_pitch_radians;
+       float video360_zoom;
+       int video360_horizontal_fov;
+       int video360_vertical_fov;
+
 } mm_player_t;
 
-typedef struct
-{
+typedef struct {
        gchar *language_code;
        gchar *language_key;
        gboolean active;
-}MMPlayerLangStruct;
+} MMPlayerLangStruct;
 
-typedef struct
-{
+typedef struct {
        GstPad *dump_pad;
        gulong probe_handle_id;
        FILE *dump_element_file;
 } mm_player_dump_t;
 
-typedef struct{
+typedef struct {
        char *name;
        int value_type;
        int flags;                              // r, w
@@ -764,12 +881,12 @@ typedef struct{
        int valid_type;                 // validity type
        int value_min;                  //<- set validity value range
        int value_max;          //->
-}MMPlayerAttrsSpec;
+} MMPlayerAttrsSpec;
 
 /*===========================================================================================
 |                                                                                                                                                                                      |
 |  GLOBAL FUNCTION PROTOTYPES                                                                                                                          |
-|                                                                                                                                                                                      |
+|                                                                                                                                                                                      |
 ========================================================================================== */
 #ifdef __cplusplus
        extern "C" {
@@ -791,20 +908,17 @@ int _mmplayer_resume(MMHandleType hplayer);
 int _mmplayer_set_position(MMHandleType hplayer, int format, int pos);
 int _mmplayer_get_position(MMHandleType hplayer, int format, unsigned long *pos);
 int _mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format,  int pos);
-int _mmplayer_adjust_video_postion(MMHandleType hplayer,int offset);
+int _mmplayer_adjust_video_postion(MMHandleType hplayer, int offset);
 int _mmplayer_activate_section_repeat(MMHandleType hplayer, unsigned long start, unsigned long end);
 int _mmplayer_deactivate_section_repeat(MMHandleType hplayer);
-int _mmplayer_push_buffer(MMHandleType hplayer, unsigned char *buf, int size);
-int _mmplayer_set_playspeed(MMHandleType hplayer, float rate);
-int _mmplayer_set_playspeed_ex(MMHandleType hplayer, gdouble rate);
+int _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming);
 int _mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback callback, void *user_param);
 int _mmplayer_set_videostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param);
 int _mmplayer_set_audiostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param);
-int _mmplayer_set_videostream_cb(MMHandleType hplayer,mm_player_video_stream_callback callback, void *user_param);
-int _mmplayer_set_audiostream_cb(MMHandleType hplayer,mm_player_audio_stream_callback callback, void *user_param);
-int _mmplayer_set_videoframe_render_error_cb(MMHandleType hplayer, mm_player_video_frame_render_error_callback callback, void *user_param);
-int _mmplayer_set_subtitle_silent (MMHandleType hplayer, int silent);
-int _mmplayer_get_subtitle_silent (MMHandleType hplayer, int* silent);
+int _mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callback callback, void *user_param);
+int _mmplayer_set_audiostream_cb(MMHandleType hplayer, mm_player_audio_stream_callback callback, void *user_param);
+int _mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent);
+int _mmplayer_get_subtitle_silent(MMHandleType hplayer, int* silent);
 int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char* filepath);
 int _mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos);
 
@@ -812,44 +926,68 @@ int _mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned lon
  * deprecated before the day of final release
  */
 int _mmplayer_set_volume_tune(MMHandleType hplayer, MMPlayerVolumeType volume);
-int _mmplayer_update_video_param(mm_player_t* player);
+int _mmplayer_update_video_param(mm_player_t* player, char *param_name);
 int _mmplayer_set_audiobuffer_cb(MMHandleType hplayer, mm_player_audio_stream_callback callback, void *user_param);
 int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface_type, void *display_overlay);
 int _mmplayer_audio_effect_custom_apply(mm_player_t *player);
 
 int _mmplayer_set_audiostream_cb_ex(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param);
 gboolean __mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype, MMMessageParamType* param);
-gboolean __mmplayer_is_streaming(mm_player_t* player);
-
 
-int _mmplayer_gst_set_audio_channel(MMHandleType hplayer, MMPlayerAudioChannel ch_idx);
-int _mmplayer_change_track_language (MMHandleType hplayer, MMPlayerTrackType type, int index);
+int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index);
 int _mmplayer_sync_subtitle_pipeline(mm_player_t* player);
-int _mmplayer_set_prepare_buffering_time(MMHandleType hplayer, int second);
-int _mmplayer_set_runtime_buffering_mode(MMHandleType hplayer, MMPlayerBufferingMode mode, int second);
-int _mmplayer_set_display_zoom(MMHandleType hplayer, float level, int x, int y);
-int _mmplayer_get_display_zoom(MMHandleType hplayer, float *level, int *x, int *y);
 int _mmplayer_set_video_hub_download_mode(MMHandleType hplayer, bool mode);
-int _mmplayer_use_system_clock (MMHandleType hplayer);
+int _mmplayer_use_system_clock(MMHandleType hplayer);
 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);
 int _mmplayer_get_video_share_master_clock(MMHandleType hplayer, long long *video_time, long long *media_clock, long long *audio_time);
-int _mmplayer_get_video_rotate_angle(MMHandleType hplayer, int *angle);
 int _mmplayer_enable_sync_handler(MMHandleType hplayer, bool enable);
+int _mmplayer_set_file_buffering_path(MMHandleType hplayer, const char* file_path);
 int _mmplayer_set_uri(MMHandleType hplayer, const char* uri);
 int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_path);
 int _mmplayer_get_next_uri(MMHandleType hplayer, char** uri);
 int _mmplayer_has_closed_caption(MMHandleType hplayer, bool* exist);
-int _mmplayer_enable_media_packet_video_stream(MMHandleType hplayer, bool enable);
-void * _mm_player_media_packet_video_stream_internal_buffer_ref(void *buffer);
-void _mm_player_media_packet_video_stream_internal_buffer_unref(void *buffer);
+void _mm_player_video_stream_internal_buffer_unref(void *buffer);
 int _mmplayer_set_pcm_spec(MMHandleType hplayer, int samplerate, int channel);
-int __mmplayer_gst_set_state (mm_player_t* player, GstElement * pipeline,  GstState state, gboolean async, gint timeout );
+int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout);
+int _mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *extra_num);
+int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int state);
+int __mmplayer_gst_set_state(mm_player_t* player, GstElement * pipeline,  GstState state, gboolean async, gint timeout);
 int __mmplayer_set_state(mm_player_t* player, int state);
-gboolean __mmplayer_gst_callback(GstBus *bus, GstMessage *msg, gpointer data);
 int __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command);
-gboolean __mmplayer_dump_pipeline_state( mm_player_t* player );
-GstBusSyncReply __mmplayer_bus_sync_callback (GstBus * bus, GstMessage * message, gpointer data);
+gboolean __mmplayer_dump_pipeline_state(mm_player_t* player);
 void __mmplayer_remove_g_source_from_context(GMainContext *context, guint source_id);
+void _mmplayer_bus_msg_thread_destroy(MMHandleType hplayer);
+
+/* util */
+const gchar * __get_state_name(int state);
+gboolean __mmplayer_can_do_interrupt(mm_player_t *player);
+gboolean __is_streaming(mm_player_t* player);
+gboolean __is_rtsp_streaming(mm_player_t* player);
+gboolean __is_live_streaming(mm_player_t* player);
+gboolean __is_http_streaming(mm_player_t* player);
+gboolean __is_http_live_streaming(mm_player_t* player);
+gboolean __is_dash_streaming(mm_player_t* player);
+gboolean __is_smooth_streaming(mm_player_t* player);
+gboolean __is_http_progressive_down(mm_player_t* player);
+
+gboolean __mmplayer_check_useful_message(mm_player_t *player, GstMessage * message);
+gboolean __mmplayer_handle_gst_error(mm_player_t* player, GstMessage * message, GError* error);
+gint __gst_handle_core_error(mm_player_t* player, int code);
+gint __gst_handle_library_error(mm_player_t* player, int code);
+gint __gst_handle_resource_error(mm_player_t* player, int code, GstMessage * message);
+gint __gst_handle_stream_error(mm_player_t* player, GError* error, GstMessage * message);
+int _mmplayer_sound_register_with_pid(MMHandleType hplayer, int pid);
+int _mmplayer_get_client_pid(MMHandleType hplayer, int* pid);
+int __mmplayer_get_video_angle(mm_player_t* player, int *user_angle, int *org_angle);
+int _mmplayer_video_stream_release_bo(mm_player_t* player, void* bo);
+int _mmplayer_get_adaptive_variant_info(MMHandleType hplayer, int *num, char **var_info);
+int _mmplayer_set_max_adaptive_variant_limit(MMHandleType hplayer, int bandwidth, int width, int height);
+int _mmplayer_get_max_adaptive_variant_limit(MMHandleType hplayer, int *bandwidth, int *width, int *height);
+int _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only);
+int _mmplayer_get_audio_only(MMHandleType hplayer, bool *paudio_only);
+int _mmplayer_set_streaming_buffering_time(MMHandleType hplayer, int buffer_ms, int rebuffer_ms);
+int _mmplayer_get_streaming_buffering_time(MMHandleType hplayer, int *buffer_ms, int *rebuffer_ms);
+int _mmplayer_set_codec_type(MMHandleType hplayer, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type);
 
 #ifdef __cplusplus
        }