mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
more rename PV -> PINOS, Pv -> Pinos, pv -> pinos
This commit is contained in:
parent
0dd41f5e40
commit
a3505fb880
46 changed files with 2333 additions and 2267 deletions
|
|
@ -32,17 +32,17 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstpvsrc.h"
|
||||
#include "gstpvsink.h"
|
||||
#include "gstpinossrc.h"
|
||||
#include "gstpinossink.h"
|
||||
#include "gstfdpay.h"
|
||||
#include "gstfddepay.h"
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
gst_element_register (plugin, "pvfdpay", GST_RANK_NONE,
|
||||
gst_element_register (plugin, "pinosfdpay", GST_RANK_NONE,
|
||||
GST_TYPE_FDPAY);
|
||||
gst_element_register (plugin, "pvfddepay", GST_RANK_NONE,
|
||||
gst_element_register (plugin, "pinosfddepay", GST_RANK_NONE,
|
||||
GST_TYPE_FDDEPAY);
|
||||
gst_element_register (plugin, "pinossrc", GST_RANK_PRIMARY + 1,
|
||||
GST_TYPE_PINOS_SRC);
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "gstpvsink.h"
|
||||
#include "gstpinossink.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -55,7 +55,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
#define PVS_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL)
|
||||
#define PINOSS_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL)
|
||||
|
||||
static GstStaticPadTemplate gst_pinos_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
|
|
@ -196,9 +196,9 @@ static void
|
|||
on_new_buffer (GObject *gobject,
|
||||
gpointer user_data)
|
||||
{
|
||||
GstPinosSink *pvsink = user_data;
|
||||
GstPinosSink *pinossink = user_data;
|
||||
|
||||
g_cond_signal (&pvsink->cond);
|
||||
g_cond_signal (&pinossink->cond);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -206,17 +206,17 @@ on_stream_notify (GObject *gobject,
|
|||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
PvStreamState state;
|
||||
GstPinosSink *pvsink = user_data;
|
||||
PinosStreamState state;
|
||||
GstPinosSink *pinossink = user_data;
|
||||
|
||||
state = pv_stream_get_state (pvsink->stream);
|
||||
state = pinos_stream_get_state (pinossink->stream);
|
||||
g_print ("got stream state %d\n", state);
|
||||
g_cond_broadcast (&pvsink->cond);
|
||||
g_cond_broadcast (&pinossink->cond);
|
||||
|
||||
if (state == PV_STREAM_STATE_ERROR) {
|
||||
GST_ELEMENT_ERROR (pvsink, RESOURCE, FAILED,
|
||||
if (state == PINOS_STREAM_STATE_ERROR) {
|
||||
GST_ELEMENT_ERROR (pinossink, RESOURCE, FAILED,
|
||||
("Failed to connect stream: %s",
|
||||
pv_stream_get_error (pvsink->stream)->message), (NULL));
|
||||
pinos_stream_get_error (pinossink->stream)->message), (NULL));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -229,56 +229,56 @@ gst_pinos_sink_getcaps (GstBaseSink * bsink, GstCaps * filter)
|
|||
static gboolean
|
||||
gst_pinos_sink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||
{
|
||||
GstPinosSink *pvsink;
|
||||
GstPinosSink *pinossink;
|
||||
gchar *str;
|
||||
GBytes *format;
|
||||
|
||||
pvsink = GST_PINOS_SINK (bsink);
|
||||
pinossink = GST_PINOS_SINK (bsink);
|
||||
|
||||
str = gst_caps_to_string (caps);
|
||||
format = g_bytes_new_take (str, strlen (str) + 1);
|
||||
|
||||
g_mutex_lock (&pvsink->lock);
|
||||
pvsink->stream = pv_stream_new (pvsink->ctx, "test", NULL);
|
||||
g_signal_connect (pvsink->stream, "notify::state", (GCallback) on_stream_notify, pvsink);
|
||||
g_signal_connect (pvsink->stream, "new-buffer", (GCallback) on_new_buffer, pvsink);
|
||||
g_mutex_lock (&pinossink->lock);
|
||||
pinossink->stream = pinos_stream_new (pinossink->ctx, "test", NULL);
|
||||
g_signal_connect (pinossink->stream, "notify::state", (GCallback) on_stream_notify, pinossink);
|
||||
g_signal_connect (pinossink->stream, "new-buffer", (GCallback) on_new_buffer, pinossink);
|
||||
|
||||
pv_stream_connect_provide (pvsink->stream, 0, format);
|
||||
pinos_stream_connect_provide (pinossink->stream, 0, format);
|
||||
|
||||
while (TRUE) {
|
||||
PvStreamState state = pv_stream_get_state (pvsink->stream);
|
||||
PinosStreamState state = pinos_stream_get_state (pinossink->stream);
|
||||
|
||||
if (state == PV_STREAM_STATE_READY)
|
||||
if (state == PINOS_STREAM_STATE_READY)
|
||||
break;
|
||||
|
||||
if (state == PV_STREAM_STATE_ERROR)
|
||||
if (state == PINOS_STREAM_STATE_ERROR)
|
||||
goto connect_error;
|
||||
|
||||
g_cond_wait (&pvsink->cond, &pvsink->lock);
|
||||
g_cond_wait (&pinossink->cond, &pinossink->lock);
|
||||
}
|
||||
|
||||
pv_stream_start (pvsink->stream, format, PV_STREAM_MODE_BUFFER);
|
||||
pinos_stream_start (pinossink->stream, format, PINOS_STREAM_MODE_BUFFER);
|
||||
|
||||
while (TRUE) {
|
||||
PvStreamState state = pv_stream_get_state (pvsink->stream);
|
||||
PinosStreamState state = pinos_stream_get_state (pinossink->stream);
|
||||
|
||||
if (state == PV_STREAM_STATE_STREAMING)
|
||||
if (state == PINOS_STREAM_STATE_STREAMING)
|
||||
break;
|
||||
|
||||
if (state == PV_STREAM_STATE_ERROR)
|
||||
if (state == PINOS_STREAM_STATE_ERROR)
|
||||
goto connect_error;
|
||||
|
||||
g_cond_wait (&pvsink->cond, &pvsink->lock);
|
||||
g_cond_wait (&pinossink->cond, &pinossink->lock);
|
||||
}
|
||||
g_mutex_unlock (&pvsink->lock);
|
||||
g_mutex_unlock (&pinossink->lock);
|
||||
|
||||
pvsink->negotiated = TRUE;
|
||||
pinossink->negotiated = TRUE;
|
||||
|
||||
return TRUE;
|
||||
|
||||
connect_error:
|
||||
{
|
||||
g_mutex_unlock (&pvsink->lock);
|
||||
g_mutex_unlock (&pinossink->lock);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -286,14 +286,14 @@ connect_error:
|
|||
static GstFlowReturn
|
||||
gst_pinos_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||
{
|
||||
GstPinosSink *pvsink;
|
||||
PvBufferInfo info;
|
||||
GstPinosSink *pinossink;
|
||||
PinosBufferInfo info;
|
||||
GSocketControlMessage *mesg;
|
||||
GstMemory *mem = NULL;
|
||||
|
||||
pvsink = GST_PINOS_SINK (bsink);
|
||||
pinossink = GST_PINOS_SINK (bsink);
|
||||
|
||||
if (!pvsink->negotiated)
|
||||
if (!pinossink->negotiated)
|
||||
goto not_negotiated;
|
||||
|
||||
info.flags = 0;
|
||||
|
|
@ -313,7 +313,7 @@ gst_pinos_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
|||
|
||||
GST_INFO_OBJECT (bsink, "Buffer cannot be payloaded without copying");
|
||||
|
||||
mem = gst_allocator_alloc (pvsink->allocator, info.size, ¶ms);
|
||||
mem = gst_allocator_alloc (pinossink->allocator, info.size, ¶ms);
|
||||
if (!gst_memory_map (mem, &minfo, GST_MAP_WRITE))
|
||||
goto map_error;
|
||||
gst_buffer_extract (buffer, 0, minfo.data, info.size);
|
||||
|
|
@ -323,11 +323,11 @@ gst_pinos_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
|||
gst_memory_unref (mem);
|
||||
info.message = mesg;
|
||||
|
||||
g_mutex_lock (&pvsink->lock);
|
||||
if (pv_stream_get_state (pvsink->stream) != PV_STREAM_STATE_STREAMING)
|
||||
g_mutex_lock (&pinossink->lock);
|
||||
if (pinos_stream_get_state (pinossink->stream) != PINOS_STREAM_STATE_STREAMING)
|
||||
goto streaming_error;
|
||||
pv_stream_provide_buffer (pvsink->stream, &info);
|
||||
g_mutex_unlock (&pvsink->lock);
|
||||
pinos_stream_provide_buffer (pinossink->stream, &info);
|
||||
g_mutex_unlock (&pinossink->lock);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ map_error:
|
|||
}
|
||||
streaming_error:
|
||||
{
|
||||
g_mutex_unlock (&pvsink->lock);
|
||||
g_mutex_unlock (&pinossink->lock);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -403,76 +403,76 @@ on_state_notify (GObject *gobject,
|
|||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
GstPinosSink *pvsink = user_data;
|
||||
PvContextState state;
|
||||
GstPinosSink *pinossink = user_data;
|
||||
PinosContextState state;
|
||||
|
||||
state = pv_context_get_state (pvsink->ctx);
|
||||
state = pinos_context_get_state (pinossink->ctx);
|
||||
g_print ("got context state %d\n", state);
|
||||
g_cond_broadcast (&pvsink->cond);
|
||||
g_cond_broadcast (&pinossink->cond);
|
||||
|
||||
if (state == PV_CONTEXT_STATE_ERROR) {
|
||||
GST_ELEMENT_ERROR (pvsink, RESOURCE, FAILED,
|
||||
if (state == PINOS_CONTEXT_STATE_ERROR) {
|
||||
GST_ELEMENT_ERROR (pinossink, RESOURCE, FAILED,
|
||||
("Failed to connect stream: %s",
|
||||
pv_context_get_error (pvsink->ctx)->message), (NULL));
|
||||
pinos_context_get_error (pinossink->ctx)->message), (NULL));
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_pinos_sink_open (GstPinosSink * pvsink)
|
||||
gst_pinos_sink_open (GstPinosSink * pinossink)
|
||||
{
|
||||
g_mutex_lock (&pvsink->lock);
|
||||
pvsink->ctx = pv_context_new (pvsink->context, "test-client", NULL);
|
||||
g_signal_connect (pvsink->ctx, "notify::state", (GCallback) on_state_notify, pvsink);
|
||||
g_mutex_lock (&pinossink->lock);
|
||||
pinossink->ctx = pinos_context_new (pinossink->context, "test-client", NULL);
|
||||
g_signal_connect (pinossink->ctx, "notify::state", (GCallback) on_state_notify, pinossink);
|
||||
|
||||
pv_context_connect(pvsink->ctx, PV_CONTEXT_FLAGS_NONE);
|
||||
pinos_context_connect(pinossink->ctx, PINOS_CONTEXT_FLAGS_NONE);
|
||||
|
||||
while (TRUE) {
|
||||
PvContextState state = pv_context_get_state (pvsink->ctx);
|
||||
PinosContextState state = pinos_context_get_state (pinossink->ctx);
|
||||
|
||||
if (state == PV_CONTEXT_STATE_READY)
|
||||
if (state == PINOS_CONTEXT_STATE_READY)
|
||||
break;
|
||||
|
||||
if (state == PV_CONTEXT_STATE_ERROR)
|
||||
if (state == PINOS_CONTEXT_STATE_ERROR)
|
||||
goto connect_error;
|
||||
|
||||
g_cond_wait (&pvsink->cond, &pvsink->lock);
|
||||
g_cond_wait (&pinossink->cond, &pinossink->lock);
|
||||
}
|
||||
g_mutex_unlock (&pvsink->lock);
|
||||
g_mutex_unlock (&pinossink->lock);
|
||||
|
||||
return TRUE;
|
||||
|
||||
/* ERRORS */
|
||||
connect_error:
|
||||
{
|
||||
g_mutex_unlock (&pvsink->lock);
|
||||
g_mutex_unlock (&pinossink->lock);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_pinos_sink_close (GstPinosSink * pvsink)
|
||||
gst_pinos_sink_close (GstPinosSink * pinossink)
|
||||
{
|
||||
|
||||
g_mutex_lock (&pvsink->lock);
|
||||
if (pvsink->stream) {
|
||||
pv_stream_disconnect (pvsink->stream);
|
||||
g_mutex_lock (&pinossink->lock);
|
||||
if (pinossink->stream) {
|
||||
pinos_stream_disconnect (pinossink->stream);
|
||||
}
|
||||
if (pvsink->ctx) {
|
||||
pv_context_disconnect(pvsink->ctx);
|
||||
if (pinossink->ctx) {
|
||||
pinos_context_disconnect(pinossink->ctx);
|
||||
|
||||
while (TRUE) {
|
||||
PvContextState state = pv_context_get_state (pvsink->ctx);
|
||||
PinosContextState state = pinos_context_get_state (pinossink->ctx);
|
||||
|
||||
if (state == PV_CONTEXT_STATE_UNCONNECTED)
|
||||
if (state == PINOS_CONTEXT_STATE_UNCONNECTED)
|
||||
break;
|
||||
|
||||
if (state == PV_CONTEXT_STATE_ERROR)
|
||||
if (state == PINOS_CONTEXT_STATE_ERROR)
|
||||
break;
|
||||
|
||||
g_cond_wait (&pvsink->cond, &pvsink->lock);
|
||||
g_cond_wait (&pinossink->cond, &pinossink->lock);
|
||||
}
|
||||
}
|
||||
g_mutex_unlock (&pvsink->lock);
|
||||
g_mutex_unlock (&pinossink->lock);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -23,9 +23,9 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/base/gstbasesink.h>
|
||||
|
||||
#include <client/pv-context.h>
|
||||
#include <client/pv-stream.h>
|
||||
#include <client/pv-introspect.h>
|
||||
#include <client/context.h>
|
||||
#include <client/stream.h>
|
||||
#include <client/introspect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
@ -61,8 +61,8 @@ struct _GstPinosSink {
|
|||
GMainContext *context;
|
||||
GMainLoop *loop;
|
||||
GThread *thread;
|
||||
PvContext *ctx;
|
||||
PvStream *stream;
|
||||
PinosContext *ctx;
|
||||
PinosStream *stream;
|
||||
GstAllocator *allocator;
|
||||
|
||||
GPollFunc poll_func;
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "gstpvsrc.h"
|
||||
#include "gstpinossrc.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -54,7 +54,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
#define PVS_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL)
|
||||
#define PINOSS_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL)
|
||||
|
||||
static GstStaticPadTemplate gst_pinos_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
|
|
@ -84,12 +84,12 @@ static void
|
|||
gst_pinos_src_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstPinosSrc *pvsrc = GST_PINOS_SRC (object);
|
||||
GstPinosSrc *pinossrc = GST_PINOS_SRC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_SOURCE:
|
||||
g_free (pvsrc->source);
|
||||
pvsrc->source = g_value_dup_string (value);
|
||||
g_free (pinossrc->source);
|
||||
pinossrc->source = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -102,11 +102,11 @@ static void
|
|||
gst_pinos_src_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstPinosSrc *pvsrc = GST_PINOS_SRC (object);
|
||||
GstPinosSrc *pinossrc = GST_PINOS_SRC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_SOURCE:
|
||||
g_value_set_string (value, pvsrc->source);
|
||||
g_value_set_string (value, pinossrc->source);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -118,12 +118,12 @@ gst_pinos_src_get_property (GObject * object, guint prop_id,
|
|||
static void
|
||||
gst_pinos_src_finalize (GObject * object)
|
||||
{
|
||||
GstPinosSrc *pvsrc = GST_PINOS_SRC (object);
|
||||
GstPinosSrc *pinossrc = GST_PINOS_SRC (object);
|
||||
|
||||
g_object_unref (pvsrc->fd_allocator);
|
||||
g_mutex_clear (&pvsrc->lock);
|
||||
g_cond_clear (&pvsrc->cond);
|
||||
g_free (pvsrc->source);
|
||||
g_object_unref (pinossrc->fd_allocator);
|
||||
g_mutex_clear (&pinossrc->lock);
|
||||
g_cond_clear (&pinossrc->cond);
|
||||
g_free (pinossrc->source);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
|
@ -237,9 +237,9 @@ static void
|
|||
on_new_buffer (GObject *gobject,
|
||||
gpointer user_data)
|
||||
{
|
||||
GstPinosSrc *pvsrc = user_data;
|
||||
GstPinosSrc *pinossrc = user_data;
|
||||
|
||||
g_cond_signal (&pvsrc->cond);
|
||||
g_cond_signal (&pinossrc->cond);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -247,24 +247,24 @@ on_stream_notify (GObject *gobject,
|
|||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
PvStreamState state;
|
||||
GstPinosSrc *pvsrc = user_data;
|
||||
PinosStreamState state;
|
||||
GstPinosSrc *pinossrc = user_data;
|
||||
|
||||
state = pv_stream_get_state (pvsrc->stream);
|
||||
state = pinos_stream_get_state (pinossrc->stream);
|
||||
g_print ("got stream state %d\n", state);
|
||||
g_cond_broadcast (&pvsrc->cond);
|
||||
g_cond_broadcast (&pinossrc->cond);
|
||||
|
||||
if (state == PV_STREAM_STATE_ERROR) {
|
||||
GST_ELEMENT_ERROR (pvsrc, RESOURCE, FAILED,
|
||||
if (state == PINOS_STREAM_STATE_ERROR) {
|
||||
GST_ELEMENT_ERROR (pinossrc, RESOURCE, FAILED,
|
||||
("Failed to connect stream: %s",
|
||||
pv_stream_get_error (pvsrc->stream)->message), (NULL));
|
||||
pinos_stream_get_error (pinossrc->stream)->message), (NULL));
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_pinos_src_negotiate (GstBaseSrc * basesrc)
|
||||
{
|
||||
GstPinosSrc *pvsrc = GST_PINOS_SRC (basesrc);
|
||||
GstPinosSrc *pinossrc = GST_PINOS_SRC (basesrc);
|
||||
GstCaps *thiscaps;
|
||||
GstCaps *caps = NULL;
|
||||
GstCaps *peercaps = NULL;
|
||||
|
|
@ -300,23 +300,23 @@ gst_pinos_src_negotiate (GstBaseSrc * basesrc)
|
|||
str = gst_caps_to_string (caps);
|
||||
accepted = g_bytes_new_take (str, strlen (str) + 1);
|
||||
|
||||
g_mutex_lock (&pvsrc->lock);
|
||||
pv_stream_connect_capture (pvsrc->stream, pvsrc->source, 0, accepted);
|
||||
g_mutex_lock (&pinossrc->lock);
|
||||
pinos_stream_connect_capture (pinossrc->stream, pinossrc->source, 0, accepted);
|
||||
|
||||
while (TRUE) {
|
||||
PvStreamState state = pv_stream_get_state (pvsrc->stream);
|
||||
PinosStreamState state = pinos_stream_get_state (pinossrc->stream);
|
||||
|
||||
if (state == PV_STREAM_STATE_READY)
|
||||
if (state == PINOS_STREAM_STATE_READY)
|
||||
break;
|
||||
|
||||
if (state == PV_STREAM_STATE_ERROR)
|
||||
if (state == PINOS_STREAM_STATE_ERROR)
|
||||
goto connect_error;
|
||||
|
||||
g_cond_wait (&pvsrc->cond, &pvsrc->lock);
|
||||
g_cond_wait (&pinossrc->cond, &pinossrc->lock);
|
||||
}
|
||||
g_mutex_unlock (&pvsrc->lock);
|
||||
g_mutex_unlock (&pinossrc->lock);
|
||||
|
||||
g_object_get (pvsrc->stream, "possible-formats", &possible, NULL);
|
||||
g_object_get (pinossrc->stream, "possible-formats", &possible, NULL);
|
||||
if (possible) {
|
||||
GstCaps *newcaps;
|
||||
|
||||
|
|
@ -346,7 +346,7 @@ gst_pinos_src_negotiate (GstBaseSrc * basesrc)
|
|||
gst_caps_unref (caps);
|
||||
GST_DEBUG_OBJECT (basesrc, "no common caps");
|
||||
}
|
||||
pvsrc->negotiated = result;
|
||||
pinossrc->negotiated = result;
|
||||
return result;
|
||||
|
||||
no_nego_needed:
|
||||
|
|
@ -367,7 +367,7 @@ no_caps:
|
|||
}
|
||||
connect_error:
|
||||
{
|
||||
g_mutex_unlock (&pvsrc->lock);
|
||||
g_mutex_unlock (&pinossrc->lock);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -381,19 +381,19 @@ gst_pinos_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
|
|||
static gboolean
|
||||
gst_pinos_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
|
||||
{
|
||||
GstPinosSrc *pvsrc;
|
||||
GstPinosSrc *pinossrc;
|
||||
gchar *str;
|
||||
GBytes *format;
|
||||
gboolean res;
|
||||
|
||||
pvsrc = GST_PINOS_SRC (bsrc);
|
||||
pinossrc = GST_PINOS_SRC (bsrc);
|
||||
|
||||
str = gst_caps_to_string (caps);
|
||||
format = g_bytes_new_take (str, strlen (str) + 1);
|
||||
|
||||
g_mutex_lock (&pvsrc->lock);
|
||||
res = pv_stream_start (pvsrc->stream, format, PV_STREAM_MODE_BUFFER);
|
||||
g_mutex_unlock (&pvsrc->lock);
|
||||
g_mutex_lock (&pinossrc->lock);
|
||||
res = pinos_stream_start (pinossrc->stream, format, PINOS_STREAM_MODE_BUFFER);
|
||||
g_mutex_unlock (&pinossrc->lock);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
@ -401,35 +401,35 @@ gst_pinos_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
|
|||
static GstFlowReturn
|
||||
gst_pinos_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
|
||||
{
|
||||
GstPinosSrc *pvsrc;
|
||||
PvBufferInfo info;
|
||||
GstPinosSrc *pinossrc;
|
||||
PinosBufferInfo info;
|
||||
gint *fds, n_fds;
|
||||
GstMemory *fdmem = NULL;
|
||||
|
||||
pvsrc = GST_PINOS_SRC (psrc);
|
||||
pinossrc = GST_PINOS_SRC (psrc);
|
||||
|
||||
if (!pvsrc->negotiated)
|
||||
if (!pinossrc->negotiated)
|
||||
goto not_negotiated;
|
||||
|
||||
again:
|
||||
g_mutex_lock (&pvsrc->lock);
|
||||
g_mutex_lock (&pinossrc->lock);
|
||||
while (TRUE) {
|
||||
PvStreamState state;
|
||||
PinosStreamState state;
|
||||
|
||||
g_cond_wait (&pvsrc->cond, &pvsrc->lock);
|
||||
g_cond_wait (&pinossrc->cond, &pinossrc->lock);
|
||||
|
||||
state = pv_stream_get_state (pvsrc->stream);
|
||||
if (state == PV_STREAM_STATE_ERROR)
|
||||
state = pinos_stream_get_state (pinossrc->stream);
|
||||
if (state == PINOS_STREAM_STATE_ERROR)
|
||||
goto streaming_error;
|
||||
|
||||
if (state != PV_STREAM_STATE_STREAMING)
|
||||
if (state != PINOS_STREAM_STATE_STREAMING)
|
||||
goto streaming_stopped;
|
||||
|
||||
pv_stream_capture_buffer (pvsrc->stream, &info);
|
||||
pinos_stream_capture_buffer (pinossrc->stream, &info);
|
||||
if (info.message != NULL)
|
||||
break;
|
||||
}
|
||||
g_mutex_unlock (&pvsrc->lock);
|
||||
g_mutex_unlock (&pinossrc->lock);
|
||||
|
||||
if (g_socket_control_message_get_msg_type (info.message) != SCM_RIGHTS)
|
||||
goto again;
|
||||
|
|
@ -438,7 +438,7 @@ again:
|
|||
if (n_fds < 1 || fds[0] < 0)
|
||||
goto again;
|
||||
|
||||
fdmem = gst_fd_allocator_alloc (pvsrc->fd_allocator, fds[0],
|
||||
fdmem = gst_fd_allocator_alloc (pinossrc->fd_allocator, fds[0],
|
||||
info.offset + info.size, GST_FD_MEMORY_FLAG_NONE);
|
||||
gst_memory_resize (fdmem, info.offset, info.size);
|
||||
|
||||
|
|
@ -453,12 +453,12 @@ not_negotiated:
|
|||
}
|
||||
streaming_error:
|
||||
{
|
||||
g_mutex_unlock (&pvsrc->lock);
|
||||
g_mutex_unlock (&pinossrc->lock);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
streaming_stopped:
|
||||
{
|
||||
g_mutex_unlock (&pvsrc->lock);
|
||||
g_mutex_unlock (&pinossrc->lock);
|
||||
return GST_FLOW_FLUSHING;
|
||||
}
|
||||
}
|
||||
|
|
@ -512,53 +512,53 @@ on_state_notify (GObject *gobject,
|
|||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
GstPinosSrc *pvsrc = user_data;
|
||||
PvContextState state;
|
||||
GstPinosSrc *pinossrc = user_data;
|
||||
PinosContextState state;
|
||||
|
||||
state = pv_context_get_state (pvsrc->ctx);
|
||||
state = pinos_context_get_state (pinossrc->ctx);
|
||||
g_print ("got context state %d\n", state);
|
||||
g_cond_broadcast (&pvsrc->cond);
|
||||
g_cond_broadcast (&pinossrc->cond);
|
||||
|
||||
if (state == PV_CONTEXT_STATE_ERROR) {
|
||||
GST_ELEMENT_ERROR (pvsrc, RESOURCE, FAILED,
|
||||
if (state == PINOS_CONTEXT_STATE_ERROR) {
|
||||
GST_ELEMENT_ERROR (pinossrc, RESOURCE, FAILED,
|
||||
("Failed to connect stream: %s",
|
||||
pv_context_get_error (pvsrc->ctx)->message), (NULL));
|
||||
pinos_context_get_error (pinossrc->ctx)->message), (NULL));
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_pinos_src_open (GstPinosSrc * pvsrc)
|
||||
gst_pinos_src_open (GstPinosSrc * pinossrc)
|
||||
{
|
||||
|
||||
g_mutex_lock (&pvsrc->lock);
|
||||
pvsrc->ctx = pv_context_new (pvsrc->context, "test-client", NULL);
|
||||
g_signal_connect (pvsrc->ctx, "notify::state", (GCallback) on_state_notify, pvsrc);
|
||||
g_mutex_lock (&pinossrc->lock);
|
||||
pinossrc->ctx = pinos_context_new (pinossrc->context, "test-client", NULL);
|
||||
g_signal_connect (pinossrc->ctx, "notify::state", (GCallback) on_state_notify, pinossrc);
|
||||
|
||||
pv_context_connect(pvsrc->ctx, PV_CONTEXT_FLAGS_NONE);
|
||||
pinos_context_connect(pinossrc->ctx, PINOS_CONTEXT_FLAGS_NONE);
|
||||
|
||||
while (TRUE) {
|
||||
PvContextState state = pv_context_get_state (pvsrc->ctx);
|
||||
PinosContextState state = pinos_context_get_state (pinossrc->ctx);
|
||||
|
||||
if (state == PV_CONTEXT_STATE_READY)
|
||||
if (state == PINOS_CONTEXT_STATE_READY)
|
||||
break;
|
||||
|
||||
if (state == PV_CONTEXT_STATE_ERROR)
|
||||
if (state == PINOS_CONTEXT_STATE_ERROR)
|
||||
goto connect_error;
|
||||
|
||||
g_cond_wait (&pvsrc->cond, &pvsrc->lock);
|
||||
g_cond_wait (&pinossrc->cond, &pinossrc->lock);
|
||||
}
|
||||
|
||||
pvsrc->stream = pv_stream_new (pvsrc->ctx, "test", NULL);
|
||||
g_signal_connect (pvsrc->stream, "notify::state", (GCallback) on_stream_notify, pvsrc);
|
||||
g_signal_connect (pvsrc->stream, "new-buffer", (GCallback) on_new_buffer, pvsrc);
|
||||
g_mutex_unlock (&pvsrc->lock);
|
||||
pinossrc->stream = pinos_stream_new (pinossrc->ctx, "test", NULL);
|
||||
g_signal_connect (pinossrc->stream, "notify::state", (GCallback) on_stream_notify, pinossrc);
|
||||
g_signal_connect (pinossrc->stream, "new-buffer", (GCallback) on_new_buffer, pinossrc);
|
||||
g_mutex_unlock (&pinossrc->lock);
|
||||
|
||||
return TRUE;
|
||||
|
||||
/* ERRORS */
|
||||
connect_error:
|
||||
{
|
||||
g_mutex_unlock (&pvsrc->lock);
|
||||
g_mutex_unlock (&pinossrc->lock);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -23,9 +23,9 @@
|
|||
#include <gst/gst.h>
|
||||
#include <gst/base/gstpushsrc.h>
|
||||
|
||||
#include <client/pv-context.h>
|
||||
#include <client/pv-stream.h>
|
||||
#include <client/pv-introspect.h>
|
||||
#include <client/context.h>
|
||||
#include <client/stream.h>
|
||||
#include <client/introspect.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
@ -61,8 +61,8 @@ struct _GstPinosSrc {
|
|||
GMainContext *context;
|
||||
GMainLoop *loop;
|
||||
GThread *thread;
|
||||
PvContext *ctx;
|
||||
PvStream *stream;
|
||||
PinosContext *ctx;
|
||||
PinosStream *stream;
|
||||
GstAllocator *fd_allocator;
|
||||
|
||||
GPollFunc poll_func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue