From: Ognyan Tonchev Date: Sat, 21 Oct 2017 12:06:30 +0000 (+0200) Subject: onvif: Make requires_backchannel() public X-Git-Tag: 1.19.3~495^2~320 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62aae8c7dc4b8fb1bdc1e89f603e44c7804c612c;p=platform%2Fupstream%2Fgstreamer.git 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. --- 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__ */