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>
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 */
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);

View file

@ -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;

View file

@ -45,6 +45,7 @@
#include <glib.h>
#include "gstrtspsrc.h"
#include "rtsptransport.h"
#include "sdp.h"
@ -66,6 +67,8 @@ struct _RTSPExtensionCtx
RTSPResult (*parse_sdp) (RTSPExtensionCtx *ctx, SDPMessage *sdp);
RTSPResult (*setup_media) (RTSPExtensionCtx *ctx, SDPMedia *media);
gboolean (*configure_stream) (RTSPExtensionCtx *ctx, GstRTSPStream *stream);
RTSPResult (*get_transports) (RTSPExtensionCtx *ctx, RTSPLowerTrans protocols, gchar **transport);
RTSPResult (*stream_select) (RTSPExtensionCtx *ctx);

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 *
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;
}