mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
inspect: improve output
Keep state variable to enumerate things. This allows us to remove the expectation that the same index will give the same item. Use a new rectangle type for video size. When enumerating sizes, this allows us to specify relations between width and height more easily. Remove the struct and bytes type, they are like pointer. Add filter to enum_formats to speed up enumerations.
This commit is contained in:
parent
77bc2a1793
commit
b9320c67c2
27 changed files with 414 additions and 287 deletions
|
|
@ -54,7 +54,7 @@ static SpaResult
|
|||
make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char *name)
|
||||
{
|
||||
SpaResult res;
|
||||
void *hnd;
|
||||
void *hnd, *state;
|
||||
SpaEnumHandleFactoryFunc enum_func;
|
||||
unsigned int i;
|
||||
|
||||
|
|
|
|||
|
|
@ -240,12 +240,14 @@ struct _SpaNode {
|
|||
* SpaNode::port_enum_formats:
|
||||
* @handle: a #SpaHandle
|
||||
* @port_id: the port to query
|
||||
* @index: the format index to retrieve
|
||||
* @format: pointer to a format
|
||||
* @filter: a format filter
|
||||
* @state: a state variable, %NULL to get the first item
|
||||
*
|
||||
* Enumerate all possible formats on @port_id of @node.
|
||||
* Enumerate all possible formats on @port_id of @node that are compatible
|
||||
* with @filter..
|
||||
*
|
||||
* Use the index to retrieve the formats one by one until the function
|
||||
* Use @state to retrieve the formats one by one until the function
|
||||
* returns #SPA_RESULT_ENUM_END.
|
||||
*
|
||||
* The result format can be queried and modified and ultimately be used
|
||||
|
|
@ -254,13 +256,13 @@ struct _SpaNode {
|
|||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when node or format is %NULL
|
||||
* #SPA_RESULT_INVALID_PORT when port_id is not valid
|
||||
* #SPA_RESULT_ENUM_END when no format exists for @index
|
||||
*
|
||||
* #SPA_RESULT_ENUM_END when no format exists
|
||||
*/
|
||||
SpaResult (*port_enum_formats) (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpaFormat **format);
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
void **state);
|
||||
/**
|
||||
* SpaNode::port_set_format:
|
||||
* @handle: a #SpaHandle
|
||||
|
|
|
|||
|
|
@ -102,10 +102,10 @@ struct _SpaHandleFactory {
|
|||
/**
|
||||
* SpaHandle::enum_interface_info:
|
||||
* @factory: a #SpaHandleFactory
|
||||
* @index: the interface index
|
||||
* @info: result to hold SpaInterfaceInfo.
|
||||
* @state: state to keep track of the enumeration, %NULL for first item
|
||||
*
|
||||
* Get the interface information at @index.
|
||||
* Enumerate the interface information for @factory.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no interfaces
|
||||
|
|
@ -113,14 +113,14 @@ struct _SpaHandleFactory {
|
|||
* #SPA_RESULT_ENUM_END when there are no more infos
|
||||
*/
|
||||
SpaResult (*enum_interface_info) (const SpaHandleFactory *factory,
|
||||
unsigned int index,
|
||||
const SpaInterfaceInfo **info);
|
||||
const SpaInterfaceInfo **info,
|
||||
void **state);
|
||||
};
|
||||
|
||||
/**
|
||||
* SpaEnumHandleFactoryFunc:
|
||||
* @index: the index to enumerate
|
||||
* @factory: a location to hold the factory result
|
||||
* @state: state to keep track of the enumeration
|
||||
*
|
||||
* The function signature of the entry point in a plugin.
|
||||
*
|
||||
|
|
@ -128,13 +128,13 @@ struct _SpaHandleFactory {
|
|||
* #SPA_RESULT_INVALID_ARGUMENTS when factory is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||
*/
|
||||
typedef SpaResult (*SpaEnumHandleFactoryFunc) (unsigned int index,
|
||||
const SpaHandleFactory **factory);
|
||||
typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
|
||||
void **state);
|
||||
|
||||
/**
|
||||
* spa_enum_handle_factory:
|
||||
* @index: the index to enumerate
|
||||
* @factory: a location to hold the factory result
|
||||
* @state: state to keep track of the enumeration
|
||||
*
|
||||
* The entry point in a plugin.
|
||||
*
|
||||
|
|
@ -142,8 +142,8 @@ typedef SpaResult (*SpaEnumHandleFactoryFunc) (unsigned int index,
|
|||
* #SPA_RESULT_INVALID_ARGUMENTS when factory is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||
*/
|
||||
SpaResult spa_enum_handle_factory (unsigned int index,
|
||||
const SpaHandleFactory **factory);
|
||||
SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||
void **state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
|||
|
|
@ -46,13 +46,17 @@ typedef enum {
|
|||
SPA_PROP_TYPE_FLOAT,
|
||||
SPA_PROP_TYPE_DOUBLE,
|
||||
SPA_PROP_TYPE_STRING,
|
||||
SPA_PROP_TYPE_POINTER,
|
||||
SPA_PROP_TYPE_RECTANGLE,
|
||||
SPA_PROP_TYPE_FRACTION,
|
||||
SPA_PROP_TYPE_BITMASK,
|
||||
SPA_PROP_TYPE_BYTES,
|
||||
SPA_PROP_TYPE_STRUCT,
|
||||
SPA_PROP_TYPE_POINTER
|
||||
} SpaPropType;
|
||||
|
||||
typedef struct {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
} SpaRectangle;
|
||||
|
||||
typedef struct {
|
||||
uint32_t num;
|
||||
uint32_t denom;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ typedef struct _SpaVideoRawFormat SpaVideoRawFormat;
|
|||
|
||||
typedef enum {
|
||||
SPA_PROP_ID_VIDEO_FORMAT = SPA_PROP_ID_MEDIA_CUSTOM_START,
|
||||
SPA_PROP_ID_VIDEO_WIDTH,
|
||||
SPA_PROP_ID_VIDEO_HEIGHT,
|
||||
SPA_PROP_ID_VIDEO_SIZE,
|
||||
SPA_PROP_ID_VIDEO_FRAMERATE,
|
||||
SPA_PROP_ID_VIDEO_MAX_FRAMERATE,
|
||||
SPA_PROP_ID_VIDEO_VIEWS,
|
||||
|
|
|
|||
|
|
@ -148,8 +148,7 @@ typedef enum {
|
|||
/**
|
||||
* SpaVideoRawInfo:
|
||||
* @format: the format
|
||||
* @width: the width of the video
|
||||
* @height: the height of the video
|
||||
* @size: the frame size of the video
|
||||
* @framerate: the framerate of the video 0/1 means variable rate
|
||||
* @max_framerate: the maximum framerate of the video. This is only valid when
|
||||
* @framerate is 0/1
|
||||
|
|
@ -168,8 +167,7 @@ typedef enum {
|
|||
*/
|
||||
struct _SpaVideoRawInfo {
|
||||
SpaVideoFormat format;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
SpaRectangle size;
|
||||
SpaFraction framerate;
|
||||
SpaFraction max_framerate;
|
||||
unsigned int views;
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
NULL },
|
||||
{ SPA_PROP_ID_AUDIO_RAW_INFO, "info", "the SpaAudioRawInfo structure",
|
||||
SPA_PROP_FLAG_READWRITE,
|
||||
SPA_PROP_TYPE_STRUCT, sizeof (SpaAudioRawInfo),
|
||||
SPA_PROP_TYPE_POINTER, sizeof (SpaAudioRawInfo),
|
||||
0, NULL,
|
||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
||||
NULL,
|
||||
|
|
@ -238,7 +238,7 @@ spa_audio_raw_format_parse (const SpaFormat *format,
|
|||
if ((res = props->get_prop (props, SPA_PROP_ID_AUDIO_RAW_INFO, &value)) < 0)
|
||||
goto fallback;
|
||||
|
||||
if (value.type != SPA_PROP_TYPE_STRUCT || value.size != sizeof (SpaAudioRawInfo))
|
||||
if (value.type != SPA_PROP_TYPE_POINTER || value.size != sizeof (SpaAudioRawInfo))
|
||||
goto fallback;
|
||||
|
||||
memcpy (&rawformat->info, value.value, sizeof (SpaAudioRawInfo));
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@
|
|||
|
||||
static const SpaVideoRawInfo default_info = {
|
||||
SPA_VIDEO_FORMAT_UNKNOWN,
|
||||
320,
|
||||
240,
|
||||
{ 320, 240 },
|
||||
{ 0, 1 },
|
||||
{ 0, 1 },
|
||||
1,
|
||||
|
|
@ -142,6 +141,14 @@ static const SpaPropRangeInfo format_range[] = {
|
|||
{ "F64BE", "F64BE", sizeof (uint32_t), &format_values[29] },
|
||||
};
|
||||
|
||||
static const SpaRectangle min_size = { 1, 1 };
|
||||
static const SpaRectangle max_size = { UINT32_MAX, UINT32_MAX };
|
||||
|
||||
static const SpaPropRangeInfo size_range[] = {
|
||||
{ "min", "Minimum value", sizeof (SpaRectangle), &min_size },
|
||||
{ "max", "Maximum value", sizeof (SpaRectangle), &max_size },
|
||||
};
|
||||
|
||||
static const uint32_t interlace_modes[] = {
|
||||
SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE,
|
||||
SPA_VIDEO_INTERLACE_MODE_INTERLEAVED,
|
||||
|
|
@ -341,24 +348,15 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
offsetof (SpaVideoRawFormat, info.format),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 0,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_WIDTH, "width", "Video width",
|
||||
{ SPA_PROP_ID_VIDEO_SIZE, "size", "Video size",
|
||||
SPA_PROP_FLAG_READWRITE,
|
||||
SPA_PROP_TYPE_UINT32, sizeof (uint32_t),
|
||||
sizeof (uint32_t), &default_info.width,
|
||||
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, uint32_range,
|
||||
SPA_PROP_TYPE_RECTANGLE, sizeof (SpaRectangle),
|
||||
sizeof (SpaRectangle), &default_info.size,
|
||||
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, size_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.width),
|
||||
offsetof (SpaVideoRawFormat, info.size),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 1,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_HEIGHT, "height", "Video height",
|
||||
SPA_PROP_FLAG_READWRITE,
|
||||
SPA_PROP_TYPE_UINT32, sizeof (uint32_t),
|
||||
sizeof (uint32_t), &default_info.height,
|
||||
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, uint32_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.height),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 2,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_FRAMERATE, "framerate", "Video framerate",
|
||||
SPA_PROP_FLAG_READWRITE,
|
||||
SPA_PROP_TYPE_FRACTION, sizeof (SpaFraction),
|
||||
|
|
@ -366,7 +364,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, framerate_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.framerate),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 3,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 2,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_MAX_FRAMERATE, "max-framerate", "Video max framerate",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -375,7 +373,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, framerate_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.max_framerate),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 4,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 3,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_VIEWS, "views", "Video number of views",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -384,7 +382,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, uint32_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.views),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 5,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 4,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_INTERLACE_MODE, "interlace-mode", "Interlace mode",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -393,7 +391,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (interlace_mode_range), interlace_mode_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.interlace_mode),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 6,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 5,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_PIXEL_ASPECT_RATIO, "pixel-aspect-ratio", "Video pixel aspect ratio",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -402,7 +400,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, framerate_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.pixel_aspect_ratio),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 7,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 6,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_MULTIVIEW_MODE, "multiview-mode", "Multiview mode",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -411,7 +409,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (multiview_mode_range), multiview_mode_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.multiview_mode),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 8,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 7,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_MULTIVIEW_FLAGS, "multiview-flags", "Multiview flags",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -420,7 +418,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_FLAGS, SPA_N_ELEMENTS (multiview_flags_range), multiview_flags_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.multiview_flags),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 9,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 8,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_CHROMA_SITE, "chroma-site", "Chroma site",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -429,7 +427,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_FLAGS, SPA_N_ELEMENTS (chroma_site_range), chroma_site_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.chroma_site),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 10,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 9,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_COLOR_RANGE, "color-range", "Color range",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -438,7 +436,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (color_range_range), color_range_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.color_range),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 11,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 10,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_COLOR_MATRIX, "color-matrix", "Color matrix",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -447,7 +445,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (color_matrix_range), color_matrix_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.color_matrix),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 12,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 11,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_TRANSFER_FUNCTION, "transfer-function", "Transfer function",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -456,7 +454,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (transfer_function_range), transfer_function_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.transfer_function),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 13,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 12,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_COLOR_PRIMARIES, "color-primaries", "Color primaries",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
|
|
@ -465,11 +463,11 @@ static const SpaPropInfo raw_format_prop_info[] =
|
|||
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (color_primaries_range), color_primaries_range,
|
||||
NULL,
|
||||
offsetof (SpaVideoRawFormat, info.color_primaries),
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 14,
|
||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 13,
|
||||
NULL },
|
||||
{ SPA_PROP_ID_VIDEO_RAW_INFO, "info", "the SpaVideoRawInfo structure",
|
||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||
SPA_PROP_TYPE_STRUCT, sizeof (SpaVideoRawInfo),
|
||||
SPA_PROP_TYPE_POINTER, sizeof (SpaVideoRawInfo),
|
||||
0, NULL,
|
||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
||||
NULL,
|
||||
|
|
@ -487,7 +485,7 @@ spa_video_raw_format_init (SpaVideoRawFormat *format)
|
|||
format->format.props.prop_info = raw_format_prop_info;
|
||||
format->format.props.set_prop = spa_props_generic_set_prop;
|
||||
format->format.props.get_prop = spa_props_generic_get_prop;
|
||||
format->unset_mask = (1 << 15)-1;
|
||||
format->unset_mask = (1 << 14)-1;
|
||||
format->info = default_info;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
|
|
@ -514,7 +512,7 @@ spa_video_raw_format_parse (const SpaFormat *format,
|
|||
if ((res = props->get_prop (props, SPA_PROP_ID_VIDEO_RAW_INFO, &value)) < 0)
|
||||
goto fallback;
|
||||
|
||||
if (value.type != SPA_PROP_TYPE_STRUCT || value.size != sizeof (SpaVideoRawInfo))
|
||||
if (value.type != SPA_PROP_TYPE_POINTER || value.size != sizeof (SpaVideoRawInfo))
|
||||
goto fallback;
|
||||
|
||||
memcpy (&rawformat->info, value.value, sizeof (SpaVideoRawInfo));
|
||||
|
|
|
|||
|
|
@ -333,17 +333,21 @@ spa_alsa_sink_node_remove_port (SpaHandle *handle,
|
|||
static SpaResult
|
||||
spa_alsa_sink_node_port_enum_formats (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpaFormat **format)
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
void **state)
|
||||
{
|
||||
SpaALSASink *this = (SpaALSASink *) handle;
|
||||
int index;
|
||||
|
||||
if (handle == NULL || format == NULL)
|
||||
if (handle == NULL || format == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_audio_raw_format_init (&this->query_format);
|
||||
|
|
@ -355,6 +359,7 @@ spa_alsa_sink_node_port_enum_formats (SpaHandle *handle,
|
|||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*format = &this->query_format.format;
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -608,13 +613,24 @@ static const SpaInterfaceInfo alsa_sink_interfaces[] =
|
|||
|
||||
static SpaResult
|
||||
alsa_sink_enum_interface_info (const SpaHandleFactory *factory,
|
||||
unsigned int index,
|
||||
const SpaInterfaceInfo **info)
|
||||
const SpaInterfaceInfo **info,
|
||||
void **state)
|
||||
{
|
||||
if (index >= 1)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
int index;
|
||||
|
||||
*info = &alsa_sink_interfaces[index];
|
||||
if (factory == NULL || info == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*info = &alsa_sink_interfaces[index];
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,16 @@
|
|||
extern const SpaHandleFactory spa_alsa_sink_factory;
|
||||
|
||||
SpaResult
|
||||
spa_enum_handle_factory (unsigned int index,
|
||||
const SpaHandleFactory **factory)
|
||||
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||
void **state)
|
||||
{
|
||||
if (factory == NULL)
|
||||
int index;
|
||||
|
||||
if (factory == NULL || state == NULL)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*factory = &spa_alsa_sink_factory;
|
||||
|
|
@ -36,5 +40,6 @@ spa_enum_handle_factory (unsigned int index,
|
|||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = index++;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -301,17 +301,21 @@ spa_audiomixer_node_remove_port (SpaHandle *handle,
|
|||
static SpaResult
|
||||
spa_audiomixer_node_port_enum_formats (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpaFormat **format)
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
void **state)
|
||||
{
|
||||
SpaAudioMixer *this = (SpaAudioMixer *) handle;
|
||||
int index;
|
||||
|
||||
if (handle == NULL || format == NULL)
|
||||
if (handle == NULL || format == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id > MAX_PORTS)
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_audio_raw_format_init (&this->query_format);
|
||||
|
|
@ -320,6 +324,7 @@ spa_audiomixer_node_port_enum_formats (SpaHandle *handle,
|
|||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*format = &this->query_format.format;
|
||||
*(int*)state = index++;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -771,14 +776,24 @@ static const SpaInterfaceInfo audiomixer_interfaces[] =
|
|||
|
||||
static SpaResult
|
||||
audiomixer_enum_interface_info (const SpaHandleFactory *factory,
|
||||
unsigned int index,
|
||||
const SpaInterfaceInfo **info)
|
||||
const SpaInterfaceInfo **info,
|
||||
void **state)
|
||||
{
|
||||
if (index >= 1)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
int index;
|
||||
|
||||
*info = &audiomixer_interfaces[index];
|
||||
if (factory == NULL || info == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*info = &audiomixer_interfaces[index];
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,16 @@
|
|||
extern const SpaHandleFactory spa_audiomixer_factory;
|
||||
|
||||
SpaResult
|
||||
spa_enum_handle_factory (unsigned int index,
|
||||
const SpaHandleFactory **factory)
|
||||
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||
void **state)
|
||||
{
|
||||
if (factory == NULL)
|
||||
int index;
|
||||
|
||||
if (factory == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*factory = &spa_audiomixer_factory;
|
||||
|
|
@ -36,5 +40,6 @@ spa_enum_handle_factory (unsigned int index,
|
|||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,17 +278,21 @@ spa_audiotestsrc_node_remove_port (SpaHandle *handle,
|
|||
static SpaResult
|
||||
spa_audiotestsrc_node_port_enum_formats (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpaFormat **format)
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
void **state)
|
||||
{
|
||||
SpaAudioTestSrc *this = (SpaAudioTestSrc *) handle;
|
||||
int index;
|
||||
|
||||
if (handle == NULL || format == NULL)
|
||||
if (handle == NULL || format == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_audio_raw_format_init (&this->query_format);
|
||||
|
|
@ -297,6 +301,7 @@ spa_audiotestsrc_node_port_enum_formats (SpaHandle *handle,
|
|||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*format = &this->query_format.format;
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -557,14 +562,24 @@ static const SpaInterfaceInfo audiotestsrc_interfaces[] =
|
|||
|
||||
static SpaResult
|
||||
audiotestsrc_enum_interface_info (const SpaHandleFactory *factory,
|
||||
unsigned int index,
|
||||
const SpaInterfaceInfo **info)
|
||||
const SpaInterfaceInfo **info,
|
||||
void **state)
|
||||
{
|
||||
if (index >= 1)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
int index;
|
||||
|
||||
*info = &audiotestsrc_interfaces[index];
|
||||
if (factory == NULL || info == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*info = &audiotestsrc_interfaces[index];
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,16 @@
|
|||
extern const SpaHandleFactory spa_audiotestsrc_factory;
|
||||
|
||||
SpaResult
|
||||
spa_enum_handle_factory (unsigned int index,
|
||||
const SpaHandleFactory **factory)
|
||||
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||
void **state)
|
||||
{
|
||||
if (factory == NULL)
|
||||
int index;
|
||||
|
||||
if (factory == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*factory = &spa_audiotestsrc_factory;
|
||||
|
|
@ -36,5 +40,6 @@ spa_enum_handle_factory (unsigned int index,
|
|||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,28 +246,33 @@ spa_ffmpeg_dec_node_remove_port (SpaHandle *handle,
|
|||
static SpaResult
|
||||
spa_ffmpeg_dec_node_port_enum_formats (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpaFormat **format)
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
void **state)
|
||||
{
|
||||
SpaFFMpegDec *this = (SpaFFMpegDec *) handle;
|
||||
SpaFFMpegState *state;
|
||||
SpaFFMpegState *s;
|
||||
int index;
|
||||
|
||||
if (handle == NULL || format == NULL)
|
||||
if (handle == NULL || format == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (!IS_VALID_PORT (port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
state = &this->state[port_id];
|
||||
s = &this->state[port_id];
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_video_raw_format_init (&state->raw_format[0]);
|
||||
spa_video_raw_format_init (&s->raw_format[0]);
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*format = &state->raw_format[0].format;
|
||||
*format = &s->raw_format[0].format;
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,11 +246,13 @@ spa_ffmpeg_enc_node_remove_port (SpaHandle *handle,
|
|||
static SpaResult
|
||||
spa_ffmpeg_enc_node_port_enum_formats (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpaFormat **format)
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
void **state)
|
||||
{
|
||||
SpaFFMpegEnc *this = (SpaFFMpegEnc *) handle;
|
||||
SpaFFMpegState *state;
|
||||
SpaFFMpegState *s;
|
||||
int index;
|
||||
|
||||
if (handle == NULL || format == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
|
@ -258,16 +260,19 @@ spa_ffmpeg_enc_node_port_enum_formats (SpaHandle *handle,
|
|||
if (!IS_VALID_PORT (port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
state = &this->state[port_id];
|
||||
s = &this->state[port_id];
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_video_raw_format_init (&state->raw_format[0]);
|
||||
spa_video_raw_format_init (&s->raw_format[0]);
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*format = &state->raw_format[0].format;
|
||||
*format = &s->raw_format[0].format;
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,25 +58,36 @@ static const SpaInterfaceInfo ffmpeg_interfaces[] =
|
|||
|
||||
static SpaResult
|
||||
ffmpeg_enum_interface_info (const SpaHandleFactory *factory,
|
||||
unsigned int index,
|
||||
const SpaInterfaceInfo **info)
|
||||
const SpaInterfaceInfo **info,
|
||||
void **state)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (factory == NULL || state == NULL || info == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
if (index >= 1)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
|
||||
*info = &ffmpeg_interfaces[index];
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
SpaResult
|
||||
spa_enum_handle_factory (unsigned int index,
|
||||
const SpaHandleFactory **factory)
|
||||
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||
void **state)
|
||||
{
|
||||
static const AVCodec *c = NULL;
|
||||
static int ci = 0;
|
||||
static SpaHandleFactory f;
|
||||
static char name[128];
|
||||
int index;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
av_register_all();
|
||||
|
||||
|
|
@ -91,6 +102,8 @@ spa_enum_handle_factory (unsigned int index,
|
|||
if (c == NULL)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
|
||||
*(int*)state = ++index;
|
||||
|
||||
if (av_codec_is_encoder (c)) {
|
||||
snprintf (name, 128, "ffenc_%s", c->name);
|
||||
f.init = ffmpeg_enc_init;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
typedef struct _SpaV4l2Source SpaV4l2Source;
|
||||
|
||||
static const char default_device[] = "/dev/video0";
|
||||
static const char default_device[] = "/dev/video1";
|
||||
|
||||
typedef struct {
|
||||
SpaProps props;
|
||||
|
|
@ -312,32 +312,22 @@ spa_v4l2_source_node_remove_port (SpaHandle *handle,
|
|||
static SpaResult
|
||||
spa_v4l2_source_node_port_enum_formats (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpaFormat **format)
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
void **state)
|
||||
{
|
||||
SpaV4l2Source *this = (SpaV4l2Source *) handle;
|
||||
SpaV4l2State *state;
|
||||
SpaResult res;
|
||||
|
||||
if (handle == NULL || format == NULL)
|
||||
if (handle == NULL || format == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
state = &this->state[port_id];
|
||||
res = spa_v4l2_enum_format (this, format, state);
|
||||
|
||||
/*
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_video_raw_format_init (&state->raw_format[0]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*format = &state->raw_format[0].format;
|
||||
*/
|
||||
|
||||
return spa_v4l2_enum_format (this, format, &state->cookie);
|
||||
return res;
|
||||
}
|
||||
|
||||
static SpaResult
|
||||
|
|
@ -616,7 +606,7 @@ v4l2_source_init (const SpaHandleFactory *factory,
|
|||
this->state[0].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||
this->state[0].status.flags = SPA_PORT_STATUS_FLAG_NONE;
|
||||
|
||||
this->state[0].export_buf = true;
|
||||
this->state[0].export_buf = false;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -631,14 +621,24 @@ static const SpaInterfaceInfo v4l2_source_interfaces[] =
|
|||
|
||||
static SpaResult
|
||||
v4l2_source_enum_interface_info (const SpaHandleFactory *factory,
|
||||
unsigned int index,
|
||||
const SpaInterfaceInfo **info)
|
||||
const SpaInterfaceInfo **info,
|
||||
void **state)
|
||||
{
|
||||
if (index >= 1)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
int index;
|
||||
|
||||
*info = &v4l2_source_interfaces[index];
|
||||
if (factory == NULL || info == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*info = &v4l2_source_interfaces[index];
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ spa_v4l2_open (SpaV4l2Source *this)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static SpaVideoFormat
|
||||
fourcc_to_video_format (uint32_t fourcc)
|
||||
{
|
||||
|
|
@ -169,7 +168,6 @@ fourcc_to_video_format (uint32_t fourcc)
|
|||
}
|
||||
return format;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint32_t
|
||||
video_format_to_fourcc (SpaVideoFormat format)
|
||||
|
|
@ -329,37 +327,17 @@ again:
|
|||
}
|
||||
state->frmival.index++;
|
||||
}
|
||||
fprintf (stderr, "format %c%c%c%c\n", FOURCC_ARGS (state->fmtdesc.pixelformat));
|
||||
if (state->frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
|
||||
fprintf (stderr, "size %dx%d\n", state->frmsize.discrete.width, state->frmsize.discrete.height);
|
||||
} else if (state->frmsize.type == V4L2_FRMSIZE_TYPE_STEPWISE) {
|
||||
fprintf (stderr, "size %dx%d - %dx%d with step %d/%d\n",
|
||||
state->frmsize.stepwise.min_width,
|
||||
state->frmsize.stepwise.min_height,
|
||||
state->frmsize.stepwise.max_width,
|
||||
state->frmsize.stepwise.max_height,
|
||||
state->frmsize.stepwise.step_width,
|
||||
state->frmsize.stepwise.step_height);
|
||||
}
|
||||
if (state->frmival.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
|
||||
fprintf (stderr, "framerate %u/%u\n",
|
||||
state->frmival.discrete.numerator,
|
||||
state->frmival.discrete.denominator);
|
||||
} else if (state->frmival.type == V4L2_FRMIVAL_TYPE_CONTINUOUS) {
|
||||
fprintf (stderr, "framerate %u/%u - %u/%u\n",
|
||||
state->frmival.stepwise.min.numerator,
|
||||
state->frmival.stepwise.min.denominator,
|
||||
state->frmival.stepwise.max.numerator,
|
||||
state->frmival.stepwise.max.denominator);
|
||||
} else if (state->frmival.type == V4L2_FRMIVAL_TYPE_STEPWISE) {
|
||||
fprintf (stderr, "framerate %u/%u - %u/%u step %u/%u\n",
|
||||
state->frmival.stepwise.min.numerator,
|
||||
state->frmival.stepwise.min.denominator,
|
||||
state->frmival.stepwise.max.numerator,
|
||||
state->frmival.stepwise.max.denominator,
|
||||
state->frmival.stepwise.step.numerator,
|
||||
state->frmival.stepwise.step.denominator);
|
||||
}
|
||||
|
||||
spa_video_raw_format_init (&state->raw_format[0]);
|
||||
state->raw_format[0].info.format = fourcc_to_video_format (state->fmtdesc.pixelformat);
|
||||
state->raw_format[0].info.size.width = state->frmsize.discrete.width;
|
||||
state->raw_format[0].info.size.height = state->frmsize.discrete.height;
|
||||
state->raw_format[0].info.framerate.num = state->frmival.discrete.numerator;
|
||||
state->raw_format[0].info.framerate.denom = state->frmival.discrete.denominator;
|
||||
state->raw_format[0].unset_mask &= ~((1<<0)|(1<<1)|(1<<2));
|
||||
|
||||
*format = &state->raw_format[0].format;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
@ -381,8 +359,8 @@ spa_v4l2_set_format (SpaV4l2Source *this, SpaFormat *format, bool try_only)
|
|||
SpaVideoRawFormat *f = (SpaVideoRawFormat *) format;
|
||||
|
||||
fmt.fmt.pix.pixelformat = video_format_to_fourcc (f->info.format);
|
||||
fmt.fmt.pix.width = f->info.width;
|
||||
fmt.fmt.pix.height = f->info.height;
|
||||
fmt.fmt.pix.width = f->info.size.width;
|
||||
fmt.fmt.pix.height = f->info.size.height;
|
||||
fmt.fmt.pix.field = V4L2_FIELD_ANY;
|
||||
streamparm.parm.capture.timeperframe.numerator = f->info.framerate.denom;
|
||||
streamparm.parm.capture.timeperframe.denominator = f->info.framerate.num;
|
||||
|
|
|
|||
|
|
@ -23,12 +23,16 @@
|
|||
extern const SpaHandleFactory spa_v4l2_source_factory;
|
||||
|
||||
SpaResult
|
||||
spa_enum_handle_factory (unsigned int index,
|
||||
const SpaHandleFactory **factory)
|
||||
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||
void **state)
|
||||
{
|
||||
if (factory == NULL)
|
||||
int index;
|
||||
|
||||
if (factory == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*factory = &spa_v4l2_source_factory;
|
||||
|
|
@ -36,5 +40,7 @@ spa_enum_handle_factory (unsigned int index,
|
|||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,18 +23,24 @@
|
|||
extern const SpaHandleFactory spa_volume_factory;
|
||||
|
||||
SpaResult
|
||||
spa_enum_handle_factory (unsigned int index,
|
||||
const SpaHandleFactory **factory)
|
||||
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||
void **state)
|
||||
{
|
||||
if (factory == NULL)
|
||||
int index;
|
||||
|
||||
if (factory == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*factory = &spa_volume_factory;
|
||||
*factory = &spa_volume_factory;
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,17 +259,21 @@ spa_volume_node_remove_port (SpaHandle *handle,
|
|||
static SpaResult
|
||||
spa_volume_node_port_enum_formats (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpaFormat **format)
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
void **state)
|
||||
{
|
||||
SpaVolume *this = (SpaVolume *) handle;
|
||||
int index;
|
||||
|
||||
if (handle == NULL || format == NULL)
|
||||
if (handle == NULL || format == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_audio_raw_format_init (&this->query_format);
|
||||
|
|
@ -278,6 +282,7 @@ spa_volume_node_port_enum_formats (SpaHandle *handle,
|
|||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*format = &this->query_format.format;
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -636,13 +641,24 @@ static const SpaInterfaceInfo volume_interfaces[] =
|
|||
|
||||
static SpaResult
|
||||
volume_enum_interface_info (const SpaHandleFactory *factory,
|
||||
unsigned int index,
|
||||
const SpaInterfaceInfo **info)
|
||||
const SpaInterfaceInfo **info,
|
||||
void **state)
|
||||
{
|
||||
if (index >= 1)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
int index;
|
||||
|
||||
*info = &volume_interfaces[index];
|
||||
if (factory == NULL || info == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*info = &volume_interfaces[index];
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,17 +288,21 @@ spa_xv_sink_node_remove_port (SpaHandle *handle,
|
|||
static SpaResult
|
||||
spa_xv_sink_node_port_enum_formats (SpaHandle *handle,
|
||||
uint32_t port_id,
|
||||
unsigned int index,
|
||||
SpaFormat **format)
|
||||
SpaFormat **format,
|
||||
const SpaFormat *filter,
|
||||
void **state)
|
||||
{
|
||||
SpaXvSink *this = (SpaXvSink *) handle;
|
||||
int index;
|
||||
|
||||
if (handle == NULL || format == NULL)
|
||||
if (handle == NULL || format == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
if (port_id != 0)
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
spa_video_raw_format_init (&this->raw_format[0]);
|
||||
|
|
@ -307,6 +311,7 @@ spa_xv_sink_node_port_enum_formats (SpaHandle *handle,
|
|||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*format = &this->raw_format[0].format;
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -582,14 +587,24 @@ static const SpaInterfaceInfo xv_sink_interfaces[] =
|
|||
|
||||
static SpaResult
|
||||
xv_sink_enum_interface_info (const SpaHandleFactory *factory,
|
||||
unsigned int index,
|
||||
const SpaInterfaceInfo **info)
|
||||
const SpaInterfaceInfo **info,
|
||||
void **state)
|
||||
{
|
||||
if (index >= 1)
|
||||
return SPA_RESULT_ENUM_END;
|
||||
int index;
|
||||
|
||||
*info = &xv_sink_interfaces[index];
|
||||
if (factory == NULL || info == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*info = &xv_sink_interfaces[index];
|
||||
break;
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,16 @@
|
|||
extern const SpaHandleFactory spa_xv_sink_factory;
|
||||
|
||||
SpaResult
|
||||
spa_enum_handle_factory (unsigned int index,
|
||||
const SpaHandleFactory **factory)
|
||||
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||
void **state)
|
||||
{
|
||||
if (factory == NULL)
|
||||
int index;
|
||||
|
||||
if (factory == NULL || state == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
||||
index = (*state == NULL ? 0 : *(int*)state);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
*factory = &spa_xv_sink_factory;
|
||||
|
|
@ -36,5 +40,7 @@ spa_enum_handle_factory (unsigned int index,
|
|||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
*(int*)state = ++index;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
|
|||
void *hnd;
|
||||
SpaEnumHandleFactoryFunc enum_func;
|
||||
unsigned int i;
|
||||
void *state = NULL;
|
||||
|
||||
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
|
||||
printf ("can't load %s: %s\n", lib, dlerror());
|
||||
|
|
@ -67,7 +68,7 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
|
|||
const SpaHandleFactory *factory;
|
||||
const void *iface;
|
||||
|
||||
if ((res = enum_func (i, &factory)) < 0) {
|
||||
if ((res = enum_func (&factory, &state)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf ("can't enumerate factories: %d\n", res);
|
||||
break;
|
||||
|
|
@ -234,8 +235,9 @@ negotiate_formats (AppData *data)
|
|||
SpaProps *props;
|
||||
uint32_t val;
|
||||
SpaPropValue value;
|
||||
void *state = NULL;
|
||||
|
||||
if ((res = data->sink_node->port_enum_formats (data->sink, 0, 0, &format)) < 0)
|
||||
if ((res = data->sink_node->port_enum_formats (data->sink, 0, &format, NULL, &state)) < 0)
|
||||
return res;
|
||||
|
||||
props = &format->props;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#include <spa/debug.h>
|
||||
#include <spa/video/format.h>
|
||||
|
||||
#undef USE_BUFFER
|
||||
#define USE_BUFFER
|
||||
|
||||
#define MAX_BUFFERS 8
|
||||
|
||||
|
|
@ -66,6 +66,7 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
|
|||
void *hnd;
|
||||
SpaEnumHandleFactoryFunc enum_func;
|
||||
unsigned int i;
|
||||
void *state = NULL;
|
||||
|
||||
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
|
||||
printf ("can't load %s: %s\n", lib, dlerror());
|
||||
|
|
@ -80,7 +81,7 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
|
|||
const SpaHandleFactory *factory;
|
||||
const void *iface;
|
||||
|
||||
if ((res = enum_func (i, &factory)) < 0) {
|
||||
if ((res = enum_func (&factory, &state)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf ("can't enumerate factories: %d\n", res);
|
||||
break;
|
||||
|
|
@ -251,7 +252,7 @@ alloc_buffers (AppData *data)
|
|||
b->metas[0].data = &b->header;
|
||||
b->metas[0].size = sizeof (b->header);
|
||||
|
||||
b->ptr.type = "SDL_Texture";
|
||||
b->ptr.ptr_type = "SDL_Texture";
|
||||
b->ptr.ptr = texture;
|
||||
b->metas[1].type = SPA_META_TYPE_POINTER;
|
||||
b->metas[1].data = &b->ptr;
|
||||
|
|
@ -278,8 +279,10 @@ negotiate_formats (AppData *data)
|
|||
SpaFraction frac;
|
||||
SpaPropValue value;
|
||||
const SpaPortInfo *info;
|
||||
SpaRectangle size;
|
||||
void *state = NULL;
|
||||
|
||||
if ((res = data->source_node->port_enum_formats (data->source, 0, 0, &format)) < 0)
|
||||
if ((res = data->source_node->port_enum_formats (data->source, 0, &format, NULL, &state)) < 0)
|
||||
return res;
|
||||
|
||||
props = &format->props;
|
||||
|
|
@ -291,19 +294,21 @@ negotiate_formats (AppData *data)
|
|||
val = SPA_VIDEO_FORMAT_YUY2;
|
||||
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FORMAT), &value)) < 0)
|
||||
return res;
|
||||
val = 320;
|
||||
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_WIDTH), &value)) < 0)
|
||||
return res;
|
||||
val = 240;
|
||||
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_HEIGHT), &value)) < 0)
|
||||
|
||||
value.type = SPA_PROP_TYPE_RECTANGLE;
|
||||
value.size = sizeof (SpaRectangle);
|
||||
value.value = &size;
|
||||
size.width = 320;
|
||||
size.height = 240;
|
||||
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_SIZE), &value)) < 0)
|
||||
return res;
|
||||
|
||||
value.type = SPA_PROP_TYPE_FRACTION;
|
||||
value.size = sizeof (SpaFraction);
|
||||
value.value = &frac;
|
||||
|
||||
frac.num = 25;
|
||||
frac.denom = 1;
|
||||
|
||||
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FRAMERATE), &value)) < 0)
|
||||
return res;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,44 @@
|
|||
|
||||
#include <spa/node.h>
|
||||
|
||||
struct media_type_name {
|
||||
const char *name;
|
||||
} media_type_names[] = {
|
||||
{ "unknown" },
|
||||
{ "audio" },
|
||||
{ "video" },
|
||||
};
|
||||
|
||||
struct media_subtype_name {
|
||||
const char *name;
|
||||
} media_subtype_names[] = {
|
||||
{ "unknown" },
|
||||
{ "raw" },
|
||||
};
|
||||
|
||||
struct prop_type_name {
|
||||
const char *name;
|
||||
const char *CCName;
|
||||
} prop_type_names[] = {
|
||||
{ "invalid", "*Invalid*" },
|
||||
{ "bool", "Boolean" },
|
||||
{ "int8", "Int8" },
|
||||
{ "uint8", "UInt8" },
|
||||
{ "int16", "Int16" },
|
||||
{ "uint16", "UInt16" },
|
||||
{ "int32", "Int32" },
|
||||
{ "uint32", "UInt32" },
|
||||
{ "int64", "Int64" },
|
||||
{ "uint64", "UInt64" },
|
||||
{ "float", "Float" },
|
||||
{ "double", "Double" },
|
||||
{ "string", "String" },
|
||||
{ "rectangle", "Rectangle" },
|
||||
{ "fraction", "Fraction" },
|
||||
{ "bitmask", "Bitmask" },
|
||||
{ "pointer", "Pointer" },
|
||||
};
|
||||
|
||||
static void
|
||||
print_value (SpaPropType type, int size, const void *value)
|
||||
{
|
||||
|
|
@ -68,9 +106,12 @@ print_value (SpaPropType type, int size, const void *value)
|
|||
case SPA_PROP_TYPE_STRING:
|
||||
printf ("\"%s\"", (char *)value);
|
||||
break;
|
||||
case SPA_PROP_TYPE_POINTER:
|
||||
printf ("%p", value);
|
||||
case SPA_PROP_TYPE_RECTANGLE:
|
||||
{
|
||||
const SpaRectangle *r = value;
|
||||
printf ("%"PRIu32"x%"PRIu32, r->width, r->height);
|
||||
break;
|
||||
}
|
||||
case SPA_PROP_TYPE_FRACTION:
|
||||
{
|
||||
const SpaFraction *f = value;
|
||||
|
|
@ -79,9 +120,8 @@ print_value (SpaPropType type, int size, const void *value)
|
|||
}
|
||||
case SPA_PROP_TYPE_BITMASK:
|
||||
break;
|
||||
case SPA_PROP_TYPE_BYTES:
|
||||
break;
|
||||
case SPA_PROP_TYPE_STRUCT:
|
||||
case SPA_PROP_TYPE_POINTER:
|
||||
printf ("%p", value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -113,66 +153,7 @@ print_props (const SpaProps *props, int print_ranges)
|
|||
printf ("deprecated ");
|
||||
printf ("\n");
|
||||
|
||||
printf ("%-23.23s ", "");
|
||||
switch (info->type) {
|
||||
case SPA_PROP_TYPE_INVALID:
|
||||
printf ("Invalid.");
|
||||
break;
|
||||
case SPA_PROP_TYPE_BOOL:
|
||||
printf ("Boolean. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_INT8:
|
||||
printf ("Int8. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_UINT8:
|
||||
printf ("UInt8. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_INT16:
|
||||
printf ("Int16. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_UINT16:
|
||||
printf ("UInt16. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_INT32:
|
||||
printf ("Int32. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_UINT32:
|
||||
printf ("UInt32. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_INT64:
|
||||
printf ("Int64. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_UINT64:
|
||||
printf ("UInt64. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_FLOAT:
|
||||
printf ("Float. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_DOUBLE:
|
||||
printf ("Double. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_STRING:
|
||||
printf ("String. Maxsize %zd. ", info->maxsize);
|
||||
break;
|
||||
case SPA_PROP_TYPE_POINTER:
|
||||
printf ("Pointer. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_FRACTION:
|
||||
printf ("Fraction. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_BITMASK:
|
||||
printf ("Bitmask. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_BYTES:
|
||||
printf ("Bytes. ");
|
||||
break;
|
||||
case SPA_PROP_TYPE_STRUCT:
|
||||
printf ("Struct. ");
|
||||
break;
|
||||
default:
|
||||
printf ("*Unknown Property Type*. ");
|
||||
break;
|
||||
}
|
||||
printf ("%-23.23s %s. ", "", prop_type_names[info->type].CCName);
|
||||
|
||||
printf ("Default: ");
|
||||
if (info->default_value)
|
||||
|
|
@ -191,6 +172,9 @@ print_props (const SpaProps *props, int print_ranges)
|
|||
printf ("Error %d", res);
|
||||
printf (".\n");
|
||||
|
||||
if (!print_ranges)
|
||||
continue;
|
||||
|
||||
if (info->range_type != SPA_PROP_RANGE_TYPE_NONE) {
|
||||
printf ("%-23.23s ", "");
|
||||
switch (info->range_type) {
|
||||
|
|
@ -230,11 +214,34 @@ print_props (const SpaProps *props, int print_ranges)
|
|||
}
|
||||
|
||||
static void
|
||||
print_format (const SpaFormat *format, int print_ranges)
|
||||
print_format (const SpaFormat *format)
|
||||
{
|
||||
printf ("media-type:\t\t%d\n", format->media_type);
|
||||
printf ("media-subtype:\t\t%d\n", format->media_subtype);
|
||||
print_props (&format->props, print_ranges);
|
||||
const SpaProps *props = &format->props;
|
||||
int i;
|
||||
|
||||
printf (" %-10s %s/%s\n", "", media_type_names[format->media_type].name,
|
||||
media_subtype_names[format->media_subtype].name);
|
||||
|
||||
for (i = 0; i < props->n_prop_info; i++) {
|
||||
const SpaPropInfo *info = &props->prop_info[i];
|
||||
SpaPropValue value;
|
||||
SpaResult res;
|
||||
|
||||
res = props->get_prop (props, i, &value);
|
||||
|
||||
if (res == SPA_RESULT_PROPERTY_UNSET && info->flags & SPA_PROP_FLAG_OPTIONAL)
|
||||
continue;
|
||||
|
||||
printf (" %20s : (%s) ", info->name, prop_type_names[info->type].name);
|
||||
if (res == SPA_RESULT_OK) {
|
||||
print_value (info->type, value.size, value.value);
|
||||
} else if (res == SPA_RESULT_PROPERTY_UNSET) {
|
||||
printf ("Unset");
|
||||
} else {
|
||||
printf ("*Error*");
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -242,8 +249,9 @@ inspect_node (const SpaNode *node, SpaHandle *handle)
|
|||
{
|
||||
SpaResult res;
|
||||
SpaProps *props;
|
||||
unsigned int n_input, max_input, n_output, max_output, i;
|
||||
unsigned int n_input, max_input, n_output, max_output;
|
||||
SpaFormat *format;
|
||||
void *state = NULL;
|
||||
|
||||
if ((res = node->get_props (handle, &props)) < 0)
|
||||
printf ("can't get properties: %d\n", res);
|
||||
|
|
@ -255,14 +263,14 @@ inspect_node (const SpaNode *node, SpaHandle *handle)
|
|||
else
|
||||
printf ("supported ports %d %d %d %d\n", n_input, max_input, n_output, max_output);
|
||||
|
||||
for (i = 0; ; i++) {
|
||||
if ((res = node->port_enum_formats (handle, 0, i, &format)) < 0) {
|
||||
while (true) {
|
||||
if ((res = node->port_enum_formats (handle, 0, &format, NULL, &state)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf ("got error %d\n", res);
|
||||
break;
|
||||
}
|
||||
if (format)
|
||||
print_format (format, 1);
|
||||
print_format (format);
|
||||
}
|
||||
if ((res = node->port_get_props (handle, 0, &props)) < 0)
|
||||
printf ("port_get_props error: %d\n", res);
|
||||
|
|
@ -274,9 +282,9 @@ static void
|
|||
inspect_factory (const SpaHandleFactory *factory)
|
||||
{
|
||||
SpaResult res;
|
||||
unsigned int i;
|
||||
SpaHandle *handle;
|
||||
const void *interface;
|
||||
void *state = NULL;
|
||||
|
||||
printf ("factory name:\t\t'%s'\n", factory->name);
|
||||
printf ("factory info:\n");
|
||||
|
|
@ -293,16 +301,16 @@ inspect_factory (const SpaHandleFactory *factory)
|
|||
|
||||
printf ("factory interfaces:\n");
|
||||
|
||||
for (i = 0; ; i++) {
|
||||
while (true) {
|
||||
const SpaInterfaceInfo *info;
|
||||
|
||||
if ((res = factory->enum_interface_info (factory, i, &info)) < 0) {
|
||||
if ((res = factory->enum_interface_info (factory, &info, &state)) < 0) {
|
||||
if (res == SPA_RESULT_ENUM_END)
|
||||
break;
|
||||
else
|
||||
printf ("can't enumerate interfaces: %d\n", res);
|
||||
}
|
||||
printf (" interface: %d, (%d) '%s' : '%s'\n", i, info->interface_id, info->name, info->description);
|
||||
printf (" interface: (%d) '%s' : '%s'\n", info->interface_id, info->name, info->description);
|
||||
|
||||
if ((res = handle->get_interface (handle, info->interface_id, &interface)) < 0) {
|
||||
printf ("can't get interface: %d\n", res);
|
||||
|
|
@ -326,7 +334,7 @@ main (int argc, char *argv[])
|
|||
SpaResult res;
|
||||
void *handle;
|
||||
SpaEnumHandleFactoryFunc enum_func;
|
||||
unsigned int i;
|
||||
void *state = NULL;
|
||||
|
||||
if ((handle = dlopen (argv[1], RTLD_NOW)) == NULL) {
|
||||
printf ("can't load %s\n", argv[1]);
|
||||
|
|
@ -337,10 +345,10 @@ main (int argc, char *argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; ;i++) {
|
||||
while (true) {
|
||||
const SpaHandleFactory *factory;
|
||||
|
||||
if ((res = enum_func (i, &factory)) < 0) {
|
||||
if ((res = enum_func (&factory, &state)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf ("can't enumerate factories: %d\n", res);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue