2005-12-28 21:07:17 +00:00
|
|
|
/* GStreamer
|
2017-02-26 00:47:47 +00:00
|
|
|
* Copyright (C) <2005> Edgard Lima <edgard.lima@gmail.com>
|
2006-12-22 16:23:32 +00:00
|
|
|
* Copyright (C) <2006> Rosfran Borges <rosfran.borges@indt.org.br>
|
|
|
|
* Copyright (C) <2006> Andre Moreira Magalhaes <andre.magalhaes@indt.org.br>
|
2005-12-28 21:07:17 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2006-09-21 14:01:18 +00:00
|
|
|
#include "config.h"
|
2005-12-28 21:07:17 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "gstneonhttpsrc.h"
|
2007-07-18 07:35:32 +00:00
|
|
|
#include <stdlib.h>
|
2005-12-28 21:07:17 +00:00
|
|
|
#include <string.h>
|
2008-02-07 21:02:19 +00:00
|
|
|
#ifdef _HAVE_UNISTD_H
|
2005-12-28 21:07:17 +00:00
|
|
|
#include <unistd.h>
|
2008-02-07 21:02:19 +00:00
|
|
|
#endif /* _HAVE_UNISTD_H */
|
2006-09-21 14:01:18 +00:00
|
|
|
|
2006-08-04 21:04:55 +00:00
|
|
|
#include <ne_redirect.h>
|
|
|
|
|
2009-09-04 11:13:39 +00:00
|
|
|
#define STATUS_IS_REDIRECTION(status) ((status) >= 300 && (status) < 400)
|
|
|
|
|
2006-06-23 09:09:44 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (neonhttpsrc_debug);
|
2005-12-28 21:07:17 +00:00
|
|
|
#define GST_CAT_DEFAULT neonhttpsrc_debug
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
#define MAX_READ_SIZE (4 * 1024)
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2009-09-04 11:13:39 +00:00
|
|
|
/* max number of HTTP redirects, when iterating over a sequence of HTTP 3xx status code */
|
2006-12-22 16:23:32 +00:00
|
|
|
#define MAX_HTTP_REDIRECTS_NUMBER 5
|
2005-12-28 21:07:17 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
#define HTTP_SOCKET_ERROR -2
|
|
|
|
#define HTTP_REQUEST_WRONG_PROXY -1
|
|
|
|
#define HTTP_DEFAULT_PORT 80
|
|
|
|
#define HTTPS_DEFAULT_PORT 443
|
|
|
|
#define HTTP_DEFAULT_HOST "localhost"
|
|
|
|
|
|
|
|
/* default properties */
|
2013-05-12 17:28:18 +00:00
|
|
|
#define DEFAULT_LOCATION "http://" HTTP_DEFAULT_HOST ":" G_STRINGIFY(HTTP_DEFAULT_PORT)
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
#define DEFAULT_PROXY ""
|
|
|
|
#define DEFAULT_USER_AGENT "GStreamer neonhttpsrc"
|
|
|
|
#define DEFAULT_AUTOMATIC_REDIRECT TRUE
|
2009-05-25 15:24:32 +00:00
|
|
|
#define DEFAULT_ACCEPT_SELF_SIGNED FALSE
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
#define DEFAULT_NEON_HTTP_DEBUG FALSE
|
2010-08-06 10:04:57 +00:00
|
|
|
#define DEFAULT_CONNECT_TIMEOUT 0
|
|
|
|
#define DEFAULT_READ_TIMEOUT 0
|
2013-05-12 17:47:32 +00:00
|
|
|
#define DEFAULT_IRADIO_MODE TRUE
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
|
2005-12-28 21:07:17 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2006-02-24 17:02:08 +00:00
|
|
|
PROP_LOCATION,
|
2006-04-29 15:36:16 +00:00
|
|
|
PROP_PROXY,
|
|
|
|
PROP_USER_AGENT,
|
2010-08-06 09:44:24 +00:00
|
|
|
PROP_COOKIES,
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
PROP_AUTOMATIC_REDIRECT,
|
2009-05-25 15:24:32 +00:00
|
|
|
PROP_ACCEPT_SELF_SIGNED,
|
2010-08-06 10:04:57 +00:00
|
|
|
PROP_CONNECT_TIMEOUT,
|
|
|
|
PROP_READ_TIMEOUT,
|
2006-08-04 21:04:55 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
2013-05-12 17:47:32 +00:00
|
|
|
PROP_NEON_HTTP_DEBUG,
|
2006-08-04 21:04:55 +00:00
|
|
|
#endif
|
2013-05-12 17:47:32 +00:00
|
|
|
PROP_IRADIO_MODE
|
2005-12-28 21:07:17 +00:00
|
|
|
};
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
static void gst_neonhttp_src_uri_handler_init (gpointer g_iface,
|
|
|
|
gpointer iface_data);
|
|
|
|
static void gst_neonhttp_src_dispose (GObject * gobject);
|
|
|
|
static void gst_neonhttp_src_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_neonhttp_src_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
static GstFlowReturn gst_neonhttp_src_fill (GstPushSrc * psrc,
|
|
|
|
GstBuffer * outbuf);
|
2005-12-28 21:07:17 +00:00
|
|
|
static gboolean gst_neonhttp_src_start (GstBaseSrc * bsrc);
|
2006-01-04 19:39:10 +00:00
|
|
|
static gboolean gst_neonhttp_src_stop (GstBaseSrc * bsrc);
|
|
|
|
static gboolean gst_neonhttp_src_get_size (GstBaseSrc * bsrc, guint64 * size);
|
2006-12-22 16:23:32 +00:00
|
|
|
static gboolean gst_neonhttp_src_is_seekable (GstBaseSrc * bsrc);
|
|
|
|
static gboolean gst_neonhttp_src_do_seek (GstBaseSrc * bsrc,
|
|
|
|
GstSegment * segment);
|
2011-06-26 18:32:53 +00:00
|
|
|
static gboolean gst_neonhttp_src_query (GstBaseSrc * bsrc, GstQuery * query);
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
static gboolean gst_neonhttp_src_set_proxy (GstNeonhttpSrc * src,
|
2007-03-02 12:04:02 +00:00
|
|
|
const gchar * uri);
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
static gboolean gst_neonhttp_src_set_location (GstNeonhttpSrc * src,
|
2013-05-12 17:28:18 +00:00
|
|
|
const gchar * uri, GError ** err);
|
2006-12-22 16:23:32 +00:00
|
|
|
static gint gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src,
|
|
|
|
ne_session ** ses, ne_request ** req, gint64 offset, gboolean do_redir);
|
|
|
|
static gint gst_neonhttp_src_request_dispatch (GstNeonhttpSrc * src,
|
|
|
|
GstBuffer * outbuf);
|
|
|
|
static void gst_neonhttp_src_close_session (GstNeonhttpSrc * src);
|
|
|
|
static gchar *gst_neonhttp_src_unicodify (const gchar * str);
|
|
|
|
static void oom_callback (void);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
#define parent_class gst_neonhttp_src_parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstNeonhttpSrc, gst_neonhttp_src, GST_TYPE_PUSH_SRC,
|
|
|
|
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
|
2021-02-18 09:35:34 +00:00
|
|
|
gst_neonhttp_src_uri_handler_init);
|
|
|
|
GST_DEBUG_CATEGORY_INIT (neonhttpsrc_debug, "neonhttpsrc", 0,
|
|
|
|
"NEON HTTP src");
|
|
|
|
);
|
|
|
|
GST_ELEMENT_REGISTER_DEFINE (neonhttpsrc, "neonhttpsrc", GST_RANK_NONE,
|
|
|
|
GST_TYPE_NEONHTTP_SRC);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_neonhttp_src_class_init (GstNeonhttpSrcClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2013-05-12 17:28:18 +00:00
|
|
|
GstElementClass *element_class;
|
2005-12-28 21:07:17 +00:00
|
|
|
GstBaseSrcClass *gstbasesrc_class;
|
2006-12-22 16:23:32 +00:00
|
|
|
GstPushSrcClass *gstpushsrc_class;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
2013-05-12 17:28:18 +00:00
|
|
|
element_class = (GstElementClass *) klass;
|
2005-12-28 21:07:17 +00:00
|
|
|
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
2006-12-22 16:23:32 +00:00
|
|
|
gstpushsrc_class = (GstPushSrcClass *) klass;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_neonhttp_src_set_property;
|
|
|
|
gobject_class->get_property = gst_neonhttp_src_get_property;
|
2006-12-22 16:23:32 +00:00
|
|
|
gobject_class->dispose = gst_neonhttp_src_dispose;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
|
|
|
g_object_class_install_property
|
2006-04-29 15:36:16 +00:00
|
|
|
(gobject_class, PROP_LOCATION,
|
2006-02-24 17:02:08 +00:00
|
|
|
g_param_spec_string ("location", "Location",
|
2010-10-19 13:23:23 +00:00
|
|
|
"Location to read from", "",
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-12-28 21:07:17 +00:00
|
|
|
|
|
|
|
g_object_class_install_property
|
2006-04-29 15:36:16 +00:00
|
|
|
(gobject_class, PROP_PROXY,
|
2005-12-28 21:07:17 +00:00
|
|
|
g_param_spec_string ("proxy", "Proxy",
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
"Proxy server to use, in the form HOSTNAME:PORT. "
|
|
|
|
"Defaults to the http_proxy environment variable",
|
2010-10-19 13:23:23 +00:00
|
|
|
"", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-04-29 15:36:16 +00:00
|
|
|
g_object_class_install_property
|
|
|
|
(gobject_class, PROP_USER_AGENT,
|
|
|
|
g_param_spec_string ("user-agent", "User-Agent",
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
"Value of the User-Agent HTTP request header field",
|
2010-10-19 13:23:23 +00:00
|
|
|
"GStreamer neonhttpsrc", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-04-29 15:36:16 +00:00
|
|
|
|
2010-08-06 09:44:24 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_COOKIES,
|
|
|
|
g_param_spec_boxed ("cookies", "Cookies", "HTTP request cookies",
|
2010-10-19 13:23:23 +00:00
|
|
|
G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-08-06 09:44:24 +00:00
|
|
|
|
2006-08-04 21:04:55 +00:00
|
|
|
g_object_class_install_property
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
(gobject_class, PROP_AUTOMATIC_REDIRECT,
|
2006-08-04 21:04:55 +00:00
|
|
|
g_param_spec_boolean ("automatic-redirect", "automatic-redirect",
|
2009-09-04 11:13:39 +00:00
|
|
|
"Automatically follow HTTP redirects (HTTP Status Code 3xx)",
|
2010-10-19 13:23:23 +00:00
|
|
|
TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-08-04 21:04:55 +00:00
|
|
|
|
2009-05-25 15:24:32 +00:00
|
|
|
g_object_class_install_property
|
|
|
|
(gobject_class, PROP_ACCEPT_SELF_SIGNED,
|
|
|
|
g_param_spec_boolean ("accept-self-signed", "accept-self-signed",
|
|
|
|
"Accept self-signed SSL/TLS certificates",
|
2010-10-19 13:23:23 +00:00
|
|
|
DEFAULT_ACCEPT_SELF_SIGNED,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-05-25 15:24:32 +00:00
|
|
|
|
2010-08-06 10:04:57 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CONNECT_TIMEOUT,
|
|
|
|
g_param_spec_uint ("connect-timeout", "connect-timeout",
|
|
|
|
"Value in seconds to timeout a blocking connection (0 = default).", 0,
|
2010-10-19 13:23:23 +00:00
|
|
|
3600, DEFAULT_CONNECT_TIMEOUT,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-08-06 10:04:57 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_READ_TIMEOUT,
|
|
|
|
g_param_spec_uint ("read-timeout", "read-timeout",
|
|
|
|
"Value in seconds to timeout a blocking read (0 = default).", 0,
|
2010-10-19 13:23:23 +00:00
|
|
|
3600, DEFAULT_READ_TIMEOUT,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2010-08-06 10:04:57 +00:00
|
|
|
|
2006-08-04 21:04:55 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
g_object_class_install_property
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
(gobject_class, PROP_NEON_HTTP_DEBUG,
|
2006-08-04 21:04:55 +00:00
|
|
|
g_param_spec_boolean ("neon-http-debug", "neon-http-debug",
|
2007-03-02 12:04:02 +00:00
|
|
|
"Enable Neon HTTP debug messages",
|
2010-10-19 13:23:23 +00:00
|
|
|
DEFAULT_NEON_HTTP_DEBUG, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-08-04 21:04:55 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-12 17:47:32 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_IRADIO_MODE,
|
|
|
|
g_param_spec_boolean ("iradio-mode", "iradio-mode",
|
|
|
|
"Enable internet radio mode (ask server to send shoutcast/icecast "
|
|
|
|
"metadata interleaved with the actual stream data)",
|
|
|
|
DEFAULT_IRADIO_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2006-12-12 11:46:05 +00:00
|
|
|
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_neonhttp_src_start);
|
|
|
|
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_neonhttp_src_stop);
|
|
|
|
gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_neonhttp_src_get_size);
|
2006-12-22 16:23:32 +00:00
|
|
|
gstbasesrc_class->is_seekable =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_neonhttp_src_is_seekable);
|
|
|
|
gstbasesrc_class->do_seek = GST_DEBUG_FUNCPTR (gst_neonhttp_src_do_seek);
|
2011-06-26 18:32:53 +00:00
|
|
|
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_neonhttp_src_query);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
gstpushsrc_class->fill = GST_DEBUG_FUNCPTR (gst_neonhttp_src_fill);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (neonhttpsrc_debug, "neonhttpsrc", 0,
|
|
|
|
"NEON HTTP Client Source");
|
2013-05-12 17:28:18 +00:00
|
|
|
|
2016-03-04 06:50:26 +00:00
|
|
|
gst_element_class_add_static_pad_template (element_class, &srctemplate);
|
2013-05-12 17:28:18 +00:00
|
|
|
|
|
|
|
gst_element_class_set_static_metadata (element_class, "HTTP client source",
|
|
|
|
"Source/Network",
|
|
|
|
"Receive data as a client over the network via HTTP using NEON",
|
2017-02-26 00:47:47 +00:00
|
|
|
"Edgard Lima <edgard.lima@gmail.com>, "
|
2013-05-12 17:28:18 +00:00
|
|
|
"Rosfran Borges <rosfran.borges@indt.org.br>, "
|
|
|
|
"Andre Moreira Magalhaes <andre.magalhaes@indt.org.br>");
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-05-12 17:28:18 +00:00
|
|
|
gst_neonhttp_src_init (GstNeonhttpSrc * src)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
const gchar *str;
|
|
|
|
|
|
|
|
src->neon_http_debug = DEFAULT_NEON_HTTP_DEBUG;
|
|
|
|
src->user_agent = g_strdup (DEFAULT_USER_AGENT);
|
|
|
|
src->automatic_redirect = DEFAULT_AUTOMATIC_REDIRECT;
|
2009-05-25 15:24:32 +00:00
|
|
|
src->accept_self_signed = DEFAULT_ACCEPT_SELF_SIGNED;
|
2010-08-06 10:04:57 +00:00
|
|
|
src->connect_timeout = DEFAULT_CONNECT_TIMEOUT;
|
|
|
|
src->read_timeout = DEFAULT_READ_TIMEOUT;
|
2013-05-12 17:47:32 +00:00
|
|
|
src->iradio_mode = DEFAULT_IRADIO_MODE;
|
2007-03-02 12:04:02 +00:00
|
|
|
|
2010-08-06 09:44:24 +00:00
|
|
|
src->cookies = NULL;
|
2007-03-02 12:04:02 +00:00
|
|
|
src->session = NULL;
|
|
|
|
src->request = NULL;
|
2006-12-22 16:23:32 +00:00
|
|
|
memset (&src->uri, 0, sizeof (src->uri));
|
|
|
|
memset (&src->proxy, 0, sizeof (src->proxy));
|
|
|
|
src->content_size = -1;
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
src->seekable = TRUE;
|
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
gst_neonhttp_src_set_location (src, DEFAULT_LOCATION, NULL);
|
2007-03-02 12:04:02 +00:00
|
|
|
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
/* configure proxy */
|
|
|
|
str = g_getenv ("http_proxy");
|
2007-03-02 12:04:02 +00:00
|
|
|
if (str && !gst_neonhttp_src_set_proxy (src, str)) {
|
|
|
|
GST_WARNING_OBJECT (src,
|
|
|
|
"The proxy set on http_proxy env var ('%s') cannot be parsed.", str);
|
|
|
|
}
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-12-22 16:23:32 +00:00
|
|
|
gst_neonhttp_src_dispose (GObject * gobject)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
2006-12-22 16:23:32 +00:00
|
|
|
GstNeonhttpSrc *src = GST_NEONHTTP_SRC (gobject);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
ne_uri_free (&src->uri);
|
|
|
|
ne_uri_free (&src->proxy);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
g_free (src->user_agent);
|
2006-04-29 15:36:16 +00:00
|
|
|
|
2010-08-06 09:44:24 +00:00
|
|
|
if (src->cookies) {
|
|
|
|
g_strfreev (src->cookies);
|
|
|
|
src->cookies = NULL;
|
|
|
|
}
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
if (src->request) {
|
|
|
|
ne_request_destroy (src->request);
|
|
|
|
src->request = NULL;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
if (src->session) {
|
|
|
|
ne_close_connection (src->session);
|
|
|
|
ne_session_destroy (src->session);
|
|
|
|
src->session = NULL;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
if (src->location) {
|
|
|
|
ne_free (src->location);
|
2006-01-04 13:26:35 +00:00
|
|
|
}
|
2007-09-28 09:29:09 +00:00
|
|
|
if (src->query_string) {
|
|
|
|
ne_free (src->query_string);
|
|
|
|
}
|
2006-01-04 13:26:35 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (gobject);
|
2006-01-04 13:26:35 +00:00
|
|
|
}
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
static void
|
|
|
|
gst_neonhttp_src_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2006-01-04 13:26:35 +00:00
|
|
|
{
|
2006-12-22 16:23:32 +00:00
|
|
|
GstNeonhttpSrc *src = GST_NEONHTTP_SRC (object);
|
2006-01-04 13:26:35 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_PROXY:
|
|
|
|
{
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
const gchar *proxy;
|
|
|
|
|
|
|
|
proxy = g_value_get_string (value);
|
|
|
|
|
|
|
|
if (proxy == NULL) {
|
2006-12-22 16:23:32 +00:00
|
|
|
GST_WARNING ("proxy property cannot be NULL");
|
|
|
|
goto done;
|
|
|
|
}
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
if (!gst_neonhttp_src_set_proxy (src, proxy)) {
|
2019-09-02 19:08:44 +00:00
|
|
|
GST_WARNING ("badly formatted proxy");
|
2006-12-22 16:23:32 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2006-01-04 13:26:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
case PROP_LOCATION:
|
|
|
|
{
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
const gchar *location;
|
|
|
|
|
|
|
|
location = g_value_get_string (value);
|
|
|
|
|
|
|
|
if (location == NULL) {
|
2006-12-22 16:23:32 +00:00
|
|
|
GST_WARNING ("location property cannot be NULL");
|
|
|
|
goto done;
|
|
|
|
}
|
2013-05-12 17:28:18 +00:00
|
|
|
if (!gst_neonhttp_src_set_location (src, location, NULL)) {
|
2019-09-02 19:08:44 +00:00
|
|
|
GST_WARNING ("badly formatted location");
|
2006-12-22 16:23:32 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PROP_USER_AGENT:
|
2015-11-17 23:23:17 +00:00
|
|
|
g_free (src->user_agent);
|
2019-12-18 14:37:03 +00:00
|
|
|
src->user_agent = g_value_dup_string (value);
|
2006-12-22 16:23:32 +00:00
|
|
|
break;
|
2010-08-06 09:44:24 +00:00
|
|
|
case PROP_COOKIES:
|
|
|
|
if (src->cookies)
|
|
|
|
g_strfreev (src->cookies);
|
|
|
|
src->cookies = (gchar **) g_value_dup_boxed (value);
|
|
|
|
break;
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
case PROP_AUTOMATIC_REDIRECT:
|
|
|
|
src->automatic_redirect = g_value_get_boolean (value);
|
2006-12-22 16:23:32 +00:00
|
|
|
break;
|
2009-05-25 15:24:32 +00:00
|
|
|
case PROP_ACCEPT_SELF_SIGNED:
|
|
|
|
src->accept_self_signed = g_value_get_boolean (value);
|
|
|
|
break;
|
2010-08-06 10:04:57 +00:00
|
|
|
case PROP_CONNECT_TIMEOUT:
|
|
|
|
src->connect_timeout = g_value_get_uint (value);
|
|
|
|
break;
|
|
|
|
case PROP_READ_TIMEOUT:
|
|
|
|
src->read_timeout = g_value_get_uint (value);
|
|
|
|
break;
|
2006-12-22 16:23:32 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
case PROP_NEON_HTTP_DEBUG:
|
|
|
|
src->neon_http_debug = g_value_get_boolean (value);
|
2006-12-22 16:23:32 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2013-05-12 17:47:32 +00:00
|
|
|
case PROP_IRADIO_MODE:
|
|
|
|
src->iradio_mode = g_value_get_boolean (value);
|
|
|
|
break;
|
2006-12-22 16:23:32 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2006-01-04 13:26:35 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
done:
|
|
|
|
return;
|
|
|
|
}
|
2006-01-04 13:26:35 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
static void
|
|
|
|
gst_neonhttp_src_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstNeonhttpSrc *neonhttpsrc = GST_NEONHTTP_SRC (object);
|
2006-01-04 13:26:35 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_PROXY:
|
|
|
|
{
|
|
|
|
gchar *str;
|
|
|
|
|
|
|
|
if (neonhttpsrc->proxy.host) {
|
|
|
|
str = ne_uri_unparse (&neonhttpsrc->proxy);
|
|
|
|
if (!str)
|
|
|
|
break;
|
|
|
|
g_value_set_string (value, str);
|
|
|
|
ne_free (str);
|
2006-01-04 13:26:35 +00:00
|
|
|
} else {
|
2010-03-16 21:43:02 +00:00
|
|
|
g_value_set_static_string (value, "");
|
2006-01-04 13:26:35 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
break;
|
2006-01-04 13:26:35 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
case PROP_LOCATION:
|
|
|
|
{
|
|
|
|
gchar *str;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
if (neonhttpsrc->uri.host) {
|
|
|
|
str = ne_uri_unparse (&neonhttpsrc->uri);
|
|
|
|
if (!str)
|
|
|
|
break;
|
|
|
|
g_value_set_string (value, str);
|
|
|
|
ne_free (str);
|
|
|
|
} else {
|
2010-03-16 21:43:02 +00:00
|
|
|
g_value_set_static_string (value, "");
|
2006-12-22 16:23:32 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PROP_USER_AGENT:
|
|
|
|
g_value_set_string (value, neonhttpsrc->user_agent);
|
|
|
|
break;
|
2010-08-06 09:44:24 +00:00
|
|
|
case PROP_COOKIES:
|
|
|
|
g_value_set_boxed (value, neonhttpsrc->cookies);
|
|
|
|
break;
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
case PROP_AUTOMATIC_REDIRECT:
|
|
|
|
g_value_set_boolean (value, neonhttpsrc->automatic_redirect);
|
2006-12-22 16:23:32 +00:00
|
|
|
break;
|
2009-05-25 15:24:32 +00:00
|
|
|
case PROP_ACCEPT_SELF_SIGNED:
|
|
|
|
g_value_set_boolean (value, neonhttpsrc->accept_self_signed);
|
|
|
|
break;
|
2010-08-06 10:04:57 +00:00
|
|
|
case PROP_CONNECT_TIMEOUT:
|
|
|
|
g_value_set_uint (value, neonhttpsrc->connect_timeout);
|
|
|
|
break;
|
|
|
|
case PROP_READ_TIMEOUT:
|
|
|
|
g_value_set_uint (value, neonhttpsrc->read_timeout);
|
|
|
|
break;
|
2006-12-22 16:23:32 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
case PROP_NEON_HTTP_DEBUG:
|
|
|
|
g_value_set_boolean (value, neonhttpsrc->neon_http_debug);
|
2006-12-22 16:23:32 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2013-05-12 17:47:32 +00:00
|
|
|
case PROP_IRADIO_MODE:
|
|
|
|
g_value_set_boolean (value, neonhttpsrc->iradio_mode);
|
|
|
|
break;
|
2006-12-22 16:23:32 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
2009-05-25 15:24:32 +00:00
|
|
|
/* NEON CALLBACK */
|
|
|
|
static void
|
2010-03-22 15:56:03 +00:00
|
|
|
oom_callback (void)
|
2009-05-25 15:24:32 +00:00
|
|
|
{
|
2019-09-02 19:08:44 +00:00
|
|
|
GST_ERROR ("memory exception in neon");
|
2009-05-25 15:24:32 +00:00
|
|
|
}
|
|
|
|
|
2005-12-28 21:07:17 +00:00
|
|
|
static GstFlowReturn
|
2013-05-12 17:28:18 +00:00
|
|
|
gst_neonhttp_src_fill (GstPushSrc * psrc, GstBuffer * outbuf)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
|
|
|
GstNeonhttpSrc *src;
|
2006-12-22 16:23:32 +00:00
|
|
|
gint read;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
|
|
|
src = GST_NEONHTTP_SRC (psrc);
|
|
|
|
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
/* The caller should know the number of bytes and not read beyond EOS. */
|
|
|
|
if (G_UNLIKELY (src->eos))
|
|
|
|
goto eos;
|
2006-01-04 19:39:10 +00:00
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
read = gst_neonhttp_src_request_dispatch (src, outbuf);
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
if (G_UNLIKELY (read < 0))
|
|
|
|
goto read_error;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
GST_LOG_OBJECT (src, "returning %" G_GSIZE_FORMAT " bytes, "
|
|
|
|
"offset %" G_GUINT64_FORMAT, gst_buffer_get_size (outbuf),
|
|
|
|
GST_BUFFER_OFFSET (outbuf));
|
2006-12-12 16:10:21 +00:00
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
return GST_FLOW_OK;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
/* ERRORS */
|
|
|
|
eos:
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
GST_DEBUG_OBJECT (src, "EOS reached");
|
2013-05-12 17:28:18 +00:00
|
|
|
return GST_FLOW_EOS;
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
}
|
|
|
|
read_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
|
|
|
(NULL), ("Could not read any bytes (%i, %s)", read,
|
|
|
|
ne_get_error (src->session)));
|
|
|
|
return GST_FLOW_ERROR;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
/* create a socket for connecting to remote server */
|
|
|
|
static gboolean
|
|
|
|
gst_neonhttp_src_start (GstBaseSrc * bsrc)
|
2006-01-04 19:39:10 +00:00
|
|
|
{
|
2006-12-22 16:23:32 +00:00
|
|
|
GstNeonhttpSrc *src = GST_NEONHTTP_SRC (bsrc);
|
|
|
|
const gchar *content_length;
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
gint res;
|
2006-08-04 21:04:55 +00:00
|
|
|
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
if (src->neon_http_debug)
|
2006-08-04 21:04:55 +00:00
|
|
|
ne_debug_init (stderr, NE_DBG_HTTP);
|
|
|
|
#endif
|
2006-01-04 19:39:10 +00:00
|
|
|
|
|
|
|
ne_oom_callback (oom_callback);
|
|
|
|
|
2008-09-17 14:22:38 +00:00
|
|
|
res = ne_sock_init ();
|
|
|
|
if (res != 0)
|
|
|
|
goto init_failed;
|
2006-01-04 19:39:10 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
res = gst_neonhttp_src_send_request_and_redirect (src,
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
&src->session, &src->request, 0, src->automatic_redirect);
|
2006-04-29 15:36:16 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
if (res != NE_OK || !src->session) {
|
|
|
|
if (res == HTTP_SOCKET_ERROR) {
|
2008-09-17 14:22:38 +00:00
|
|
|
goto socket_error;
|
2006-12-22 16:23:32 +00:00
|
|
|
} else if (res == HTTP_REQUEST_WRONG_PROXY) {
|
|
|
|
goto wrong_proxy;
|
|
|
|
} else {
|
|
|
|
goto begin_req_failed;
|
2006-08-04 21:04:55 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
}
|
2006-04-29 15:36:16 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
content_length = ne_get_response_header (src->request, "Content-Length");
|
2006-08-04 21:04:55 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
if (content_length)
|
|
|
|
src->content_size = g_ascii_strtoull (content_length, NULL, 10);
|
|
|
|
else
|
|
|
|
src->content_size = -1;
|
2006-08-04 21:04:55 +00:00
|
|
|
|
2011-11-24 01:52:36 +00:00
|
|
|
if (TRUE) {
|
2006-12-22 16:23:32 +00:00
|
|
|
/* Icecast stuff */
|
|
|
|
const gchar *str_value;
|
2013-05-12 17:47:32 +00:00
|
|
|
GstTagList *tags;
|
|
|
|
gchar *iradio_name;
|
|
|
|
gchar *iradio_url;
|
|
|
|
gchar *iradio_genre;
|
2013-05-12 17:28:18 +00:00
|
|
|
gint icy_metaint;
|
2006-04-29 15:36:16 +00:00
|
|
|
|
2013-05-12 17:47:32 +00:00
|
|
|
tags = gst_tag_list_new_empty ();
|
|
|
|
|
2006-04-29 15:36:16 +00:00
|
|
|
str_value = ne_get_response_header (src->request, "icy-metaint");
|
|
|
|
if (str_value) {
|
2013-05-12 17:28:18 +00:00
|
|
|
if (sscanf (str_value, "%d", &icy_metaint) == 1) {
|
|
|
|
GstCaps *icy_caps;
|
|
|
|
|
|
|
|
icy_caps = gst_caps_new_simple ("application/x-icy",
|
|
|
|
"metadata-interval", G_TYPE_INT, icy_metaint, NULL);
|
|
|
|
gst_base_src_set_caps (GST_BASE_SRC (src), icy_caps);
|
2006-04-29 15:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-24 01:56:07 +00:00
|
|
|
/* FIXME: send tags with name, genre, url */
|
2006-04-29 15:36:16 +00:00
|
|
|
str_value = ne_get_response_header (src->request, "icy-name");
|
|
|
|
if (str_value) {
|
2013-05-12 17:47:32 +00:00
|
|
|
iradio_name = gst_neonhttp_src_unicodify (str_value);
|
|
|
|
if (iradio_name) {
|
|
|
|
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_ORGANIZATION,
|
|
|
|
iradio_name, NULL);
|
|
|
|
g_free (iradio_name);
|
2006-04-29 15:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
str_value = ne_get_response_header (src->request, "icy-genre");
|
|
|
|
if (str_value) {
|
2013-05-12 17:47:32 +00:00
|
|
|
iradio_genre = gst_neonhttp_src_unicodify (str_value);
|
|
|
|
if (iradio_genre) {
|
|
|
|
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_GENRE,
|
|
|
|
iradio_genre, NULL);
|
|
|
|
g_free (iradio_genre);
|
2006-04-29 15:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
str_value = ne_get_response_header (src->request, "icy-url");
|
|
|
|
if (str_value) {
|
2013-05-12 17:47:32 +00:00
|
|
|
iradio_url = gst_neonhttp_src_unicodify (str_value);
|
|
|
|
if (iradio_url) {
|
|
|
|
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_LOCATION,
|
|
|
|
iradio_url, NULL);
|
|
|
|
g_free (iradio_url);
|
2006-04-29 15:36:16 +00:00
|
|
|
}
|
2013-05-12 17:47:32 +00:00
|
|
|
}
|
|
|
|
if (!gst_tag_list_is_empty (tags)) {
|
|
|
|
GST_DEBUG_OBJECT (src, "pushing tag list %" GST_PTR_FORMAT, tags);
|
|
|
|
gst_pad_push_event (GST_BASE_SRC_PAD (src), gst_event_new_tag (tags));
|
|
|
|
} else {
|
|
|
|
gst_tag_list_unref (tags);
|
2006-04-29 15:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
2006-08-04 21:04:55 +00:00
|
|
|
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
return TRUE;
|
2006-04-29 15:36:16 +00:00
|
|
|
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
/* ERRORS */
|
|
|
|
init_failed:
|
|
|
|
{
|
2008-09-17 14:22:38 +00:00
|
|
|
GST_ELEMENT_ERROR (src, LIBRARY, INIT, (NULL),
|
|
|
|
("ne_sock_init() failed: %d", res));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
socket_error:
|
|
|
|
{
|
2008-09-17 14:47:12 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
|
|
|
|
("HTTP Request failed when opening socket: %d", res));
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wrong_proxy:
|
|
|
|
{
|
2008-09-17 14:47:12 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
|
|
|
|
("Proxy Server URI is invalid - make sure that either both proxy host "
|
|
|
|
"and port are specified or neither."));
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
begin_req_failed:
|
|
|
|
{
|
2008-09-17 14:47:12 +00:00
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
|
|
|
|
("Could not begin request: %d", res));
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2006-01-04 19:39:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* close the socket and associated resources
|
|
|
|
* used both to recover from errors and go to NULL state */
|
|
|
|
static gboolean
|
|
|
|
gst_neonhttp_src_stop (GstBaseSrc * bsrc)
|
|
|
|
{
|
|
|
|
GstNeonhttpSrc *src;
|
|
|
|
|
|
|
|
src = GST_NEONHTTP_SRC (bsrc);
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
src->eos = FALSE;
|
|
|
|
src->content_size = -1;
|
|
|
|
src->read_position = 0;
|
|
|
|
src->seekable = TRUE;
|
2006-01-04 19:39:10 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
gst_neonhttp_src_close_session (src);
|
2006-01-04 19:39:10 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
ne_debug_init (NULL, 0);
|
|
|
|
#endif
|
|
|
|
ne_oom_callback (NULL);
|
|
|
|
ne_sock_exit ();
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
|
2006-01-04 19:39:10 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
static gboolean
|
2006-12-22 16:23:32 +00:00
|
|
|
gst_neonhttp_src_get_size (GstBaseSrc * bsrc, guint64 * size)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
2006-12-22 16:23:32 +00:00
|
|
|
GstNeonhttpSrc *src;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
src = GST_NEONHTTP_SRC (bsrc);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
if (src->content_size == -1)
|
|
|
|
return FALSE;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
*size = src->content_size;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
static gboolean
|
|
|
|
gst_neonhttp_src_is_seekable (GstBaseSrc * bsrc)
|
|
|
|
{
|
2005-12-28 21:07:17 +00:00
|
|
|
return TRUE;
|
2006-12-22 16:23:32 +00:00
|
|
|
}
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
static gboolean
|
|
|
|
gst_neonhttp_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
|
|
|
|
{
|
|
|
|
GstNeonhttpSrc *src;
|
|
|
|
gint res;
|
|
|
|
ne_session *session = NULL;
|
|
|
|
ne_request *request = NULL;
|
|
|
|
|
|
|
|
src = GST_NEONHTTP_SRC (bsrc);
|
|
|
|
|
|
|
|
if (!src->seekable)
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
return FALSE;
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
if (src->read_position == segment->start)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
res = gst_neonhttp_src_send_request_and_redirect (src,
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
&session, &request, segment->start, src->automatic_redirect);
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
/* if we are able to seek, replace the session */
|
|
|
|
if (res == NE_OK && session) {
|
|
|
|
gst_neonhttp_src_close_session (src);
|
|
|
|
src->session = session;
|
|
|
|
src->request = request;
|
|
|
|
src->read_position = segment->start;
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
2011-06-26 18:32:53 +00:00
|
|
|
static gboolean
|
|
|
|
gst_neonhttp_src_query (GstBaseSrc * bsrc, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstNeonhttpSrc *src = GST_NEONHTTP_SRC (bsrc);
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_URI:
|
|
|
|
gst_query_set_uri (query, src->location);
|
|
|
|
ret = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
ret = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
|
|
|
|
|
2013-05-12 17:51:52 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_SCHEDULING:{
|
|
|
|
GstSchedulingFlags flags;
|
|
|
|
gint minsize, maxsize, align;
|
|
|
|
|
|
|
|
gst_query_parse_scheduling (query, &flags, &minsize, &maxsize, &align);
|
|
|
|
flags |= GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED;
|
|
|
|
gst_query_set_scheduling (query, flags, minsize, maxsize, align);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-06-26 18:32:53 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
static gboolean
|
2013-05-12 17:28:18 +00:00
|
|
|
gst_neonhttp_src_set_location (GstNeonhttpSrc * src, const gchar * uri,
|
|
|
|
GError ** err)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
2007-03-02 12:04:02 +00:00
|
|
|
ne_uri_free (&src->uri);
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
if (src->location) {
|
|
|
|
ne_free (src->location);
|
|
|
|
src->location = NULL;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
2007-09-28 09:29:09 +00:00
|
|
|
if (src->query_string) {
|
|
|
|
ne_free (src->query_string);
|
|
|
|
src->query_string = NULL;
|
|
|
|
}
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2007-03-02 12:04:02 +00:00
|
|
|
if (ne_uri_parse (uri, &src->uri) != 0)
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
goto parse_error;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2007-03-02 12:04:02 +00:00
|
|
|
if (src->uri.scheme == NULL)
|
|
|
|
src->uri.scheme = g_strdup ("http");
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2007-03-02 12:04:02 +00:00
|
|
|
if (src->uri.host == NULL)
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
src->uri.host = g_strdup (DEFAULT_LOCATION);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2007-03-02 12:04:02 +00:00
|
|
|
if (src->uri.port == 0) {
|
|
|
|
if (!strcmp (src->uri.scheme, "https"))
|
|
|
|
src->uri.port = HTTPS_DEFAULT_PORT;
|
2005-12-28 21:07:17 +00:00
|
|
|
else
|
2007-03-02 12:04:02 +00:00
|
|
|
src->uri.port = HTTP_DEFAULT_PORT;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
2007-03-02 12:04:02 +00:00
|
|
|
if (!src->uri.path)
|
|
|
|
src->uri.path = g_strdup ("");
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2007-09-29 05:26:54 +00:00
|
|
|
src->query_string = g_strjoin ("?", src->uri.path, src->uri.query, NULL);
|
2007-09-28 09:29:09 +00:00
|
|
|
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
src->location = ne_uri_unparse (&src->uri);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
/* ERRORS */
|
|
|
|
parse_error:
|
|
|
|
{
|
ext/neon/gstneonhttpsrc.*: Deprecated "uri" property. Clean up property descriptions.
Original commit message from CVS:
Patch by René Stadler <mail at renestadler dot de>:
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_dispose),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_start), (gst_neonhttp_src_do_seek),
(gst_neonhttp_src_set_location),
(gst_neonhttp_src_send_request_and_redirect),
(gst_neonhttp_src_uri_get_uri), (gst_neonhttp_src_uri_set_uri):
* ext/neon/gstneonhttpsrc.h:
Deprecated "uri" property. Clean up property descriptions.
Change default User-Agent to the slightly more descriptive
"GStreamer neonhttpsrc".
Various other small cleanups, mostly property related.
2007-06-01 09:58:01 +00:00
|
|
|
if (src->location) {
|
|
|
|
ne_free (src->location);
|
|
|
|
src->location = NULL;
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
}
|
2007-09-28 09:29:09 +00:00
|
|
|
if (src->query_string) {
|
|
|
|
ne_free (src->query_string);
|
|
|
|
src->query_string = NULL;
|
|
|
|
}
|
2007-03-02 12:04:02 +00:00
|
|
|
ne_uri_free (&src->uri);
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
return FALSE;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
static gboolean
|
2007-03-02 12:04:02 +00:00
|
|
|
gst_neonhttp_src_set_proxy (GstNeonhttpSrc * src, const char *uri)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
2007-03-02 12:04:02 +00:00
|
|
|
ne_uri_free (&src->proxy);
|
2006-12-22 16:23:32 +00:00
|
|
|
|
2007-03-02 12:04:02 +00:00
|
|
|
if (ne_uri_parse (uri, &src->proxy) != 0)
|
2006-12-22 16:23:32 +00:00
|
|
|
goto error;
|
|
|
|
|
2007-03-02 12:04:02 +00:00
|
|
|
if (src->proxy.scheme)
|
|
|
|
GST_WARNING ("The proxy schema shouldn't be defined (schema is '%s')",
|
|
|
|
src->proxy.scheme);
|
2006-12-22 16:23:32 +00:00
|
|
|
|
2007-03-02 12:04:02 +00:00
|
|
|
if (src->proxy.host && !src->proxy.port)
|
2006-12-22 16:23:32 +00:00
|
|
|
goto error;
|
|
|
|
|
2007-03-02 12:04:02 +00:00
|
|
|
if (!src->proxy.path || src->proxy.userinfo)
|
2006-12-22 16:23:32 +00:00
|
|
|
goto error;
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
error:
|
|
|
|
{
|
2007-03-02 12:04:02 +00:00
|
|
|
ne_uri_free (&src->proxy);
|
2006-12-22 16:23:32 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-25 15:24:32 +00:00
|
|
|
static int
|
|
|
|
ssl_verify_callback (void *data, int failures, const ne_ssl_certificate * cert)
|
|
|
|
{
|
|
|
|
GstNeonhttpSrc *src = GST_NEONHTTP_SRC (data);
|
|
|
|
|
|
|
|
if ((failures & NE_SSL_UNTRUSTED) &&
|
|
|
|
src->accept_self_signed && !ne_ssl_cert_signedby (cert)) {
|
|
|
|
GST_ELEMENT_INFO (src, RESOURCE, READ,
|
|
|
|
(NULL), ("Accepting self-signed server certificate"));
|
|
|
|
|
|
|
|
failures &= ~NE_SSL_UNTRUSTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (failures & NE_SSL_NOTYETVALID)
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
|
|
|
(NULL), ("Server certificate not valid yet"));
|
|
|
|
if (failures & NE_SSL_EXPIRED)
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
|
|
|
(NULL), ("Server certificate has expired"));
|
|
|
|
if (failures & NE_SSL_IDMISMATCH)
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
|
|
|
(NULL), ("Server certificate doesn't match hostname"));
|
|
|
|
if (failures & NE_SSL_UNTRUSTED)
|
|
|
|
GST_ELEMENT_ERROR (src, RESOURCE, READ,
|
|
|
|
(NULL), ("Server certificate signer not trusted"));
|
|
|
|
|
2019-12-11 09:47:20 +00:00
|
|
|
GST_DEBUG_OBJECT (src, "failures: %d", failures);
|
2009-05-25 15:24:32 +00:00
|
|
|
|
|
|
|
return failures;
|
|
|
|
}
|
|
|
|
|
2007-05-31 19:12:37 +00:00
|
|
|
/* Try to send the HTTP request to the Icecast server, and if possible deals with
|
2009-09-04 11:13:39 +00:00
|
|
|
* all the probable redirections (HTTP status code == 3xx)
|
2006-12-22 16:23:32 +00:00
|
|
|
*/
|
|
|
|
static gint
|
|
|
|
gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src,
|
|
|
|
ne_session ** ses, ne_request ** req, gint64 offset, gboolean do_redir)
|
|
|
|
{
|
|
|
|
ne_session *session = NULL;
|
|
|
|
ne_request *request = NULL;
|
2010-08-06 09:44:24 +00:00
|
|
|
gchar **c;
|
2006-12-22 16:23:32 +00:00
|
|
|
gint res;
|
|
|
|
gint http_status = 0;
|
|
|
|
guint request_count = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (src->proxy.host && src->proxy.port) {
|
|
|
|
session =
|
|
|
|
ne_session_create (src->uri.scheme, src->uri.host, src->uri.port);
|
|
|
|
ne_session_proxy (session, src->proxy.host, src->proxy.port);
|
|
|
|
} else if (src->proxy.host || src->proxy.port) {
|
|
|
|
/* both proxy host and port must be specified or none */
|
|
|
|
return HTTP_REQUEST_WRONG_PROXY;
|
|
|
|
} else {
|
|
|
|
session =
|
|
|
|
ne_session_create (src->uri.scheme, src->uri.host, src->uri.port);
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
|
2010-08-06 10:04:57 +00:00
|
|
|
if (src->connect_timeout > 0) {
|
|
|
|
ne_set_connect_timeout (session, src->connect_timeout);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src->read_timeout > 0) {
|
|
|
|
ne_set_read_timeout (session, src->read_timeout);
|
|
|
|
}
|
|
|
|
|
2007-09-09 19:05:19 +00:00
|
|
|
ne_set_session_flag (session, NE_SESSFLAG_ICYPROTO, 1);
|
2009-05-25 15:24:32 +00:00
|
|
|
ne_ssl_set_verify (session, ssl_verify_callback, src);
|
2007-09-09 19:05:19 +00:00
|
|
|
|
2007-09-28 09:29:09 +00:00
|
|
|
request = ne_request_create (session, "GET", src->query_string);
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
if (src->user_agent) {
|
|
|
|
ne_add_request_header (request, "User-Agent", src->user_agent);
|
2006-04-29 15:36:16 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
|
2010-08-06 09:44:24 +00:00
|
|
|
for (c = src->cookies; c != NULL && *c != NULL; ++c) {
|
|
|
|
GST_INFO ("Adding header Cookie : %s", *c);
|
|
|
|
ne_add_request_header (request, "Cookies", *c);
|
|
|
|
}
|
|
|
|
|
2013-05-12 17:47:32 +00:00
|
|
|
if (src->iradio_mode)
|
|
|
|
ne_add_request_header (request, "icy-metadata", "1");
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
if (offset > 0) {
|
|
|
|
ne_print_request_header (request, "Range",
|
|
|
|
"bytes=%" G_GINT64_FORMAT "-", offset);
|
2006-08-04 21:04:55 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
res = ne_begin_request (request);
|
|
|
|
|
|
|
|
if (res == NE_OK) {
|
2009-09-04 11:13:39 +00:00
|
|
|
/* When the HTTP status code is 3xx, it is not the SHOUTcast streaming content yet;
|
2006-12-22 16:23:32 +00:00
|
|
|
* Reload the HTTP request with a new URI value */
|
|
|
|
http_status = ne_get_status (request)->code;
|
2009-09-04 11:13:39 +00:00
|
|
|
if (STATUS_IS_REDIRECTION (http_status) && do_redir) {
|
2006-12-22 16:23:32 +00:00
|
|
|
const gchar *redir;
|
|
|
|
|
|
|
|
/* the new URI value to go when redirecting can be found on the 'Location' HTTP header */
|
|
|
|
redir = ne_get_response_header (request, "Location");
|
|
|
|
if (redir != NULL) {
|
|
|
|
ne_uri_free (&src->uri);
|
2013-05-12 17:28:18 +00:00
|
|
|
gst_neonhttp_src_set_location (src, redir, NULL);
|
2008-09-17 14:47:12 +00:00
|
|
|
GST_LOG_OBJECT (src, "Got HTTP Status Code %d", http_status);
|
|
|
|
GST_LOG_OBJECT (src, "Using 'Location' header [%s]", src->uri.host);
|
2006-12-22 16:23:32 +00:00
|
|
|
}
|
|
|
|
}
|
2006-08-04 21:04:55 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
if ((res != NE_OK) ||
|
|
|
|
(offset == 0 && http_status != 200) ||
|
2009-09-04 11:13:39 +00:00
|
|
|
(offset > 0 && http_status != 206 &&
|
|
|
|
!STATUS_IS_REDIRECTION (http_status))) {
|
2006-12-22 16:23:32 +00:00
|
|
|
ne_request_destroy (request);
|
|
|
|
request = NULL;
|
|
|
|
ne_close_connection (session);
|
|
|
|
ne_session_destroy (session);
|
|
|
|
session = NULL;
|
2009-09-04 11:13:39 +00:00
|
|
|
if (offset > 0 && http_status != 206 &&
|
|
|
|
!STATUS_IS_REDIRECTION (http_status)) {
|
2006-12-22 16:23:32 +00:00
|
|
|
src->seekable = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if - NE_OK */
|
2009-09-04 11:13:39 +00:00
|
|
|
if (STATUS_IS_REDIRECTION (http_status) && do_redir) {
|
2006-12-22 16:23:32 +00:00
|
|
|
++request_count;
|
2008-09-17 14:47:12 +00:00
|
|
|
GST_LOG_OBJECT (src, "redirect request_count is now %d", request_count);
|
|
|
|
if (request_count < MAX_HTTP_REDIRECTS_NUMBER && do_redir) {
|
|
|
|
GST_INFO_OBJECT (src, "Redirecting to %s", src->uri.host);
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (src, "Will not redirect, try again with a "
|
|
|
|
"different URI or redirect location %s", src->uri.host);
|
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
/* FIXME: when not redirecting automatically, shouldn't we post a
|
|
|
|
* redirect element message on the bus? */
|
|
|
|
}
|
|
|
|
/* do the redirect, go back to send another HTTP request now using the 'Location' */
|
|
|
|
} while (do_redir && (request_count < MAX_HTTP_REDIRECTS_NUMBER)
|
2009-09-04 11:13:39 +00:00
|
|
|
&& STATUS_IS_REDIRECTION (http_status));
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
if (session) {
|
|
|
|
*ses = session;
|
|
|
|
*req = request;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
return res;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
static gint
|
|
|
|
gst_neonhttp_src_request_dispatch (GstNeonhttpSrc * src, GstBuffer * outbuf)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
2013-05-12 17:28:18 +00:00
|
|
|
GstMapInfo map = GST_MAP_INFO_INIT;
|
2006-12-22 16:23:32 +00:00
|
|
|
gint ret;
|
|
|
|
gint read = 0;
|
2013-05-12 17:28:18 +00:00
|
|
|
gint sizetoread;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
/* Loop sending the request:
|
|
|
|
* Retry whilst authentication fails and we supply it. */
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
ssize_t len = 0;
|
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
if (!gst_buffer_map (outbuf, &map, GST_MAP_WRITE))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
sizetoread = map.size;
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
while (sizetoread > 0) {
|
2013-05-12 17:28:18 +00:00
|
|
|
len = ne_read_response_block (src->request, (gchar *) map.data + read,
|
|
|
|
sizetoread);
|
2006-12-22 16:23:32 +00:00
|
|
|
if (len > 0) {
|
|
|
|
read += len;
|
|
|
|
sizetoread -= len;
|
|
|
|
} else {
|
2005-12-28 21:07:17 +00:00
|
|
|
break;
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
}
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
}
|
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
gst_buffer_set_size (outbuf, read);
|
|
|
|
GST_BUFFER_OFFSET (outbuf) = src->read_position;
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
if (len < 0) {
|
|
|
|
read = -2;
|
|
|
|
goto done;
|
|
|
|
} else if (len == 0) {
|
|
|
|
ret = ne_end_request (src->request);
|
|
|
|
if (ret != NE_RETRY) {
|
|
|
|
if (ret == NE_OK) {
|
|
|
|
src->eos = TRUE;
|
2005-12-28 21:07:17 +00:00
|
|
|
} else {
|
2006-12-22 16:23:32 +00:00
|
|
|
read = -3;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
ext/neon/gstneonhttpsrc.*: Remove unlock function. start/stop will do everything needed
Original commit message from CVS:
Patch by: Lutz Mueller <lutz at topfrose dot de>
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init),
(gst_neonhttp_src_init), (gst_neonhttp_src_finalize),
(request_dispatch), (gst_neonhttp_src_create),
(gst_neonhttp_src_start), (gst_neonhttp_src_get_size),
(gst_neonhttp_src_stop), (set_proxy), (set_uri),
(gst_neonhttp_src_set_property), (gst_neonhttp_src_get_property),
(gst_neonhttp_src_uri_set_uri), (size_header_handler):
* ext/neon/gstneonhttpsrc.h:
Remove unlock function. start/stop will do everything needed
Removed code that was never called.
Use gst_pad_alloc_buffer. Don't send EOS - parent class does that for us.
Do not escape path. Fixes #346723.
Additional code cleanups.
2006-07-07 11:44:05 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
goto done;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
if (read > 0)
|
|
|
|
src->read_position += read;
|
|
|
|
|
|
|
|
done:
|
2013-05-12 17:28:18 +00:00
|
|
|
|
|
|
|
gst_buffer_unmap (outbuf, &map);
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
return read;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
static void
|
|
|
|
gst_neonhttp_src_close_session (GstNeonhttpSrc * src)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
2006-12-22 16:23:32 +00:00
|
|
|
if (src->request) {
|
|
|
|
ne_request_destroy (src->request);
|
|
|
|
src->request = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src->session) {
|
|
|
|
ne_close_connection (src->session);
|
|
|
|
ne_session_destroy (src->session);
|
|
|
|
src->session = NULL;
|
|
|
|
}
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
/* The following two charset mangling functions were copied from gnomevfssrc.
|
|
|
|
* Preserve them under the unverified assumption that they do something vaguely
|
|
|
|
* worthwhile.
|
|
|
|
*/
|
|
|
|
static gchar *
|
|
|
|
unicodify (const gchar * str, gint len, ...)
|
|
|
|
{
|
|
|
|
gchar *ret = NULL, *cset;
|
|
|
|
va_list args;
|
|
|
|
gsize bytes_read, bytes_written;
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
if (g_utf8_validate (str, len, NULL))
|
|
|
|
return g_strndup (str, len >= 0 ? len : strlen (str));
|
|
|
|
|
|
|
|
va_start (args, len);
|
|
|
|
while ((cset = va_arg (args, gchar *)) != NULL) {
|
|
|
|
if (!strcmp (cset, "locale"))
|
|
|
|
ret = g_locale_to_utf8 (str, len, &bytes_read, &bytes_written, NULL);
|
|
|
|
else
|
|
|
|
ret = g_convert (str, len, "UTF-8", cset,
|
|
|
|
&bytes_read, &bytes_written, NULL);
|
|
|
|
if (ret)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
va_end (args);
|
2005-12-28 21:07:17 +00:00
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
gst_neonhttp_src_unicodify (const gchar * str)
|
|
|
|
{
|
|
|
|
return unicodify (str, -1, "locale", "ISO-8859-1", NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* GstURIHandler Interface */
|
|
|
|
static guint
|
2013-05-12 17:28:18 +00:00
|
|
|
gst_neonhttp_src_uri_get_type (GType type)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
|
|
|
return GST_URI_SRC;
|
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
|
2011-11-13 23:55:56 +00:00
|
|
|
static const gchar *const *
|
2013-05-12 17:28:18 +00:00
|
|
|
gst_neonhttp_src_uri_get_protocols (GType type)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
2010-03-22 12:16:33 +00:00
|
|
|
static const gchar *protocols[] = { "http", "https", NULL };
|
2011-11-13 23:55:56 +00:00
|
|
|
|
|
|
|
return protocols;
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
static gchar *
|
2005-12-28 21:07:17 +00:00
|
|
|
gst_neonhttp_src_uri_get_uri (GstURIHandler * handler)
|
|
|
|
{
|
|
|
|
GstNeonhttpSrc *src = GST_NEONHTTP_SRC (handler);
|
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
/* FIXME: make thread-safe */
|
|
|
|
return g_strdup (src->location);
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-05-12 17:28:18 +00:00
|
|
|
gst_neonhttp_src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
|
|
|
|
GError ** error)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
|
|
|
GstNeonhttpSrc *src = GST_NEONHTTP_SRC (handler);
|
|
|
|
|
2013-05-12 17:28:18 +00:00
|
|
|
return gst_neonhttp_src_set_location (src, uri, error);
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_neonhttp_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
|
|
|
|
|
|
|
iface->get_type = gst_neonhttp_src_uri_get_type;
|
|
|
|
iface->get_protocols = gst_neonhttp_src_uri_get_protocols;
|
|
|
|
iface->get_uri = gst_neonhttp_src_uri_get_uri;
|
|
|
|
iface->set_uri = gst_neonhttp_src_uri_set_uri;
|
|
|
|
}
|
|
|
|
|
2006-12-22 16:23:32 +00:00
|
|
|
/* entry point to initialize the plug-in
|
|
|
|
* initialize the plug-in itself
|
|
|
|
* register the element factories and pad templates
|
|
|
|
* register the features
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
2005-12-28 21:07:17 +00:00
|
|
|
{
|
2021-02-18 09:35:34 +00:00
|
|
|
return GST_ELEMENT_REGISTER (neonhttpsrc, plugin);
|
2005-12-28 21:07:17 +00:00
|
|
|
}
|
2006-12-22 16:23:32 +00:00
|
|
|
|
|
|
|
/* this is the structure that gst-register looks for
|
|
|
|
* so keep the name plugin_desc, or you cannot get your plug-in registered */
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
2017-05-09 13:41:17 +00:00
|
|
|
neonhttpsrc,
|
2006-12-22 16:23:32 +00:00
|
|
|
"lib neon http client src",
|
2008-03-13 14:25:20 +00:00
|
|
|
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|