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

@ -64,6 +64,7 @@ typedef enum {
#include <spa/defs.h>
#include <spa/port.h>
#include <spa/ringbuffer.h>
/**
* SpaBufferFlags:
@ -112,16 +113,10 @@ typedef struct {
/**
* SpaMetaRingbuffer:
* @readindex:
* @writeindex:
* @size:
* @size_mask:
* @ringbuffer:
*/
typedef struct {
volatile int readindex;
volatile int writeindex;
int size;
int size_mask;
SpaRingbuffer ringbuffer;
} SpaMetaRingbuffer;
/**

View file

@ -57,8 +57,6 @@ struct _SpaIDMap {
#define spa_id_map_get_id(n,...) (n)->get_id((n),__VA_ARGS__)
#define spa_id_map_get_uri(n,...) (n)->get_uri((n),__VA_ARGS__)
SpaIDMap * spa_id_map_get_default (void);
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -70,6 +70,15 @@ typedef struct {
SpaMetaType type;
} SpaAllocParamMetaEnable;
typedef struct {
SpaAllocParam param;
SpaMetaType type;
size_t minsize;
size_t stride;
size_t blocks;
uint32_t align;
} SpaAllocParamMetaEnableRingbuffer;
typedef struct {
SpaAllocParam param;
unsigned int padding_top;

View file

@ -197,44 +197,6 @@ spa_props_index_for_name (const SpaProps *props, const char *name)
return SPA_IDX_INVALID;
}
/**
* 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

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:

View file

@ -17,8 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_DEBUG_H__
#define __SPA_DEBUG_H__
#ifndef __SPA_LIBDEBUG_H__
#define __SPA_LIBDEBUG_H__
#ifdef __cplusplus
extern "C" {
@ -43,4 +43,4 @@ SpaResult spa_debug_dict (const SpaDict *dict);
#endif
#endif /* __SPA_DEBUG_H__ */
#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,

View file

@ -17,6 +17,7 @@ dl_lib = cc.find_library('dl', required : true)
pthread_lib = cc.find_library('pthread', required : true)
spa_inc = include_directories('include')
spa_libinc = include_directories('.')
subdir('include')
subdir('lib')

View file

@ -31,7 +31,7 @@
#include <spa/id-map.h>
#include <spa/poll.h>
#include <spa/monitor.h>
#include <spa/debug.h>
#include <lib/debug.h>
extern const SpaHandleFactory spa_alsa_sink_factory;
extern const SpaHandleFactory spa_alsa_source_factory;
@ -100,7 +100,7 @@ path_get_card_id (const char *path)
return e + 5;
}
#define CHECK(s,msg) if ((err = (s)) < 0) { spa_log_error (state->log, msg ": %s\n", snd_strerror(err)); return err; }
#define CHECK(s,msg) if ((err = (s)) < 0) { spa_log_error (state->log, msg ": %s", snd_strerror(err)); return err; }
static int
fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
@ -136,7 +136,7 @@ fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
SND_PCM_NO_AUTO_RESAMPLE |
SND_PCM_NO_AUTO_CHANNELS |
SND_PCM_NO_AUTO_FORMAT)) < 0) {
spa_log_error (this->log, "PLAYBACK open failed: %s\n", snd_strerror(err));
spa_log_error (this->log, "PLAYBACK open failed: %s", snd_strerror(err));
if ((err = snd_pcm_open (&hndl,
device,
SND_PCM_STREAM_CAPTURE,
@ -144,7 +144,7 @@ fill_item (SpaALSAMonitor *this, ALSAItem *item, struct udev_device *udevice)
SND_PCM_NO_AUTO_RESAMPLE |
SND_PCM_NO_AUTO_CHANNELS |
SND_PCM_NO_AUTO_FORMAT)) < 0) {
spa_log_error (this->log, "CAPTURE open failed: %s\n", snd_strerror(err));
spa_log_error (this->log, "CAPTURE open failed: %s", snd_strerror(err));
return -1;
} else {
item->item.factory = &spa_alsa_source_factory;

View file

@ -23,6 +23,7 @@
#include <spa/node.h>
#include <spa/audio/format.h>
#include <lib/props.h>
#include "alsa-utils.h"
@ -47,7 +48,7 @@ reset_alsa_sink_props (SpaALSAProps *props)
static void
update_state (SpaALSASink *this, SpaNodeState state)
{
spa_log_info (this->log, "update state %d\n", state);
spa_log_info (this->log, "update state %d", state);
this->node.state = state;
}
@ -367,6 +368,7 @@ spa_alsa_clear_buffers (SpaALSASink *this)
if (this->n_buffers > 0) {
SPA_QUEUE_INIT (&this->ready);
this->n_buffers = 0;
this->ringbuffer = NULL;
}
return SPA_RESULT_OK;
}
@ -390,7 +392,7 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
return SPA_RESULT_INVALID_PORT;
if (format == NULL) {
spa_log_info (this->log, "clear format\n");
spa_log_info (this->log, "clear format");
spa_alsa_pause (this, false);
spa_alsa_clear_buffers (this);
spa_alsa_close (this);
@ -409,7 +411,7 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
SPA_PORT_INFO_FLAG_LIVE;
this->info.maxbuffering = this->buffer_frames * this->frame_size;
this->info.latency = (this->period_frames * SPA_NSEC_PER_SEC) / this->rate;
this->info.n_params = 2;
this->info.n_params = 3;
this->info.params = this->params;
this->params[0] = &this->param_buffers.param;
this->param_buffers.param.type = SPA_ALLOC_PARAM_TYPE_BUFFERS;
@ -423,6 +425,14 @@ spa_alsa_sink_node_port_set_format (SpaNode *node,
this->param_meta.param.type = SPA_ALLOC_PARAM_TYPE_META_ENABLE;
this->param_meta.param.size = sizeof (this->param_meta);
this->param_meta.type = SPA_META_TYPE_HEADER;
this->params[2] = &this->param_meta_rb.param;
this->param_meta_rb.param.type = SPA_ALLOC_PARAM_TYPE_META_ENABLE;
this->param_meta_rb.param.size = sizeof (this->param_meta_rb);
this->param_meta_rb.type = SPA_META_TYPE_RINGBUFFER;
this->param_meta_rb.minsize = this->period_frames * this->frame_size * 32;
this->param_meta_rb.stride = 0;
this->param_meta_rb.blocks = 1;
this->param_meta_rb.align = 16;
this->info.extra = NULL;
this->have_format = true;
@ -512,7 +522,7 @@ spa_alsa_sink_node_port_use_buffers (SpaNode *node,
this = SPA_CONTAINER_OF (node, SpaALSASink, node);
spa_log_info (this->log, "use buffers %d\n", n_buffers);
spa_log_info (this->log, "use buffers %d", n_buffers);
if (!this->have_format)
return SPA_RESULT_NO_FORMAT;
@ -530,13 +540,16 @@ spa_alsa_sink_node_port_use_buffers (SpaNode *node,
b->outstanding = true;
b->h = spa_buffer_find_meta (b->outbuf, SPA_META_TYPE_HEADER);
b->rb = spa_buffer_find_meta (b->outbuf, SPA_META_TYPE_RINGBUFFER);
if (b->rb)
this->ringbuffer = b;
switch (buffers[i]->datas[0].type) {
case SPA_DATA_TYPE_MEMFD:
case SPA_DATA_TYPE_DMABUF:
case SPA_DATA_TYPE_MEMPTR:
if (buffers[i]->datas[0].data == NULL) {
spa_log_error (this->log, "alsa-source: need mapped memory\n");
spa_log_error (this->log, "alsa-source: need mapped memory");
continue;
}
break;
@ -637,9 +650,14 @@ spa_alsa_sink_node_port_push_input (SpaNode *node,
have_error = true;
continue;
}
if (this->ringbuffer) {
this->ringbuffer->outstanding = true;
this->ringbuffer = b;
} else {
b->next = NULL;
SPA_QUEUE_PUSH_TAIL (&this->ready, SpaALSABuffer, next, b);
}
b->outstanding = false;
b->next = NULL;
SPA_QUEUE_PUSH_TAIL (&this->ready, SpaALSABuffer, next, b);
info[i].status = SPA_RESULT_OK;
}
if (have_error)

View file

@ -24,6 +24,7 @@
#include <spa/node.h>
#include <spa/queue.h>
#include <spa/audio/format.h>
#include <lib/props.h>
#include "alsa-utils.h"
@ -583,7 +584,7 @@ spa_alsa_source_node_port_use_buffers (SpaNode *node,
case SPA_DATA_TYPE_DMABUF:
case SPA_DATA_TYPE_MEMPTR:
if (buffers[i]->datas[0].data == NULL) {
spa_log_error (this->log, "alsa-source: need mapped memory\n");
spa_log_error (this->log, "alsa-source: need mapped memory");
continue;
}
break;
@ -697,7 +698,7 @@ spa_alsa_source_node_port_pull_output (SpaNode *node,
info[i].buffer_id = b->outbuf->id;
info[i].status = SPA_RESULT_OK;
spa_log_debug (this->log, "pull buffer %u\n", b->outbuf->id);
spa_log_debug (this->log, "pull buffer %u", b->outbuf->id);
}
if (have_error)
return SPA_RESULT_ERROR;
@ -727,7 +728,7 @@ spa_alsa_source_node_port_reuse_buffer (SpaNode *node,
if (buffer_id >= this->n_buffers)
return SPA_RESULT_INVALID_BUFFER_ID;
spa_log_debug (this->log, "recycle buffer %u\n", buffer_id);
spa_log_debug (this->log, "recycle buffer %u", buffer_id);
recycle_buffer (this, buffer_id);
return SPA_RESULT_OK;

View file

@ -7,9 +7,10 @@
#include <sys/time.h>
#include <math.h>
#include <lib/debug.h>
#include "alsa-utils.h"
#define CHECK(s,msg) if ((err = (s)) < 0) { spa_log_error (state->log, msg ": %s\n", snd_strerror(err)); return err; }
#define CHECK(s,msg) if ((err = (s)) < 0) { spa_log_error (state->log, msg ": %s", snd_strerror(err)); return err; }
static int alsa_on_fd_events (SpaPollNotifyData *data);
@ -24,7 +25,7 @@ spa_alsa_open (SpaALSAState *state)
CHECK (snd_output_stdio_attach (&state->output, stderr, 0), "attach failed");
spa_log_info (state->log, "ALSA device open '%s'\n", props->device);
spa_log_info (state->log, "ALSA device open '%s'", props->device);
CHECK (snd_pcm_open (&state->hndl,
props->device,
state->stream,
@ -59,7 +60,7 @@ spa_alsa_close (SpaALSAState *state)
spa_poll_remove_item (state->data_loop, &state->poll);
spa_log_info (state->log, "Device closing\n");
spa_log_info (state->log, "Device closing");
CHECK (snd_pcm_close (state->hndl), "close failed");
state->opened = false;
@ -147,14 +148,14 @@ spa_alsa_set_format (SpaALSAState *state, SpaFormatAudio *fmt, SpaPortFormatFlag
/* set the sample format */
format = spa_alsa_format_to_alsa (info->format);
spa_log_info (state->log, "Stream parameters are %iHz, %s, %i channels\n", info->rate, snd_pcm_format_name(format), info->channels);
spa_log_info (state->log, "Stream parameters are %iHz, %s, %i channels", info->rate, snd_pcm_format_name(format), info->channels);
CHECK (snd_pcm_hw_params_set_format (hndl, params, format), "set_format");
/* set the count of channels */
rchannels = info->channels;
CHECK (snd_pcm_hw_params_set_channels_near (hndl, params, &rchannels), "set_channels");
if (rchannels != info->channels) {
spa_log_info (state->log, "Channels doesn't match (requested %u, get %u\n", info->channels, rchannels);
spa_log_info (state->log, "Channels doesn't match (requested %u, get %u", info->channels, rchannels);
if (flags & SPA_PORT_FORMAT_FLAG_NEAREST)
info->channels = rchannels;
else
@ -165,7 +166,7 @@ spa_alsa_set_format (SpaALSAState *state, SpaFormatAudio *fmt, SpaPortFormatFlag
rrate = info->rate;
CHECK (snd_pcm_hw_params_set_rate_near (hndl, params, &rrate, 0), "set_rate_near");
if (rrate != info->rate) {
spa_log_info (state->log, "Rate doesn't match (requested %iHz, get %iHz)\n", info->rate, rrate);
spa_log_info (state->log, "Rate doesn't match (requested %iHz, get %iHz)", info->rate, rrate);
if (flags & SPA_PORT_FORMAT_FLAG_NEAREST)
info->rate = rrate;
else
@ -189,6 +190,8 @@ spa_alsa_set_format (SpaALSAState *state, SpaFormatAudio *fmt, SpaPortFormatFlag
CHECK (snd_pcm_hw_params_get_period_size (params, &size, &dir), "get_period_size");
state->period_frames = size;
spa_log_info (state->log, "buffer frames %zd, period frames %zd", state->buffer_frames, state->period_frames);
/* write the parameters to device */
CHECK (snd_pcm_hw_params (hndl, params), "set_hw_params");
@ -210,10 +213,13 @@ set_swparams (SpaALSAState *state)
CHECK (snd_pcm_sw_params_set_tstamp_mode (hndl, params, SND_PCM_TSTAMP_ENABLE), "sw_params_set_tstamp_mode");
/* start the transfer when the buffer is almost full: */
/* (buffer_frames / avail_min) * avail_min */
CHECK (snd_pcm_sw_params_set_start_threshold (hndl, params,
(state->buffer_frames / state->period_frames) * state->period_frames), "set_start_threshold");
/* start the transfer */
CHECK (snd_pcm_sw_params_set_start_threshold (hndl, params, 0U), "set_start_threshold");
CHECK (snd_pcm_sw_params_set_stop_threshold (hndl, params,
(state->buffer_frames / state->period_frames) * state->period_frames), "set_stop_threshold");
// CHECK (snd_pcm_sw_params_set_stop_threshold (hndl, params, -1), "set_stop_threshold");
CHECK (snd_pcm_sw_params_set_silence_threshold (hndl, params, 0U), "set_silence_threshold");
/* allow the transfer when at least period_size samples can be processed */
/* or disable this mechanism when period event is enabled (aka interrupt like style processing) */
@ -240,18 +246,18 @@ xrun_recovery (SpaALSAState *state, snd_pcm_t *hndl, int err)
snd_pcm_status_alloca (&status);
if ((err = snd_pcm_status (hndl, status)) < 0) {
spa_log_error (state->log, "snd_pcm_status error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_status error: %s", snd_strerror (err));
}
if (snd_pcm_status_get_state (status) == SND_PCM_STATE_SUSPENDED) {
spa_log_info (state->log, "SUSPENDED, trying to resume\n");
spa_log_warn (state->log, "SUSPENDED, trying to resume");
if ((err = snd_pcm_prepare (hndl)) < 0) {
spa_log_error (state->log, "snd_pcm_prepare error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_prepare error: %s", snd_strerror (err));
}
}
if (snd_pcm_status_get_state (status) == SND_PCM_STATE_XRUN) {
spa_log_info (state->log, "XRUN\n");
spa_log_warn (state->log, "XRUN");
}
if (spa_alsa_pause (state, true) != SPA_RESULT_OK)
@ -262,6 +268,98 @@ xrun_recovery (SpaALSAState *state, snd_pcm_t *hndl, int err)
return err;
}
static snd_pcm_uframes_t
pull_frames_queue (SpaALSAState *state,
const snd_pcm_channel_area_t *my_areas,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t frames)
{
SpaALSABuffer *b;
SPA_QUEUE_PEEK_HEAD (&state->ready, SpaALSABuffer, b);
if (b) {
uint8_t *src, *dst;
size_t n_bytes;
src = SPA_MEMBER (b->outbuf->datas[0].data, b->outbuf->datas[0].offset + state->ready_offset, uint8_t);
dst = SPA_MEMBER (my_areas[0].addr, offset * state->frame_size, uint8_t);
n_bytes = SPA_MIN (b->outbuf->datas[0].size - state->ready_offset, frames * state->frame_size);
frames = SPA_MIN (frames, n_bytes / state->frame_size);
memcpy (dst, src, n_bytes);
state->ready_offset += n_bytes;
if (state->ready_offset >= b->outbuf->datas[0].size) {
SpaNodeEventReuseBuffer rb;
SPA_QUEUE_POP_HEAD (&state->ready, SpaALSABuffer, next, b);
b->outstanding = true;
rb.event.type = SPA_NODE_EVENT_TYPE_REUSE_BUFFER;
rb.event.size = sizeof (rb);
rb.port_id = 0;
rb.buffer_id = b->outbuf->id;
state->event_cb (&state->node, &rb.event, state->user_data);
state->ready_offset = 0;
}
} else {
spa_log_warn (state->log, "underrun");
snd_pcm_areas_silence (my_areas, offset, state->channels, frames, state->format);
}
return frames;
}
static snd_pcm_uframes_t
pull_frames_ringbuffer (SpaALSAState *state,
const snd_pcm_channel_area_t *my_areas,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t frames)
{
SpaRingbufferArea areas[2];
size_t size, avail;
SpaALSABuffer *b;
uint8_t *src, *dst;
SpaNodeEventReuseBuffer rb;
b = state->ringbuffer;
src = SPA_MEMBER (b->outbuf->datas[0].data, b->outbuf->datas[0].offset, void);
dst = SPA_MEMBER (my_areas[0].addr, offset * state->frame_size, uint8_t);
spa_ringbuffer_get_read_areas (&b->rb->ringbuffer, areas);
avail = areas[0].len + areas[1].len;
size = SPA_MIN (avail, frames * state->frame_size);
spa_log_debug (state->log, "%zd %zd %zd %zd %zd %zd",
areas[0].offset, areas[0].len,
areas[1].offset, areas[1].len, offset, size);
if (size > 0) {
areas[0].len = SPA_MIN (areas[0].len, size);
areas[1].len = SPA_MIN (areas[1].len, size - areas[0].len);
memcpy (dst, src + areas[0].offset, areas[0].len);
if (areas[1].len)
memcpy (dst + areas[0].len, src + areas[1].offset, areas[1].len);
spa_ringbuffer_read_advance (&b->rb->ringbuffer, size);
frames = size / state->frame_size;
} else {
spa_log_warn (state->log, "underrun");
snd_pcm_areas_silence (my_areas, offset, state->channels, frames, state->format);
}
b->outstanding = true;
rb.event.type = SPA_NODE_EVENT_TYPE_REUSE_BUFFER;
rb.event.size = sizeof (rb);
rb.port_id = 0;
rb.buffer_id = b->outbuf->id;
state->event_cb (&state->node, &rb.event, state->user_data);
return frames;
}
static int
mmap_write (SpaALSAState *state)
{
@ -270,71 +368,42 @@ mmap_write (SpaALSAState *state)
snd_pcm_sframes_t avail;
snd_pcm_uframes_t offset, frames, size;
const snd_pcm_channel_area_t *my_areas;
SpaNodeEventNeedInput ni;
SpaALSABuffer *b;
snd_pcm_status_t *status;
SpaNodeEventNeedInput ni;
snd_pcm_status_alloca (&status);
if ((err = snd_pcm_status (hndl, status)) < 0) {
spa_log_error (state->log, "snd_pcm_status error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_status error: %s", snd_strerror (err));
return -1;
}
avail = snd_pcm_status_get_avail (status);
ni.event.type = SPA_NODE_EVENT_TYPE_NEED_INPUT;
ni.event.size = sizeof (ni);
ni.port_id = 0;
state->event_cb (&state->node, &ni.event, state->user_data);
size = avail;
while (size > 0) {
frames = size;
if ((err = snd_pcm_mmap_begin (hndl, &my_areas, &offset, &frames)) < 0) {
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s", snd_strerror(err));
return -1;
}
ni.event.type = SPA_NODE_EVENT_TYPE_NEED_INPUT;
ni.event.size = sizeof (ni);
ni.port_id = 0;
state->event_cb (&state->node, &ni.event, state->user_data);
SPA_QUEUE_PEEK_HEAD (&state->ready, SpaALSABuffer, b);
if (b) {
uint8_t *src;
size_t n_bytes;
src = SPA_MEMBER (b->outbuf->datas[0].data, b->outbuf->datas[0].offset + state->ready_offset, void);
n_bytes = SPA_MIN (b->outbuf->datas[0].size - state->ready_offset, frames * state->frame_size);
frames = SPA_MIN (frames, n_bytes / state->frame_size);
memcpy ((uint8_t *)my_areas[0].addr + (offset * state->frame_size),
src,
n_bytes);
state->ready_offset += n_bytes;
if (state->ready_offset >= b->outbuf->datas[0].size) {
SpaNodeEventReuseBuffer rb;
SPA_QUEUE_POP_HEAD (&state->ready, SpaALSABuffer, next, b);
b->outstanding = true;
rb.event.type = SPA_NODE_EVENT_TYPE_REUSE_BUFFER;
rb.event.size = sizeof (rb);
rb.port_id = 0;
rb.buffer_id = b->outbuf->id;
state->event_cb (&state->node, &rb.event, state->user_data);
state->ready_offset = 0;
}
} else {
spa_log_warn (state->log, "underrun\n");
snd_pcm_areas_silence (my_areas, offset, state->channels, frames, state->format);
}
if (state->ringbuffer)
frames = pull_frames_ringbuffer (state, my_areas, offset, frames);
else
frames = pull_frames_queue (state, my_areas, offset, frames);
if ((err = snd_pcm_mmap_commit (hndl, offset, frames)) < 0) {
spa_log_error (state->log, "snd_pcm_mmap_commit error: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_mmap_commit error: %s", snd_strerror(err));
if (err != -EPIPE && err != -ESTRPIPE)
return -1;
}
spa_log_debug (state->log, "write %zd/%zd/%zd %u", frames, size, avail, state->ready.length);
size -= frames;
}
return 0;
@ -358,7 +427,7 @@ mmap_read (SpaALSAState *state)
snd_pcm_status_alloca(&status);
if ((err = snd_pcm_status (hndl, status)) < 0) {
spa_log_error (state->log, "snd_pcm_status error: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_status error: %s", snd_strerror(err));
return err;
}
@ -371,7 +440,7 @@ mmap_read (SpaALSAState *state)
SPA_QUEUE_POP_HEAD (&state->free, SpaALSABuffer, next, b);
if (b == NULL) {
spa_log_warn (state->log, "no more buffers\n");
spa_log_warn (state->log, "no more buffers");
} else {
dest = SPA_MEMBER (b->outbuf->datas[0].data, b->outbuf->datas[0].offset, void);
destsize = b->outbuf->datas[0].size;
@ -390,7 +459,7 @@ mmap_read (SpaALSAState *state)
while (size > 0) {
frames = size;
if ((err = snd_pcm_mmap_begin (hndl, &my_areas, &offset, &frames)) < 0) {
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_mmap_begin error: %s", snd_strerror (err));
return -1;
}
@ -404,13 +473,12 @@ mmap_read (SpaALSAState *state)
}
if ((err = snd_pcm_mmap_commit (hndl, offset, frames)) < 0) {
spa_log_error (state->log, "snd_pcm_mmap_commit error: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_mmap_commit error: %s", snd_strerror(err));
return -1;
}
size -= frames;
}
if (b) {
SpaNodeEventHaveOutput ho;
SpaData *d;
@ -443,7 +511,7 @@ alsa_on_fd_events (SpaPollNotifyData *data)
&revents);
if (revents & POLLERR) {
if ((err = xrun_recovery (state, hndl, err)) < 0) {
spa_log_error (state->log, "error: %s\n", snd_strerror (err));
spa_log_error (state->log, "error: %s", snd_strerror (err));
return -1;
}
}
@ -476,16 +544,16 @@ spa_alsa_start (SpaALSAState *state, bool xrun_recover)
snd_pcm_dump (state->hndl, state->output);
if ((err = snd_pcm_prepare (state->hndl)) < 0) {
spa_log_error (state->log, "snd_pcm_prepare error: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_prepare error: %s", snd_strerror (err));
return SPA_RESULT_ERROR;
}
if ((state->poll.n_fds = snd_pcm_poll_descriptors_count (state->hndl)) <= 0) {
spa_log_error (state->log, "Invalid poll descriptors count %d\n", state->poll.n_fds);
spa_log_error (state->log, "Invalid poll descriptors count %d", state->poll.n_fds);
return SPA_RESULT_ERROR;
}
if ((err = snd_pcm_poll_descriptors (state->hndl, (struct pollfd *)state->fds, state->poll.n_fds)) < 0) {
spa_log_error (state->log, "snd_pcm_poll_descriptors: %s\n", snd_strerror(err));
spa_log_error (state->log, "snd_pcm_poll_descriptors: %s", snd_strerror(err));
return SPA_RESULT_ERROR;
}
@ -499,7 +567,7 @@ spa_alsa_start (SpaALSAState *state, bool xrun_recover)
}
if ((err = snd_pcm_start (state->hndl)) < 0) {
spa_log_error (state->log, "snd_pcm_start: %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_start: %s", snd_strerror (err));
return SPA_RESULT_ERROR;
}
@ -522,7 +590,7 @@ spa_alsa_pause (SpaALSAState *state, bool xrun_recover)
}
if ((err = snd_pcm_drop (state->hndl)) < 0)
spa_log_error (state->log, "snd_pcm_drop %s\n", snd_strerror (err));
spa_log_error (state->log, "snd_pcm_drop %s", snd_strerror (err));
state->started = false;

View file

@ -32,6 +32,7 @@ extern "C" {
#include <spa/log.h>
#include <spa/queue.h>
#include <spa/node.h>
#include <spa/ringbuffer.h>
#include <spa/audio/format.h>
typedef struct _SpaALSAState SpaALSAState;
@ -52,6 +53,7 @@ typedef struct {
struct _SpaALSABuffer {
SpaBuffer *outbuf;
SpaMetaHeader *h;
SpaMetaRingbuffer *rb;
bool outstanding;
SpaALSABuffer *next;
};
@ -96,13 +98,16 @@ struct _SpaALSAState {
size_t frame_size;
SpaPortInfo info;
SpaAllocParam *params[2];
SpaAllocParam *params[3];
SpaAllocParamBuffers param_buffers;
SpaAllocParamMetaEnable param_meta;
SpaAllocParamMetaEnableRingbuffer param_meta_rb;
SpaPortStatus status;
SpaALSABuffer buffers[MAX_BUFFERS];
unsigned int n_buffers;
bool use_ringbuffer;
SpaALSABuffer *ringbuffer;
SpaQueue free;
SpaQueue ready;

View file

@ -6,7 +6,7 @@ spa_alsa_sources = ['alsa.c',
spa_alsa = shared_library('spa-alsa',
spa_alsa_sources,
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc],
dependencies : [ alsa_dep, libudev_dep ],
link_with : spalib,
install : true,

View file

@ -24,6 +24,7 @@
#include <spa/id-map.h>
#include <spa/node.h>
#include <spa/audio/format.h>
#include <lib/props.h>
#define MAX_PORTS 128
@ -700,7 +701,7 @@ spa_audiomixer_node_port_pull_output (SpaNode *node,
for (i = 0; i < n_info; i++) {
if ((info[i].status = mix_data (this, &info[i])) < 0) {
spa_log_error (this->log, "error mixing: %d\n", info[i].status);
spa_log_error (this->log, "error mixing: %d", info[i].status);
have_error = true;
continue;
}

View file

@ -2,7 +2,7 @@ audiomixer_sources = ['audiomixer.c', 'plugin.c']
audiomixerlib = shared_library('spa-audiomixer',
audiomixer_sources,
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc],
link_with : spalib,
install : true,
install_dir : '@0@/spa'.format(get_option('libdir')))

View file

@ -29,6 +29,7 @@
#include <spa/node.h>
#include <spa/queue.h>
#include <spa/audio/format.h>
#include <lib/props.h>
#define SAMPLES_TO_TIME(this,s) ((s) * SPA_NSEC_PER_SEC / (this)->current_format.info.raw.rate)
#define BYTES_TO_SAMPLES(this,b) ((b)/(this)->bpf)
@ -526,7 +527,7 @@ static SpaResult
clear_buffers (SpaAudioTestSrc *this)
{
if (this->n_buffers > 0) {
spa_log_info (this->log, "audiotestsrc %p: clear buffers\n", this);
spa_log_info (this->log, "audiotestsrc %p: clear buffers", this);
this->n_buffers = 0;
SPA_QUEUE_INIT (&this->empty);
SPA_QUEUE_INIT (&this->ready);
@ -690,7 +691,7 @@ spa_audiotestsrc_node_port_use_buffers (SpaNode *node,
case SPA_DATA_TYPE_MEMFD:
case SPA_DATA_TYPE_DMABUF:
if (d[0].data == NULL) {
spa_log_error (this->log, "audiotestsrc %p: invalid memory on buffer %p\n", this, buffers[i]);
spa_log_error (this->log, "audiotestsrc %p: invalid memory on buffer %p", this, buffers[i]);
continue;
}
b->ptr = SPA_MEMBER (d[0].data, d[0].offset, void);

View file

@ -2,7 +2,7 @@ audiotestsrc_sources = ['audiotestsrc.c', 'plugin.c']
audiotestsrclib = shared_library('spa-audiotestsrc',
audiotestsrc_sources,
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc],
link_with : spalib,
install : true,
install_dir : '@0@/spa'.format(get_option('libdir')))

View file

@ -26,6 +26,7 @@
#include <spa/log.h>
#include <spa/node.h>
#include <spa/video/format.h>
#include <lib/props.h>
typedef struct _SpaFFMpegDec SpaFFMpegDec;

View file

@ -26,6 +26,7 @@
#include <spa/id-map.h>
#include <spa/node.h>
#include <spa/video/format.h>
#include <lib/props.h>
typedef struct _SpaFFMpegEnc SpaFFMpegEnc;

View file

@ -4,7 +4,7 @@ ffmpeg_sources = ['ffmpeg.c',
ffmpeglib = shared_library('spa-ffmpeg',
ffmpeg_sources,
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc],
dependencies : [ avcodec_dep, avformat_dep ],
link_with : spalib,
install : true,

View file

@ -4,7 +4,7 @@ v4l2_sources = ['v4l2.c',
v4l2lib = shared_library('spa-v4l2',
v4l2_sources,
include_directories : spa_inc,
include_directories : [ spa_inc, spa_libinc ],
dependencies : [ v4l2_dep, libudev_dep ],
link_with : spalib,
install : true,

View file

@ -30,7 +30,7 @@
#include <spa/id-map.h>
#include <spa/poll.h>
#include <spa/monitor.h>
#include <spa/debug.h>
#include <lib/debug.h>
extern const SpaHandleFactory spa_v4l2_source_factory;

View file

@ -26,10 +26,11 @@
#include <spa/node.h>
#include <spa/video/format.h>
#include <spa/debug.h>
#include <spa/queue.h>
#include <spa/log.h>
#include <spa/id-map.h>
#include <lib/debug.h>
#include <lib/props.h>
typedef struct _SpaV4l2Source SpaV4l2Source;
@ -150,7 +151,7 @@ struct _SpaV4l2Source {
static void
update_state (SpaV4l2Source *this, SpaNodeState state)
{
spa_log_info (this->log, "state: %d\n", state);
spa_log_info (this->log, "state: %d", state);
this->node.state = state;
}
#include "v4l2-utils.c"

View file

@ -34,27 +34,27 @@ spa_v4l2_open (SpaV4l2Source *this)
return 0;
if (props->props.unset_mask & 1) {
spa_log_error (state->log, "v4l2: Device property not set\n");
spa_log_error (state->log, "v4l2: Device property not set");
return -1;
}
spa_log_info (state->log, "v4l2: Playback device is '%s'\n", props->device);
spa_log_info (state->log, "v4l2: Playback device is '%s'", props->device);
if (stat (props->device, &st) < 0) {
spa_log_error (state->log, "v4l2: Cannot identify '%s': %d, %s\n",
spa_log_error (state->log, "v4l2: Cannot identify '%s': %d, %s",
props->device, errno, strerror (errno));
return -1;
}
if (!S_ISCHR (st.st_mode)) {
spa_log_error (state->log, "v4l2: %s is no device\n", props->device);
spa_log_error (state->log, "v4l2: %s is no device", props->device);
return -1;
}
state->fd = open (props->device, O_RDWR | O_NONBLOCK, 0);
if (state->fd == -1) {
spa_log_error (state->log, "v4l2: Cannot open '%s': %d, %s\n",
spa_log_error (state->log, "v4l2: Cannot open '%s': %d, %s",
props->device, errno, strerror (errno));
return -1;
}
@ -65,7 +65,7 @@ spa_v4l2_open (SpaV4l2Source *this)
}
if ((state->cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) {
spa_log_error (state->log, "v4l2: %s is no video capture device\n", props->device);
spa_log_error (state->log, "v4l2: %s is no video capture device", props->device);
return -1;
}
@ -120,7 +120,7 @@ spa_v4l2_clear_buffers (SpaV4l2Source *this)
b = &state->buffers[i];
if (b->outstanding) {
spa_log_info (state->log, "v4l2: queueing outstanding buffer %p\n", b);
spa_log_info (state->log, "v4l2: queueing outstanding buffer %p", b);
spa_v4l2_buffer_recycle (this, i);
}
if (b->allocated) {
@ -156,7 +156,7 @@ spa_v4l2_close (SpaV4l2Source *this)
if (state->n_buffers > 0)
return 0;
spa_log_info (state->log, "v4l2: close\n");
spa_log_info (state->log, "v4l2: close");
spa_poll_remove_item (state->data_loop, &state->poll);
@ -768,7 +768,7 @@ spa_v4l2_set_format (SpaV4l2Source *this, V4l2Format *f, bool try_only)
f->format,
0);
if (info == NULL) {
spa_log_error (state->log, "v4l2: unknown media type %d %d %d\n", f->fmt.media_type,
spa_log_error (state->log, "v4l2: unknown media type %d %d %d", f->fmt.media_type,
f->fmt.media_subtype, f->format);
return -1;
}
@ -780,7 +780,7 @@ spa_v4l2_set_format (SpaV4l2Source *this, V4l2Format *f, bool try_only)
streamparm.parm.capture.timeperframe.numerator = f->framerate.denom;
streamparm.parm.capture.timeperframe.denominator = f->framerate.num;
spa_log_info (state->log, "v4l2: set %08x %dx%d %d/%d\n", fmt.fmt.pix.pixelformat,
spa_log_info (state->log, "v4l2: set %08x %dx%d %d/%d", fmt.fmt.pix.pixelformat,
fmt.fmt.pix.width, fmt.fmt.pix.height,
streamparm.parm.capture.timeperframe.numerator,
streamparm.parm.capture.timeperframe.denominator);
@ -800,7 +800,7 @@ spa_v4l2_set_format (SpaV4l2Source *this, V4l2Format *f, bool try_only)
if (xioctl (state->fd, VIDIOC_S_PARM, &streamparm) < 0)
perror ("VIDIOC_S_PARM");
spa_log_info (state->log, "v4l2: got %08x %dx%d %d/%d\n", fmt.fmt.pix.pixelformat,
spa_log_info (state->log, "v4l2: got %08x %dx%d %d/%d", fmt.fmt.pix.pixelformat,
fmt.fmt.pix.width, fmt.fmt.pix.height,
streamparm.parm.capture.timeperframe.numerator,
streamparm.parm.capture.timeperframe.denominator);
@ -932,7 +932,7 @@ spa_v4l2_use_buffers (SpaV4l2Source *this, SpaBuffer **buffers, uint32_t n_buffe
state->memtype = V4L2_MEMORY_DMABUF;
break;
default:
spa_log_error (state->log, "v4l2: can't use buffers\n");
spa_log_error (state->log, "v4l2: can't use buffers");
return SPA_RESULT_ERROR;
}
}
@ -946,9 +946,9 @@ spa_v4l2_use_buffers (SpaV4l2Source *this, SpaBuffer **buffers, uint32_t n_buffe
perror ("VIDIOC_REQBUFS");
return SPA_RESULT_ERROR;
}
spa_log_info (state->log, "v4l2: got %d buffers\n", reqbuf.count);
spa_log_info (state->log, "v4l2: got %d buffers", reqbuf.count);
if (reqbuf.count < 2) {
spa_log_error (state->log, "v4l2: can't allocate enough buffers\n");
spa_log_error (state->log, "v4l2: can't allocate enough buffers");
return SPA_RESULT_ERROR;
}
@ -961,10 +961,10 @@ spa_v4l2_use_buffers (SpaV4l2Source *this, SpaBuffer **buffers, uint32_t n_buffe
b->allocated = false;
b->h = spa_buffer_find_meta (b->outbuf, SPA_META_TYPE_HEADER);
spa_log_info (state->log, "v4l2: import buffer %p\n", buffers[i]);
spa_log_info (state->log, "v4l2: import buffer %p", buffers[i]);
if (buffers[i]->n_datas < 1) {
spa_log_error (state->log, "v4l2: invalid memory on buffer %p\n", buffers[i]);
spa_log_error (state->log, "v4l2: invalid memory on buffer %p", buffers[i]);
continue;
}
d = buffers[i]->datas;
@ -977,7 +977,7 @@ spa_v4l2_use_buffers (SpaV4l2Source *this, SpaBuffer **buffers, uint32_t n_buffe
case SPA_DATA_TYPE_MEMPTR:
case SPA_DATA_TYPE_MEMFD:
if (d[0].data == NULL) {
spa_log_error (state->log, "v4l2: need mmaped memory\n");
spa_log_error (state->log, "v4l2: need mmaped memory");
continue;
}
b->v4l2_buffer.m.userptr = (unsigned long) SPA_MEMBER (d[0].data, d[0].offset, void *);
@ -1019,22 +1019,22 @@ mmap_init (SpaV4l2Source *this,
return SPA_RESULT_ERROR;
}
spa_log_info (state->log, "v4l2: got %d buffers\n", reqbuf.count);
spa_log_info (state->log, "v4l2: got %d buffers", reqbuf.count);
*n_buffers = reqbuf.count;
if (reqbuf.count < 2) {
spa_log_error (state->log, "v4l2: can't allocate enough buffers\n");
spa_log_error (state->log, "v4l2: can't allocate enough buffers");
return SPA_RESULT_ERROR;
}
if (state->export_buf)
spa_log_info (state->log, "v4l2: using EXPBUF\n");
spa_log_info (state->log, "v4l2: using EXPBUF");
for (i = 0; i < reqbuf.count; i++) {
V4l2Buffer *b;
SpaData *d;
if (buffers[i]->n_datas < 1) {
spa_log_error (state->log, "v4l2: invalid buffer data\n");
spa_log_error (state->log, "v4l2: invalid buffer data");
return SPA_RESULT_ERROR;
}

View file

@ -2,7 +2,7 @@ videotestsrc_sources = ['videotestsrc.c', 'plugin.c']
videotestsrclib = shared_library('spa-videotestsrc',
videotestsrc_sources,
include_directories : spa_inc,
include_directories : [ spa_inc, spa_libinc],
dependencies : threads_dep,
link_with : spalib,
install : true,

View file

@ -30,6 +30,7 @@
#include <spa/node.h>
#include <spa/queue.h>
#include <spa/video/format.h>
#include <lib/props.h>
#define FRAMES_TO_TIME(this,f) ((this->current_format.info.raw.framerate.num * (f) * SPA_NSEC_PER_SEC) / \
(this->current_format.info.raw.framerate.denom))
@ -474,7 +475,7 @@ static SpaResult
clear_buffers (SpaVideoTestSrc *this)
{
if (this->n_buffers > 0) {
spa_log_info (this->log, "videotestsrc %p: clear buffers\n", this);
spa_log_info (this->log, "videotestsrc %p: clear buffers", this);
this->n_buffers = 0;
SPA_QUEUE_INIT (&this->empty);
SPA_QUEUE_INIT (&this->ready);
@ -639,7 +640,7 @@ spa_videotestsrc_node_port_use_buffers (SpaNode *node,
case SPA_DATA_TYPE_MEMFD:
case SPA_DATA_TYPE_DMABUF:
if (d[0].data == NULL) {
spa_log_error (this->log, "videotestsrc %p: invalid memory on buffer %p\n", this, buffers[i]);
spa_log_error (this->log, "videotestsrc %p: invalid memory on buffer %p", this, buffers[i]);
continue;
}
b->ptr = SPA_MEMBER (d[0].data, d[0].offset, void);

View file

@ -2,7 +2,7 @@ volume_sources = ['volume.c', 'plugin.c']
volumelib = shared_library('spa-volume',
volume_sources,
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc],
link_with : spalib,
install : true,
install_dir : '@0@/spa'.format(get_option('libdir')))

View file

@ -24,6 +24,7 @@
#include <spa/id-map.h>
#include <spa/node.h>
#include <spa/audio/format.h>
#include <lib/props.h>
typedef struct _SpaVolume SpaVolume;

View file

@ -3,7 +3,7 @@ xv_sources = ['xv.c',
xvlib = shared_library('spa-xv',
xv_sources,
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc],
dependencies : xv_dep,
link_with : spalib,
install : true,

View file

@ -28,6 +28,7 @@
#include <spa/log.h>
#include <spa/node.h>
#include <spa/video/format.h>
#include <lib/props.h>
typedef struct _SpaXvSink SpaXvSink;

View file

@ -1,11 +1,11 @@
executable('test-mixer', 'test-mixer.c',
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc ],
dependencies : [dl_lib, pthread_lib],
link_with : spalib,
install : false)
executable('test-v4l2', 'test-v4l2.c',
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc ],
dependencies : [dl_lib, sdl_dep, pthread_lib],
link_with : spalib,
install : false)

View file

@ -30,6 +30,8 @@
#include <spa/log.h>
#include <spa/id-map.h>
#include <spa/audio/format.h>
#include <lib/mapper.h>
#include <lib/props.h>
typedef struct {
uint32_t node;

View file

@ -31,8 +31,10 @@
#include <spa/id-map.h>
#include <spa/log.h>
#include <spa/node.h>
#include <spa/debug.h>
#include <spa/video/format.h>
#include <lib/debug.h>
#include <lib/props.h>
#include <lib/mapper.h>
#define MAX_BUFFERS 8

View file

@ -1,11 +1,11 @@
executable('spa-inspect', 'spa-inspect.c',
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc],
dependencies : [dl_lib],
link_with : spalib,
install : true)
executable('spa-monitor', 'spa-monitor.c',
include_directories : spa_inc,
include_directories : [spa_inc, spa_libinc],
dependencies : [dl_lib],
link_with : spalib,
install : true)

View file

@ -26,7 +26,8 @@
#include <spa/id-map.h>
#include <spa/log.h>
#include <spa/node.h>
#include <spa/debug.h>
#include <lib/debug.h>
#include <lib/mapper.h>
typedef struct {
uint32_t node;

View file

@ -29,7 +29,8 @@
#include <spa/id-map.h>
#include <spa/monitor.h>
#include <spa/poll.h>
#include <spa/debug.h>
#include <lib/debug.h>
#include <lib/mapper.h>
typedef struct {
uint32_t monitor;