diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2006-11-28 11:52:27 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2006-11-28 11:52:27 +0000 |
commit | f249d639f843b15487caf402374f189b5f702c7b (patch) | |
tree | 753e457fb25ce8a7e4f383de4e98fbd788c21549 /gst | |
parent | 4b8597668d8b56f4f735f3c5feef3e59ccf366e5 (diff) |
gst/rtsp/: Add method so that extensions can choose to disable the setup of a stream.
Original commit message from CVS:
* 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.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/rtsp/gstrtspsrc.c | 12 | ||||
-rw-r--r-- | gst/rtsp/gstrtspsrc.h | 3 | ||||
-rw-r--r-- | gst/rtsp/rtspext.h | 17 | ||||
-rw-r--r-- | gst/rtsp/rtspextwms.c | 20 |
4 files changed, 43 insertions, 9 deletions
diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index f29bfa29..6af4c68b 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 d7ea7e59..cdc7c7cd 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 3f41f310..c3f938ef 100644 --- a/gst/rtsp/rtspext.h +++ b/gst/rtsp/rtspext.h @@ -45,6 +45,7 @@ #include <glib.h> +#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 81964e1e..44776d67 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; } |