More hacking

Move array and map to pinos
Move more things to spa lib
ControlCmd -> Message
Make pinos log, use for plugins as well
work on ringbuffer in alsa and nodes
work on making registry with all objects
This commit is contained in:
Wim Taymans 2016-11-03 19:41:53 +01:00
parent a1c0bef2ed
commit 7e46f9e3ad
81 changed files with 1831 additions and 1030 deletions

View file

@ -24,6 +24,7 @@
#include <spa/audio/raw.h>
#include <spa/audio/format.h>
#include <lib/props.h>
static const uint32_t format_values[] = {
SPA_AUDIO_FORMAT_S8,

View file

@ -19,9 +19,8 @@
#include <stdio.h>
#include "spa/debug.h"
#include "spa/props.h"
#include "spa/format.h"
#include "debug.h"
#include "props.h"
struct meta_type_name {
const char *name;
@ -83,6 +82,19 @@ spa_debug_port_info (const SpaPortInfo *info)
SpaAllocParamMetaEnable *p = (SpaAllocParamMetaEnable *)param;
fprintf (stderr, " SpaAllocParamMetaEnable:\n");
fprintf (stderr, " type: \t%d (%s)\n", p->type, META_TYPE_NAME(p->type));
switch (p->type) {
case SPA_META_TYPE_RINGBUFFER:
{
SpaAllocParamMetaEnableRingbuffer *rb = (SpaAllocParamMetaEnableRingbuffer *)p;
fprintf (stderr, " minsize: \t\t%zd\n", rb->minsize);
fprintf (stderr, " stride: \t\t%zd\n", rb->stride);
fprintf (stderr, " blocks: \t\t%zd\n", rb->blocks);
fprintf (stderr, " align: \t\t%d\n", rb->align);
break;
}
default:
break;
}
break;
}
case SPA_ALLOC_PARAM_TYPE_VIDEO_PADDING:
@ -153,10 +165,11 @@ spa_debug_buffer (const SpaBuffer *buffer)
{
SpaMetaRingbuffer *h = m->data;
fprintf (stderr, " SpaMetaRingbuffer:\n");
fprintf (stderr, " readindex: %d\n", h->readindex);
fprintf (stderr, " writeindex: %d\n", h->writeindex);
fprintf (stderr, " size: %d\n", h->size);
fprintf (stderr, " size_mask: %d\n", h->size_mask);
fprintf (stderr, " readindex: %zd\n", h->ringbuffer.readindex);
fprintf (stderr, " writeindex: %zd\n", h->ringbuffer.writeindex);
fprintf (stderr, " size: %zd\n", h->ringbuffer.size);
fprintf (stderr, " mask: %zd\n", h->ringbuffer.mask);
fprintf (stderr, " mask2: %zd\n", h->ringbuffer.mask2);
break;
}
default:

46
spa/lib/debug.h Normal file
View file

@ -0,0 +1,46 @@
/* Simple Plugin API
* Copyright (C) 2016 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 __SPA_LIBDEBUG_H__
#define __SPA_LIBDEBUG_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/defs.h>
#include <spa/port.h>
#include <spa/buffer.h>
#include <spa/props.h>
#include <spa/format.h>
#include <spa/dict.h>
SpaResult spa_debug_port_info (const SpaPortInfo *info);
SpaResult spa_debug_buffer (const SpaBuffer *buffer);
SpaResult spa_debug_props (const SpaProps *props, bool print_ranges);
SpaResult spa_debug_format (const SpaFormat *format);
SpaResult spa_debug_dump_mem (const void *data, size_t size);
SpaResult spa_debug_dict (const SpaDict *dict);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_LIBDEBUG_H__ */

View file

@ -36,7 +36,8 @@
#include <spa/props.h>
#include <spa/queue.h>
#include <spa/ringbuffer.h>
#include <spa/debug.h>
#include <lib/debug.h>
#define MAX_URIS 4096

35
spa/lib/mapper.h Normal file
View file

@ -0,0 +1,35 @@
/* Simple Plugin API
* Copyright (C) 2016 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 __SPA_LIBMAPPER_H__
#define __SPA_LIBMAPPER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/id-map.h>
SpaIDMap * spa_id_map_get_default (void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_LIBMAPPER_H__ */

View file

@ -6,7 +6,7 @@ spalib_sources = ['audio-raw.c',
spalib = shared_library('spa-lib',
spalib_sources,
include_directories : spa_inc,
include_directories : [ spa_inc, spa_libinc ],
install : true)
spalib_dep = declare_dependency(link_with : spalib,

71
spa/lib/props.h Normal file
View file

@ -0,0 +1,71 @@
/* Simple Plugin API
* Copyright (C) 2016 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 __SPA_LIBPROPS_H__
#define __SPA_LIBPROPS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/props.h>
/**
* spa_props_set_value:
* @props: a #SpaProps
* @index: the index of the property in the prop_info array
* @value: the value to set
*
* Sets @value in @prop. type should match the type specified
* in the #SpaPropInfo at @index or else #SPA_RESULT_WRONG_PROPERTY_TYPE
* is returned.
*
* Returns: #SPA_RESULT_OK on success.
* #SPA_RESULT_INVALID_PROPERTY_INDEX when @index is not valid
* #SPA_RESULT_WRONG_PROPERTY_TYPE when type is not correct
*/
SpaResult spa_props_set_value (SpaProps *props,
unsigned int index,
const SpaPropValue *value);
/**
* spa_props_get_value:
* @props: a #SpaProps
* @index: the property index in the prop_info array
* @value: a location for the type, size and value
*
* Get the size and value of the property at @index.
*
* Returns: #SPA_RESULT_OK on success.
* #SPA_RESULT_INVALID_PROPERTY_INDEX when @index is not valid
* #SPA_RESULT_PROPERTY_UNSET when no value has been set yet
*/
SpaResult spa_props_get_value (const SpaProps *props,
unsigned int index,
SpaPropValue *value);
SpaResult spa_props_copy_values (const SpaProps *src,
SpaProps *dest);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_LIBPROPS_H__ */

View file

@ -25,6 +25,8 @@
#include <spa/video/raw.h>
#include <spa/video/format.h>
#include "props.h"
static const uint32_t format_values[] = {
SPA_VIDEO_FORMAT_UNKNOWN,
SPA_VIDEO_FORMAT_ENCODED,