[0.6.90] Fix getting orientation bug when capture video
[platform/core/multimedia/libmm-player.git] / src / include / mm_player_priv.h
index f9f5a24..73e0154 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <tbm_bufmgr.h>
-#include <Evas.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_resource.h"
+#include <mm_resource_manager.h>
 #include "mm_player_sound_focus.h"
 #include "mm_player_pd.h"
 #include "mm_player_streaming.h"
  */
 #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 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:                                                                                      |
@@ -121,7 +125,6 @@ enum alassink_sync {
 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 */
@@ -187,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,
@@ -224,8 +228,9 @@ enum AudioElementID {
        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,
@@ -240,6 +245,7 @@ enum VideoElementID {
        MMPLAYER_V_SCALE,
        MMPLAYER_V_CAPS,
        MMPLAYER_V_SINK,
+       MMPLAYER_V_360,
        MMPLAYER_V_NUM
 };
 
@@ -328,6 +334,55 @@ 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:                                                                                     |
 ---------------------------------------------------------------------------*/
@@ -368,6 +423,13 @@ 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;
@@ -388,11 +450,6 @@ typedef struct {
 } MMPlayerSetMode;
 
 typedef struct {
-       GMainContext *global_default;
-       GMainContext *thread_default;
-} MMPlayerGMainContext;
-
-typedef struct {
        gint uri_idx;
        GList *uri_list;
 } MMPlayerUriList;
@@ -439,6 +496,41 @@ typedef struct {
 } 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,6 +573,13 @@ 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;
 
@@ -518,7 +617,8 @@ typedef struct {
        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;
@@ -569,6 +669,7 @@ typedef struct {
 
        /* content profile */
        MMPlayerParseProfile profile;
+       MMPlayerStorageInfo storage_info[MMPLAYER_PATH_MAX];
 
        /* streaming service type */
        MMStreamingType streaming_type;
@@ -638,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;
@@ -652,7 +752,10 @@ typedef struct {
        gboolean is_nv12_tiled;
 
        /* resource manager for H/W resources */
-       MMPlayerResourceManager resource_manager;
+       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;
@@ -674,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 */
@@ -691,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;
@@ -708,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;
@@ -748,6 +842,23 @@ 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 {
@@ -823,40 +934,35 @@ 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);
 
-int _mmplayer_gst_set_audio_channel(MMHandleType hplayer, MMPlayerAudioChannel ch_idx);
 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_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);
-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_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);
 int __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command);
 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_wfd_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);
@@ -868,12 +974,20 @@ gboolean __mmplayer_check_useful_message(mm_player_t *player, GstMessage * messa
 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);
+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
        }