add mm_player_set_video_frame_render_error_callback() API
authorSangchul Lee <sc11.lee@samsung.com>
Fri, 18 Jan 2013 12:40:12 +0000 (21:40 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 23 Jan 2013 09:30:04 +0000 (18:30 +0900)
Change-Id: I158b089c7e823ef1ddf7b1ccc45bfa88a191c94d

packaging/libmm-player.spec
src/include/mm_player_internal.h
src/include/mm_player_priv.h
src/mm_player.c
src/mm_player_priv.c

index 4da2b04..f036a26 100644 (file)
@@ -1,7 +1,7 @@
 
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.2.10
+Version:    0.2.11
 Release:    0
 Group:      System/Libraries
 License:    Apache License, Version 2.0
index ac3256a..bf8b4c0 100644 (file)
@@ -166,6 +166,17 @@ typedef bool       (*mm_player_video_stream_callback) (void *stream, int stream_size,
 typedef bool   (*mm_player_video_capture_callback) (void *stream, int stream_size, void *user_param);
 
 /**
+ * Video frame render error callback function type.
+ *
+ * @param      error_id        [in]    cause of error
+ * @param      user_param      [in]    User defined parameter which is passed when set
+ *                                                             video frame render error callback
+ *
+ * @return     This callback function have to return MM_ERROR_NONE.
+ */
+typedef bool   (*mm_player_video_frame_render_error_callback) (void *error_id, void *user_param);
+
+/**
  * This function is to set play speed for playback.
  *
  * @param      player          [in]    Handle of player.
@@ -197,6 +208,22 @@ int mm_player_set_play_speed(MMHandleType player, float rate);
 int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_stream_callback callback, void *user_param);
 
 /**
+ * This function set callback function for rendering error information of video render plug-in.
+ *
+ * @param      player          [in]    Handle of player.
+ * @param      callback                [in]    Frame render error callback function.
+ * @param      user_param      [in]    User parameter which is passed to callback function.
+ *
+ * @return     This function returns zero on success, or negative value with error code.
+ * @see
+ * @remark     None
+ * @par Example
+ * @code
+ * @endcode
+ */
+int mm_player_set_video_frame_render_error_callback(MMHandleType player, mm_player_video_frame_render_error_callback callback, void *user_param);
+
+/**
  * This function set callback function for receiving audio stream from player.
  *
  * @param       player          [in]    Handle of player.
index f42810e..08f7ba2 100644 (file)
@@ -452,14 +452,14 @@ typedef struct {
        MMPlayerGstPipelineInfo *pipeline;
        gboolean pipeline_is_constructed;
 
-       /* Buffering support cbs*/
+       /* buffering support cbs*/
        mm_player_buffer_need_data_callback need_data_cb;
        mm_player_buffer_enough_data_callback enough_data_cb;
        mm_player_buffer_seek_data_callback seek_data_cb;
 
        void* buffer_cb_user_param;
 
-       /* for video stream callback */
+       /* video stream callback */
        mm_player_video_stream_callback video_stream_cb;
        void* video_stream_cb_user_param;
        int use_video_stream;
@@ -475,6 +475,10 @@ 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;
 
@@ -646,6 +650,7 @@ int _mmplayer_set_playspeed(MMHandleType hplayer, gdouble rate);
 int _mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback 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_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos);
index 1783b48..e50fefb 100644 (file)
@@ -271,6 +271,23 @@ int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_str
        return result;
 }
 
+int mm_player_set_video_frame_render_error_callback(MMHandleType player, mm_player_video_frame_render_error_callback callback, void *user_param)
+{
+       int result = MM_ERROR_NONE;
+
+       debug_log("\n");
+
+       return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+       MMPLAYER_CMD_LOCK( player );
+
+       result = _mmplayer_set_videoframe_render_error_cb(player, callback, user_param);
+
+       MMPLAYER_CMD_UNLOCK( player );
+
+       return result;
+}
+
 int mm_player_do_video_capture(MMHandleType player)
 {
        int result = MM_ERROR_NONE;
index c4e22ad..d21d27f 100644 (file)
@@ -511,6 +511,45 @@ int width, int height, gpointer data) // @
        debug_fleave();
 }
 
+static void
+__mmplayer_videoframe_render_error_cb(GstElement *element, void *error_id, gpointer data)
+{
+       mm_player_t* player = (mm_player_t*)data;
+
+       return_if_fail ( player );
+
+       debug_fenter();
+
+       if (player->video_frame_render_error_cb )
+       {
+               if (player->attrs)
+               {
+                       int surface_type = 0;
+                       mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &surface_type);
+                       switch (surface_type)
+                       {
+                       case MM_DISPLAY_SURFACE_X_EXT:
+                               player->video_frame_render_error_cb((unsigned int*)error_id, player->video_frame_render_error_cb_user_param);
+                               debug_log("display surface type(X_EXT) : render error callback(%p) is finished", player->video_frame_render_error_cb);
+                               break;
+                       default:
+                               debug_error("video_frame_render_error_cb was set, but this surface type(%d) is not supported", surface_type);
+                               break;
+                       }
+               }
+               else
+               {
+                       debug_error("could not get surface type");
+               }
+       }
+       else
+       {
+               debug_warning("video_frame_render_error_cb was not set");
+       }
+
+       debug_fleave();
+}
+
 gboolean
 _mmplayer_update_content_attrs(mm_player_t* player) // @
 {
@@ -2837,7 +2876,7 @@ _mmplayer_update_video_param(mm_player_t* player) // @
                        }
                }
                break;
-               case MM_DISPLAY_SURFACE_X_EXT:  /* NOTE : this surface type is for the video texture(canvas texture) */
+               case MM_DISPLAY_SURFACE_X_EXT:  /* NOTE : this surface type is used for the videoTexture(canvasTexture) overlay */
                {
                        void *pixmap_id_cb = NULL;
                        void *pixmap_id_cb_user_data = NULL;
@@ -3572,10 +3611,9 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl
                {
                        void *pixmap_id_cb = NULL;
                        mm_attrs_get_data_by_name(attrs, "display_overlay", &pixmap_id_cb);
-                       if (pixmap_id_cb) /* this is for the video textue(canvas texture) */
+                       if (pixmap_id_cb) /* this is used for the videoTextue(canvasTexture) overlay */
                        {
                                videosink_element = PLAYER_INI()->videosink_element_x;
-                               debug_warning("video texture usage");
                        }
                        else
                        {
@@ -3597,6 +3635,20 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl
 
                MMPLAYER_CREATE_ELEMENT(videobin, MMPLAYER_V_SINK, videosink_element, videosink_element, TRUE);
                debug_log("selected videosink name: %s", videosink_element);
+
+               /* connect signal handlers for sink plug-in */
+               switch (surface_type) {
+               case MM_DISPLAY_SURFACE_X_EXT:
+                       MMPLAYER_SIGNAL_CONNECT( player,
+                                                                       player->pipeline->videobin[MMPLAYER_V_SINK].gst,
+                                                                       "frame-render-error",
+                                                                       G_CALLBACK(__mmplayer_videoframe_render_error_cb),
+                                                                       player );
+                       debug_log("videoTexture usage, connect a signal handler for pixmap rendering error");
+                       break;
+               default:
+                       break;
+               }
        }
 
        if ( _mmplayer_update_video_param(player) != MM_ERROR_NONE)
@@ -6865,7 +6917,28 @@ _mmplayer_set_buffer_seek_data_cb(MMHandleType hplayer, mm_player_buffer_seek_da
        return MM_ERROR_NONE;
 }
 
-int __mmplayer_start_streaming_ext(mm_player_t *player)
+int
+_mmplayer_set_videoframe_render_error_cb(MMHandleType hplayer, mm_player_video_frame_render_error_callback callback, void *user_param) // @
+{
+       mm_player_t* player = (mm_player_t*) hplayer;
+
+       debug_fenter();
+
+       return_val_if_fail ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+       return_val_if_fail ( callback, MM_ERROR_INVALID_ARGUMENT );
+
+       player->video_frame_render_error_cb = callback;
+       player->video_frame_render_error_cb_user_param = user_param;
+
+       debug_log("Video frame render error cb Handle value is %p : %p\n", player, player->video_frame_render_error_cb);
+
+       debug_fleave();
+
+       return MM_ERROR_NONE;
+}
+
+int
+__mmplayer_start_streaming_ext(mm_player_t *player)
 {
        gint ret = MM_ERROR_NONE;