#include <stdlib.h> /* atoi() */
#endif
#include <gst/gstelement.h>
-#include <gst/gst-i18n-plugin.h>
+#include <glib/gi18n-lib.h>
#include "gstsoupelements.h"
#include "gstsouphttpsrc.h"
#include "gstsouputils.h"
G_DEFINE_TYPE_WITH_CODE (GstSoupHTTPSrc, gst_soup_http_src, GST_TYPE_PUSH_SRC,
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
gst_soup_http_src_uri_handler_init));
-GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (souphttpsrc, "souphttpsrc",
- GST_RANK_PRIMARY, GST_TYPE_SOUP_HTTP_SRC, soup_element_init (plugin));
+
+static gboolean souphttpsrc_element_init (GstPlugin * plugin);
+GST_ELEMENT_REGISTER_DEFINE_CUSTOM (souphttpsrc, souphttpsrc_element_init);
static void
gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass)
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_soup_http_src_query);
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_soup_http_src_create);
-
- GST_DEBUG_CATEGORY_INIT (souphttpsrc_debug, "souphttpsrc", 0,
- "SOUP HTTP src");
}
static void
NULL);
g_object_unref (proxy_resolver);
}
+#if !defined(STATIC_SOUP) || STATIC_SOUP == 2
} else {
g_object_set (session->session, "ssl-strict", src->ssl_strict, NULL);
if (src->proxy != NULL) {
+ /* Need #if because there's no proxy->soup_uri when STATIC_SOUP == 3 */
g_object_set (session->session, "proxy-uri", src->proxy->soup_uri, NULL);
}
+#endif
}
gst_soup_util_log_setup (session->session, src->log_level,
return GST_FLOW_OK;
}
+ /* SOUP_STATUS_IS_TRANSPORT_ERROR was replaced with GError in libsoup-3.0 */
+#if !defined(STATIC_SOUP) || STATIC_SOUP == 2
if (SOUP_STATUS_IS_TRANSPORT_ERROR (status_code)) {
switch (status_code) {
case SOUP_STATUS_CANT_RESOLVE:
}
return GST_FLOW_OK;
}
+#endif
if (SOUP_STATUS_IS_CLIENT_ERROR (status_code) ||
SOUP_STATUS_IS_REDIRECTION (status_code) ||
G_CALLBACK (gst_soup_http_src_authenticate_cb), src);
}
- _soup_message_set_flags (src->msg, SOUP_MESSAGE_OVERWRITE_CHUNKS |
- (src->automatic_redirect ? 0 : SOUP_MESSAGE_NO_REDIRECT));
+ {
+ SoupMessageFlags flags =
+ src->automatic_redirect ? 0 : SOUP_MESSAGE_NO_REDIRECT;
+
+ /* SOUP_MESSAGE_OVERWRITE_CHUNKS is gone in libsoup-3.0, and
+ * soup_message_body_set_accumulate() requires SoupMessageBody, which
+ * can only be fetched from SoupServerMessage, not SoupMessage */
+#if !defined(STATIC_SOUP) || STATIC_SOUP == 2
+ if (gst_soup_loader_get_api_version () == 2)
+ flags |= SOUP_MESSAGE_OVERWRITE_CHUNKS;
+#endif
+
+ _soup_message_set_flags (src->msg, flags);
+ }
if (src->automatic_redirect) {
g_signal_connect (src->msg, "restarted",
iface->get_uri = gst_soup_http_src_uri_get_uri;
iface->set_uri = gst_soup_http_src_uri_set_uri;
}
+
+static gboolean
+souphttpsrc_element_init (GstPlugin * plugin)
+{
+ gboolean ret = TRUE;
+
+ GST_DEBUG_CATEGORY_INIT (souphttpsrc_debug, "souphttpsrc", 0,
+ "SOUP HTTP src");
+
+ if (!soup_element_init (plugin))
+ return TRUE;
+
+ ret = gst_element_register (plugin, "souphttpsrc",
+ GST_RANK_PRIMARY, GST_TYPE_SOUP_HTTP_SRC);
+
+ return ret;
+}