diff --git a/ChangeLog b/ChangeLog index b79b55a9bc..a88aa95f6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-11-28 Wim Taymans + + * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_open): + * gst/rtsp/gstrtspsrc.h: + * gst/rtsp/rtspext.h: + * gst/rtsp/rtspextwms.c: (rtsp_ext_wms_configure_stream), + (rtsp_ext_wms_get_context): + Add method so that extensions can choose to disable the setup of + a stream. + Make the WMS extension skip setup of x-wms-rtx streams. Fixes #377792. + 2006-11-27 Wim Taymans Patch by: Jonas Holmberg diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index f29bfa2994..6af4c68bfb 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -1770,6 +1770,14 @@ gst_rtspsrc_open (GstRTSPSrc * src) /* create stream from the media, can never return NULL */ stream = gst_rtspsrc_create_stream (src, &sdp, i); + /* see if we need to configure this stream */ + if (src->extension && src->extension->configure_stream) { + if (!src->extension->configure_stream (src->extension, stream)) { + GST_DEBUG_OBJECT (src, "skipping stream %d, disabled by extension", i); + continue; + } + } + /* merge/overwrite global caps */ if (stream->caps) { guint j, num; @@ -1791,8 +1799,10 @@ gst_rtspsrc_open (GstRTSPSrc * src) } /* skip setup if we have no URL for it */ - if (stream->setup_url == NULL) + if (stream->setup_url == NULL) { + GST_DEBUG_OBJECT (src, "skipping stream %d, no setup", i); continue; + } GST_DEBUG_OBJECT (src, "doing setup of stream %d with %s", i, stream->setup_url); diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h index d7ea7e59fa..cdc7c7cd58 100644 --- a/gst/rtsp/gstrtspsrc.h +++ b/gst/rtsp/gstrtspsrc.h @@ -50,7 +50,6 @@ G_BEGIN_DECLS #include "gstrtsp.h" #include "rtsp.h" -#include "rtspext.h" #define GST_TYPE_RTSPSRC \ (gst_rtspsrc_get_type()) @@ -74,6 +73,8 @@ typedef struct _GstRTSPSrcClass GstRTSPSrcClass; typedef struct _GstRTSPStream GstRTSPStream; +#include "rtspext.h" + struct _GstRTSPStream { gint id; diff --git a/gst/rtsp/rtspext.h b/gst/rtsp/rtspext.h index 3f41f31076..c3f938ef6f 100644 --- a/gst/rtsp/rtspext.h +++ b/gst/rtsp/rtspext.h @@ -45,6 +45,7 @@ #include +#include "gstrtspsrc.h" #include "rtsptransport.h" #include "sdp.h" @@ -58,17 +59,19 @@ struct _RTSPExtensionCtx gchar *name; gpointer *src; - gboolean (*detect_server) (RTSPExtensionCtx *ctx, RTSPMessage *resp); + gboolean (*detect_server) (RTSPExtensionCtx *ctx, RTSPMessage *resp); - RTSPResult (*before_send) (RTSPExtensionCtx *ctx, RTSPMessage *req); - RTSPResult (*after_send) (RTSPExtensionCtx *ctx, RTSPMessage *req, RTSPMessage *resp); + RTSPResult (*before_send) (RTSPExtensionCtx *ctx, RTSPMessage *req); + RTSPResult (*after_send) (RTSPExtensionCtx *ctx, RTSPMessage *req, RTSPMessage *resp); - RTSPResult (*parse_sdp) (RTSPExtensionCtx *ctx, SDPMessage *sdp); - RTSPResult (*setup_media) (RTSPExtensionCtx *ctx, SDPMedia *media); + RTSPResult (*parse_sdp) (RTSPExtensionCtx *ctx, SDPMessage *sdp); + RTSPResult (*setup_media) (RTSPExtensionCtx *ctx, SDPMedia *media); - RTSPResult (*get_transports) (RTSPExtensionCtx *ctx, RTSPLowerTrans protocols, gchar **transport); + gboolean (*configure_stream) (RTSPExtensionCtx *ctx, GstRTSPStream *stream); - RTSPResult (*stream_select) (RTSPExtensionCtx *ctx); + RTSPResult (*get_transports) (RTSPExtensionCtx *ctx, RTSPLowerTrans protocols, gchar **transport); + + RTSPResult (*stream_select) (RTSPExtensionCtx *ctx); }; RTSPExtensionCtx* rtsp_extension_detect (RTSPMessage *resp); diff --git a/gst/rtsp/rtspextwms.c b/gst/rtsp/rtspextwms.c index 81964e1eba..44776d675d 100644 --- a/gst/rtsp/rtspextwms.c +++ b/gst/rtsp/rtspextwms.c @@ -142,6 +142,25 @@ no_config: } } +static gboolean +rtsp_ext_wms_configure_stream (RTSPExtensionCtx * ctx, GstRTSPStream * stream) +{ + GstRTSPSrc *src = (GstRTSPSrc *) ctx->src; + GstStructure *s; + const gchar *encoding; + + s = gst_caps_get_structure (stream->caps, 0); + encoding = gst_structure_get_string (s, "encoding-name"); + + GST_DEBUG_OBJECT (src, "%" GST_PTR_FORMAT " encoding-name: %s", stream->caps, + encoding); + + if (!strcmp (encoding, "x-wms-rtx")) + return FALSE; + + return TRUE; +} + RTSPExtensionCtx * rtsp_ext_wms_get_context (void) { @@ -151,6 +170,7 @@ rtsp_ext_wms_get_context (void) res->ctx.parse_sdp = rtsp_ext_wms_parse_sdp; res->ctx.before_send = rtsp_ext_wms_before_send; res->ctx.after_send = rtsp_ext_wms_after_send; + res->ctx.configure_stream = rtsp_ext_wms_configure_stream; return (RTSPExtensionCtx *) res; }