Add callback of video bin created 84/47984/1 tizen_3.0.m1_mobile tizen_3.0.m1_tv accepted/tizen/mobile/20150911.144938 accepted/tizen/tv/20150911.144957 accepted/tizen/wearable/20150911.145015 submit/tizen/20150911.034908 submit/tizen_common/20151023.083358 submit/tizen_common/20151026.085049 tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release
authorHyongtaek Lim <hyongtaek.lim@samsung.com>
Thu, 10 Sep 2015 13:33:52 +0000 (22:33 +0900)
committerHyongtaek Lim <hyongtaek.lim@samsung.com>
Thu, 10 Sep 2015 13:34:24 +0000 (22:34 +0900)
Signed-off-by: Hyongtaek Lim <hyongtaek.lim@samsung.com>
Change-Id: I9d060aa640f82ce98dca4141bada0b39999eeef7

include/mobile/player_internal.h
include/player_private.h
include/wearable/player_internal.h
src/player.c
src/player_internal.c
test/legacy_player_media_packet_test.c
test/legacy_player_test.c

index c724bd0..244f46e 100644 (file)
@@ -43,7 +43,7 @@ typedef struct
        int rate;            /**<  Samplerate */
        int depth;           /**< Depth */
        bool little_endian;  /**< Endianness */
-       guint64 channel_mask;     /**< channel_mask */
+       guint64 channel_mask;   /**< channel_mask */
 } player_audio_raw_data_s;
 
 /**
index eee43ac..d83991d 100644 (file)
@@ -86,6 +86,7 @@ typedef enum {
        _PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK,
        _PLAYER_EVENT_TYPE_AUDIO_STREAM_CHANGED,
        _PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED,
+       _PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED,
        _PLAYER_EVENT_TYPE_NUM
 }_player_event_e;
 
@@ -133,6 +134,45 @@ typedef struct _player_s{
 int __player_convert_error_code(int code, char* func_name);
 bool __player_state_validate(player_s * handle, player_state_e threshold);
 
+/**
+ * @brief Called when the video sink bin is crated.
+ * @since_tizen 3.0
+ * @param[out] caps                    video sink current caps
+ * @param[out ] user_data      The user data passed from the callback registration function
+ * @see player_set_vidoe_bin_created_cb()
+ * @see player_unset_vidoe_bin_created_cb()
+ */
+typedef void (*player_video_bin_created_cb)(const char *caps, void *user_data);
+
+/**
+ * @brief Registers a callback function to be invoked when video sink bin is created.
+ * @since_tizen 3.0
+ * @param[in] player    The handle to the media player
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post player_video_bin_created_cb() will be invoked.
+ * @see player_unset_vidoe_bin_created_cb()
+ */
+int player_set_video_bin_created_cb(player_h player, player_video_bin_created_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters a callback function to be invoked when video sink bin is created.
+ * @since_tizen 3.0
+ * @param[in] player    The handle to the media player
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @post player_video_bin_created_cb() will be invoked.
+ * @see player_unset_vidoe_bin_created_cb()
+ */
+int player_unset_video_bin_created_cb(player_h player);
+
+
 #ifdef __cplusplus
 }
 #endif
index 31e4c17..54fb92b 100644 (file)
@@ -43,7 +43,7 @@ typedef struct
        int rate;            /**<  Samplerate */
        int depth;           /**< Depth */
        bool little_endian;  /**< Endianness */
-       guint64 channel_mask;     /**< channel_mask */
+       guint64 channel_mask;   /**< channel_mask */
 } player_audio_raw_data_s;
 
 /**
index e5a135b..1653ec6 100644 (file)
@@ -824,6 +824,17 @@ static int __msg_callback(int message, void *param, void *user_data)
 #endif
                        }
                        break;
+               case MM_MESSAGE_VIDEO_BIN_CREATED:
+                       if( handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED])
+                       {
+                               char *caps = (char *)msg->data;
+                               if(caps)
+                                       ((player_video_bin_created_cb)
+                                               handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED])(
+                                                       caps, handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED]);
+                               g_free(caps);
+                       }
+                       break;
                case MM_MESSAGE_UNKNOWN: //0x00
                case MM_MESSAGE_WARNING: //0x02
                case MM_MESSAGE_CONNECTING: //0x100
index 94b27d0..2eb7e36 100644 (file)
@@ -422,3 +422,28 @@ int player_get_raw_video_caps(player_h player, char **caps)
 
        return PLAYER_ERROR_NONE;
 }
+
+int player_set_video_bin_created_cb(player_h player, player_video_bin_created_cb callback, void *user_data)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(callback);
+       int type = _PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED;
+
+       player_s * handle = (player_s *) player;
+       handle->user_cb[type] = callback;
+       handle->user_data[type] = user_data;
+       LOGI("[%s] Event type : %d ",__FUNCTION__, type);
+       return PLAYER_ERROR_NONE;
+}
+
+int player_unset_video_bin_created_cb(player_h player)
+{
+       PLAYER_INSTANCE_CHECK(player);
+       player_s * handle = (player_s *) player;
+       int type = _PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED;
+
+       handle->user_cb[type] = NULL;
+       handle->user_data[type] = NULL;
+       LOGI("[%s] Event type : %d ",__FUNCTION__, type);
+       return PLAYER_ERROR_NONE;
+}
index 8134a67..9a72afd 100644 (file)
@@ -22,7 +22,7 @@
 #include <appcore-efl.h>
 
 #define KEY_END "XF86Stop"
-#define MEDIA_FILE_PATH "/opt/usr/media/Color.mp4"
+#define MEDIA_FILE_PATH "/home/owner/content/Color.mp4"
 #ifdef PACKAGE
 #undef PACKAGE
 #endif
index 925fd68..b1bf9f6 100644 (file)
@@ -35,7 +35,7 @@
 #define PACKAGE "player_test"
 #define MAX_STRING_LEN 2048
 #define MMTS_SAMPLELIST_INI_DEFAULT_PATH "/opt/etc/mmts_filelist.ini"
-#define PLAYER_TEST_DUMP_PATH_PREFIX   "/opt/usr/media/dump_pcm_"
+#define PLAYER_TEST_DUMP_PATH_PREFIX   "/home/owner/content/dump_pcm_"
 #define INI_SAMPLE_LIST_MAX 9
 #define DEFAULT_HTTP_TIMEOUT -1
 
@@ -987,7 +987,7 @@ static void _player_state()
 
 static void _player_set_progressive_download()
 {
-       player_set_progressive_download_path(g_player[0], "/opt/test.pd");
+       player_set_progressive_download_path(g_player[0], "/home/owner/test.pd");
        player_set_progressive_download_message_cb(g_player[0], progress_down_cb, (void*)g_player[0]);
 }