Change wfd message 35/113335/7 accepted/tizen/common/20170214.173902 accepted/tizen/ivi/20170214.230154 accepted/tizen/mobile/20170214.230043 accepted/tizen/tv/20170214.230105 submit/tizen/20170214.113450
authorSeokHoon Lee <andy.shlee@samsung.com>
Tue, 7 Feb 2017 07:13:04 +0000 (16:13 +0900)
committerSeokHoon Lee <andy.shlee@samsung.com>
Thu, 9 Feb 2017 00:34:49 +0000 (09:34 +0900)
wfd-video-formats have none parameter for audio only sink

Signed-off-by: SeokHoon Lee <andy.shlee@samsung.com>
Change-Id: Ie2703c2015aa110b8d45e937e327d953b58d2193

gst/rtsp-server/gstwfdmessage.c [changed mode: 0755->0644]
gst/rtsp-server/rtsp-client-wfd.c [changed mode: 0755->0644]
gst/rtsp-server/rtsp-media-factory-wfd.c
packaging/gst-rtsp-server.spec

old mode 100755 (executable)
new mode 100644 (file)
index 1e7e042..4ad9d1b
@@ -484,44 +484,49 @@ gst_wfd_parse_attribute (gchar * buffer, GstWFDMessage * msg)
   } else if (!g_strcmp0 (attr, GST_STRING_WFD_VIDEO_FORMATS)) {
     msg->video_formats = g_new0 (GstWFDVideoCodeclist, 1);
     if (strlen (v)) {
-      msg->video_formats->count = 1;
-      msg->video_formats->list = g_new0 (GstWFDVideoCodec, 1);
       WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->native);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->
-          preferred_display_mode_supported);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->H264_codec.profile);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->H264_codec.level);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
-          CEA_Support);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
-          VESA_Support);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
-          HH_Support);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
-          latency);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
-          min_slice_size);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
-          slice_enc_params);
-      WFD_SKIP_SPACE (v);
-      WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
-          frame_rate_control_support);
-      WFD_SKIP_SPACE (v);
-      if (msg->video_formats->list->preferred_display_mode_supported == 1) {
-        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.max_hres);
+      if (strncmp (v, "none", 4)) {
+        msg->video_formats->count = 1;
+        msg->video_formats->list = g_new0 (GstWFDVideoCodec, 1);
+        WFD_READ_UINT32 (msg->video_formats->list->native);
         WFD_SKIP_SPACE (v);
-        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.max_vres);
+        WFD_READ_UINT32 (msg->video_formats->list->
+            preferred_display_mode_supported);
+        WFD_SKIP_SPACE (v);
+        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.profile);
+        WFD_SKIP_SPACE (v);
+        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.level);
+        WFD_SKIP_SPACE (v);
+        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
+            CEA_Support);
         WFD_SKIP_SPACE (v);
+        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
+            VESA_Support);
+        WFD_SKIP_SPACE (v);
+        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
+            HH_Support);
+        WFD_SKIP_SPACE (v);
+        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
+            latency);
+        WFD_SKIP_SPACE (v);
+        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
+            min_slice_size);
+        WFD_SKIP_SPACE (v);
+        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
+            slice_enc_params);
+        WFD_SKIP_SPACE (v);
+        WFD_READ_UINT32 (msg->video_formats->list->H264_codec.misc_params.
+            frame_rate_control_support);
+        WFD_SKIP_SPACE (v);
+        if (msg->video_formats->list->preferred_display_mode_supported == 1) {
+          WFD_READ_UINT32 (msg->video_formats->list->H264_codec.max_hres);
+          WFD_SKIP_SPACE (v);
+          WFD_READ_UINT32 (msg->video_formats->list->H264_codec.max_vres);
+          WFD_SKIP_SPACE (v);
+        }
+      } else {
+        msg->video_formats->count = 0;
+        msg->video_formats->list = NULL;
       }
     }
   } else if (!g_strcmp0 (attr, GST_STRING_WFD_3D_VIDEO_FORMATS)) {
@@ -904,8 +909,8 @@ gst_wfd_message_as_text (const GstWFDMessage * msg)
   /* list of video codecs */
   if (msg->video_formats) {
     g_string_append_printf (lines, GST_STRING_WFD_VIDEO_FORMATS);
+    g_string_append_printf (lines, ":");
     if (msg->video_formats->list) {
-      g_string_append_printf (lines, ":");
       g_string_append_printf (lines, " %02x", msg->video_formats->list->native);
       g_string_append_printf (lines, " %02x",
           msg->video_formats->list->preferred_display_mode_supported);
@@ -940,6 +945,8 @@ gst_wfd_message_as_text (const GstWFDMessage * msg)
             msg->video_formats->list->H264_codec.max_vres);
       else
         g_string_append_printf (lines, " none");
+    } else {
+      g_string_append_printf (lines, " none");
     }
     g_string_append_printf (lines, "\r\n");
   }
@@ -1720,6 +1727,13 @@ gst_wfd_message_set_preferred_video_format (GstWFDMessage * msg,
 
   if (!msg->video_formats)
     msg->video_formats = g_new0 (GstWFDVideoCodeclist, 1);
+
+  if (v_codec == GST_WFD_VIDEO_UNKNOWN) {
+    msg->video_formats->list = NULL;
+    msg->video_formats->count = 0;
+    return GST_WFD_OK;
+  }
+
   msg->video_formats->list = g_new0 (GstWFDVideoCodec, 1);
 
   while (temp) {
old mode 100755 (executable)
new mode 100644 (file)
index 973305f..d75b7c8
@@ -1493,19 +1493,21 @@ handle_wfd_response (GstRTSPClient * client, GstRTSPContext * ctx)
       }
 
       /* Get the Video formats supported by WFDSink */
-      wfd_res =
-          gst_wfd_message_get_supported_video_format (msg, &priv->cvCodec,
-          &priv->cNative, &priv->cNativeResolution,
-          (guint64 *) & priv->cCEAResolution,
-          (guint64 *) & priv->cVESAResolution,
-          (guint64 *) & priv->cHHResolution, &priv->cProfile, &priv->cLevel,
-          &priv->cvLatency, &priv->cMaxHeight, &priv->cMaxWidth,
-          &priv->cmin_slice_size, &priv->cslice_enc_params,
-          &priv->cframe_rate_control);
-      if (wfd_res != GST_WFD_OK) {
-        GST_WARNING_OBJECT (client,
-            "Failed to get wfd supported video formats...");
-        goto error;
+      if (msg->video_formats && msg->video_formats->count > 0) {
+        wfd_res =
+            gst_wfd_message_get_supported_video_format (msg, &priv->cvCodec,
+            &priv->cNative, &priv->cNativeResolution,
+            (guint64 *) & priv->cCEAResolution,
+            (guint64 *) & priv->cVESAResolution,
+            (guint64 *) & priv->cHHResolution, &priv->cProfile, &priv->cLevel,
+            &priv->cvLatency, &priv->cMaxHeight, &priv->cMaxWidth,
+            &priv->cmin_slice_size, &priv->cslice_enc_params,
+            &priv->cframe_rate_control);
+        if (wfd_res != GST_WFD_OK) {
+          GST_WARNING_OBJECT (client,
+              "Failed to get wfd supported video formats...");
+          goto error;
+        }
       }
 
       if (msg->client_rtp_ports) {
@@ -1948,6 +1950,52 @@ no_mount_points:
 }
 
 static gboolean
+_set_negotiated_video_codec (GstRTSPWFDClient * client, guint video_codec)
+{
+  GstRTSPClient *parent_client = GST_RTSP_CLIENT_CAST (client);
+
+  GstRTSPMediaFactory *factory = NULL;
+  GstRTSPMountPoints *mount_points = NULL;
+  gchar *path = NULL;
+  gint matched = 0;
+  gboolean ret = TRUE;
+
+  if (!(mount_points = gst_rtsp_client_get_mount_points (parent_client))) {
+    ret = FALSE;
+    GST_ERROR_OBJECT (client,
+        "Failed to set negotiated video codec: no mount points...");
+    goto no_mount_points;
+  }
+
+  path = g_strdup (WFD_MOUNT_POINT);
+  if (!path) {
+    ret = FALSE;
+    GST_ERROR_OBJECT (client,
+        "Failed to set negotiated vidoe codec: no path...");
+    goto no_path;
+  }
+
+  if (!(factory = gst_rtsp_mount_points_match (mount_points, path, &matched))) {
+    GST_ERROR_OBJECT (client,
+        "Failed to set negotiated vidoe codec: no factory...");
+    ret = FALSE;
+    goto no_factory;
+  }
+
+  gst_rtsp_media_factory_wfd_set_video_codec (factory, video_codec);
+  ret = TRUE;
+
+  g_object_unref (factory);
+
+no_factory:
+  g_free (path);
+no_path:
+  g_object_unref (mount_points);
+no_mount_points:
+  return ret;
+}
+
+static gboolean
 _set_negotiated_resolution (GstRTSPWFDClient * client,
     guint32 width, guint32 height)
 {
@@ -2203,53 +2251,61 @@ _set_wfd_message_body (GstRTSPWFDClient * client, GstWFDMessageType msg_type,
     }
 
     /* Set the preffered video formats */
-    priv->cvCodec = GST_WFD_VIDEO_H264;
-    priv->cProfile = tcProfile = GST_WFD_H264_BASE_PROFILE;
-    priv->cLevel = tcLevel = GST_WFD_H264_LEVEL_3_1;
-
-    resolution_supported = priv->video_resolution_supported;
-
-    /* TODO-WFD: Need to verify this logic
-       if(priv->edid_supported) {
-       if (priv->edid_hres < 1920) resolution_supported = resolution_supported & 0x8C7F;
-       if (priv->edid_hres < 1280) resolution_supported = resolution_supported & 0x1F;
-       if (priv->edid_hres < 720) resolution_supported = resolution_supported & 0x01;
-       }
-     */
+    GST_INFO_OBJECT (priv, "Set the video formats... %d", priv->cvCodec);
+    if (priv->cvCodec != GST_WFD_VIDEO_UNKNOWN) {
+      priv->cvCodec = GST_WFD_VIDEO_H264;
+      priv->cProfile = tcProfile = GST_WFD_H264_BASE_PROFILE;
+      priv->cLevel = tcLevel = GST_WFD_H264_LEVEL_3_1;
+
+      resolution_supported = priv->video_resolution_supported;
+
+      /* TODO-WFD: Need to verify this logic
+         if(priv->edid_supported) {
+         if (priv->edid_hres < 1920) resolution_supported = resolution_supported & 0x8C7F;
+         if (priv->edid_hres < 1280) resolution_supported = resolution_supported & 0x1F;
+         if (priv->edid_hres < 720) resolution_supported = resolution_supported & 0x01;
+         }
+       */
+
+      if (priv->video_native_resolution == GST_WFD_VIDEO_CEA_RESOLUTION) {
+        tcCEAResolution =
+            wfd_get_preferred_resolution (resolution_supported,
+            priv->cCEAResolution, priv->video_native_resolution, &priv->cMaxWidth,
+            &priv->cMaxHeight, &priv->cFramerate, &priv->cInterleaved);
+        GST_DEBUG
+            ("wfd negotiated resolution: %08x, width: %d, height: %d, framerate: %d, interleaved: %d",
+            tcCEAResolution, priv->cMaxWidth, priv->cMaxHeight, priv->cFramerate,
+            priv->cInterleaved);
+      } else if (priv->video_native_resolution == GST_WFD_VIDEO_VESA_RESOLUTION) {
+        tcVESAResolution =
+            wfd_get_preferred_resolution (resolution_supported,
+            priv->cVESAResolution, priv->video_native_resolution,
+            &priv->cMaxWidth, &priv->cMaxHeight, &priv->cFramerate,
+            &priv->cInterleaved);
+        GST_DEBUG
+            ("wfd negotiated resolution: %08x, width: %d, height: %d, framerate: %d, interleaved: %d",
+            tcVESAResolution, priv->cMaxWidth, priv->cMaxHeight, priv->cFramerate,
+            priv->cInterleaved);
+      } else if (priv->video_native_resolution == GST_WFD_VIDEO_HH_RESOLUTION) {
+        tcHHResolution =
+            wfd_get_preferred_resolution (resolution_supported,
+            priv->cHHResolution, priv->video_native_resolution, &priv->cMaxWidth,
+            &priv->cMaxHeight, &priv->cFramerate, &priv->cInterleaved);
+        GST_DEBUG
+            ("wfd negotiated resolution: %08x, width: %d, height: %d, framerate: %d, interleaved: %d",
+            tcHHResolution, priv->cMaxWidth, priv->cMaxHeight, priv->cFramerate,
+            priv->cInterleaved);
+      }
 
-    if (priv->video_native_resolution == GST_WFD_VIDEO_CEA_RESOLUTION) {
-      tcCEAResolution =
-          wfd_get_preferred_resolution (resolution_supported,
-          priv->cCEAResolution, priv->video_native_resolution, &priv->cMaxWidth,
-          &priv->cMaxHeight, &priv->cFramerate, &priv->cInterleaved);
-      GST_DEBUG
-          ("wfd negotiated resolution: %08x, width: %d, height: %d, framerate: %d, interleaved: %d",
-          tcCEAResolution, priv->cMaxWidth, priv->cMaxHeight, priv->cFramerate,
-          priv->cInterleaved);
-    } else if (priv->video_native_resolution == GST_WFD_VIDEO_VESA_RESOLUTION) {
-      tcVESAResolution =
-          wfd_get_preferred_resolution (resolution_supported,
-          priv->cVESAResolution, priv->video_native_resolution,
-          &priv->cMaxWidth, &priv->cMaxHeight, &priv->cFramerate,
-          &priv->cInterleaved);
-      GST_DEBUG
-          ("wfd negotiated resolution: %08x, width: %d, height: %d, framerate: %d, interleaved: %d",
-          tcVESAResolution, priv->cMaxWidth, priv->cMaxHeight, priv->cFramerate,
-          priv->cInterleaved);
-    } else if (priv->video_native_resolution == GST_WFD_VIDEO_HH_RESOLUTION) {
-      tcHHResolution =
-          wfd_get_preferred_resolution (resolution_supported,
-          priv->cHHResolution, priv->video_native_resolution, &priv->cMaxWidth,
-          &priv->cMaxHeight, &priv->cFramerate, &priv->cInterleaved);
-      GST_DEBUG
-          ("wfd negotiated resolution: %08x, width: %d, height: %d, framerate: %d, interleaved: %d",
-          tcHHResolution, priv->cMaxWidth, priv->cMaxHeight, priv->cFramerate,
-          priv->cInterleaved);
+      if (!_set_negotiated_resolution (client, priv->cMaxWidth, priv->cMaxHeight)) {
+        GST_ERROR_OBJECT (client, "Failed to set negotiated "
+            "resolution to media factory...");
+      }
     }
 
-    if (!_set_negotiated_resolution (client, priv->cMaxWidth, priv->cMaxHeight)) {
+    if (!_set_negotiated_video_codec (client, priv->cvCodec)) {
       GST_ERROR_OBJECT (client, "Failed to set negotiated "
-          "resolution to media factory...");
+          "video format to media factory...");
     }
 
     wfd_res =
index de3569a..6d19dfa 100644 (file)
@@ -222,6 +222,16 @@ gst_rtsp_media_factory_wfd_set_audio_codec (GstRTSPMediaFactory * factory,
   priv->audio_codec = audio_codec;
 }
 
+void
+gst_rtsp_media_factory_wfd_set_video_codec (GstRTSPMediaFactory * factory,
+    guint video_codec)
+{
+  GstRTSPMediaFactoryWFD *factory_wfd = GST_RTSP_MEDIA_FACTORY_WFD (factory);
+  GstRTSPMediaFactoryWFDPrivate *priv = factory_wfd->priv;
+
+  priv->video_codec = video_codec;
+}
+
 static void
 _config_bitrate (GstRTSPMediaFactoryWFD * factory)
 {
@@ -752,6 +762,11 @@ _rtsp_media_factory_wfd_create_waylandsrc_bin (GstRTSPMediaFactoryWFD * factory,
 
   GST_INFO_OBJECT (factory, "picked waylandsrc as video source");
 
+  if (priv->video_codec == GST_WFD_VIDEO_UNKNOWN) {
+    GST_INFO_OBJECT (factory, "Skip create video source.");
+    return TRUE;
+  }
+
   videosrc = gst_element_factory_make ("waylandsrc", "videosrc");
   if (NULL == videosrc) {
     GST_ERROR_OBJECT (factory, "failed to create ximagesrc element");
@@ -1126,6 +1141,7 @@ _rtsp_media_factory_wfd_create_srcbin (GstRTSPMediaFactoryWFD * factory)
     goto create_error;
   }
 
+  GST_INFO_OBJECT (factory, "Check video codec... %d", priv->video_codec);
   /* create video src element */
   switch (priv->videosrc_type) {
     case GST_WFD_VSRC_XIMAGESRC:
@@ -1196,29 +1212,31 @@ _rtsp_media_factory_wfd_create_srcbin (GstRTSPMediaFactoryWFD * factory)
     goto create_error;
   }
 
-  /* request video sink pad from muxer, which has elementary pid 0x1011 */
-  mux_vsinkpad = gst_element_get_request_pad (mux, "sink_4113");
-  if (!mux_vsinkpad) {
-    GST_ERROR_OBJECT (factory, "Failed to get sink pad from muxer...");
-    goto create_error;
-  }
+  if (priv->video_codec > GST_WFD_VIDEO_UNKNOWN) {
+    /* request video sink pad from muxer, which has elementary pid 0x1011 */
+    mux_vsinkpad = gst_element_get_request_pad (mux, "sink_4113");
+    if (!mux_vsinkpad) {
+      GST_ERROR_OBJECT (factory, "Failed to get sink pad from muxer...");
+      goto create_error;
+    }
 
-  /* request srcpad from video queue */
-  srcpad = gst_element_get_static_pad (priv->video_queue, "src");
-  if (!srcpad) {
-    GST_ERROR_OBJECT (factory, "Failed to get srcpad from video queue...");
-    goto create_error;
-  }
+    /* request srcpad from video queue */
+    srcpad = gst_element_get_static_pad (priv->video_queue, "src");
+    if (!srcpad) {
+      GST_ERROR_OBJECT (factory, "Failed to get srcpad from video queue...");
+      goto create_error;
+    }
 
-  if (gst_pad_link (srcpad, mux_vsinkpad) != GST_PAD_LINK_OK) {
-    GST_ERROR_OBJECT (factory,
-        "Failed to link video queue src pad & muxer video sink pad...");
-    goto create_error;
-  }
+    if (gst_pad_link (srcpad, mux_vsinkpad) != GST_PAD_LINK_OK) {
+      GST_ERROR_OBJECT (factory,
+          "Failed to link video queue src pad & muxer video sink pad...");
+      goto create_error;
+    }
 
-  gst_object_unref (mux_vsinkpad);
-  gst_object_unref (srcpad);
-  srcpad = NULL;
+    gst_object_unref (mux_vsinkpad);
+    gst_object_unref (srcpad);
+    srcpad = NULL;
+  }
 
   /* create audio source elements & add to pipeline */
   if (!_rtsp_media_factory_wfd_create_audio_capture_bin (factory, srcbin))
index d777ac1..ac6ccb6 100644 (file)
@@ -1,7 +1,7 @@
 Name:       gst-rtsp-server
 Summary:    Multimedia Framework Library
 Version:    1.6.1
-Release:    7
+Release:    8
 Url:        http://gstreamer.freedesktop.org/
 Group:      System/Libraries
 License:    LGPL-2.0+