mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
rework subscription
Rework subscription so that we can use it for client and server. Move source and source-output to client to allow client provided sources. Still needs some work but registration seems to work partly. Rework DBUS API: move CreateSourceOutput to Client1 interface, remove Add/RemoveProvider and Device1 interface. Rework SourceOutput1 to allow for reconfigure. Add a client to test v4l2 source.
This commit is contained in:
parent
75d5fa91e2
commit
752494621c
19 changed files with 775 additions and 388 deletions
|
|
@ -46,9 +46,16 @@ on_state_notify (GObject *gobject,
|
|||
g_main_loop_quit (loop);
|
||||
break;
|
||||
case PV_CONTEXT_STATE_READY:
|
||||
g_object_set (c, "subscription-mask", PV_SUBSCRIPTION_FLAGS_ALL, NULL);
|
||||
g_signal_connect (c, "subscription-event", (GCallback) subscription_cb, NULL);
|
||||
{
|
||||
PvSubscribe *subscribe;
|
||||
|
||||
subscribe = pv_subscribe_new ();
|
||||
g_object_set (subscribe, "subscription-mask", PV_SUBSCRIPTION_FLAGS_ALL, NULL);
|
||||
g_signal_connect (subscribe, "subscription-event", (GCallback) subscription_cb, NULL);
|
||||
pv_context_set_subscribe (c, subscribe);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
75
src/tests/test-v4l2.c
Normal file
75
src/tests/test-v4l2.c
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/* Pulsevideo
|
||||
* Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* 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 details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <client/pulsevideo.h>
|
||||
|
||||
#include <modules/v4l2/pv-v4l2-source.h>
|
||||
|
||||
static GMainLoop *loop;
|
||||
|
||||
static void
|
||||
on_state_notify (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
PvContextState state;
|
||||
PvContext *c = user_data;
|
||||
|
||||
g_object_get (gobject, "state", &state, NULL);
|
||||
g_print ("got context state %d\n", state);
|
||||
|
||||
switch (state) {
|
||||
case PV_CONTEXT_STATE_ERROR:
|
||||
g_main_loop_quit (loop);
|
||||
break;
|
||||
case PV_CONTEXT_STATE_READY:
|
||||
{
|
||||
PvSource *source;
|
||||
|
||||
source = pv_v4l2_source_new ();
|
||||
pv_context_register_source (c, source);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
main (gint argc, gchar *argv[])
|
||||
{
|
||||
PvContext *c;
|
||||
|
||||
pv_init (&argc, &argv);
|
||||
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
c = pv_context_new ("test-client", NULL);
|
||||
g_signal_connect (c, "notify::state", (GCallback) on_state_notify, c);
|
||||
pv_context_connect(c, PV_CONTEXT_FLAGS_NONE);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
|
||||
g_object_unref (c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue