gio: Some more random cleanup

This commit is contained in:
Sebastian Dröge 2009-07-07 20:21:36 +02:00
parent b81f957bfc
commit 7483a4834c
7 changed files with 50 additions and 80 deletions

View file

@ -62,13 +62,8 @@ gst_gio_base_sink_base_init (gpointer gclass)
static void static void
gst_gio_base_sink_class_init (GstGioBaseSinkClass * klass) gst_gio_base_sink_class_init (GstGioBaseSinkClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class; GstBaseSinkClass *gstbasesink_class = (GstBaseSinkClass *) klass;
GstBaseSinkClass *gstbasesink_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasesink_class = (GstBaseSinkClass *) klass;
gobject_class->finalize = gst_gio_base_sink_finalize; gobject_class->finalize = gst_gio_base_sink_finalize;
@ -144,7 +139,7 @@ gst_gio_base_sink_stop (GstBaseSink * base_sink)
if (!success && !gst_gio_error (sink, "g_output_stream_close", &err, NULL)) { if (!success && !gst_gio_error (sink, "g_output_stream_close", &err, NULL)) {
GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL), GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),
("g_ooutput_stream_close failed: %s", err->message)); ("gio_output_stream_close failed: %s", err->message));
g_clear_error (&err); g_clear_error (&err);
} else if (!success) { } else if (!success) {
GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL), GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL),

View file

@ -32,6 +32,8 @@ G_BEGIN_DECLS
(gst_gio_base_sink_get_type()) (gst_gio_base_sink_get_type())
#define GST_GIO_BASE_SINK(obj) \ #define GST_GIO_BASE_SINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GIO_BASE_SINK,GstGioBaseSink)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GIO_BASE_SINK,GstGioBaseSink))
#define GST_GIO_BASE_SINK_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GIO_BASE_SINK, GstGioBaseSinkClass))
#define GST_GIO_BASE_SINK_CLASS(klass) \ #define GST_GIO_BASE_SINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GIO_BASE_SINK,GstGioBaseSinkClass)) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GIO_BASE_SINK,GstGioBaseSinkClass))
#define GST_IS_GIO_BASE_SINK(obj) \ #define GST_IS_GIO_BASE_SINK(obj) \

View file

@ -68,13 +68,8 @@ gst_gio_base_src_base_init (gpointer gclass)
static void static void
gst_gio_base_src_class_init (GstGioBaseSrcClass * klass) gst_gio_base_src_class_init (GstGioBaseSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class; GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *) klass;
GstBaseSrcClass *gstbasesrc_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass;
gobject_class->finalize = gst_gio_base_src_finalize; gobject_class->finalize = gst_gio_base_src_finalize;

View file

@ -70,9 +70,9 @@ enum
enum enum
{ {
ARG_0, PROP_0,
ARG_LOCATION, PROP_LOCATION,
ARG_FILE PROP_FILE
}; };
GST_BOILERPLATE_FULL (GstGioSink, gst_gio_sink, GstGioBaseSink, GST_BOILERPLATE_FULL (GstGioSink, gst_gio_sink, GstGioBaseSink,
@ -102,19 +102,14 @@ gst_gio_sink_base_init (gpointer gclass)
static void static void
gst_gio_sink_class_init (GstGioSinkClass * klass) gst_gio_sink_class_init (GstGioSinkClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class; GstBaseSinkClass *gstbasesink_class = (GstBaseSinkClass *) klass;
GstBaseSinkClass *gstbasesink_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasesink_class = (GstBaseSinkClass *) klass;
gobject_class->finalize = gst_gio_sink_finalize; gobject_class->finalize = gst_gio_sink_finalize;
gobject_class->set_property = gst_gio_sink_set_property; gobject_class->set_property = gst_gio_sink_set_property;
gobject_class->get_property = gst_gio_sink_get_property; gobject_class->get_property = gst_gio_sink_get_property;
g_object_class_install_property (gobject_class, ARG_LOCATION, g_object_class_install_property (gobject_class, PROP_LOCATION,
g_param_spec_string ("location", "Location", "URI location to write to", g_param_spec_string ("location", "Location", "URI location to write to",
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@ -125,7 +120,7 @@ gst_gio_sink_class_init (GstGioSinkClass * klass)
* *
* Since: 0.10.20 * Since: 0.10.20
**/ **/
g_object_class_install_property (gobject_class, ARG_FILE, g_object_class_install_property (gobject_class, PROP_FILE,
g_param_spec_object ("file", "File", "GFile to write to", g_param_spec_object ("file", "File", "GFile to write to",
G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@ -157,7 +152,7 @@ gst_gio_sink_set_property (GObject * object, guint prop_id,
GstGioSink *sink = GST_GIO_SINK (object); GstGioSink *sink = GST_GIO_SINK (object);
switch (prop_id) { switch (prop_id) {
case ARG_LOCATION:{ case PROP_LOCATION:{
const gchar *uri = NULL; const gchar *uri = NULL;
if (GST_STATE (sink) == GST_STATE_PLAYING || if (GST_STATE (sink) == GST_STATE_PLAYING ||
@ -185,7 +180,7 @@ gst_gio_sink_set_property (GObject * object, guint prop_id,
GST_OBJECT_UNLOCK (GST_OBJECT (sink)); GST_OBJECT_UNLOCK (GST_OBJECT (sink));
break; break;
} }
case ARG_FILE: case PROP_FILE:
if (GST_STATE (sink) == GST_STATE_PLAYING || if (GST_STATE (sink) == GST_STATE_PLAYING ||
GST_STATE (sink) == GST_STATE_PAUSED) { GST_STATE (sink) == GST_STATE_PAUSED) {
GST_WARNING GST_WARNING
@ -214,7 +209,7 @@ gst_gio_sink_get_property (GObject * object, guint prop_id,
GstGioSink *sink = GST_GIO_SINK (object); GstGioSink *sink = GST_GIO_SINK (object);
switch (prop_id) { switch (prop_id) {
case ARG_LOCATION:{ case PROP_LOCATION:{
gchar *uri; gchar *uri;
GST_OBJECT_LOCK (GST_OBJECT (sink)); GST_OBJECT_LOCK (GST_OBJECT (sink));
@ -228,7 +223,7 @@ gst_gio_sink_get_property (GObject * object, guint prop_id,
GST_OBJECT_UNLOCK (GST_OBJECT (sink)); GST_OBJECT_UNLOCK (GST_OBJECT (sink));
break; break;
} }
case ARG_FILE: case PROP_FILE:
GST_OBJECT_LOCK (GST_OBJECT (sink)); GST_OBJECT_LOCK (GST_OBJECT (sink));
g_value_set_object (value, sink->file); g_value_set_object (value, sink->file);
GST_OBJECT_UNLOCK (GST_OBJECT (sink)); GST_OBJECT_UNLOCK (GST_OBJECT (sink));

View file

@ -66,9 +66,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_gio_src_debug);
enum enum
{ {
ARG_0, PROP_0,
ARG_LOCATION, PROP_LOCATION,
ARG_FILE PROP_FILE
}; };
GST_BOILERPLATE_FULL (GstGioSrc, gst_gio_src, GstGioBaseSrc, GST_BOILERPLATE_FULL (GstGioSrc, gst_gio_src, GstGioBaseSrc,
@ -102,19 +102,15 @@ gst_gio_src_base_init (gpointer gclass)
static void static void
gst_gio_src_class_init (GstGioSrcClass * klass) gst_gio_src_class_init (GstGioSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class = (GObjectClass *) klass;
GstBaseSrcClass *gstbasesrc_class; GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *) klass;
GstGioBaseSrcClass *gstgiobasesrc_class; GstGioBaseSrcClass *gstgiobasesrc_class = (GstGioBaseSrcClass *) klass;
gobject_class = (GObjectClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass;
gstgiobasesrc_class = (GstGioBaseSrcClass *) klass;
gobject_class->finalize = gst_gio_src_finalize; gobject_class->finalize = gst_gio_src_finalize;
gobject_class->set_property = gst_gio_src_set_property; gobject_class->set_property = gst_gio_src_set_property;
gobject_class->get_property = gst_gio_src_get_property; gobject_class->get_property = gst_gio_src_get_property;
g_object_class_install_property (gobject_class, ARG_LOCATION, g_object_class_install_property (gobject_class, PROP_LOCATION,
g_param_spec_string ("location", "Location", "URI location to read from", g_param_spec_string ("location", "Location", "URI location to read from",
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@ -125,7 +121,7 @@ gst_gio_src_class_init (GstGioSrcClass * klass)
* *
* Since: 0.10.20 * Since: 0.10.20
**/ **/
g_object_class_install_property (gobject_class, ARG_FILE, g_object_class_install_property (gobject_class, PROP_FILE,
g_param_spec_object ("file", "File", "GFile to read from", g_param_spec_object ("file", "File", "GFile to read from",
G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_TYPE_FILE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@ -160,7 +156,7 @@ gst_gio_src_set_property (GObject * object, guint prop_id,
GstGioSrc *src = GST_GIO_SRC (object); GstGioSrc *src = GST_GIO_SRC (object);
switch (prop_id) { switch (prop_id) {
case ARG_LOCATION:{ case PROP_LOCATION:{
const gchar *uri = NULL; const gchar *uri = NULL;
if (GST_STATE (src) == GST_STATE_PLAYING || if (GST_STATE (src) == GST_STATE_PLAYING ||
@ -188,7 +184,7 @@ gst_gio_src_set_property (GObject * object, guint prop_id,
GST_OBJECT_UNLOCK (GST_OBJECT (src)); GST_OBJECT_UNLOCK (GST_OBJECT (src));
break; break;
} }
case ARG_FILE: case PROP_FILE:
if (GST_STATE (src) == GST_STATE_PLAYING || if (GST_STATE (src) == GST_STATE_PLAYING ||
GST_STATE (src) == GST_STATE_PAUSED) { GST_STATE (src) == GST_STATE_PAUSED) {
GST_WARNING GST_WARNING
@ -217,7 +213,7 @@ gst_gio_src_get_property (GObject * object, guint prop_id,
GstGioSrc *src = GST_GIO_SRC (object); GstGioSrc *src = GST_GIO_SRC (object);
switch (prop_id) { switch (prop_id) {
case ARG_LOCATION:{ case PROP_LOCATION:{
gchar *uri; gchar *uri;
GST_OBJECT_LOCK (GST_OBJECT (src)); GST_OBJECT_LOCK (GST_OBJECT (src));
@ -231,7 +227,7 @@ gst_gio_src_get_property (GObject * object, guint prop_id,
GST_OBJECT_UNLOCK (GST_OBJECT (src)); GST_OBJECT_UNLOCK (GST_OBJECT (src));
break; break;
} }
case ARG_FILE: case PROP_FILE:
GST_OBJECT_LOCK (GST_OBJECT (src)); GST_OBJECT_LOCK (GST_OBJECT (src));
g_value_set_object (value, src->file); g_value_set_object (value, src->file);
GST_OBJECT_UNLOCK (GST_OBJECT (src)); GST_OBJECT_UNLOCK (GST_OBJECT (src));
@ -246,7 +242,6 @@ static gboolean
gst_gio_src_check_get_range (GstBaseSrc * base_src) gst_gio_src_check_get_range (GstBaseSrc * base_src)
{ {
GstGioSrc *src = GST_GIO_SRC (base_src); GstGioSrc *src = GST_GIO_SRC (base_src);
gchar *scheme; gchar *scheme;
if (src->file == NULL) if (src->file == NULL)

View file

@ -79,8 +79,8 @@ enum
enum enum
{ {
ARG_0, PROP_0,
ARG_STREAM PROP_STREAM
}; };
GST_BOILERPLATE (GstGioStreamSink, gst_gio_stream_sink, GstGioBaseSink, GST_BOILERPLATE (GstGioStreamSink, gst_gio_stream_sink, GstGioBaseSink,
@ -95,36 +95,27 @@ static void gst_gio_stream_sink_get_property (GObject * object, guint prop_id,
static void static void
gst_gio_stream_sink_base_init (gpointer gclass) gst_gio_stream_sink_base_init (gpointer gclass)
{ {
static GstElementDetails element_details = {
"GIO stream sink",
"Sink",
"Write to any GIO stream",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>"
};
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
GST_DEBUG_CATEGORY_INIT (gst_gio_stream_sink_debug, "gio_stream_sink", 0, GST_DEBUG_CATEGORY_INIT (gst_gio_stream_sink_debug, "gio_stream_sink", 0,
"GIO stream sink"); "GIO stream sink");
gst_element_class_set_details (element_class, &element_details); gst_element_class_set_details_simple (element_class, "GIO stream sink",
"Sink",
"Write to any GIO stream",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
} }
static void static void
gst_gio_stream_sink_class_init (GstGioStreamSinkClass * klass) gst_gio_stream_sink_class_init (GstGioStreamSinkClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class;
GstBaseSinkClass *gstbasesink_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasesink_class = (GstBaseSinkClass *) klass;
gobject_class->finalize = gst_gio_stream_sink_finalize; gobject_class->finalize = gst_gio_stream_sink_finalize;
gobject_class->set_property = gst_gio_stream_sink_set_property; gobject_class->set_property = gst_gio_stream_sink_set_property;
gobject_class->get_property = gst_gio_stream_sink_get_property; gobject_class->get_property = gst_gio_stream_sink_get_property;
g_object_class_install_property (gobject_class, ARG_STREAM, g_object_class_install_property (gobject_class, PROP_STREAM,
g_param_spec_object ("stream", "Stream", "Stream to write to", g_param_spec_object ("stream", "Stream", "Stream to write to",
G_TYPE_OUTPUT_STREAM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_TYPE_OUTPUT_STREAM, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
} }
@ -148,12 +139,15 @@ gst_gio_stream_sink_set_property (GObject * object, guint prop_id,
GstGioStreamSink *sink = GST_GIO_STREAM_SINK (object); GstGioStreamSink *sink = GST_GIO_STREAM_SINK (object);
switch (prop_id) { switch (prop_id) {
case ARG_STREAM:{ case PROP_STREAM:{
GObject *stream; GObject *stream;
if (GST_STATE (sink) == GST_STATE_PLAYING || if (GST_STATE (sink) == GST_STATE_PLAYING ||
GST_STATE (sink) == GST_STATE_PAUSED) GST_STATE (sink) == GST_STATE_PAUSED) {
GST_WARNING
("Setting a new stream not supported in PLAYING or PAUSED state");
break; break;
}
stream = g_value_dup_object (value); stream = g_value_dup_object (value);
if (G_IS_OUTPUT_STREAM (stream)) if (G_IS_OUTPUT_STREAM (stream))
@ -175,7 +169,7 @@ gst_gio_stream_sink_get_property (GObject * object, guint prop_id,
GstGioStreamSink *sink = GST_GIO_STREAM_SINK (object); GstGioStreamSink *sink = GST_GIO_STREAM_SINK (object);
switch (prop_id) { switch (prop_id) {
case ARG_STREAM: case PROP_STREAM:
g_value_set_object (value, GST_GIO_BASE_SINK (sink)->stream); g_value_set_object (value, GST_GIO_BASE_SINK (sink)->stream);
break; break;
default: default:

View file

@ -90,28 +90,22 @@ static GInputStream *gst_gio_stream_src_get_stream (GstGioBaseSrc * bsrc);
static void static void
gst_gio_stream_src_base_init (gpointer gclass) gst_gio_stream_src_base_init (gpointer gclass)
{ {
static GstElementDetails element_details = {
"GIO stream source",
"Source",
"Read from any GIO stream",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>"
};
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
GST_DEBUG_CATEGORY_INIT (gst_gio_stream_src_debug, "gio_stream_src", 0, GST_DEBUG_CATEGORY_INIT (gst_gio_stream_src_debug, "gio_stream_src", 0,
"GIO source"); "GIO source");
gst_element_class_set_details (element_class, &element_details); gst_element_class_set_details_simple (element_class, "GIO stream source",
"Source",
"Read from any GIO stream",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
} }
static void static void
gst_gio_stream_src_class_init (GstGioStreamSrcClass * klass) gst_gio_stream_src_class_init (GstGioStreamSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class = (GObjectClass *) klass;
GstGioBaseSrcClass *gstgiobasesrc_class; GstGioBaseSrcClass *gstgiobasesrc_class = (GstGioBaseSrcClass *) klass;
gobject_class = (GObjectClass *) klass;
gstgiobasesrc_class = (GstGioBaseSrcClass *) klass;
gobject_class->finalize = gst_gio_stream_src_finalize; gobject_class->finalize = gst_gio_stream_src_finalize;
gobject_class->set_property = gst_gio_stream_src_set_property; gobject_class->set_property = gst_gio_stream_src_set_property;