remove unused property setting and disable enable-last-sample property in case of... 26/81426/2
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 26 Jul 2016 07:00:29 +0000 (16:00 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 26 Jul 2016 07:02:40 +0000 (16:02 +0900)
Change-Id: Iba1eb5b5132cb9a82c01ecb2f0f7f1e1490d5095

src/include/mm_player.h
src/mm_player_attrs.c
src/mm_player_priv.c

index 28a5b47..9fb1798 100644 (file)
@@ -827,17 +827,6 @@ typedef enum
 } MMPlayerStreamType;
 
 /**
- * Enumeration for pipeline type.
- */
-typedef enum
-{
-       MM_PLAYER_PIPELINE_LEGACY,      /**< Legacy pipeline */
-       MM_PLAYER_PIPELINE_SERVER,      /**< Pipeline for server(src,decoder,demux...) */
-       MM_PLAYER_PIPELINE_CLIENT,      /**< Pipeline for client(sink)*/
-       MM_PLAYER_PIPELINE_MAX
-} MMPlayerPipelineType;
-
-/**
  * Attribute validity structure
  */
 typedef struct {
index 1528242..8e4f8c7 100644 (file)
@@ -172,24 +172,22 @@ __mmplayer_apply_attribute(MMHandleType handle, const char *attribute_name)
        MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
 
        player = MM_PLAYER_CAST(handle);
+       MMPlayerGstPipelineInfo *pipeline = player->pipeline;
 
-       if ( g_strrstr(attribute_name, "display") || g_strrstr(attribute_name, "wl_window_render_x"))
+       if (!pipeline ||
+               !pipeline->videobin ||
+               !pipeline->videobin[MMPLAYER_V_SINK].gst ) /* Currently, there are only display related implementation at below */
        {
-               int pipeline_type = 0;
-               MMPlayerGstPipelineInfo *pipeline = player->pipeline;
-
-               /* check videosink element is created */
-               if(!pipeline)
-                       return MM_ERROR_NONE;
-               mm_attrs_get_int_by_name(player->attrs, "pipeline_type", &pipeline_type);
-               if (pipeline_type == MM_PLAYER_PIPELINE_CLIENT) {
-                       if(!pipeline->mainbin || !pipeline->mainbin[MMPLAYER_M_V_SINK].gst)
-                               return MM_ERROR_NONE;
-               } else {
-                       if(!pipeline->videobin || !pipeline->videobin[MMPLAYER_V_SINK].gst)
-                               return MM_ERROR_NONE;
-               }
+               /*
+                * The attribute should be committed even though videobin is not created yet.
+                * So, true should be returned here.
+                * Otherwise, video can be diaplayed abnormal.
+                */
+               return MM_ERROR_NONE;
+       }
 
+       if ( g_strrstr(attribute_name, "display") || g_strrstr(attribute_name, "wl_window_render_x"))
+       {
                char *param_name = NULL;
                int str_len = strlen(attribute_name);
                param_name = g_malloc0(str_len);
@@ -208,6 +206,18 @@ __mmplayer_apply_attribute(MMHandleType handle, const char *attribute_name)
                g_free(param_name);
        }
 
+       if (g_strrstr(attribute_name, MM_PLAYER_GAPLESS_MODE))
+       {
+               int gapless = 0;
+
+               mm_attrs_get_int_by_name (player->attrs, "gapless_mode", &gapless);
+
+               if (gapless > 0) {
+                       LOGD("disable last-sample at videosink");
+                       g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "enable-last-sample", FALSE, NULL);
+               }
+       }
+
        return MM_ERROR_NONE;
 }
 
@@ -1088,15 +1098,6 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        MM_DISPLAY_SURFACE_NUM - 1
                },
                {
-                       "pipeline_type",
-                       MM_ATTRS_TYPE_INT,
-                       MM_ATTRS_FLAG_RW,
-                       (void *) MM_PLAYER_PIPELINE_LEGACY,
-                       MM_ATTRS_VALID_TYPE_INT_RANGE,
-                       MM_PLAYER_PIPELINE_LEGACY,
-                       MM_PLAYER_PIPELINE_MAX - 1
-               },
-               {
                        "drc_mode",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
index 6591ea3..d37b9e5 100644 (file)
@@ -5948,22 +5948,19 @@ __mmplayer_gst_create_video_pipeline(mm_player_t* player, GstCaps* caps, MMDispl
                                        {
                                                g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst,
                                                        "use-tbm", use_tbm, NULL);
+                                       }
+                               }
+                               else
+                               {
+                                       if (attrs)
+                                       {
+                                               int gapless = 0;
 
-                                               if (attrs) {
-                                                       gboolean use_gapless = FALSE;
-                                                       int count = 0;
-                                                       int gapless = 0;
-
-                                                       mm_attrs_get_int_by_name (attrs, "profile_play_count", &count);
-                                                       mm_attrs_get_int_by_name (attrs, "gapless_mode", &gapless);
-
-                                                       if (count == -1 || count > 1 || gapless == 1) /* enable gapless when looping */
-                                                               use_gapless = TRUE;
+                                               mm_attrs_get_int_by_name (attrs, "gapless_mode", &gapless);
 
-                                                       if (g_object_class_find_property (G_OBJECT_GET_CLASS (player->pipeline->videobin[MMPLAYER_V_SINK].gst), "use-gapless")) {
-                                                               LOGD("set gapless mode at videosink to %d", use_gapless);
-                                                               g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "use-gapless", use_gapless, NULL);
-                                                       }
+                                               if (gapless > 0) {
+                                                       LOGD("disable last-sample");
+                                                       g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "enable-last-sample", FALSE, NULL);
                                                }
                                        }
                                }
@@ -12842,20 +12839,6 @@ int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_
 
                player->uri_info.uri_list = g_list_append(player->uri_info.uri_list, g_strdup(uri));
                LOGD("add new path : %s (total num of list = %d)", uri, g_list_length(player->uri_info.uri_list));
-
-               if (player->pipeline && player->pipeline->videobin &&
-                       player->pipeline->videobin[MMPLAYER_V_SINK].gst &&
-                       g_object_class_find_property (G_OBJECT_GET_CLASS (player->pipeline->videobin[MMPLAYER_V_SINK].gst), "use-gapless"))
-               {
-                       int gapless = 0;
-
-                       if (attrs) {
-                               mm_attrs_get_int_by_name (attrs, "gapless_mode", &gapless);
-                       }
-
-                       LOGD("set gapless mode to %d", gapless);
-                       g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "use-gapless", (gboolean)gapless, NULL);
-               }
        }
 
        MMPLAYER_FLEAVE();
@@ -12983,7 +12966,6 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
        const gchar* klass = NULL;
        gint idx = 0;
        int surface_type = 0;
-       int pipeline_type = 0;
 
        factory_name = GST_OBJECT_NAME (factory);
        klass = gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS);
@@ -12999,13 +12981,8 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
        }
 
        /* To support evasimagesink, omx is excluded temporarily*/
-       mm_attrs_get_int_by_name(player->attrs, "pipeline_type", &pipeline_type);
-       if (pipeline_type == MM_PLAYER_PIPELINE_LEGACY)
-               mm_attrs_get_int_by_name(player->attrs,
-                               "display_surface_type", &surface_type);
-       else
-               mm_attrs_get_int_by_name(player->attrs,
-                               "display_surface_client_type", &surface_type);
+       mm_attrs_get_int_by_name(player->attrs,
+                       "display_surface_type", &surface_type);
        LOGD("check display surface type attribute: %d", surface_type);
        if (surface_type == MM_DISPLAY_SURFACE_EVAS && strstr(factory_name, "omx"))
        {