} 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)) {
/* 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);
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");
}
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) {
}
/* 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) {
}
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)
{
}
/* 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 =
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)
{
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");
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:
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))