diff options
author | Ognyan Tonchev <ognyan@axis.com> | 2017-10-21 14:06:30 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2018-02-09 11:08:45 +0200 |
commit | 5b08b62d6182ff6557c447232acc326d39c21449 (patch) | |
tree | aa5acc397322b3d4d4e9d7b27d71848f89b8f418 | |
parent | 7e62415b5c1cc29a81d444756dd49f5b41c4e00e (diff) |
onvif: Make requires_backchannel() public
...in order to let subclasses building the onvif part of the pipeline
check whether backchannel shall be included or not.
-rw-r--r-- | gst/rtsp-server/rtsp-onvif-media-factory.c | 26 | ||||
-rw-r--r-- | gst/rtsp-server/rtsp-onvif-media-factory.h | 2 |
2 files changed, 22 insertions, 6 deletions
diff --git a/gst/rtsp-server/rtsp-onvif-media-factory.c b/gst/rtsp-server/rtsp-onvif-media-factory.c index a200f1d..f242608 100644 --- a/gst/rtsp-server/rtsp-onvif-media-factory.c +++ b/gst/rtsp-server/rtsp-onvif-media-factory.c @@ -55,13 +55,27 @@ struct GstRTSPOnvifMediaFactoryPrivate G_DEFINE_TYPE_WITH_PRIVATE (GstRTSPOnvifMediaFactory, gst_rtsp_onvif_media_factory, GST_TYPE_RTSP_MEDIA_FACTORY); -static gboolean -requires_backchannel (GstRTSPMessage * msg) +/** + * gst_rtsp_onvif_media_factory_requires_backchannel: + * @factory: a #GstRTSPMediaFactory + * + * Checks whether the client request requires backchannel. + * + * Returns: %TRUE if the client request requires backchannel. + * + * Since: 1.14 + */ +gboolean +gst_rtsp_onvif_media_factory_requires_backchannel (GstRTSPMediaFactory * + factory, GstRTSPContext * ctx) { + GstRTSPMessage *msg = ctx->request; GstRTSPResult res; gint i; gchar *reqs = NULL; + g_return_val_if_fail (GST_IS_RTSP_ONVIF_MEDIA_FACTORY (factory), FALSE); + i = 0; do { res = gst_rtsp_message_get_header (msg, GST_RTSP_HDR_REQUIRE, &reqs, i++); @@ -81,10 +95,9 @@ gst_rtsp_onvif_media_factory_gen_key (GstRTSPMediaFactory * factory, const GstRTSPUrl * url) { GstRTSPContext *ctx = gst_rtsp_context_get_current (); - GstRTSPMessage *msg = ctx->request; /* Only medias where no backchannel was requested can be shared */ - if (requires_backchannel (msg)) + if (gst_rtsp_onvif_media_factory_requires_backchannel (factory, ctx)) return NULL; return @@ -139,7 +152,8 @@ gst_rtsp_onvif_media_factory_construct (GstRTSPMediaFactory * factory, got_backchannel_stream = gst_rtsp_onvif_media_collect_backchannel (GST_RTSP_ONVIF_MEDIA (media)); /* FIXME: This should not happen! We checked for that before */ - if (requires_backchannel (ctx->request) && !got_backchannel_stream) { + if (gst_rtsp_onvif_media_factory_requires_backchannel (factory, ctx) && + !got_backchannel_stream) { g_object_unref (media); return NULL; } @@ -206,7 +220,7 @@ gst_rtsp_onvif_media_factory_create_element (GstRTSPMediaFactory * factory, } /* add backchannel pipeline part, if requested */ - if (requires_backchannel (ctx->request)) { + if (gst_rtsp_onvif_media_factory_requires_backchannel (factory, ctx)) { GstRTSPOnvifMediaFactory *onvif_factory = GST_RTSP_ONVIF_MEDIA_FACTORY (factory); GstElement *backchannel_bin; diff --git a/gst/rtsp-server/rtsp-onvif-media-factory.h b/gst/rtsp-server/rtsp-onvif-media-factory.h index 5468748..09e9d4b 100644 --- a/gst/rtsp-server/rtsp-onvif-media-factory.h +++ b/gst/rtsp-server/rtsp-onvif-media-factory.h @@ -74,4 +74,6 @@ void gst_rtsp_onvif_media_factory_set_backchannel_bandwidth (GstRTSPOnvifMediaFa GST_EXPORT guint gst_rtsp_onvif_media_factory_get_backchannel_bandwidth (GstRTSPOnvifMediaFactory * factory); +gboolean gst_rtsp_onvif_media_factory_requires_backchannel (GstRTSPMediaFactory * factory, GstRTSPContext * ctx); + #endif /* __GST_RTSP_ONVIF_MEDIA_FACTORY_H__ */ |