Make native protocol

Remove DBus and work towards something like wayland.
Remove more glib stuff from the client code
This commit is contained in:
Wim Taymans 2016-11-24 17:00:42 +01:00
parent efae64a759
commit 27bba6f587
55 changed files with 3089 additions and 4969 deletions

View file

@ -39,19 +39,18 @@ G_DEFINE_TYPE (GstPinosDevice, gst_pinos_device, GST_TYPE_DEVICE);
enum
{
PROP_PATH = 1,
PROP_ID = 1,
};
static GstDevice *
gst_pinos_device_new (gpointer id, const gchar * device_name,
GstCaps * caps, const gchar * path, const gchar *klass,
gst_pinos_device_new (uint32_t id, const gchar * device_name,
GstCaps * caps, const gchar *klass,
GstPinosDeviceType type, GstStructure *props)
{
GstPinosDevice *gstdev;
const gchar *element = NULL;
g_return_val_if_fail (device_name, NULL);
g_return_val_if_fail (path, NULL);
g_return_val_if_fail (caps, NULL);
switch (type) {
@ -68,7 +67,7 @@ gst_pinos_device_new (gpointer id, const gchar * device_name,
gstdev = g_object_new (GST_TYPE_PINOS_DEVICE,
"display-name", device_name, "caps", caps, "device-class", klass,
"path", path, "properties", props, NULL);
"id", id, "properties", props, NULL);
gstdev->id = id;
gstdev->type = type;
@ -84,7 +83,7 @@ gst_pinos_device_create_element (GstDevice * device, const gchar * name)
GstElement *elem;
elem = gst_element_factory_make (pinos_dev->element, name);
g_object_set (elem, "path", pinos_dev->path, NULL);
g_object_set (elem, "path", pinos_dev->id, NULL);
return elem;
}
@ -104,7 +103,7 @@ gst_pinos_device_reconfigure_element (GstDevice * device, GstElement * element)
g_assert_not_reached ();
}
g_object_set (element, "path", pinos_dev->path, NULL);
g_object_set (element, "path", pinos_dev->id, NULL);
return TRUE;
}
@ -119,8 +118,8 @@ gst_pinos_device_get_property (GObject * object, guint prop_id,
device = GST_PINOS_DEVICE_CAST (object);
switch (prop_id) {
case PROP_PATH:
g_value_set_string (value, device->path);
case PROP_ID:
g_value_set_uint (value, device->id);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -137,8 +136,8 @@ gst_pinos_device_set_property (GObject * object, guint prop_id,
device = GST_PINOS_DEVICE_CAST (object);
switch (prop_id) {
case PROP_PATH:
device->path = g_value_dup_string (value);
case PROP_ID:
device->id = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -149,10 +148,6 @@ gst_pinos_device_set_property (GObject * object, guint prop_id,
static void
gst_pinos_device_finalize (GObject * object)
{
GstPinosDevice *device = GST_PINOS_DEVICE (object);
g_free (device->path);
G_OBJECT_CLASS (gst_pinos_device_parent_class)->finalize (object);
}
@ -169,9 +164,9 @@ gst_pinos_device_class_init (GstPinosDeviceClass * klass)
object_class->set_property = gst_pinos_device_set_property;
object_class->finalize = gst_pinos_device_finalize;
g_object_class_install_property (object_class, PROP_PATH,
g_param_spec_string ("path", "Path",
"The internal path of the Pinos device", "",
g_object_class_install_property (object_class, PROP_ID,
g_param_spec_uint ("id", "Id",
"The internal id of the Pinos device", 0, G_MAXUINT32, SPA_ID_INVALID,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
@ -225,7 +220,6 @@ new_node (const PinosNodeInfo *info)
return gst_pinos_device_new (info->id,
info->name,
caps,
info->node_path,
klass,
GST_PINOS_DEVICE_TYPE_SOURCE,
props);
@ -233,19 +227,22 @@ new_node (const PinosNodeInfo *info)
static void
get_node_info_cb (PinosContext *context,
SpaResult res,
const PinosNodeInfo *info,
gpointer user_data)
{
GstPinosDeviceProvider *self = user_data;
GstDevice *dev;
dev = new_node (info);
if (dev)
gst_device_provider_device_add (GST_DEVICE_PROVIDER (self), dev);
if (info) {
GstDevice *dev;
dev = new_node (info);
if (dev)
gst_device_provider_device_add (GST_DEVICE_PROVIDER (self), dev);
}
}
static GstPinosDevice *
find_device (GstDeviceProvider *provider, gpointer id)
find_device (GstDeviceProvider *provider, uint32_t id)
{
GList *item;
GstPinosDevice *dev = NULL;
@ -266,10 +263,10 @@ find_device (GstDeviceProvider *provider, gpointer id)
static void
context_subscribe_cb (PinosContext *context,
PinosSubscriptionEvent type,
PinosSubscriptionFlags flags,
gpointer id,
gpointer user_data)
PinosSubscriptionEvent type,
uint32_t id,
void *user_data)
{
GstPinosDeviceProvider *self = user_data;
GstDeviceProvider *provider = user_data;
@ -284,10 +281,7 @@ context_subscribe_cb (PinosContext *context,
if (flags == PINOS_SUBSCRIPTION_FLAG_NODE && dev == NULL)
pinos_context_get_node_info_by_id (context,
id,
PINOS_NODE_INFO_FLAGS_NONE,
get_node_info_cb,
NULL,
NULL,
self);
} else if (type == PINOS_SUBSCRIPTION_EVENT_REMOVE) {
if (flags == PINOS_SUBSCRIPTION_FLAG_NODE && dev != NULL) {
@ -306,31 +300,23 @@ typedef struct {
static void
list_node_info_cb (PinosContext *c,
SpaResult res,
const PinosNodeInfo *info,
gpointer user_data)
void *user_data)
{
InfoData *data = user_data;
*data->devices = g_list_prepend (*data->devices, gst_object_ref_sink (new_node (info)));
}
static void
list_node_info_end_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
InfoData *data = user_data;
GError *error = NULL;
if (!pinos_context_info_finish (source_object, res, &error)) {
GST_WARNING_OBJECT (source_object, "failed to list nodes: %s", error->message);
g_clear_error (&error);
if (info) {
*data->devices = g_list_prepend (*data->devices, gst_object_ref_sink (new_node (info)));
} else {
data->end = TRUE;
}
data->end = TRUE;
}
static void
get_daemon_info_cb (PinosContext *c, const PinosDaemonInfo *info, gpointer user_data)
get_daemon_info_cb (PinosContext *c,
SpaResult res,
const PinosDaemonInfo *info,
void *user_data)
{
GstDeviceProvider *provider = user_data;
const gchar *value;
@ -353,30 +339,27 @@ static GList *
gst_pinos_device_provider_probe (GstDeviceProvider * provider)
{
GstPinosDeviceProvider *self = GST_PINOS_DEVICE_PROVIDER (provider);
GMainContext *m = NULL;
PinosLoop *l = NULL;
PinosContext *c = NULL;
InfoData data;
GST_DEBUG_OBJECT (self, "starting probe");
if (!(m = g_main_context_new ()))
if (!(l = pinos_loop_new ()))
return NULL;
if (!(c = pinos_context_new (m, self->client_name, NULL)))
if (!(c = pinos_context_new (l, self->client_name, NULL)))
goto failed;
g_main_context_push_thread_default (m);
pinos_context_connect (c, PINOS_CONTEXT_FLAGS_NONE);
pinos_context_connect (c);
for (;;) {
PinosContextState state;
state = pinos_context_get_state (c);
state = c->state;
if (state <= 0) {
GST_ERROR_OBJECT (self, "Failed to connect: %s",
pinos_context_get_error (c)->message);
GST_ERROR_OBJECT (self, "Failed to connect: %s", c->error);
goto failed;
}
@ -384,59 +367,47 @@ gst_pinos_device_provider_probe (GstDeviceProvider * provider)
break;
/* Wait until something happens */
g_main_context_iteration (m, TRUE);
pinos_loop_iterate (l, -1);
}
GST_DEBUG_OBJECT (self, "connected");
pinos_context_get_daemon_info (c,
PINOS_DAEMON_INFO_FLAGS_NONE,
get_daemon_info_cb,
NULL,
NULL,
self);
data.end = FALSE;
data.devices = NULL;
pinos_context_list_node_info (c,
PINOS_NODE_INFO_FLAGS_NONE,
list_node_info_cb,
NULL,
list_node_info_end_cb,
&data);
for (;;) {
if (pinos_context_get_state (c) <= 0)
if (c->state <= 0)
break;
if (data.end)
break;
g_main_context_iteration (m, TRUE);
pinos_loop_iterate (l, -1);
}
pinos_context_disconnect (c);
g_clear_object (&c);
g_main_context_pop_thread_default (m);
g_main_context_unref (m);
pinos_context_destroy (c);
pinos_loop_destroy (l);
return *data.devices;
failed:
g_main_context_pop_thread_default (m);
g_main_context_unref (m);
pinos_loop_destroy (l);
return NULL;
}
static void
context_state_notify (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
on_context_state_changed (PinosListener *listener,
PinosContext *context)
{
GstPinosDeviceProvider *self = user_data;
PinosContext *context = PINOS_CONTEXT (gobject);
GstPinosDeviceProvider *self = SPA_CONTAINER_OF (listener, GstPinosDeviceProvider, ctx_state_changed);
PinosContextState state;
state= pinos_context_get_state (context);
state= context->state;
GST_DEBUG ("got context state %d", state);
@ -447,67 +418,53 @@ context_state_notify (GObject *gobject,
case PINOS_CONTEXT_STATE_CONNECTED:
break;
case PINOS_CONTEXT_STATE_ERROR:
GST_ERROR_OBJECT (self, "context error: %s",
pinos_context_get_error (context)->message);
GST_ERROR_OBJECT (self, "context error: %s", context->error);
break;
}
pinos_thread_main_loop_signal (self->loop, FALSE);
pinos_thread_main_loop_signal (self->main_loop, FALSE);
}
static gboolean
gst_pinos_device_provider_start (GstDeviceProvider * provider)
{
GstPinosDeviceProvider *self = GST_PINOS_DEVICE_PROVIDER (provider);
GError *error = NULL;
GMainContext *c;
GST_DEBUG_OBJECT (self, "starting provider");
c = g_main_context_new ();
self->loop = pinos_loop_new ();
if (!(self->loop = pinos_thread_main_loop_new (c, "pinos-device-monitor"))) {
if (!(self->main_loop = pinos_thread_main_loop_new (self->loop, "pinos-device-monitor"))) {
GST_ERROR_OBJECT (self, "Could not create pinos mainloop");
goto failed;
goto failed_main_loop;
}
if (!pinos_thread_main_loop_start (self->loop, &error)) {
GST_ERROR_OBJECT (self, "Could not start pinos mainloop: %s", error->message);
g_clear_object (&self->loop);
goto failed;
if (pinos_thread_main_loop_start (self->main_loop) != SPA_RESULT_OK) {
GST_ERROR_OBJECT (self, "Could not start pinos mainloop");
goto failed_start;
}
pinos_thread_main_loop_lock (self->loop);
pinos_thread_main_loop_lock (self->main_loop);
if (!(self->context = pinos_context_new (c, self->client_name, NULL))) {
if (!(self->context = pinos_context_new (self->loop, self->client_name, NULL))) {
GST_ERROR_OBJECT (self, "Failed to create context");
pinos_thread_main_loop_unlock (self->loop);
pinos_thread_main_loop_stop (self->loop);
g_clear_object (&self->loop);
goto failed;
goto failed_context;
}
g_signal_connect (self->context,
"notify::state",
(GCallback) context_state_notify,
self);
pinos_signal_add (&self->context->state_changed, &self->ctx_state_changed, on_context_state_changed);
g_object_set (self->context,
"subscription-mask", PINOS_SUBSCRIPTION_FLAGS_ALL,
NULL);
g_signal_connect (self->context,
"subscription-event",
(GCallback) context_subscribe_cb,
self);
pinos_context_subscribe (self->context,
PINOS_SUBSCRIPTION_FLAGS_ALL,
context_subscribe_cb,
self);
pinos_context_connect (self->context, PINOS_CONTEXT_FLAGS_NONE);
pinos_context_connect (self->context);
for (;;) {
PinosContextState state;
state = pinos_context_get_state (self->context);
state = self->context->state;
if (state <= 0) {
GST_WARNING_OBJECT (self, "Failed to connect: %s",
pinos_context_get_error (self->context)->message);
GST_WARNING_OBJECT (self, "Failed to connect: %s", self->context->error);
goto not_running;
}
@ -515,34 +472,28 @@ gst_pinos_device_provider_start (GstDeviceProvider * provider)
break;
/* Wait until something happens */
pinos_thread_main_loop_wait (self->loop);
pinos_thread_main_loop_wait (self->main_loop);
}
GST_DEBUG_OBJECT (self, "connected");
pinos_context_get_daemon_info (self->context,
PINOS_DAEMON_INFO_FLAGS_NONE,
get_daemon_info_cb,
NULL,
NULL,
self);
pinos_thread_main_loop_unlock (self->loop);
g_main_context_unref (c);
pinos_thread_main_loop_unlock (self->main_loop);
return TRUE;
failed:
{
g_main_context_unref (c);
return FALSE;
}
not_running:
{
pinos_thread_main_loop_unlock (self->loop);
pinos_thread_main_loop_stop (self->loop);
g_clear_object (&self->context);
g_clear_object (&self->loop);
return TRUE;
}
pinos_context_destroy (self->context);
self->context = NULL;
failed_context:
pinos_thread_main_loop_unlock (self->main_loop);
failed_start:
pinos_thread_main_loop_destroy (self->main_loop);
self->main_loop = NULL;
failed_main_loop:
pinos_loop_destroy (self->loop);
self->loop = NULL;
return FALSE;
}
static void
@ -552,12 +503,17 @@ gst_pinos_device_provider_stop (GstDeviceProvider * provider)
if (self->context) {
pinos_context_disconnect (self->context);
pinos_context_destroy (self->context);
self->context = NULL;
}
if (self->main_loop) {
pinos_thread_main_loop_destroy (self->main_loop);
self->main_loop = NULL;
}
if (self->loop) {
pinos_thread_main_loop_stop (self->loop);
pinos_loop_destroy (self->loop);
self->loop = NULL;
}
g_clear_object (&self->context);
g_clear_object (&self->loop);
}
static void

View file

@ -54,8 +54,7 @@ struct _GstPinosDevice {
GstDevice parent;
GstPinosDeviceType type;
gpointer id;
gchar *path;
uint32_t id;
const gchar *element;
};
@ -81,10 +80,11 @@ struct _GstPinosDeviceProvider {
gchar *client_name;
GMainContext *maincontext;
PinosThreadMainLoop *loop;
PinosLoop *loop;
PinosThreadMainLoop *main_loop;
PinosContext *context;
PinosListener ctx_state_changed;
};
struct _GstPinosDeviceProviderClass {

View file

@ -348,11 +348,11 @@ process_mem_data_destroy (gpointer user_data)
}
static void
on_add_buffer (GObject *gobject,
guint id,
gpointer user_data)
on_add_buffer (PinosListener *listener,
PinosStream *stream,
uint32_t id)
{
GstPinosSink *pinossink = user_data;
GstPinosSink *pinossink = SPA_CONTAINER_OF (listener, GstPinosSink, stream_add_buffer);
SpaBuffer *b;
GstBuffer *buf;
unsigned int i;
@ -415,15 +415,15 @@ on_add_buffer (GObject *gobject,
gst_pinos_pool_add_buffer (pinossink->pool, buf);
g_hash_table_insert (pinossink->buf_ids, GINT_TO_POINTER (id), buf);
pinos_thread_main_loop_signal (pinossink->loop, FALSE);
pinos_thread_main_loop_signal (pinossink->main_loop, FALSE);
}
static void
on_remove_buffer (GObject *gobject,
guint id,
gpointer user_data)
on_remove_buffer (PinosListener *listener,
PinosStream *stream,
uint32_t id)
{
GstPinosSink *pinossink = user_data;
GstPinosSink *pinossink = SPA_CONTAINER_OF (listener, GstPinosSink, stream_remove_buffer);
GstBuffer *buf;
GST_LOG_OBJECT (pinossink, "remove buffer");
@ -435,11 +435,11 @@ on_remove_buffer (GObject *gobject,
}
static void
on_new_buffer (GObject *gobject,
guint id,
gpointer user_data)
on_new_buffer (PinosListener *listener,
PinosStream *stream,
uint32_t id)
{
GstPinosSink *pinossink = user_data;
GstPinosSink *pinossink = SPA_CONTAINER_OF (listener, GstPinosSink, stream_new_buffer);
GstBuffer *buf;
GST_LOG_OBJECT (pinossink, "got new buffer");
@ -451,20 +451,18 @@ on_new_buffer (GObject *gobject,
if (buf) {
gst_buffer_unref (buf);
pinos_thread_main_loop_signal (pinossink->loop, FALSE);
pinos_thread_main_loop_signal (pinossink->main_loop, FALSE);
}
}
static void
on_stream_notify (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
on_state_changed (PinosListener *listener,
PinosStream *stream)
{
GstPinosSink *pinossink = SPA_CONTAINER_OF (listener, GstPinosSink, stream_state_changed);
PinosStreamState state;
PinosStream *stream = PINOS_STREAM (gobject);
GstPinosSink *pinossink = user_data;
state = pinos_stream_get_state (stream);
state = stream->state;
GST_DEBUG ("got stream state %d", state);
switch (state) {
@ -477,20 +475,19 @@ on_stream_notify (GObject *gobject,
break;
case PINOS_STREAM_STATE_ERROR:
GST_ELEMENT_ERROR (pinossink, RESOURCE, FAILED,
("stream error: %s",
pinos_stream_get_error (stream)->message), (NULL));
("stream error: %s", stream->error), (NULL));
break;
}
pinos_thread_main_loop_signal (pinossink->loop, FALSE);
pinos_thread_main_loop_signal (pinossink->main_loop, FALSE);
}
static void
on_format_notify (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
on_format_changed (PinosListener *listener,
PinosStream *stream,
SpaFormat *format)
{
#if 0
GstPinosSink *pinossink = user_data;
GstPinosSink *pinossink = SPA_CONTAINER_OF (listener, GstPinosSink, stream_format_changed);
GstStructure *config;
GstCaps *caps;
guint size;
@ -532,8 +529,8 @@ gst_pinos_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
possible = gst_caps_to_format_all (caps);
pinos_thread_main_loop_lock (pinossink->loop);
state = pinos_stream_get_state (pinossink->stream);
pinos_thread_main_loop_lock (pinossink->main_loop);
state = pinossink->stream->state;
if (state == PINOS_STREAM_STATE_ERROR)
goto start_error;
@ -549,10 +546,11 @@ gst_pinos_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
PINOS_STREAM_MODE_BUFFER,
pinossink->path,
flags,
possible);
possible->len,
(SpaFormat **) possible->pdata);
while (TRUE) {
state = pinos_stream_get_state (pinossink->stream);
state = pinossink->stream->state;
if (state == PINOS_STREAM_STATE_READY)
break;
@ -560,7 +558,7 @@ gst_pinos_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
if (state == PINOS_STREAM_STATE_ERROR)
goto start_error;
pinos_thread_main_loop_wait (pinossink->loop);
pinos_thread_main_loop_wait (pinossink->main_loop);
}
}
res = TRUE;
@ -570,7 +568,7 @@ gst_pinos_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
res = pinos_stream_start (pinossink->stream);
while (TRUE) {
state = pinos_stream_get_state (pinossink->stream);
state = pinossink->stream->state;
if (state == PINOS_STREAM_STATE_STREAMING)
break;
@ -578,11 +576,11 @@ gst_pinos_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
if (state == PINOS_STREAM_STATE_ERROR)
goto start_error;
pinos_thread_main_loop_wait (pinossink->loop);
pinos_thread_main_loop_wait (pinossink->main_loop);
}
}
#endif
pinos_thread_main_loop_unlock (pinossink->loop);
pinos_thread_main_loop_unlock (pinossink->main_loop);
pinossink->negotiated = res;
@ -591,7 +589,7 @@ gst_pinos_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
start_error:
{
GST_ERROR ("could not start stream");
pinos_thread_main_loop_unlock (pinossink->loop);
pinos_thread_main_loop_unlock (pinossink->main_loop);
g_ptr_array_unref (possible);
return FALSE;
}
@ -610,8 +608,8 @@ gst_pinos_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
if (!pinossink->negotiated)
goto not_negotiated;
pinos_thread_main_loop_lock (pinossink->loop);
if (pinos_stream_get_state (pinossink->stream) != PINOS_STREAM_STATE_STREAMING)
pinos_thread_main_loop_lock (pinossink->main_loop);
if (pinossink->stream->state != PINOS_STREAM_STATE_STREAMING)
goto done;
// goto streaming_error;
@ -645,7 +643,7 @@ gst_pinos_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
done:
pinos_thread_main_loop_unlock (pinossink->loop);
pinos_thread_main_loop_unlock (pinossink->main_loop);
return GST_FLOW_OK;
@ -655,7 +653,7 @@ not_negotiated:
}
//streaming_error:
// {
// pinos_thread_main_loop_unlock (pinossink->loop);
// pinos_thread_main_loop_unlock (pinossink->main_loop);
// return GST_FLOW_ERROR;
// }
}
@ -689,15 +687,16 @@ gst_pinos_sink_start (GstBaseSink * basesink)
props = NULL;
}
pinos_thread_main_loop_lock (pinossink->loop);
pinos_thread_main_loop_lock (pinossink->main_loop);
pinossink->stream = pinos_stream_new (pinossink->ctx, pinossink->client_name, props);
pinossink->pool->stream = pinossink->stream;
g_signal_connect (pinossink->stream, "notify::state", (GCallback) on_stream_notify, pinossink);
g_signal_connect (pinossink->stream, "notify::format", (GCallback) on_format_notify, pinossink);
g_signal_connect (pinossink->stream, "add-buffer", (GCallback) on_add_buffer, pinossink);
g_signal_connect (pinossink->stream, "remove-buffer", (GCallback) on_remove_buffer, pinossink);
g_signal_connect (pinossink->stream, "new-buffer", (GCallback) on_new_buffer, pinossink);
pinos_thread_main_loop_unlock (pinossink->loop);
pinos_signal_add (&pinossink->stream->state_changed, &pinossink->stream_state_changed, on_state_changed);
pinos_signal_add (&pinossink->stream->format_changed, &pinossink->stream_format_changed, on_format_changed);
pinos_signal_add (&pinossink->stream->add_buffer, &pinossink->stream_add_buffer, on_add_buffer);
pinos_signal_add (&pinossink->stream->remove_buffer, &pinossink->stream_remove_buffer, on_remove_buffer);
pinos_signal_add (&pinossink->stream->new_buffer, &pinossink->stream_new_buffer, on_new_buffer);
pinos_thread_main_loop_unlock (pinossink->main_loop);
return TRUE;
}
@ -707,14 +706,14 @@ gst_pinos_sink_stop (GstBaseSink * basesink)
{
GstPinosSink *pinossink = GST_PINOS_SINK (basesink);
pinos_thread_main_loop_lock (pinossink->loop);
pinos_thread_main_loop_lock (pinossink->main_loop);
if (pinossink->stream) {
pinos_stream_stop (pinossink->stream);
pinos_stream_disconnect (pinossink->stream);
g_clear_object (&pinossink->stream);
pinossink->pool->stream = NULL;
}
pinos_thread_main_loop_unlock (pinossink->loop);
pinos_thread_main_loop_unlock (pinossink->main_loop);
pinossink->negotiated = FALSE;
@ -722,15 +721,13 @@ gst_pinos_sink_stop (GstBaseSink * basesink)
}
static void
on_context_notify (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
on_ctx_state_changed (PinosListener *listener,
PinosContext *ctx)
{
GstPinosSink *pinossink = user_data;
PinosContext *ctx = PINOS_CONTEXT (gobject);
GstPinosSink *pinossink = SPA_CONTAINER_OF (listener, GstPinosSink, ctx_state_changed);
PinosContextState state;
state = pinos_context_get_state (ctx);
state = ctx->state;
GST_DEBUG ("got context state %d", state);
switch (state) {
@ -740,33 +737,31 @@ on_context_notify (GObject *gobject,
break;
case PINOS_CONTEXT_STATE_ERROR:
GST_ELEMENT_ERROR (pinossink, RESOURCE, FAILED,
("context error: %s",
pinos_context_get_error (pinossink->ctx)->message), (NULL));
("context error: %s", ctx->error), (NULL));
break;
}
pinos_thread_main_loop_signal (pinossink->loop, FALSE);
pinos_thread_main_loop_signal (pinossink->main_loop, FALSE);
}
static gboolean
gst_pinos_sink_open (GstPinosSink * pinossink)
{
GError *error = NULL;
pinossink->loop = pinos_loop_new ();
GST_DEBUG ("loop %p", pinossink->loop);
pinossink->context = g_main_context_new ();
GST_DEBUG ("context %p", pinossink->context);
pinossink->loop = pinos_thread_main_loop_new (pinossink->context, "pinos-sink-loop");
if (!pinos_thread_main_loop_start (pinossink->loop, &error))
pinossink->main_loop = pinos_thread_main_loop_new (pinossink->loop, "pinos-sink-loop");
if (pinos_thread_main_loop_start (pinossink->main_loop) != SPA_RESULT_OK)
goto mainloop_error;
pinos_thread_main_loop_lock (pinossink->loop);
pinossink->ctx = pinos_context_new (pinossink->context, g_get_application_name (), NULL);
g_signal_connect (pinossink->ctx, "notify::state", (GCallback) on_context_notify, pinossink);
pinos_thread_main_loop_lock (pinossink->main_loop);
pinossink->ctx = pinos_context_new (pinossink->loop, g_get_application_name (), NULL);
pinos_context_connect(pinossink->ctx, PINOS_CONTEXT_FLAGS_NONE);
pinos_signal_add (&pinossink->ctx->state_changed, &pinossink->ctx_state_changed, on_ctx_state_changed);
pinos_context_connect(pinossink->ctx);
while (TRUE) {
PinosContextState state = pinos_context_get_state (pinossink->ctx);
PinosContextState state = pinossink->ctx->state;
if (state == PINOS_CONTEXT_STATE_CONNECTED)
break;
@ -774,9 +769,9 @@ gst_pinos_sink_open (GstPinosSink * pinossink)
if (state == PINOS_CONTEXT_STATE_ERROR)
goto connect_error;
pinos_thread_main_loop_wait (pinossink->loop);
pinos_thread_main_loop_wait (pinossink->main_loop);
}
pinos_thread_main_loop_unlock (pinossink->loop);
pinos_thread_main_loop_unlock (pinossink->main_loop);
return TRUE;
@ -784,12 +779,12 @@ gst_pinos_sink_open (GstPinosSink * pinossink)
mainloop_error:
{
GST_ELEMENT_ERROR (pinossink, RESOURCE, FAILED,
("Failed to start mainloop: %s", error->message), (NULL));
("Failed to start mainloop"), (NULL));
return FALSE;
}
connect_error:
{
pinos_thread_main_loop_unlock (pinossink->loop);
pinos_thread_main_loop_unlock (pinossink->main_loop);
return FALSE;
}
}
@ -797,7 +792,7 @@ connect_error:
static gboolean
gst_pinos_sink_close (GstPinosSink * pinossink)
{
pinos_thread_main_loop_lock (pinossink->loop);
pinos_thread_main_loop_lock (pinossink->main_loop);
if (pinossink->stream) {
pinos_stream_disconnect (pinossink->stream);
}
@ -805,7 +800,7 @@ gst_pinos_sink_close (GstPinosSink * pinossink)
pinos_context_disconnect (pinossink->ctx);
while (TRUE) {
PinosContextState state = pinos_context_get_state (pinossink->ctx);
PinosContextState state = pinossink->ctx->state;
if (state == PINOS_CONTEXT_STATE_UNCONNECTED)
break;
@ -813,16 +808,17 @@ gst_pinos_sink_close (GstPinosSink * pinossink)
if (state == PINOS_CONTEXT_STATE_ERROR)
break;
pinos_thread_main_loop_wait (pinossink->loop);
pinos_thread_main_loop_wait (pinossink->main_loop);
}
}
pinos_thread_main_loop_unlock (pinossink->loop);
pinos_thread_main_loop_unlock (pinossink->main_loop);
pinos_thread_main_loop_stop (pinossink->loop);
g_clear_object (&pinossink->loop);
g_clear_object (&pinossink->stream);
g_clear_object (&pinossink->ctx);
g_main_context_unref (pinossink->context);
pinos_thread_main_loop_stop (pinossink->main_loop);
pinos_thread_main_loop_destroy (pinossink->main_loop);
pinos_stream_destroy (pinossink->stream);
pinos_context_destroy (pinossink->ctx);
pinos_loop_destroy (pinossink->loop);
pinossink->loop = NULL;
return TRUE;
}

View file

@ -77,10 +77,19 @@ struct _GstPinosSink {
/* video state */
gboolean negotiated;
GMainContext *context;
PinosThreadMainLoop *loop;
PinosLoop *loop;
PinosThreadMainLoop *main_loop;
PinosContext *ctx;
PinosListener ctx_state_changed;
PinosStream *stream;
PinosListener stream_state_changed;
PinosListener stream_format_changed;
PinosListener stream_add_buffer;
PinosListener stream_remove_buffer;
PinosListener stream_new_buffer;
GstAllocator *allocator;
GstStructure *properties;
GstPinosSinkMode mode;

View file

@ -354,19 +354,19 @@ buffer_recycle (GstMiniObject *obj)
src = data->src;
GST_LOG_OBJECT (obj, "recycle buffer");
pinos_thread_main_loop_lock (src->loop);
pinos_thread_main_loop_lock (src->main_loop);
pinos_stream_recycle_buffer (src->stream, data->id);
pinos_thread_main_loop_unlock (src->loop);
pinos_thread_main_loop_unlock (src->main_loop);
return FALSE;
}
static void
on_add_buffer (GObject *gobject,
guint id,
gpointer user_data)
on_add_buffer (PinosListener *listener,
PinosStream *stream,
guint id)
{
GstPinosSrc *pinossrc = user_data;
GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, stream_add_buffer);
SpaBuffer *b;
GstBuffer *buf;
unsigned int i;
@ -430,11 +430,11 @@ on_add_buffer (GObject *gobject,
}
static void
on_remove_buffer (GObject *gobject,
guint id,
gpointer user_data)
on_remove_buffer (PinosListener *listener,
PinosStream *stream,
guint id)
{
GstPinosSrc *pinossrc = user_data;
GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, stream_remove_buffer);
GstBuffer *buf;
GST_LOG_OBJECT (pinossrc, "remove buffer");
@ -445,11 +445,11 @@ on_remove_buffer (GObject *gobject,
}
static void
on_new_buffer (GObject *gobject,
guint id,
gpointer user_data)
on_new_buffer (PinosListener *listener,
PinosStream *stream,
guint id)
{
GstPinosSrc *pinossrc = user_data;
GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, stream_new_buffer);
GstBuffer *buf;
ProcessMemData *data;
SpaMetaHeader *h;
@ -483,17 +483,16 @@ on_new_buffer (GObject *gobject,
}
g_queue_push_tail (&pinossrc->queue, buf);
pinos_thread_main_loop_signal (pinossrc->loop, FALSE);
pinos_thread_main_loop_signal (pinossrc->main_loop, FALSE);
return;
}
static void
on_stream_notify (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
on_state_changed (PinosListener *listener,
PinosStream *stream)
{
GstPinosSrc *pinossrc = user_data;
PinosStreamState state = pinos_stream_get_state (pinossrc->stream);
GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, stream_state_changed);
PinosStreamState state = stream->state;
GST_DEBUG ("got stream state %s", pinos_stream_state_as_string (state));
@ -507,11 +506,10 @@ on_stream_notify (GObject *gobject,
break;
case PINOS_STREAM_STATE_ERROR:
GST_ELEMENT_ERROR (pinossrc, RESOURCE, FAILED,
("stream error: %s",
pinos_stream_get_error (pinossrc->stream)->message), (NULL));
("stream error: %s", stream->error), (NULL));
break;
}
pinos_thread_main_loop_signal (pinossrc->loop, FALSE);
pinos_thread_main_loop_signal (pinossrc->main_loop, FALSE);
}
static void
@ -540,13 +538,12 @@ static gboolean
gst_pinos_src_stream_start (GstPinosSrc *pinossrc)
{
gboolean res;
PinosProperties *props;
pinos_thread_main_loop_lock (pinossrc->loop);
pinos_thread_main_loop_lock (pinossrc->main_loop);
GST_DEBUG_OBJECT (pinossrc, "doing stream start");
res = pinos_stream_start (pinossrc->stream);
while (TRUE) {
PinosStreamState state = pinos_stream_get_state (pinossrc->stream);
PinosStreamState state = pinossrc->stream->state;
GST_DEBUG_OBJECT (pinossrc, "waiting for STREAMING, now %s", pinos_stream_state_as_string (state));
if (state == PINOS_STREAM_STATE_STREAMING)
@ -555,27 +552,24 @@ gst_pinos_src_stream_start (GstPinosSrc *pinossrc)
if (state == PINOS_STREAM_STATE_ERROR)
goto start_error;
pinos_thread_main_loop_wait (pinossrc->loop);
pinos_thread_main_loop_wait (pinossrc->main_loop);
}
g_object_get (pinossrc->stream, "properties", &props, NULL);
pinos_thread_main_loop_unlock (pinossrc->loop);
parse_stream_properties (pinossrc, pinossrc->stream->properties);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
parse_stream_properties (pinossrc, props);
pinos_properties_free (props);
pinos_thread_main_loop_lock (pinossrc->loop);
pinos_thread_main_loop_lock (pinossrc->main_loop);
GST_DEBUG_OBJECT (pinossrc, "signal started");
pinossrc->started = TRUE;
pinos_thread_main_loop_signal (pinossrc->loop, FALSE);
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_signal (pinossrc->main_loop, FALSE);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return res;
start_error:
{
GST_DEBUG_OBJECT (pinossrc, "error starting stream");
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return FALSE;
}
}
@ -585,9 +579,9 @@ wait_negotiated (GstPinosSrc *this)
{
PinosStreamState state;
pinos_thread_main_loop_lock (this->loop);
pinos_thread_main_loop_lock (this->main_loop);
while (TRUE) {
state = pinos_stream_get_state (this->stream);
state = this->stream->state;
GST_DEBUG_OBJECT (this, "waiting for started signal, state now %s",
pinos_stream_state_as_string (state));
@ -597,10 +591,10 @@ wait_negotiated (GstPinosSrc *this)
if (this->started)
break;
pinos_thread_main_loop_wait (this->loop);
pinos_thread_main_loop_wait (this->main_loop);
}
GST_DEBUG_OBJECT (this, "got started signal");
pinos_thread_main_loop_unlock (this->loop);
pinos_thread_main_loop_unlock (this->main_loop);
return state;
}
@ -645,12 +639,12 @@ gst_pinos_src_negotiate (GstBaseSrc * basesrc)
possible = gst_caps_to_format_all (caps);
/* first disconnect */
pinos_thread_main_loop_lock (pinossrc->loop);
if (pinos_stream_get_state (pinossrc->stream) != PINOS_STREAM_STATE_UNCONNECTED) {
pinos_thread_main_loop_lock (pinossrc->main_loop);
if (pinossrc->stream->state != PINOS_STREAM_STATE_UNCONNECTED) {
GST_DEBUG_OBJECT (basesrc, "disconnect capture");
pinos_stream_disconnect (pinossrc->stream);
while (TRUE) {
PinosStreamState state = pinos_stream_get_state (pinossrc->stream);
PinosStreamState state = pinossrc->stream->state;
GST_DEBUG_OBJECT (basesrc, "waiting for UNCONNECTED, now %s", pinos_stream_state_as_string (state));
if (state == PINOS_STREAM_STATE_UNCONNECTED)
@ -661,7 +655,7 @@ gst_pinos_src_negotiate (GstBaseSrc * basesrc)
goto connect_error;
}
pinos_thread_main_loop_wait (pinossrc->loop);
pinos_thread_main_loop_wait (pinossrc->main_loop);
}
}
@ -671,10 +665,11 @@ gst_pinos_src_negotiate (GstBaseSrc * basesrc)
PINOS_STREAM_MODE_BUFFER,
pinossrc->path,
PINOS_STREAM_FLAG_AUTOCONNECT,
possible);
possible->len,
(SpaFormat **)possible->pdata);
while (TRUE) {
PinosStreamState state = pinos_stream_get_state (pinossrc->stream);
PinosStreamState state = pinossrc->stream->state;
GST_DEBUG_OBJECT (basesrc, "waiting for PAUSED, now %s", pinos_stream_state_as_string (state));
if (state == PINOS_STREAM_STATE_PAUSED ||
@ -684,9 +679,9 @@ gst_pinos_src_negotiate (GstBaseSrc * basesrc)
if (state == PINOS_STREAM_STATE_ERROR)
goto connect_error;
pinos_thread_main_loop_wait (pinossrc->loop);
pinos_thread_main_loop_wait (pinossrc->main_loop);
}
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
result = gst_pinos_src_stream_start (pinossrc);
@ -721,23 +716,20 @@ no_common_caps:
}
connect_error:
{
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return FALSE;
}
}
static void
on_format_notify (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
on_format_changed (PinosListener *listener,
PinosStream *stream,
SpaFormat *format)
{
GstPinosSrc *pinossrc = user_data;
SpaFormat *format;
GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, stream_format_changed);
GstCaps *caps;
gboolean res;
g_object_get (gobject, "format", &format, NULL);
caps = gst_caps_from_format (format);
GST_DEBUG_OBJECT (pinossrc, "we got format %" GST_PTR_FORMAT, caps);
res = gst_base_src_set_caps (GST_BASE_SRC (pinossrc), caps);
@ -765,11 +757,11 @@ gst_pinos_src_unlock (GstBaseSrc * basesrc)
{
GstPinosSrc *pinossrc = GST_PINOS_SRC (basesrc);
pinos_thread_main_loop_lock (pinossrc->loop);
pinos_thread_main_loop_lock (pinossrc->main_loop);
GST_DEBUG_OBJECT (pinossrc, "setting flushing");
pinossrc->flushing = TRUE;
pinos_thread_main_loop_signal (pinossrc->loop, FALSE);
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_signal (pinossrc->main_loop, FALSE);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return TRUE;
}
@ -779,10 +771,10 @@ gst_pinos_src_unlock_stop (GstBaseSrc * basesrc)
{
GstPinosSrc *pinossrc = GST_PINOS_SRC (basesrc);
pinos_thread_main_loop_lock (pinossrc->loop);
pinos_thread_main_loop_lock (pinossrc->main_loop);
GST_DEBUG_OBJECT (pinossrc, "unsetting flushing");
pinossrc->flushing = FALSE;
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return TRUE;
}
@ -868,14 +860,14 @@ gst_pinos_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
if (!pinossrc->negotiated)
goto not_negotiated;
pinos_thread_main_loop_lock (pinossrc->loop);
pinos_thread_main_loop_lock (pinossrc->main_loop);
while (TRUE) {
PinosStreamState state;
if (pinossrc->flushing)
goto streaming_stopped;
state = pinos_stream_get_state (pinossrc->stream);
state = pinossrc->stream->state;
if (state == PINOS_STREAM_STATE_ERROR)
goto streaming_error;
@ -886,9 +878,9 @@ gst_pinos_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
if (*buffer != NULL)
break;
pinos_thread_main_loop_wait (pinossrc->loop);
pinos_thread_main_loop_wait (pinossrc->main_loop);
}
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
if (pinossrc->is_live)
base_time = GST_ELEMENT_CAST (psrc)->base_time;
@ -919,12 +911,12 @@ not_negotiated:
}
streaming_error:
{
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return GST_FLOW_ERROR;
}
streaming_stopped:
{
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return GST_FLOW_FLUSHING;
}
}
@ -949,20 +941,19 @@ gst_pinos_src_stop (GstBaseSrc * basesrc)
pinossrc = GST_PINOS_SRC (basesrc);
pinos_thread_main_loop_lock (pinossrc->loop);
pinos_thread_main_loop_lock (pinossrc->main_loop);
clear_queue (pinossrc);
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return TRUE;
}
static void
on_context_notify (GObject *gobject,
GParamSpec *pspec,
gpointer user_data)
on_ctx_state_changed (PinosListener *listener,
PinosContext *ctx)
{
GstPinosSrc *pinossrc = user_data;
PinosContextState state = pinos_context_get_state (pinossrc->ctx);
GstPinosSrc *pinossrc = SPA_CONTAINER_OF (listener, GstPinosSrc, ctx_state_changed);
PinosContextState state = ctx->state;
GST_DEBUG ("got context state %s", pinos_context_state_as_string (state));
@ -973,11 +964,10 @@ on_context_notify (GObject *gobject,
break;
case PINOS_CONTEXT_STATE_ERROR:
GST_ELEMENT_ERROR (pinossrc, RESOURCE, FAILED,
("context error: %s",
pinos_context_get_error (pinossrc->ctx)->message), (NULL));
("context error: %s", ctx->error), (NULL));
break;
}
pinos_thread_main_loop_signal (pinossrc->loop, FALSE);
pinos_thread_main_loop_signal (pinossrc->main_loop, FALSE);
}
static gboolean
@ -997,24 +987,24 @@ copy_properties (GQuark field_id,
static gboolean
gst_pinos_src_open (GstPinosSrc * pinossrc)
{
GError *error = NULL;
PinosProperties *props;
pinossrc->context = g_main_context_new ();
GST_DEBUG ("context %p", pinossrc->context);
pinossrc->loop = pinos_loop_new ();
GST_DEBUG ("loop %p", pinossrc->loop);
pinossrc->loop = pinos_thread_main_loop_new (pinossrc->context, "pinos-main-loop");
if (!pinos_thread_main_loop_start (pinossrc->loop, &error))
pinossrc->main_loop = pinos_thread_main_loop_new (pinossrc->loop, "pinos-main-loop");
if (pinos_thread_main_loop_start (pinossrc->main_loop) != SPA_RESULT_OK)
goto mainloop_failed;
pinos_thread_main_loop_lock (pinossrc->loop);
pinossrc->ctx = pinos_context_new (pinossrc->context, g_get_application_name (), NULL);
g_signal_connect (pinossrc->ctx, "notify::state", (GCallback) on_context_notify, pinossrc);
pinos_thread_main_loop_lock (pinossrc->main_loop);
pinossrc->ctx = pinos_context_new (pinossrc->loop, g_get_application_name (), NULL);
pinos_context_connect (pinossrc->ctx, PINOS_CONTEXT_FLAGS_NONE);
pinos_signal_add (&pinossrc->ctx->state_changed, &pinossrc->ctx_state_changed, on_ctx_state_changed);
pinos_context_connect (pinossrc->ctx);
while (TRUE) {
PinosContextState state = pinos_context_get_state (pinossrc->ctx);
PinosContextState state = pinossrc->ctx->state;
GST_DEBUG ("waiting for CONNECTED, now %s", pinos_context_state_as_string (state));
if (state == PINOS_CONTEXT_STATE_CONNECTED)
@ -1023,7 +1013,7 @@ gst_pinos_src_open (GstPinosSrc * pinossrc)
if (state == PINOS_CONTEXT_STATE_ERROR)
goto connect_error;
pinos_thread_main_loop_wait (pinossrc->loop);
pinos_thread_main_loop_wait (pinossrc->main_loop);
}
if (pinossrc->properties) {
@ -1034,26 +1024,27 @@ gst_pinos_src_open (GstPinosSrc * pinossrc)
}
pinossrc->stream = pinos_stream_new (pinossrc->ctx, pinossrc->client_name, props);
g_signal_connect (pinossrc->stream, "notify::state", (GCallback) on_stream_notify, pinossrc);
g_signal_connect (pinossrc->stream, "notify::format", (GCallback) on_format_notify, pinossrc);
g_signal_connect (pinossrc->stream, "add-buffer", (GCallback) on_add_buffer, pinossrc);
g_signal_connect (pinossrc->stream, "remove-buffer", (GCallback) on_remove_buffer, pinossrc);
g_signal_connect (pinossrc->stream, "new-buffer", (GCallback) on_new_buffer, pinossrc);
pinos_signal_add (&pinossrc->stream->state_changed, &pinossrc->stream_state_changed, on_state_changed);
pinos_signal_add (&pinossrc->stream->format_changed, &pinossrc->stream_format_changed, on_format_changed);
pinos_signal_add (&pinossrc->stream->add_buffer, &pinossrc->stream_add_buffer, on_add_buffer);
pinos_signal_add (&pinossrc->stream->remove_buffer, &pinossrc->stream_remove_buffer, on_remove_buffer);
pinos_signal_add (&pinossrc->stream->new_buffer, &pinossrc->stream_new_buffer, on_new_buffer);
pinossrc->clock = gst_pinos_clock_new (pinossrc->stream);
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return TRUE;
/* ERRORS */
mainloop_failed:
{
GST_ELEMENT_ERROR (pinossrc, RESOURCE, FAILED,
("mainloop error: %s", error->message), (NULL));
GST_ELEMENT_ERROR (pinossrc, RESOURCE, FAILED, ("error starting mainloop"), (NULL));
return FALSE;
}
connect_error:
{
pinos_thread_main_loop_unlock (pinossrc->loop);
pinos_thread_main_loop_unlock (pinossrc->main_loop);
return FALSE;
}
}
@ -1061,10 +1052,16 @@ connect_error:
static void
gst_pinos_src_close (GstPinosSrc * pinossrc)
{
pinos_thread_main_loop_stop (pinossrc->loop);
g_clear_object (&pinossrc->loop);
g_clear_object (&pinossrc->ctx);
g_main_context_unref (pinossrc->context);
pinos_thread_main_loop_stop (pinossrc->main_loop);
pinos_thread_main_loop_destroy (pinossrc->main_loop);
pinossrc->main_loop = NULL;
pinos_context_destroy (pinossrc->ctx);
pinossrc->ctx = NULL;
pinos_loop_destroy (pinossrc->loop);
pinossrc->loop = NULL;
GST_OBJECT_LOCK (pinossrc);
g_clear_object (&pinossrc->clock);
g_clear_object (&pinossrc->stream);

View file

@ -63,10 +63,19 @@ struct _GstPinosSrc {
GstClockTime min_latency;
GstClockTime max_latency;
GMainContext *context;
PinosThreadMainLoop *loop;
PinosLoop *loop;
PinosThreadMainLoop *main_loop;
PinosContext *ctx;
PinosListener ctx_state_changed;
PinosStream *stream;
PinosListener stream_state_changed;
PinosListener stream_format_changed;
PinosListener stream_add_buffer;
PinosListener stream_remove_buffer;
PinosListener stream_new_buffer;
GstAllocator *fd_allocator;
GstStructure *properties;