Rework transport protocol

Remove the old PinosBuffer object and replace it with SpaControl, this
communication protocol is designed to make it possible to implement
remote nodes and so it is moved to Spa.
Move SpaBuffer into to API
Work on easier API to make formats, implement enumeration and support
for all formats in v4l2.
Improve format output in -inspect
This commit is contained in:
Wim Taymans 2016-07-28 21:19:20 +02:00
parent b795fb851f
commit 4cb90f3b86
37 changed files with 2658 additions and 1032 deletions

View file

@ -235,7 +235,7 @@ spa_audio_raw_format_parse (const SpaFormat *format,
spa_audio_raw_format_init (rawformat);
props = &format->props;
if ((res = props->get_prop (props, SPA_PROP_ID_AUDIO_RAW_INFO, &value)) < 0)
if ((res = props->get_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_AUDIO_RAW_INFO), &value)) < 0)
goto fallback;
if (value.type != SPA_PROP_TYPE_POINTER || value.size != sizeof (SpaAudioRawInfo))

1048
spa/lib/control.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -78,3 +78,20 @@ spa_debug_port_info (const SpaPortInfo *info)
}
return SPA_RESULT_OK;
}
SpaResult
spa_debug_dump_mem (void *mem, size_t size)
{
uint8_t *t = mem;
int i;
if (mem == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
for (i = 0; i < size; i++) {
printf ("%02x ", t[i]);
if (i % 16 == 8 || i == size - 1)
printf ("\n");
}
return SPA_RESULT_OK;
}

View file

@ -1,4 +1,5 @@
spalib_sources = ['audio-raw.c',
'control.c',
'debug.c',
'props.c',
'ringbuffer.c',
@ -8,3 +9,7 @@ spalib = shared_library('spa-lib',
spalib_sources,
include_directories : inc,
install : true)
spalibs = static_library('spa-lib',
spalib_sources,
include_directories : inc,
install : true)

View file

@ -111,11 +111,11 @@ static const uint32_t format_values[] = {
static const SpaPropRangeInfo format_range[] = {
{ "ENCODED,", "ENCODED", sizeof (uint32_t), &format_values[1] },
{ "S16LE", "S16LE", sizeof (uint32_t), &format_values[2] },
{ "S16BE", "S16BE", sizeof (uint32_t), &format_values[3] },
{ "U16LE", "U16LE", sizeof (uint32_t), &format_values[4] },
{ "U16BE", "U16BE", sizeof (uint32_t), &format_values[5] },
{ "S24_32LE", "S24_32LE", sizeof (uint32_t), &format_values[6] },
{ "I420", "I420", sizeof (uint32_t), &format_values[2] },
{ "YV12", "YV12", sizeof (uint32_t), &format_values[3] },
{ "YUY2", "YUY2", sizeof (uint32_t), &format_values[4] },
{ "UYVY", "UYVY", sizeof (uint32_t), &format_values[5] },
{ "AYUV", "AYUV", sizeof (uint32_t), &format_values[6] },
{ "S24_32BE", "S24_32BE", sizeof (uint32_t), &format_values[7] },
{ "U24_32LE", "U24_32LE", sizeof (uint32_t), &format_values[8] },
{ "U24_32BE", "U24_32BE", sizeof (uint32_t), &format_values[9] },
@ -509,7 +509,7 @@ spa_video_raw_format_parse (const SpaFormat *format,
spa_video_raw_format_init (rawformat);
props = &format->props;
if ((res = props->get_prop (props, SPA_PROP_ID_VIDEO_RAW_INFO, &value)) < 0)
if ((res = props->get_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_RAW_INFO), &value)) < 0)
goto fallback;
if (value.type != SPA_PROP_TYPE_POINTER || value.size != sizeof (SpaVideoRawInfo))
@ -524,3 +524,37 @@ fallback:
return res;
}
SpaResult
spa_video_raw_fill_default_info (SpaVideoRawInfo *info)
{
if (info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
memcpy (info, &default_info, sizeof (SpaVideoRawInfo));
return SPA_RESULT_OK;
}
SpaResult
spa_video_raw_fill_prop_info (SpaPropInfo *info,
SpaPropIdVideo id,
size_t offset)
{
unsigned int i;
if (info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
for (i = 0; i < SPA_N_ELEMENTS (raw_format_prop_info); i++) {
if (raw_format_prop_info[i].id == id) {
memcpy (info, &raw_format_prop_info[i], sizeof (SpaPropInfo));
info->offset = offset;
info->mask_offset = 0;
info->unset_mask = 0;
return SPA_RESULT_OK;
}
}
return SPA_RESULT_INVALID_PROPERTY_INDEX;
}