mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
souphttpsrc: Add "compress" property to enable/disable automatic gzip/deflate content encoding handling
This commit is contained in:
parent
9cac68709a
commit
106bc2b17b
2 changed files with 31 additions and 2 deletions
|
@ -107,12 +107,14 @@ enum
|
||||||
PROP_IRADIO_MODE,
|
PROP_IRADIO_MODE,
|
||||||
PROP_TIMEOUT,
|
PROP_TIMEOUT,
|
||||||
PROP_EXTRA_HEADERS,
|
PROP_EXTRA_HEADERS,
|
||||||
PROP_SOUP_LOG_LEVEL
|
PROP_SOUP_LOG_LEVEL,
|
||||||
|
PROP_COMPRESS
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_USER_AGENT "GStreamer souphttpsrc "
|
#define DEFAULT_USER_AGENT "GStreamer souphttpsrc "
|
||||||
#define DEFAULT_IRADIO_MODE TRUE
|
#define DEFAULT_IRADIO_MODE TRUE
|
||||||
#define DEFAULT_SOUP_LOG_LEVEL SOUP_LOGGER_LOG_NONE
|
#define DEFAULT_SOUP_LOG_LEVEL SOUP_LOGGER_LOG_NONE
|
||||||
|
#define DEFAULT_COMPRESS FALSE
|
||||||
|
|
||||||
static void gst_soup_http_src_uri_handler_init (gpointer g_iface,
|
static void gst_soup_http_src_uri_handler_init (gpointer g_iface,
|
||||||
gpointer iface_data);
|
gpointer iface_data);
|
||||||
|
@ -260,6 +262,21 @@ gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass)
|
||||||
SOUP_TYPE_LOGGER_LOG_LEVEL, DEFAULT_SOUP_LOG_LEVEL,
|
SOUP_TYPE_LOGGER_LOG_LEVEL, DEFAULT_SOUP_LOG_LEVEL,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstSoupHTTPSrc::compress:
|
||||||
|
*
|
||||||
|
* If set to %TRUE, souphttpsrc will automatically handle gzip
|
||||||
|
* and deflate Content-Encodings. This does not make much difference
|
||||||
|
* and causes more load for normal media files, but makes a real
|
||||||
|
* difference in size for plaintext files.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class, PROP_COMPRESS,
|
||||||
|
g_param_spec_boolean ("compress", "Compress",
|
||||||
|
"Allow compressed content encodings",
|
||||||
|
DEFAULT_COMPRESS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
gst_element_class_add_pad_template (gstelement_class,
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
gst_static_pad_template_get (&srctemplate));
|
gst_static_pad_template_get (&srctemplate));
|
||||||
|
|
||||||
|
@ -458,6 +475,9 @@ gst_soup_http_src_set_property (GObject * object, guint prop_id,
|
||||||
case PROP_SOUP_LOG_LEVEL:
|
case PROP_SOUP_LOG_LEVEL:
|
||||||
src->log_level = g_value_get_enum (value);
|
src->log_level = g_value_get_enum (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_COMPRESS:
|
||||||
|
src->compress = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -522,6 +542,9 @@ gst_soup_http_src_get_property (GObject * object, guint prop_id,
|
||||||
case PROP_SOUP_LOG_LEVEL:
|
case PROP_SOUP_LOG_LEVEL:
|
||||||
g_value_set_enum (value, src->log_level);
|
g_value_set_enum (value, src->log_level);
|
||||||
break;
|
break;
|
||||||
|
case PROP_COMPRESS:
|
||||||
|
g_value_set_boolean (value, src->compress);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -722,6 +745,9 @@ gst_soup_http_src_session_open (GstSoupHTTPSrc * src)
|
||||||
/* Set up logging */
|
/* Set up logging */
|
||||||
gst_soup_util_log_setup (src->session, src->log_level, GST_ELEMENT (src));
|
gst_soup_util_log_setup (src->session, src->log_level, GST_ELEMENT (src));
|
||||||
|
|
||||||
|
if (src->compress)
|
||||||
|
soup_session_add_feature_by_type (src->session, SOUP_TYPE_CONTENT_DECODER);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,6 @@ struct _GstSoupHTTPSrc {
|
||||||
* decide if an out of range request should be
|
* decide if an out of range request should be
|
||||||
* handled as an error or EOS when the content
|
* handled as an error or EOS when the content
|
||||||
* size is unknown */
|
* size is unknown */
|
||||||
SoupLoggerLogLevel log_level;/* Soup HTTP session logger level */
|
|
||||||
|
|
||||||
/* Shoutcast/icecast metadata extraction handling. */
|
/* Shoutcast/icecast metadata extraction handling. */
|
||||||
gboolean iradio_mode;
|
gboolean iradio_mode;
|
||||||
|
@ -94,6 +93,10 @@ struct _GstSoupHTTPSrc {
|
||||||
|
|
||||||
GstStructure *extra_headers;
|
GstStructure *extra_headers;
|
||||||
|
|
||||||
|
SoupLoggerLogLevel log_level;/* Soup HTTP session logger level */
|
||||||
|
|
||||||
|
gboolean compress;
|
||||||
|
|
||||||
guint timeout;
|
guint timeout;
|
||||||
|
|
||||||
GMutex mutex;
|
GMutex mutex;
|
||||||
|
|
Loading…
Reference in a new issue