mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-23 06:59:58 -05:00
Use pinos loop for mainloop
Remove more glib stuff
This commit is contained in:
parent
27bba6f587
commit
4e94743906
12 changed files with 59 additions and 248 deletions
|
|
@ -1,45 +0,0 @@
|
|||
/* Pinos
|
||||
* 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 <pinos/client/pinos.h>
|
||||
#include <pinos/client/format.h>
|
||||
#include <pinos/client/serialize.h>
|
||||
|
||||
static SpaFormat *
|
||||
format_copy (SpaFormat *format)
|
||||
{
|
||||
void *p;
|
||||
size_t size;
|
||||
|
||||
if (format == NULL)
|
||||
return NULL;
|
||||
|
||||
size = pinos_serialize_format_get_size (format);
|
||||
p = malloc (size);
|
||||
return pinos_serialize_format_copy_into (p, format);
|
||||
}
|
||||
|
||||
static void
|
||||
format_free (SpaFormat *format)
|
||||
{
|
||||
g_free (format);
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (SpaFormat, spa_format,
|
||||
format_copy, format_free);
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/* Pinos
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __PINOS_FORMAT_H__
|
||||
#define __PINOS_FORMAT_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <spa/include/spa/format.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SPA_TYPE_FORMAT (spa_format_get_type())
|
||||
|
||||
GType spa_format_get_type (void);
|
||||
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __PINOS_FORMAT_H__ */
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
pinos_headers = [
|
||||
'array.h',
|
||||
'context.h',
|
||||
'format.h',
|
||||
'introspect.h',
|
||||
'log.h',
|
||||
'loop.h',
|
||||
|
|
@ -21,7 +20,6 @@ pinos_headers = [
|
|||
pinos_sources = [
|
||||
'connection.c',
|
||||
'context.c',
|
||||
'format.c',
|
||||
'introspect.c',
|
||||
'log.c',
|
||||
'loop.c',
|
||||
|
|
@ -36,28 +34,10 @@ pinos_sources = [
|
|||
'thread-mainloop.c',
|
||||
'transport.c',
|
||||
'utils.c',
|
||||
gdbus_target,
|
||||
]
|
||||
|
||||
install_headers(pinos_headers, subdir : 'pinos/client')
|
||||
|
||||
mkenums = find_program('build_mkenum.py')
|
||||
glib_mkenums = find_program('glib-mkenums')
|
||||
|
||||
enumtypes_h = custom_target('enumtypes_h',
|
||||
output : 'enumtypes.h',
|
||||
input : pinos_headers,
|
||||
install : true,
|
||||
install_dir : 'include/pinos/client',
|
||||
command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
|
||||
|
||||
enumtypes_c = custom_target('enumtypes_c',
|
||||
output : 'enumtypes.c',
|
||||
input : pinos_headers,
|
||||
depends : [enumtypes_h],
|
||||
command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
|
||||
|
||||
|
||||
libpinos_c_args = [
|
||||
'-DHAVE_CONFIG_H',
|
||||
'-D_GNU_SOURCE',
|
||||
|
|
@ -65,8 +45,6 @@ libpinos_c_args = [
|
|||
]
|
||||
|
||||
|
||||
pinos_gen_sources = [enumtypes_h]
|
||||
|
||||
libpinos = shared_library('pinos', pinos_sources,
|
||||
version : libversion,
|
||||
soversion : soversion,
|
||||
|
|
@ -74,12 +52,10 @@ libpinos = shared_library('pinos', pinos_sources,
|
|||
include_directories : [configinc, spa_inc],
|
||||
link_with : spalib,
|
||||
install : true,
|
||||
dependencies : [gobject_dep, gmodule_dep, glib_dep, gio_dep, mathlib],
|
||||
dependencies : [glib_dep, gio_dep, mathlib, pthread_lib],
|
||||
)
|
||||
|
||||
pinos_dep = declare_dependency(link_with : libpinos,
|
||||
include_directories : [configinc, spa_inc],
|
||||
dependencies : [glib_dep, gobject_dep, gmodule_dep],
|
||||
# Everything that uses libpinos needs this built to compile
|
||||
sources : pinos_gen_sources,
|
||||
dependencies : [glib_dep, pthread_lib],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "pinos/client/pinos.h"
|
||||
#include "pinos/client/properties.h"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "spa/lib/debug.h"
|
||||
|
||||
|
|
@ -30,7 +31,6 @@
|
|||
#include "pinos/client/connection.h"
|
||||
#include "pinos/client/context.h"
|
||||
#include "pinos/client/stream.h"
|
||||
#include "pinos/client/format.h"
|
||||
#include "pinos/client/serialize.h"
|
||||
#include "pinos/client/transport.h"
|
||||
|
||||
|
|
@ -431,7 +431,7 @@ handle_rtnode_event (PinosStream *stream,
|
|||
break;
|
||||
|
||||
if ((bid = find_buffer (stream, p->buffer_id))) {
|
||||
bid->used = FALSE;
|
||||
bid->used = false;
|
||||
pinos_signal_emit (&stream->new_buffer, stream, p->buffer_id);
|
||||
}
|
||||
break;
|
||||
|
|
@ -489,7 +489,7 @@ on_rtsocket_condition (SpaSource *source,
|
|||
}
|
||||
|
||||
static void
|
||||
handle_socket (PinosStream *stream, gint rtfd)
|
||||
handle_socket (PinosStream *stream, int rtfd)
|
||||
{
|
||||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
struct timespec interval;
|
||||
|
|
@ -546,7 +546,7 @@ handle_node_event (PinosStream *stream,
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static bool
|
||||
handle_node_command (PinosStream *stream,
|
||||
uint32_t seq,
|
||||
SpaNodeCommand *command)
|
||||
|
|
@ -600,7 +600,7 @@ handle_node_command (PinosStream *stream,
|
|||
break;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
|
|
@ -658,7 +658,7 @@ stream_dispatch_func (void *object,
|
|||
case PINOS_MESSAGE_SET_FORMAT:
|
||||
{
|
||||
PinosMessageSetFormat *p = message;
|
||||
gpointer mem;
|
||||
void *mem;
|
||||
|
||||
if (impl->format)
|
||||
free (impl->format);
|
||||
|
|
@ -736,7 +736,8 @@ stream_dispatch_func (void *object,
|
|||
for (i = 0; i < b->n_datas; i++)
|
||||
size += sizeof (SpaData);
|
||||
|
||||
b = bid->buf = g_memdup (bid->buf_ptr, size);
|
||||
b = bid->buf = malloc (size);
|
||||
memcpy (b, bid->buf_ptr, size);
|
||||
|
||||
if (b->metas)
|
||||
b->metas = SPA_MEMBER (b, SPA_PTR_TO_INT (b->metas), SpaMeta);
|
||||
|
|
@ -750,7 +751,7 @@ stream_dispatch_func (void *object,
|
|||
|
||||
if (bid->id != len) {
|
||||
pinos_log_warn ("unexpected id %u found, expected %u", bid->id, len);
|
||||
impl->in_order = FALSE;
|
||||
impl->in_order = false;
|
||||
}
|
||||
pinos_log_debug ("add buffer %d %d %zd", mid->id, bid->id, p->buffers[i].offset);
|
||||
|
||||
|
|
@ -858,13 +859,13 @@ stream_dispatch_func (void *object,
|
|||
* signal and use pinos_stream_capture_buffer() to get the latest metadata and
|
||||
* data.
|
||||
*
|
||||
* Returns: %TRUE on success.
|
||||
* Returns: %true on success.
|
||||
*/
|
||||
bool
|
||||
pinos_stream_connect (PinosStream *stream,
|
||||
PinosDirection direction,
|
||||
PinosStreamMode mode,
|
||||
const gchar *port_path,
|
||||
const char *port_path,
|
||||
PinosStreamFlags flags,
|
||||
unsigned int n_possible_formats,
|
||||
SpaFormat **possible_formats)
|
||||
|
|
@ -928,7 +929,7 @@ pinos_stream_connect (PinosStream *stream,
|
|||
* When @res indicates success, @params contain the parameters for the
|
||||
* allocation state.
|
||||
*
|
||||
* Returns: %TRUE on success
|
||||
* Returns: %true on success
|
||||
*/
|
||||
bool
|
||||
pinos_stream_finish_format (PinosStream *stream,
|
||||
|
|
@ -969,7 +970,7 @@ pinos_stream_finish_format (PinosStream *stream,
|
|||
* Start capturing from @stream.
|
||||
*
|
||||
*
|
||||
* Returns: %TRUE on success.
|
||||
* Returns: %true on success.
|
||||
*/
|
||||
bool
|
||||
pinos_stream_start (PinosStream *stream)
|
||||
|
|
@ -983,7 +984,7 @@ pinos_stream_start (PinosStream *stream)
|
|||
*
|
||||
* Stop capturing from @stream.
|
||||
*
|
||||
* Returns: %TRUE on success.
|
||||
* Returns: %true on success.
|
||||
*/
|
||||
bool
|
||||
pinos_stream_stop (PinosStream *stream)
|
||||
|
|
@ -997,7 +998,7 @@ pinos_stream_stop (PinosStream *stream)
|
|||
*
|
||||
* Disconnect @stream.
|
||||
*
|
||||
* Returns: %TRUE on success
|
||||
* Returns: %true on success
|
||||
*/
|
||||
bool
|
||||
pinos_stream_disconnect (PinosStream *stream)
|
||||
|
|
@ -1056,7 +1057,7 @@ pinos_stream_get_empty_buffer (PinosStream *stream)
|
|||
*
|
||||
* Recycle the buffer with @id.
|
||||
*
|
||||
* Returns: %TRUE on success.
|
||||
* Returns: %true on success.
|
||||
*/
|
||||
bool
|
||||
pinos_stream_recycle_buffer (PinosStream *stream,
|
||||
|
|
@ -1110,7 +1111,7 @@ pinos_stream_peek_buffer (PinosStream *stream,
|
|||
* For provider streams, this function should be called whenever there is a new frame
|
||||
* available.
|
||||
*
|
||||
* Returns: %TRUE when @id was handled
|
||||
* Returns: %true when @id was handled
|
||||
*/
|
||||
bool
|
||||
pinos_stream_send_buffer (PinosStream *stream,
|
||||
|
|
@ -1118,12 +1119,12 @@ pinos_stream_send_buffer (PinosStream *stream,
|
|||
{
|
||||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||
BufferId *bid;
|
||||
guint i;
|
||||
unsigned int i;
|
||||
|
||||
if ((bid = find_buffer (stream, id))) {
|
||||
uint8_t cmd = PINOS_TRANSPORT_CMD_HAVE_DATA;
|
||||
|
||||
bid->used = TRUE;
|
||||
bid->used = true;
|
||||
for (i = 0; i < bid->buf->n_datas; i++) {
|
||||
bid->datas[i].size = bid->buf->datas[i].size;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue