player: set uri type for push media stream 21/48921/3 accepted/tizen/mobile/20151008.004640 accepted/tizen/tv/20151008.004652 accepted/tizen/wearable/20151008.004706 submit/tizen/20151007.084349
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 1 Oct 2015 13:45:39 +0000 (22:45 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 5 Oct 2015 09:57:49 +0000 (18:57 +0900)
Change-Id: I237c3c89c4031e4e4526c6fe6aa9d4c5e73a748e

src/include/mm_player.h
src/include/mm_player_es.h
src/include/mm_player_priv.h
src/include/mm_player_utils.h
src/server/mm_player_es.c
src/server/mm_player_priv.c

index e638116..f57c998 100644 (file)
@@ -2106,7 +2106,6 @@ int mm_player_submit_packet(MMHandleType player, media_packet_h packet);
  *
  * @endcode
  */
-
 int mm_player_set_video_info (MMHandleType player, media_format_h format);
 
 /**mm_player_set_audio_info
@@ -2118,7 +2117,6 @@ int mm_player_set_video_info (MMHandleType player, media_format_h format);
  *
  * @endcode
  */
-
 int mm_player_set_audio_info (MMHandleType player, media_format_h format);
 
 /**mm_player_set_subtitle_info
@@ -2130,7 +2128,6 @@ int mm_player_set_audio_info (MMHandleType player, media_format_h format);
  *
  * @endcode
  */
-
 int mm_player_set_subtitle_info (MMHandleType player, MMPlayerSubtitleStreamInfo *info);
 
 /**
index 977e6b6..7eb8084 100644 (file)
@@ -37,7 +37,6 @@ extern "C"
 /*=======================================================================================
 | GLOBAL FUNCTION PROTOTYPES                                                           |
 ========================================================================================*/
-
 int _mmplayer_set_video_info (MMHandleType player, media_format_h format);
 
 int _mmplayer_set_audio_info (MMHandleType player, media_format_h format);
index be05b94..fde4df0 100644 (file)
@@ -136,7 +136,7 @@ enum MMPlayerUriType {
        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_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 */
index ba4250b..f67981d 100644 (file)
@@ -222,7 +222,7 @@ LOGD("-- prev %s, current %s, pending %s, target %s --\n", \
 #define MMPLAYER_IS_LIVE_STREAMING(x_player)   __is_live_streaming(x_player)
 #define MMPLAYER_IS_DASH_STREAMING(x_player)   __is_dash_streaming(x_player)
 #define MMPLAYER_IS_SMOOTH_STREAMING(x_player) __is_smooth_streaming(x_player)
-#define MMPLAYER_IS_ES_BUFF_SRC(x_player)              __is_es_buff_src(x_player)
+#define MMPLAYER_IS_MS_BUFF_SRC(x_player)              __is_ms_buff_src(x_player)
 
 #define MMPLAYER_URL_HAS_DASH_SUFFIX(x_player) __has_suffix(x_player, "mpd")
 #define MMPLAYER_URL_HAS_HLS_SUFFIX(x_player) __has_suffix(x_player, "m3u8")
index 26294b0..6d88a8e 100644 (file)
@@ -529,6 +529,18 @@ _mmplayer_video_caps_new (MMHandleType hplayer, MMPlayerVideoStreamInfo * video,
   return MM_ERROR_NONE;
 }
 
+static void
+_mmplayer_set_uri_type(mm_player_t *player)
+{
+       MMPLAYER_FENTER ();
+
+       player->profile.uri_type = MM_PLAYER_URI_TYPE_MS_BUFF;
+       player->es_player_push_mode = TRUE;
+
+       MMPLAYER_FLEAVE ();
+       return;
+}
+
 int
 _mmplayer_set_video_info (MMHandleType hplayer, media_format_h format)
 {
@@ -540,6 +552,8 @@ _mmplayer_set_video_info (MMHandleType hplayer, media_format_h format)
 
   MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
+  _mmplayer_set_uri_type(player);
+
   ret = _parse_media_format (&video, NULL, format);
   if(ret != MM_ERROR_NONE)
     return ret;
@@ -601,6 +615,8 @@ _mmplayer_set_audio_info (MMHandleType hplayer, media_format_h format)
 
   MMPLAYER_RETURN_VAL_IF_FAIL (hplayer, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
+  _mmplayer_set_uri_type(player);
+
   ret = _parse_media_format (NULL, &audio, format);
   if(ret != MM_ERROR_NONE)
     return ret;
index 2919d32..8d8bc3c 100644 (file)
@@ -230,7 +230,7 @@ static void __mmplayer_add_new_caps(GstPad* pad, GParamSpec* unused, gpointer da
 static void __mmplayer_set_unlinked_mime_type(mm_player_t* player, GstCaps *caps);
 
 /* util */
-static gboolean __is_es_buff_src(mm_player_t* player);
+static gboolean __is_ms_buff_src(mm_player_t* player);
 static gboolean __has_suffix(mm_player_t * player, const gchar * suffix);
 
 static int  __mmplayer_realize_streaming_ext(mm_player_t* player);
@@ -2872,7 +2872,7 @@ __mmplayer_gst_decode_pad_added (GstElement *elem, GstPad *pad, gpointer data)
                        gint samplerate = 0;
                        gint channels = 0;
 
-                       if (MMPLAYER_IS_ES_BUFF_SRC(player))
+                       if (MMPLAYER_IS_MS_BUFF_SRC(player))
                        {
                                __mmplayer_gst_decode_callback (elem, pad, player);
                                return;
@@ -3661,7 +3661,7 @@ __mmplayer_gst_decode_no_more_pads (GstElement *elem, gpointer data)
        }
 
 
-       if (!MMPLAYER_IS_ES_BUFF_SRC(player))
+       if (!MMPLAYER_IS_MS_BUFF_SRC(player))
        {
                if (text_selector)
                {
@@ -7014,9 +7014,9 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
                                G_CALLBACK(__gst_appsrc_enough_data), player);
                }
                break;
-               case MM_PLAYER_URI_TYPE_ES_BUFF:
+               case MM_PLAYER_URI_TYPE_MS_BUFF:
                {
-                       LOGD("es buff src is selected\n");
+                       LOGD("MS buff src is selected\n");
 
                        if (player->v_stream_caps)
                        {
@@ -7240,7 +7240,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
                                NULL,
                                0);
        }
-       if (MMPLAYER_IS_ES_BUFF_SRC(player))
+       if (MMPLAYER_IS_MS_BUFF_SRC(player))
        {
                if (player->v_stream_caps)
                {
@@ -7307,7 +7307,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
        /* create autoplugging element if src element is not a rtsp src */
        if ((player->profile.uri_type != MM_PLAYER_URI_TYPE_URL_RTSP) &&
                (player->profile.uri_type != MM_PLAYER_URI_TYPE_URL_WFD) &&
-               (player->profile.uri_type != MM_PLAYER_URI_TYPE_ES_BUFF))
+               (player->profile.uri_type != MM_PLAYER_URI_TYPE_MS_BUFF))
        {
                element = NULL;
                enum MainElementID elemId = MMPLAYER_M_NUM;
@@ -7387,7 +7387,7 @@ __mmplayer_gst_create_pipeline(mm_player_t* player) // @
        /* now we have completed mainbin. take it */
        player->pipeline->mainbin = mainbin;
 
-       if (MMPLAYER_IS_ES_BUFF_SRC(player))
+       if (MMPLAYER_IS_MS_BUFF_SRC(player))
        {
                GstPad *srcpad = NULL;
 
@@ -8167,7 +8167,7 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo
                && MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED )
                goto PENDING;
 
-       if( !MMPLAYER_IS_ES_BUFF_SRC(player) )
+       if( !MMPLAYER_IS_MS_BUFF_SRC(player) )
        {
                /* check duration */
                /* NOTE : duration cannot be zero except live streaming.
@@ -8209,7 +8209,7 @@ __gst_set_position(mm_player_t* player, int format, unsigned long position, gboo
        {
                case MM_PLAYER_POS_FORMAT_TIME:
                {
-                       if( !MMPLAYER_IS_ES_BUFF_SRC(player) )
+                       if( !MMPLAYER_IS_MS_BUFF_SRC(player) )
                        {
                                /* check position is valid or not */
                                if ( position > dur_msec )
@@ -8635,7 +8635,7 @@ static int __mmfplayer_parse_profile(const char *uri, void *param, MMPlayerParse
                if (strlen(path))
                {
                        strcpy(data->uri, uri);
-                       data->uri_type = MM_PLAYER_URI_TYPE_ES_BUFF;
+                       data->uri_type = MM_PLAYER_URI_TYPE_MS_BUFF;
                        ret = MM_ERROR_NONE;
                }
        }
@@ -9771,12 +9771,15 @@ _mmplayer_realize(MMHandleType hplayer) // @
        mm_attrs_get_string_by_name(attrs, "profile_uri", &uri);
        mm_attrs_get_data_by_name(attrs, "profile_user_param", &param);
 
-       ret = __mmfplayer_parse_profile((const char*)uri, param, &player->profile);
-
-       if (ret != MM_ERROR_NONE)
+       if (player->profile.uri_type == MM_PLAYER_URI_TYPE_NONE)
        {
-               LOGE("failed to parse profile\n");
-               return ret;
+               ret = __mmfplayer_parse_profile((const char*)uri, param, &player->profile);
+
+               if (ret != MM_ERROR_NONE)
+               {
+                       LOGE("failed to parse profile\n");
+                       return ret;
+               }
        }
 
        /* FIXIT : we can use thouse in player->profile directly */
@@ -9787,7 +9790,7 @@ _mmplayer_realize(MMHandleType hplayer) // @
                player->mem_buf.offset = 0;
        }
 
-       if (player->profile.uri_type == MM_PLAYER_URI_TYPE_ES_BUFF)
+       if (uri && (strstr(uri, "es_buff://")))
        {
                if (strstr(uri, "es_buff://push_mode"))
                {
@@ -11531,7 +11534,7 @@ __mmplayer_try_to_plug(mm_player_t* player, GstPad *pad, const GstCaps *caps) //
                klass = gst_element_factory_get_metadata (GST_ELEMENT_FACTORY(factory), GST_ELEMENT_METADATA_KLASS);
 
                /*parsers are not required in case of external feeder*/
-               if (g_strrstr(klass, "Codec/Parser") && MMPLAYER_IS_ES_BUFF_SRC(player))
+               if (g_strrstr(klass, "Codec/Parser") && MMPLAYER_IS_MS_BUFF_SRC(player))
                        continue;
 
                /* NOTE : msl don't need to use image plugins.
@@ -12772,7 +12775,7 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
                goto DONE;
        }
 
-       if ((MMPLAYER_IS_ES_BUFF_SRC(player)) &&
+       if ((MMPLAYER_IS_MS_BUFF_SRC(player)) &&
                (g_strrstr(klass, "Codec/Demuxer") || (g_strrstr(klass, "Codec/Parser"))))
        {
                // TO CHECK : subtitle if needed, add subparse exception.
@@ -14706,7 +14709,7 @@ __gst_send_event_to_sink( mm_player_t* player, GstEvent* event )
                                        }
                                }
 
-                               if( MMPLAYER_IS_ES_BUFF_SRC(player))
+                               if( MMPLAYER_IS_MS_BUFF_SRC(player))
                                {
                                        sinks = g_list_next (sinks);
                                        continue;
@@ -15917,11 +15920,11 @@ int _mmplayer_get_subtitle_silent (MMHandleType hplayer, int* silent)
 }
 
 gboolean
-__is_es_buff_src( mm_player_t* player )
+__is_ms_buff_src( mm_player_t* player )
 {
        MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
 
-       return ( player->profile.uri_type == MM_PLAYER_URI_TYPE_ES_BUFF) ? TRUE : FALSE;
+       return ( player->profile.uri_type == MM_PLAYER_URI_TYPE_MS_BUFF) ? TRUE : FALSE;
 }
 
 gboolean