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.
This commit is contained in:
Wim Taymans 2006-11-28 11:52:27 +00:00
parent 4b8597668d
commit f249d639f8
5 changed files with 54 additions and 9 deletions

View file

@ -1,3 +1,14 @@
2006-11-28 Wim Taymans <wim@fluendo.com>
* 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 <wim@fluendo.com> 2006-11-27 Wim Taymans <wim@fluendo.com>
Patch by: Jonas Holmberg <jonas dot holmberg at axis dot com> Patch by: Jonas Holmberg <jonas dot holmberg at axis dot com>

View file

@ -1770,6 +1770,14 @@ gst_rtspsrc_open (GstRTSPSrc * src)
/* create stream from the media, can never return NULL */ /* create stream from the media, can never return NULL */
stream = gst_rtspsrc_create_stream (src, &sdp, i); 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 */ /* merge/overwrite global caps */
if (stream->caps) { if (stream->caps) {
guint j, num; guint j, num;
@ -1791,8 +1799,10 @@ gst_rtspsrc_open (GstRTSPSrc * src)
} }
/* skip setup if we have no URL for it */ /* 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; continue;
}
GST_DEBUG_OBJECT (src, "doing setup of stream %d with %s", i, GST_DEBUG_OBJECT (src, "doing setup of stream %d with %s", i,
stream->setup_url); stream->setup_url);

View file

@ -50,7 +50,6 @@ G_BEGIN_DECLS
#include "gstrtsp.h" #include "gstrtsp.h"
#include "rtsp.h" #include "rtsp.h"
#include "rtspext.h"
#define GST_TYPE_RTSPSRC \ #define GST_TYPE_RTSPSRC \
(gst_rtspsrc_get_type()) (gst_rtspsrc_get_type())
@ -74,6 +73,8 @@ typedef struct _GstRTSPSrcClass GstRTSPSrcClass;
typedef struct _GstRTSPStream GstRTSPStream; typedef struct _GstRTSPStream GstRTSPStream;
#include "rtspext.h"
struct _GstRTSPStream { struct _GstRTSPStream {
gint id; gint id;

View file

@ -45,6 +45,7 @@
#include <glib.h> #include <glib.h>
#include "gstrtspsrc.h"
#include "rtsptransport.h" #include "rtsptransport.h"
#include "sdp.h" #include "sdp.h"
@ -58,17 +59,19 @@ struct _RTSPExtensionCtx
gchar *name; gchar *name;
gpointer *src; gpointer *src;
gboolean (*detect_server) (RTSPExtensionCtx *ctx, RTSPMessage *resp); gboolean (*detect_server) (RTSPExtensionCtx *ctx, RTSPMessage *resp);
RTSPResult (*before_send) (RTSPExtensionCtx *ctx, RTSPMessage *req); RTSPResult (*before_send) (RTSPExtensionCtx *ctx, RTSPMessage *req);
RTSPResult (*after_send) (RTSPExtensionCtx *ctx, RTSPMessage *req, RTSPMessage *resp); RTSPResult (*after_send) (RTSPExtensionCtx *ctx, RTSPMessage *req, RTSPMessage *resp);
RTSPResult (*parse_sdp) (RTSPExtensionCtx *ctx, SDPMessage *sdp); RTSPResult (*parse_sdp) (RTSPExtensionCtx *ctx, SDPMessage *sdp);
RTSPResult (*setup_media) (RTSPExtensionCtx *ctx, SDPMedia *media); 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); RTSPExtensionCtx* rtsp_extension_detect (RTSPMessage *resp);

View file

@ -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 * RTSPExtensionCtx *
rtsp_ext_wms_get_context (void) 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.parse_sdp = rtsp_ext_wms_parse_sdp;
res->ctx.before_send = rtsp_ext_wms_before_send; res->ctx.before_send = rtsp_ext_wms_before_send;
res->ctx.after_send = rtsp_ext_wms_after_send; res->ctx.after_send = rtsp_ext_wms_after_send;
res->ctx.configure_stream = rtsp_ext_wms_configure_stream;
return (RTSPExtensionCtx *) res; return (RTSPExtensionCtx *) res;
} }