mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -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)
|
make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char *name)
|
||||||
{
|
{
|
||||||
SpaResult res;
|
SpaResult res;
|
||||||
void *hnd;
|
void *hnd, *state;
|
||||||
SpaEnumHandleFactoryFunc enum_func;
|
SpaEnumHandleFactoryFunc enum_func;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,12 +240,14 @@ struct _SpaNode {
|
||||||
* SpaNode::port_enum_formats:
|
* SpaNode::port_enum_formats:
|
||||||
* @handle: a #SpaHandle
|
* @handle: a #SpaHandle
|
||||||
* @port_id: the port to query
|
* @port_id: the port to query
|
||||||
* @index: the format index to retrieve
|
|
||||||
* @format: pointer to a format
|
* @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.
|
* returns #SPA_RESULT_ENUM_END.
|
||||||
*
|
*
|
||||||
* The result format can be queried and modified and ultimately be used
|
* The result format can be queried and modified and ultimately be used
|
||||||
|
|
@ -254,13 +256,13 @@ struct _SpaNode {
|
||||||
* Returns: #SPA_RESULT_OK on success
|
* Returns: #SPA_RESULT_OK on success
|
||||||
* #SPA_RESULT_INVALID_ARGUMENTS when node or format is %NULL
|
* #SPA_RESULT_INVALID_ARGUMENTS when node or format is %NULL
|
||||||
* #SPA_RESULT_INVALID_PORT when port_id is not valid
|
* #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,
|
SpaResult (*port_enum_formats) (SpaHandle *handle,
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
unsigned int index,
|
SpaFormat **format,
|
||||||
SpaFormat **format);
|
const SpaFormat *filter,
|
||||||
|
void **state);
|
||||||
/**
|
/**
|
||||||
* SpaNode::port_set_format:
|
* SpaNode::port_set_format:
|
||||||
* @handle: a #SpaHandle
|
* @handle: a #SpaHandle
|
||||||
|
|
|
||||||
|
|
@ -102,10 +102,10 @@ struct _SpaHandleFactory {
|
||||||
/**
|
/**
|
||||||
* SpaHandle::enum_interface_info:
|
* SpaHandle::enum_interface_info:
|
||||||
* @factory: a #SpaHandleFactory
|
* @factory: a #SpaHandleFactory
|
||||||
* @index: the interface index
|
|
||||||
* @info: result to hold SpaInterfaceInfo.
|
* @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
|
* Returns: #SPA_RESULT_OK on success
|
||||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no interfaces
|
* #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
|
* #SPA_RESULT_ENUM_END when there are no more infos
|
||||||
*/
|
*/
|
||||||
SpaResult (*enum_interface_info) (const SpaHandleFactory *factory,
|
SpaResult (*enum_interface_info) (const SpaHandleFactory *factory,
|
||||||
unsigned int index,
|
const SpaInterfaceInfo **info,
|
||||||
const SpaInterfaceInfo **info);
|
void **state);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SpaEnumHandleFactoryFunc:
|
* SpaEnumHandleFactoryFunc:
|
||||||
* @index: the index to enumerate
|
|
||||||
* @factory: a location to hold the factory result
|
* @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.
|
* 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_INVALID_ARGUMENTS when factory is %NULL
|
||||||
* #SPA_RESULT_ENUM_END when there are no more factories
|
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||||
*/
|
*/
|
||||||
typedef SpaResult (*SpaEnumHandleFactoryFunc) (unsigned int index,
|
typedef SpaResult (*SpaEnumHandleFactoryFunc) (const SpaHandleFactory **factory,
|
||||||
const SpaHandleFactory **factory);
|
void **state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spa_enum_handle_factory:
|
* spa_enum_handle_factory:
|
||||||
* @index: the index to enumerate
|
|
||||||
* @factory: a location to hold the factory result
|
* @factory: a location to hold the factory result
|
||||||
|
* @state: state to keep track of the enumeration
|
||||||
*
|
*
|
||||||
* The entry point in a plugin.
|
* 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_INVALID_ARGUMENTS when factory is %NULL
|
||||||
* #SPA_RESULT_ENUM_END when there are no more factories
|
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||||
*/
|
*/
|
||||||
SpaResult spa_enum_handle_factory (unsigned int index,
|
SpaResult spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||||
const SpaHandleFactory **factory);
|
void **state);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,17 @@ typedef enum {
|
||||||
SPA_PROP_TYPE_FLOAT,
|
SPA_PROP_TYPE_FLOAT,
|
||||||
SPA_PROP_TYPE_DOUBLE,
|
SPA_PROP_TYPE_DOUBLE,
|
||||||
SPA_PROP_TYPE_STRING,
|
SPA_PROP_TYPE_STRING,
|
||||||
SPA_PROP_TYPE_POINTER,
|
SPA_PROP_TYPE_RECTANGLE,
|
||||||
SPA_PROP_TYPE_FRACTION,
|
SPA_PROP_TYPE_FRACTION,
|
||||||
SPA_PROP_TYPE_BITMASK,
|
SPA_PROP_TYPE_BITMASK,
|
||||||
SPA_PROP_TYPE_BYTES,
|
SPA_PROP_TYPE_POINTER
|
||||||
SPA_PROP_TYPE_STRUCT,
|
|
||||||
} SpaPropType;
|
} SpaPropType;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t width;
|
||||||
|
uint32_t height;
|
||||||
|
} SpaRectangle;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t num;
|
uint32_t num;
|
||||||
uint32_t denom;
|
uint32_t denom;
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,7 @@ typedef struct _SpaVideoRawFormat SpaVideoRawFormat;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SPA_PROP_ID_VIDEO_FORMAT = SPA_PROP_ID_MEDIA_CUSTOM_START,
|
SPA_PROP_ID_VIDEO_FORMAT = SPA_PROP_ID_MEDIA_CUSTOM_START,
|
||||||
SPA_PROP_ID_VIDEO_WIDTH,
|
SPA_PROP_ID_VIDEO_SIZE,
|
||||||
SPA_PROP_ID_VIDEO_HEIGHT,
|
|
||||||
SPA_PROP_ID_VIDEO_FRAMERATE,
|
SPA_PROP_ID_VIDEO_FRAMERATE,
|
||||||
SPA_PROP_ID_VIDEO_MAX_FRAMERATE,
|
SPA_PROP_ID_VIDEO_MAX_FRAMERATE,
|
||||||
SPA_PROP_ID_VIDEO_VIEWS,
|
SPA_PROP_ID_VIDEO_VIEWS,
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,7 @@ typedef enum {
|
||||||
/**
|
/**
|
||||||
* SpaVideoRawInfo:
|
* SpaVideoRawInfo:
|
||||||
* @format: the format
|
* @format: the format
|
||||||
* @width: the width of the video
|
* @size: the frame size of the video
|
||||||
* @height: the height of the video
|
|
||||||
* @framerate: the framerate of the video 0/1 means variable rate
|
* @framerate: the framerate of the video 0/1 means variable rate
|
||||||
* @max_framerate: the maximum framerate of the video. This is only valid when
|
* @max_framerate: the maximum framerate of the video. This is only valid when
|
||||||
* @framerate is 0/1
|
* @framerate is 0/1
|
||||||
|
|
@ -168,8 +167,7 @@ typedef enum {
|
||||||
*/
|
*/
|
||||||
struct _SpaVideoRawInfo {
|
struct _SpaVideoRawInfo {
|
||||||
SpaVideoFormat format;
|
SpaVideoFormat format;
|
||||||
unsigned int width;
|
SpaRectangle size;
|
||||||
unsigned int height;
|
|
||||||
SpaFraction framerate;
|
SpaFraction framerate;
|
||||||
SpaFraction max_framerate;
|
SpaFraction max_framerate;
|
||||||
unsigned int views;
|
unsigned int views;
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ static const SpaPropInfo raw_format_prop_info[] =
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_AUDIO_RAW_INFO, "info", "the SpaAudioRawInfo structure",
|
{ SPA_PROP_ID_AUDIO_RAW_INFO, "info", "the SpaAudioRawInfo structure",
|
||||||
SPA_PROP_FLAG_READWRITE,
|
SPA_PROP_FLAG_READWRITE,
|
||||||
SPA_PROP_TYPE_STRUCT, sizeof (SpaAudioRawInfo),
|
SPA_PROP_TYPE_POINTER, sizeof (SpaAudioRawInfo),
|
||||||
0, NULL,
|
0, NULL,
|
||||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
||||||
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)
|
if ((res = props->get_prop (props, SPA_PROP_ID_AUDIO_RAW_INFO, &value)) < 0)
|
||||||
goto fallback;
|
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;
|
goto fallback;
|
||||||
|
|
||||||
memcpy (&rawformat->info, value.value, sizeof (SpaAudioRawInfo));
|
memcpy (&rawformat->info, value.value, sizeof (SpaAudioRawInfo));
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,7 @@
|
||||||
|
|
||||||
static const SpaVideoRawInfo default_info = {
|
static const SpaVideoRawInfo default_info = {
|
||||||
SPA_VIDEO_FORMAT_UNKNOWN,
|
SPA_VIDEO_FORMAT_UNKNOWN,
|
||||||
320,
|
{ 320, 240 },
|
||||||
240,
|
|
||||||
{ 0, 1 },
|
{ 0, 1 },
|
||||||
{ 0, 1 },
|
{ 0, 1 },
|
||||||
1,
|
1,
|
||||||
|
|
@ -142,6 +141,14 @@ static const SpaPropRangeInfo format_range[] = {
|
||||||
{ "F64BE", "F64BE", sizeof (uint32_t), &format_values[29] },
|
{ "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[] = {
|
static const uint32_t interlace_modes[] = {
|
||||||
SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE,
|
SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE,
|
||||||
SPA_VIDEO_INTERLACE_MODE_INTERLEAVED,
|
SPA_VIDEO_INTERLACE_MODE_INTERLEAVED,
|
||||||
|
|
@ -341,24 +348,15 @@ static const SpaPropInfo raw_format_prop_info[] =
|
||||||
offsetof (SpaVideoRawFormat, info.format),
|
offsetof (SpaVideoRawFormat, info.format),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 0,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 0,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_WIDTH, "width", "Video width",
|
{ SPA_PROP_ID_VIDEO_SIZE, "size", "Video size",
|
||||||
SPA_PROP_FLAG_READWRITE,
|
SPA_PROP_FLAG_READWRITE,
|
||||||
SPA_PROP_TYPE_UINT32, sizeof (uint32_t),
|
SPA_PROP_TYPE_RECTANGLE, sizeof (SpaRectangle),
|
||||||
sizeof (uint32_t), &default_info.width,
|
sizeof (SpaRectangle), &default_info.size,
|
||||||
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, uint32_range,
|
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, size_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.width),
|
offsetof (SpaVideoRawFormat, info.size),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 1,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 1,
|
||||||
NULL },
|
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_ID_VIDEO_FRAMERATE, "framerate", "Video framerate",
|
||||||
SPA_PROP_FLAG_READWRITE,
|
SPA_PROP_FLAG_READWRITE,
|
||||||
SPA_PROP_TYPE_FRACTION, sizeof (SpaFraction),
|
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,
|
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, framerate_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.framerate),
|
offsetof (SpaVideoRawFormat, info.framerate),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 3,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 2,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_MAX_FRAMERATE, "max-framerate", "Video max framerate",
|
{ SPA_PROP_ID_VIDEO_MAX_FRAMERATE, "max-framerate", "Video max framerate",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, framerate_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.max_framerate),
|
offsetof (SpaVideoRawFormat, info.max_framerate),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 4,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 3,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_VIEWS, "views", "Video number of views",
|
{ SPA_PROP_ID_VIDEO_VIEWS, "views", "Video number of views",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, uint32_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.views),
|
offsetof (SpaVideoRawFormat, info.views),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 5,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 4,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_INTERLACE_MODE, "interlace-mode", "Interlace mode",
|
{ SPA_PROP_ID_VIDEO_INTERLACE_MODE, "interlace-mode", "Interlace mode",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (interlace_mode_range), interlace_mode_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.interlace_mode),
|
offsetof (SpaVideoRawFormat, info.interlace_mode),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 6,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 5,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_PIXEL_ASPECT_RATIO, "pixel-aspect-ratio", "Video pixel aspect ratio",
|
{ SPA_PROP_ID_VIDEO_PIXEL_ASPECT_RATIO, "pixel-aspect-ratio", "Video pixel aspect ratio",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, framerate_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.pixel_aspect_ratio),
|
offsetof (SpaVideoRawFormat, info.pixel_aspect_ratio),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 7,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 6,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_MULTIVIEW_MODE, "multiview-mode", "Multiview mode",
|
{ SPA_PROP_ID_VIDEO_MULTIVIEW_MODE, "multiview-mode", "Multiview mode",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (multiview_mode_range), multiview_mode_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.multiview_mode),
|
offsetof (SpaVideoRawFormat, info.multiview_mode),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 8,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 7,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_MULTIVIEW_FLAGS, "multiview-flags", "Multiview flags",
|
{ SPA_PROP_ID_VIDEO_MULTIVIEW_FLAGS, "multiview-flags", "Multiview flags",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_FLAGS, SPA_N_ELEMENTS (multiview_flags_range), multiview_flags_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.multiview_flags),
|
offsetof (SpaVideoRawFormat, info.multiview_flags),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 9,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 8,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_CHROMA_SITE, "chroma-site", "Chroma site",
|
{ SPA_PROP_ID_VIDEO_CHROMA_SITE, "chroma-site", "Chroma site",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_FLAGS, SPA_N_ELEMENTS (chroma_site_range), chroma_site_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.chroma_site),
|
offsetof (SpaVideoRawFormat, info.chroma_site),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 10,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 9,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_COLOR_RANGE, "color-range", "Color range",
|
{ SPA_PROP_ID_VIDEO_COLOR_RANGE, "color-range", "Color range",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (color_range_range), color_range_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.color_range),
|
offsetof (SpaVideoRawFormat, info.color_range),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 11,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 10,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_COLOR_MATRIX, "color-matrix", "Color matrix",
|
{ SPA_PROP_ID_VIDEO_COLOR_MATRIX, "color-matrix", "Color matrix",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (color_matrix_range), color_matrix_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.color_matrix),
|
offsetof (SpaVideoRawFormat, info.color_matrix),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 12,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 11,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_TRANSFER_FUNCTION, "transfer-function", "Transfer function",
|
{ SPA_PROP_ID_VIDEO_TRANSFER_FUNCTION, "transfer-function", "Transfer function",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (transfer_function_range), transfer_function_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.transfer_function),
|
offsetof (SpaVideoRawFormat, info.transfer_function),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 13,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 12,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_COLOR_PRIMARIES, "color-primaries", "Color primaries",
|
{ SPA_PROP_ID_VIDEO_COLOR_PRIMARIES, "color-primaries", "Color primaries",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
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,
|
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (color_primaries_range), color_primaries_range,
|
||||||
NULL,
|
NULL,
|
||||||
offsetof (SpaVideoRawFormat, info.color_primaries),
|
offsetof (SpaVideoRawFormat, info.color_primaries),
|
||||||
offsetof (SpaVideoRawFormat, unset_mask), 1 << 14,
|
offsetof (SpaVideoRawFormat, unset_mask), 1 << 13,
|
||||||
NULL },
|
NULL },
|
||||||
{ SPA_PROP_ID_VIDEO_RAW_INFO, "info", "the SpaVideoRawInfo structure",
|
{ SPA_PROP_ID_VIDEO_RAW_INFO, "info", "the SpaVideoRawInfo structure",
|
||||||
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
SPA_PROP_FLAG_READWRITE | SPA_PROP_FLAG_OPTIONAL,
|
||||||
SPA_PROP_TYPE_STRUCT, sizeof (SpaVideoRawInfo),
|
SPA_PROP_TYPE_POINTER, sizeof (SpaVideoRawInfo),
|
||||||
0, NULL,
|
0, NULL,
|
||||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
||||||
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.prop_info = raw_format_prop_info;
|
||||||
format->format.props.set_prop = spa_props_generic_set_prop;
|
format->format.props.set_prop = spa_props_generic_set_prop;
|
||||||
format->format.props.get_prop = spa_props_generic_get_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;
|
format->info = default_info;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
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)
|
if ((res = props->get_prop (props, SPA_PROP_ID_VIDEO_RAW_INFO, &value)) < 0)
|
||||||
goto fallback;
|
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;
|
goto fallback;
|
||||||
|
|
||||||
memcpy (&rawformat->info, value.value, sizeof (SpaVideoRawInfo));
|
memcpy (&rawformat->info, value.value, sizeof (SpaVideoRawInfo));
|
||||||
|
|
|
||||||
|
|
@ -333,17 +333,21 @@ spa_alsa_sink_node_remove_port (SpaHandle *handle,
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_alsa_sink_node_port_enum_formats (SpaHandle *handle,
|
spa_alsa_sink_node_port_enum_formats (SpaHandle *handle,
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
unsigned int index,
|
SpaFormat **format,
|
||||||
SpaFormat **format)
|
const SpaFormat *filter,
|
||||||
|
void **state)
|
||||||
{
|
{
|
||||||
SpaALSASink *this = (SpaALSASink *) handle;
|
SpaALSASink *this = (SpaALSASink *) handle;
|
||||||
|
int index;
|
||||||
|
|
||||||
if (handle == NULL || format == NULL)
|
if (handle == NULL || format == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
if (port_id != 0)
|
if (port_id != 0)
|
||||||
return SPA_RESULT_INVALID_PORT;
|
return SPA_RESULT_INVALID_PORT;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
spa_audio_raw_format_init (&this->query_format);
|
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;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
*format = &this->query_format.format;
|
*format = &this->query_format.format;
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -608,13 +613,24 @@ static const SpaInterfaceInfo alsa_sink_interfaces[] =
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
alsa_sink_enum_interface_info (const SpaHandleFactory *factory,
|
alsa_sink_enum_interface_info (const SpaHandleFactory *factory,
|
||||||
unsigned int index,
|
const SpaInterfaceInfo **info,
|
||||||
const SpaInterfaceInfo **info)
|
void **state)
|
||||||
{
|
{
|
||||||
if (index >= 1)
|
int index;
|
||||||
return SPA_RESULT_ENUM_END;
|
|
||||||
|
|
||||||
|
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];
|
*info = &alsa_sink_interfaces[index];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return SPA_RESULT_ENUM_END;
|
||||||
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,16 @@
|
||||||
extern const SpaHandleFactory spa_alsa_sink_factory;
|
extern const SpaHandleFactory spa_alsa_sink_factory;
|
||||||
|
|
||||||
SpaResult
|
SpaResult
|
||||||
spa_enum_handle_factory (unsigned int index,
|
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||||
const SpaHandleFactory **factory)
|
void **state)
|
||||||
{
|
{
|
||||||
if (factory == NULL)
|
int index;
|
||||||
|
|
||||||
|
if (factory == NULL || state == NULL)
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
*factory = &spa_alsa_sink_factory;
|
*factory = &spa_alsa_sink_factory;
|
||||||
|
|
@ -36,5 +40,6 @@ spa_enum_handle_factory (unsigned int index,
|
||||||
default:
|
default:
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
|
*(int*)state = index++;
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -301,17 +301,21 @@ spa_audiomixer_node_remove_port (SpaHandle *handle,
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_audiomixer_node_port_enum_formats (SpaHandle *handle,
|
spa_audiomixer_node_port_enum_formats (SpaHandle *handle,
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
unsigned int index,
|
SpaFormat **format,
|
||||||
SpaFormat **format)
|
const SpaFormat *filter,
|
||||||
|
void **state)
|
||||||
{
|
{
|
||||||
SpaAudioMixer *this = (SpaAudioMixer *) handle;
|
SpaAudioMixer *this = (SpaAudioMixer *) handle;
|
||||||
|
int index;
|
||||||
|
|
||||||
if (handle == NULL || format == NULL)
|
if (handle == NULL || format == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
if (port_id > MAX_PORTS)
|
if (port_id > MAX_PORTS)
|
||||||
return SPA_RESULT_INVALID_PORT;
|
return SPA_RESULT_INVALID_PORT;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
spa_audio_raw_format_init (&this->query_format);
|
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;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
*format = &this->query_format.format;
|
*format = &this->query_format.format;
|
||||||
|
*(int*)state = index++;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -771,14 +776,24 @@ static const SpaInterfaceInfo audiomixer_interfaces[] =
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
audiomixer_enum_interface_info (const SpaHandleFactory *factory,
|
audiomixer_enum_interface_info (const SpaHandleFactory *factory,
|
||||||
unsigned int index,
|
const SpaInterfaceInfo **info,
|
||||||
const SpaInterfaceInfo **info)
|
void **state)
|
||||||
{
|
{
|
||||||
if (index >= 1)
|
int index;
|
||||||
return SPA_RESULT_ENUM_END;
|
|
||||||
|
|
||||||
|
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];
|
*info = &audiomixer_interfaces[index];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return SPA_RESULT_ENUM_END;
|
||||||
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,16 @@
|
||||||
extern const SpaHandleFactory spa_audiomixer_factory;
|
extern const SpaHandleFactory spa_audiomixer_factory;
|
||||||
|
|
||||||
SpaResult
|
SpaResult
|
||||||
spa_enum_handle_factory (unsigned int index,
|
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||||
const SpaHandleFactory **factory)
|
void **state)
|
||||||
{
|
{
|
||||||
if (factory == NULL)
|
int index;
|
||||||
|
|
||||||
|
if (factory == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
*factory = &spa_audiomixer_factory;
|
*factory = &spa_audiomixer_factory;
|
||||||
|
|
@ -36,5 +40,6 @@ spa_enum_handle_factory (unsigned int index,
|
||||||
default:
|
default:
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -278,17 +278,21 @@ spa_audiotestsrc_node_remove_port (SpaHandle *handle,
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_audiotestsrc_node_port_enum_formats (SpaHandle *handle,
|
spa_audiotestsrc_node_port_enum_formats (SpaHandle *handle,
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
unsigned int index,
|
SpaFormat **format,
|
||||||
SpaFormat **format)
|
const SpaFormat *filter,
|
||||||
|
void **state)
|
||||||
{
|
{
|
||||||
SpaAudioTestSrc *this = (SpaAudioTestSrc *) handle;
|
SpaAudioTestSrc *this = (SpaAudioTestSrc *) handle;
|
||||||
|
int index;
|
||||||
|
|
||||||
if (handle == NULL || format == NULL)
|
if (handle == NULL || format == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
if (port_id != 0)
|
if (port_id != 0)
|
||||||
return SPA_RESULT_INVALID_PORT;
|
return SPA_RESULT_INVALID_PORT;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
spa_audio_raw_format_init (&this->query_format);
|
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;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
*format = &this->query_format.format;
|
*format = &this->query_format.format;
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -557,14 +562,24 @@ static const SpaInterfaceInfo audiotestsrc_interfaces[] =
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
audiotestsrc_enum_interface_info (const SpaHandleFactory *factory,
|
audiotestsrc_enum_interface_info (const SpaHandleFactory *factory,
|
||||||
unsigned int index,
|
const SpaInterfaceInfo **info,
|
||||||
const SpaInterfaceInfo **info)
|
void **state)
|
||||||
{
|
{
|
||||||
if (index >= 1)
|
int index;
|
||||||
return SPA_RESULT_ENUM_END;
|
|
||||||
|
|
||||||
|
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];
|
*info = &audiotestsrc_interfaces[index];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return SPA_RESULT_ENUM_END;
|
||||||
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,16 @@
|
||||||
extern const SpaHandleFactory spa_audiotestsrc_factory;
|
extern const SpaHandleFactory spa_audiotestsrc_factory;
|
||||||
|
|
||||||
SpaResult
|
SpaResult
|
||||||
spa_enum_handle_factory (unsigned int index,
|
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||||
const SpaHandleFactory **factory)
|
void **state)
|
||||||
{
|
{
|
||||||
if (factory == NULL)
|
int index;
|
||||||
|
|
||||||
|
if (factory == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
*factory = &spa_audiotestsrc_factory;
|
*factory = &spa_audiotestsrc_factory;
|
||||||
|
|
@ -36,5 +40,6 @@ spa_enum_handle_factory (unsigned int index,
|
||||||
default:
|
default:
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,28 +246,33 @@ spa_ffmpeg_dec_node_remove_port (SpaHandle *handle,
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_ffmpeg_dec_node_port_enum_formats (SpaHandle *handle,
|
spa_ffmpeg_dec_node_port_enum_formats (SpaHandle *handle,
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
unsigned int index,
|
SpaFormat **format,
|
||||||
SpaFormat **format)
|
const SpaFormat *filter,
|
||||||
|
void **state)
|
||||||
{
|
{
|
||||||
SpaFFMpegDec *this = (SpaFFMpegDec *) handle;
|
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;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
if (!IS_VALID_PORT (port_id))
|
if (!IS_VALID_PORT (port_id))
|
||||||
return SPA_RESULT_INVALID_PORT;
|
return SPA_RESULT_INVALID_PORT;
|
||||||
|
|
||||||
state = &this->state[port_id];
|
s = &this->state[port_id];
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
spa_video_raw_format_init (&state->raw_format[0]);
|
spa_video_raw_format_init (&s->raw_format[0]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
*format = &state->raw_format[0].format;
|
*format = &s->raw_format[0].format;
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,11 +246,13 @@ spa_ffmpeg_enc_node_remove_port (SpaHandle *handle,
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_ffmpeg_enc_node_port_enum_formats (SpaHandle *handle,
|
spa_ffmpeg_enc_node_port_enum_formats (SpaHandle *handle,
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
unsigned int index,
|
SpaFormat **format,
|
||||||
SpaFormat **format)
|
const SpaFormat *filter,
|
||||||
|
void **state)
|
||||||
{
|
{
|
||||||
SpaFFMpegEnc *this = (SpaFFMpegEnc *) handle;
|
SpaFFMpegEnc *this = (SpaFFMpegEnc *) handle;
|
||||||
SpaFFMpegState *state;
|
SpaFFMpegState *s;
|
||||||
|
int index;
|
||||||
|
|
||||||
if (handle == NULL || format == NULL)
|
if (handle == NULL || format == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
@ -258,16 +260,19 @@ spa_ffmpeg_enc_node_port_enum_formats (SpaHandle *handle,
|
||||||
if (!IS_VALID_PORT (port_id))
|
if (!IS_VALID_PORT (port_id))
|
||||||
return SPA_RESULT_INVALID_PORT;
|
return SPA_RESULT_INVALID_PORT;
|
||||||
|
|
||||||
state = &this->state[port_id];
|
s = &this->state[port_id];
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
spa_video_raw_format_init (&state->raw_format[0]);
|
spa_video_raw_format_init (&s->raw_format[0]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
*format = &state->raw_format[0].format;
|
*format = &s->raw_format[0].format;
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,25 +58,36 @@ static const SpaInterfaceInfo ffmpeg_interfaces[] =
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
ffmpeg_enum_interface_info (const SpaHandleFactory *factory,
|
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)
|
if (index >= 1)
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
|
|
||||||
*info = &ffmpeg_interfaces[index];
|
*info = &ffmpeg_interfaces[index];
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpaResult
|
SpaResult
|
||||||
spa_enum_handle_factory (unsigned int index,
|
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||||
const SpaHandleFactory **factory)
|
void **state)
|
||||||
{
|
{
|
||||||
static const AVCodec *c = NULL;
|
static const AVCodec *c = NULL;
|
||||||
static int ci = 0;
|
static int ci = 0;
|
||||||
static SpaHandleFactory f;
|
static SpaHandleFactory f;
|
||||||
static char name[128];
|
static char name[128];
|
||||||
|
int index;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
av_register_all();
|
av_register_all();
|
||||||
|
|
||||||
|
|
@ -91,6 +102,8 @@ spa_enum_handle_factory (unsigned int index,
|
||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
|
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
if (av_codec_is_encoder (c)) {
|
if (av_codec_is_encoder (c)) {
|
||||||
snprintf (name, 128, "ffenc_%s", c->name);
|
snprintf (name, 128, "ffenc_%s", c->name);
|
||||||
f.init = ffmpeg_enc_init;
|
f.init = ffmpeg_enc_init;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
typedef struct _SpaV4l2Source SpaV4l2Source;
|
typedef struct _SpaV4l2Source SpaV4l2Source;
|
||||||
|
|
||||||
static const char default_device[] = "/dev/video0";
|
static const char default_device[] = "/dev/video1";
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SpaProps props;
|
SpaProps props;
|
||||||
|
|
@ -312,32 +312,22 @@ spa_v4l2_source_node_remove_port (SpaHandle *handle,
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_v4l2_source_node_port_enum_formats (SpaHandle *handle,
|
spa_v4l2_source_node_port_enum_formats (SpaHandle *handle,
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
unsigned int index,
|
SpaFormat **format,
|
||||||
SpaFormat **format)
|
const SpaFormat *filter,
|
||||||
|
void **state)
|
||||||
{
|
{
|
||||||
SpaV4l2Source *this = (SpaV4l2Source *) handle;
|
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;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
if (port_id != 0)
|
if (port_id != 0)
|
||||||
return SPA_RESULT_INVALID_PORT;
|
return SPA_RESULT_INVALID_PORT;
|
||||||
|
|
||||||
state = &this->state[port_id];
|
res = spa_v4l2_enum_format (this, format, state);
|
||||||
|
|
||||||
/*
|
return res;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SpaResult
|
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].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||||
this->state[0].status.flags = SPA_PORT_STATUS_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;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -631,14 +621,24 @@ static const SpaInterfaceInfo v4l2_source_interfaces[] =
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
v4l2_source_enum_interface_info (const SpaHandleFactory *factory,
|
v4l2_source_enum_interface_info (const SpaHandleFactory *factory,
|
||||||
unsigned int index,
|
const SpaInterfaceInfo **info,
|
||||||
const SpaInterfaceInfo **info)
|
void **state)
|
||||||
{
|
{
|
||||||
if (index >= 1)
|
int index;
|
||||||
return SPA_RESULT_ENUM_END;
|
|
||||||
|
|
||||||
|
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];
|
*info = &v4l2_source_interfaces[index];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return SPA_RESULT_ENUM_END;
|
||||||
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ spa_v4l2_open (SpaV4l2Source *this)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static SpaVideoFormat
|
static SpaVideoFormat
|
||||||
fourcc_to_video_format (uint32_t fourcc)
|
fourcc_to_video_format (uint32_t fourcc)
|
||||||
{
|
{
|
||||||
|
|
@ -169,7 +168,6 @@ fourcc_to_video_format (uint32_t fourcc)
|
||||||
}
|
}
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
video_format_to_fourcc (SpaVideoFormat format)
|
video_format_to_fourcc (SpaVideoFormat format)
|
||||||
|
|
@ -329,37 +327,17 @@ again:
|
||||||
}
|
}
|
||||||
state->frmival.index++;
|
state->frmival.index++;
|
||||||
}
|
}
|
||||||
fprintf (stderr, "format %c%c%c%c\n", FOURCC_ARGS (state->fmtdesc.pixelformat));
|
|
||||||
if (state->frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
|
spa_video_raw_format_init (&state->raw_format[0]);
|
||||||
fprintf (stderr, "size %dx%d\n", state->frmsize.discrete.width, state->frmsize.discrete.height);
|
state->raw_format[0].info.format = fourcc_to_video_format (state->fmtdesc.pixelformat);
|
||||||
} else if (state->frmsize.type == V4L2_FRMSIZE_TYPE_STEPWISE) {
|
state->raw_format[0].info.size.width = state->frmsize.discrete.width;
|
||||||
fprintf (stderr, "size %dx%d - %dx%d with step %d/%d\n",
|
state->raw_format[0].info.size.height = state->frmsize.discrete.height;
|
||||||
state->frmsize.stepwise.min_width,
|
state->raw_format[0].info.framerate.num = state->frmival.discrete.numerator;
|
||||||
state->frmsize.stepwise.min_height,
|
state->raw_format[0].info.framerate.denom = state->frmival.discrete.denominator;
|
||||||
state->frmsize.stepwise.max_width,
|
state->raw_format[0].unset_mask &= ~((1<<0)|(1<<1)|(1<<2));
|
||||||
state->frmsize.stepwise.max_height,
|
|
||||||
state->frmsize.stepwise.step_width,
|
*format = &state->raw_format[0].format;
|
||||||
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);
|
|
||||||
}
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -381,8 +359,8 @@ spa_v4l2_set_format (SpaV4l2Source *this, SpaFormat *format, bool try_only)
|
||||||
SpaVideoRawFormat *f = (SpaVideoRawFormat *) format;
|
SpaVideoRawFormat *f = (SpaVideoRawFormat *) format;
|
||||||
|
|
||||||
fmt.fmt.pix.pixelformat = video_format_to_fourcc (f->info.format);
|
fmt.fmt.pix.pixelformat = video_format_to_fourcc (f->info.format);
|
||||||
fmt.fmt.pix.width = f->info.width;
|
fmt.fmt.pix.width = f->info.size.width;
|
||||||
fmt.fmt.pix.height = f->info.height;
|
fmt.fmt.pix.height = f->info.size.height;
|
||||||
fmt.fmt.pix.field = V4L2_FIELD_ANY;
|
fmt.fmt.pix.field = V4L2_FIELD_ANY;
|
||||||
streamparm.parm.capture.timeperframe.numerator = f->info.framerate.denom;
|
streamparm.parm.capture.timeperframe.numerator = f->info.framerate.denom;
|
||||||
streamparm.parm.capture.timeperframe.denominator = f->info.framerate.num;
|
streamparm.parm.capture.timeperframe.denominator = f->info.framerate.num;
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,16 @@
|
||||||
extern const SpaHandleFactory spa_v4l2_source_factory;
|
extern const SpaHandleFactory spa_v4l2_source_factory;
|
||||||
|
|
||||||
SpaResult
|
SpaResult
|
||||||
spa_enum_handle_factory (unsigned int index,
|
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||||
const SpaHandleFactory **factory)
|
void **state)
|
||||||
{
|
{
|
||||||
if (factory == NULL)
|
int index;
|
||||||
|
|
||||||
|
if (factory == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
*factory = &spa_v4l2_source_factory;
|
*factory = &spa_v4l2_source_factory;
|
||||||
|
|
@ -36,5 +40,7 @@ spa_enum_handle_factory (unsigned int index,
|
||||||
default:
|
default:
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,16 @@
|
||||||
extern const SpaHandleFactory spa_volume_factory;
|
extern const SpaHandleFactory spa_volume_factory;
|
||||||
|
|
||||||
SpaResult
|
SpaResult
|
||||||
spa_enum_handle_factory (unsigned int index,
|
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||||
const SpaHandleFactory **factory)
|
void **state)
|
||||||
{
|
{
|
||||||
if (factory == NULL)
|
int index;
|
||||||
|
|
||||||
|
if (factory == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
*factory = &spa_volume_factory;
|
*factory = &spa_volume_factory;
|
||||||
|
|
@ -36,5 +40,7 @@ spa_enum_handle_factory (unsigned int index,
|
||||||
default:
|
default:
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -259,17 +259,21 @@ spa_volume_node_remove_port (SpaHandle *handle,
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_volume_node_port_enum_formats (SpaHandle *handle,
|
spa_volume_node_port_enum_formats (SpaHandle *handle,
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
unsigned int index,
|
SpaFormat **format,
|
||||||
SpaFormat **format)
|
const SpaFormat *filter,
|
||||||
|
void **state)
|
||||||
{
|
{
|
||||||
SpaVolume *this = (SpaVolume *) handle;
|
SpaVolume *this = (SpaVolume *) handle;
|
||||||
|
int index;
|
||||||
|
|
||||||
if (handle == NULL || format == NULL)
|
if (handle == NULL || format == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
if (port_id != 0)
|
if (port_id != 0)
|
||||||
return SPA_RESULT_INVALID_PORT;
|
return SPA_RESULT_INVALID_PORT;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
spa_audio_raw_format_init (&this->query_format);
|
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;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
*format = &this->query_format.format;
|
*format = &this->query_format.format;
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -636,13 +641,24 @@ static const SpaInterfaceInfo volume_interfaces[] =
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
volume_enum_interface_info (const SpaHandleFactory *factory,
|
volume_enum_interface_info (const SpaHandleFactory *factory,
|
||||||
unsigned int index,
|
const SpaInterfaceInfo **info,
|
||||||
const SpaInterfaceInfo **info)
|
void **state)
|
||||||
{
|
{
|
||||||
if (index >= 1)
|
int index;
|
||||||
return SPA_RESULT_ENUM_END;
|
|
||||||
|
|
||||||
|
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];
|
*info = &volume_interfaces[index];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return SPA_RESULT_ENUM_END;
|
||||||
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -288,17 +288,21 @@ spa_xv_sink_node_remove_port (SpaHandle *handle,
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_xv_sink_node_port_enum_formats (SpaHandle *handle,
|
spa_xv_sink_node_port_enum_formats (SpaHandle *handle,
|
||||||
uint32_t port_id,
|
uint32_t port_id,
|
||||||
unsigned int index,
|
SpaFormat **format,
|
||||||
SpaFormat **format)
|
const SpaFormat *filter,
|
||||||
|
void **state)
|
||||||
{
|
{
|
||||||
SpaXvSink *this = (SpaXvSink *) handle;
|
SpaXvSink *this = (SpaXvSink *) handle;
|
||||||
|
int index;
|
||||||
|
|
||||||
if (handle == NULL || format == NULL)
|
if (handle == NULL || format == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
if (port_id != 0)
|
if (port_id != 0)
|
||||||
return SPA_RESULT_INVALID_PORT;
|
return SPA_RESULT_INVALID_PORT;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
spa_video_raw_format_init (&this->raw_format[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;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
*format = &this->raw_format[0].format;
|
*format = &this->raw_format[0].format;
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -582,14 +587,24 @@ static const SpaInterfaceInfo xv_sink_interfaces[] =
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
xv_sink_enum_interface_info (const SpaHandleFactory *factory,
|
xv_sink_enum_interface_info (const SpaHandleFactory *factory,
|
||||||
unsigned int index,
|
const SpaInterfaceInfo **info,
|
||||||
const SpaInterfaceInfo **info)
|
void **state)
|
||||||
{
|
{
|
||||||
if (index >= 1)
|
int index;
|
||||||
return SPA_RESULT_ENUM_END;
|
|
||||||
|
|
||||||
|
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];
|
*info = &xv_sink_interfaces[index];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return SPA_RESULT_ENUM_END;
|
||||||
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,16 @@
|
||||||
extern const SpaHandleFactory spa_xv_sink_factory;
|
extern const SpaHandleFactory spa_xv_sink_factory;
|
||||||
|
|
||||||
SpaResult
|
SpaResult
|
||||||
spa_enum_handle_factory (unsigned int index,
|
spa_enum_handle_factory (const SpaHandleFactory **factory,
|
||||||
const SpaHandleFactory **factory)
|
void **state)
|
||||||
{
|
{
|
||||||
if (factory == NULL)
|
int index;
|
||||||
|
|
||||||
|
if (factory == NULL || state == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
|
index = (*state == NULL ? 0 : *(int*)state);
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
*factory = &spa_xv_sink_factory;
|
*factory = &spa_xv_sink_factory;
|
||||||
|
|
@ -36,5 +40,7 @@ spa_enum_handle_factory (unsigned int index,
|
||||||
default:
|
default:
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
}
|
}
|
||||||
|
*(int*)state = ++index;
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
|
||||||
void *hnd;
|
void *hnd;
|
||||||
SpaEnumHandleFactoryFunc enum_func;
|
SpaEnumHandleFactoryFunc enum_func;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
void *state = NULL;
|
||||||
|
|
||||||
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
|
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
|
||||||
printf ("can't load %s: %s\n", lib, dlerror());
|
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 SpaHandleFactory *factory;
|
||||||
const void *iface;
|
const void *iface;
|
||||||
|
|
||||||
if ((res = enum_func (i, &factory)) < 0) {
|
if ((res = enum_func (&factory, &state)) < 0) {
|
||||||
if (res != SPA_RESULT_ENUM_END)
|
if (res != SPA_RESULT_ENUM_END)
|
||||||
printf ("can't enumerate factories: %d\n", res);
|
printf ("can't enumerate factories: %d\n", res);
|
||||||
break;
|
break;
|
||||||
|
|
@ -234,8 +235,9 @@ negotiate_formats (AppData *data)
|
||||||
SpaProps *props;
|
SpaProps *props;
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
SpaPropValue value;
|
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;
|
return res;
|
||||||
|
|
||||||
props = &format->props;
|
props = &format->props;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
#include <spa/debug.h>
|
#include <spa/debug.h>
|
||||||
#include <spa/video/format.h>
|
#include <spa/video/format.h>
|
||||||
|
|
||||||
#undef USE_BUFFER
|
#define USE_BUFFER
|
||||||
|
|
||||||
#define MAX_BUFFERS 8
|
#define MAX_BUFFERS 8
|
||||||
|
|
||||||
|
|
@ -66,6 +66,7 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
|
||||||
void *hnd;
|
void *hnd;
|
||||||
SpaEnumHandleFactoryFunc enum_func;
|
SpaEnumHandleFactoryFunc enum_func;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
void *state = NULL;
|
||||||
|
|
||||||
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
|
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
|
||||||
printf ("can't load %s: %s\n", lib, dlerror());
|
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 SpaHandleFactory *factory;
|
||||||
const void *iface;
|
const void *iface;
|
||||||
|
|
||||||
if ((res = enum_func (i, &factory)) < 0) {
|
if ((res = enum_func (&factory, &state)) < 0) {
|
||||||
if (res != SPA_RESULT_ENUM_END)
|
if (res != SPA_RESULT_ENUM_END)
|
||||||
printf ("can't enumerate factories: %d\n", res);
|
printf ("can't enumerate factories: %d\n", res);
|
||||||
break;
|
break;
|
||||||
|
|
@ -251,7 +252,7 @@ alloc_buffers (AppData *data)
|
||||||
b->metas[0].data = &b->header;
|
b->metas[0].data = &b->header;
|
||||||
b->metas[0].size = sizeof (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->ptr.ptr = texture;
|
||||||
b->metas[1].type = SPA_META_TYPE_POINTER;
|
b->metas[1].type = SPA_META_TYPE_POINTER;
|
||||||
b->metas[1].data = &b->ptr;
|
b->metas[1].data = &b->ptr;
|
||||||
|
|
@ -278,8 +279,10 @@ negotiate_formats (AppData *data)
|
||||||
SpaFraction frac;
|
SpaFraction frac;
|
||||||
SpaPropValue value;
|
SpaPropValue value;
|
||||||
const SpaPortInfo *info;
|
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;
|
return res;
|
||||||
|
|
||||||
props = &format->props;
|
props = &format->props;
|
||||||
|
|
@ -291,19 +294,21 @@ negotiate_formats (AppData *data)
|
||||||
val = SPA_VIDEO_FORMAT_YUY2;
|
val = SPA_VIDEO_FORMAT_YUY2;
|
||||||
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FORMAT), &value)) < 0)
|
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FORMAT), &value)) < 0)
|
||||||
return res;
|
return res;
|
||||||
val = 320;
|
|
||||||
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_WIDTH), &value)) < 0)
|
value.type = SPA_PROP_TYPE_RECTANGLE;
|
||||||
return res;
|
value.size = sizeof (SpaRectangle);
|
||||||
val = 240;
|
value.value = &size;
|
||||||
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_HEIGHT), &value)) < 0)
|
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;
|
return res;
|
||||||
|
|
||||||
value.type = SPA_PROP_TYPE_FRACTION;
|
value.type = SPA_PROP_TYPE_FRACTION;
|
||||||
value.size = sizeof (SpaFraction);
|
value.size = sizeof (SpaFraction);
|
||||||
value.value = &frac;
|
value.value = &frac;
|
||||||
|
|
||||||
frac.num = 25;
|
frac.num = 25;
|
||||||
frac.denom = 1;
|
frac.denom = 1;
|
||||||
|
|
||||||
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FRAMERATE), &value)) < 0)
|
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FRAMERATE), &value)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,44 @@
|
||||||
|
|
||||||
#include <spa/node.h>
|
#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
|
static void
|
||||||
print_value (SpaPropType type, int size, const void *value)
|
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:
|
case SPA_PROP_TYPE_STRING:
|
||||||
printf ("\"%s\"", (char *)value);
|
printf ("\"%s\"", (char *)value);
|
||||||
break;
|
break;
|
||||||
case SPA_PROP_TYPE_POINTER:
|
case SPA_PROP_TYPE_RECTANGLE:
|
||||||
printf ("%p", value);
|
{
|
||||||
|
const SpaRectangle *r = value;
|
||||||
|
printf ("%"PRIu32"x%"PRIu32, r->width, r->height);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SPA_PROP_TYPE_FRACTION:
|
case SPA_PROP_TYPE_FRACTION:
|
||||||
{
|
{
|
||||||
const SpaFraction *f = value;
|
const SpaFraction *f = value;
|
||||||
|
|
@ -79,9 +120,8 @@ print_value (SpaPropType type, int size, const void *value)
|
||||||
}
|
}
|
||||||
case SPA_PROP_TYPE_BITMASK:
|
case SPA_PROP_TYPE_BITMASK:
|
||||||
break;
|
break;
|
||||||
case SPA_PROP_TYPE_BYTES:
|
case SPA_PROP_TYPE_POINTER:
|
||||||
break;
|
printf ("%p", value);
|
||||||
case SPA_PROP_TYPE_STRUCT:
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -113,66 +153,7 @@ print_props (const SpaProps *props, int print_ranges)
|
||||||
printf ("deprecated ");
|
printf ("deprecated ");
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
|
|
||||||
printf ("%-23.23s ", "");
|
printf ("%-23.23s %s. ", "", prop_type_names[info->type].CCName);
|
||||||
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 ("Default: ");
|
printf ("Default: ");
|
||||||
if (info->default_value)
|
if (info->default_value)
|
||||||
|
|
@ -191,6 +172,9 @@ print_props (const SpaProps *props, int print_ranges)
|
||||||
printf ("Error %d", res);
|
printf ("Error %d", res);
|
||||||
printf (".\n");
|
printf (".\n");
|
||||||
|
|
||||||
|
if (!print_ranges)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (info->range_type != SPA_PROP_RANGE_TYPE_NONE) {
|
if (info->range_type != SPA_PROP_RANGE_TYPE_NONE) {
|
||||||
printf ("%-23.23s ", "");
|
printf ("%-23.23s ", "");
|
||||||
switch (info->range_type) {
|
switch (info->range_type) {
|
||||||
|
|
@ -230,11 +214,34 @@ print_props (const SpaProps *props, int print_ranges)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
const SpaProps *props = &format->props;
|
||||||
printf ("media-subtype:\t\t%d\n", format->media_subtype);
|
int i;
|
||||||
print_props (&format->props, print_ranges);
|
|
||||||
|
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
|
static void
|
||||||
|
|
@ -242,8 +249,9 @@ inspect_node (const SpaNode *node, SpaHandle *handle)
|
||||||
{
|
{
|
||||||
SpaResult res;
|
SpaResult res;
|
||||||
SpaProps *props;
|
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;
|
SpaFormat *format;
|
||||||
|
void *state = NULL;
|
||||||
|
|
||||||
if ((res = node->get_props (handle, &props)) < 0)
|
if ((res = node->get_props (handle, &props)) < 0)
|
||||||
printf ("can't get properties: %d\n", res);
|
printf ("can't get properties: %d\n", res);
|
||||||
|
|
@ -255,14 +263,14 @@ inspect_node (const SpaNode *node, SpaHandle *handle)
|
||||||
else
|
else
|
||||||
printf ("supported ports %d %d %d %d\n", n_input, max_input, n_output, max_output);
|
printf ("supported ports %d %d %d %d\n", n_input, max_input, n_output, max_output);
|
||||||
|
|
||||||
for (i = 0; ; i++) {
|
while (true) {
|
||||||
if ((res = node->port_enum_formats (handle, 0, i, &format)) < 0) {
|
if ((res = node->port_enum_formats (handle, 0, &format, NULL, &state)) < 0) {
|
||||||
if (res != SPA_RESULT_ENUM_END)
|
if (res != SPA_RESULT_ENUM_END)
|
||||||
printf ("got error %d\n", res);
|
printf ("got error %d\n", res);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (format)
|
if (format)
|
||||||
print_format (format, 1);
|
print_format (format);
|
||||||
}
|
}
|
||||||
if ((res = node->port_get_props (handle, 0, &props)) < 0)
|
if ((res = node->port_get_props (handle, 0, &props)) < 0)
|
||||||
printf ("port_get_props error: %d\n", res);
|
printf ("port_get_props error: %d\n", res);
|
||||||
|
|
@ -274,9 +282,9 @@ static void
|
||||||
inspect_factory (const SpaHandleFactory *factory)
|
inspect_factory (const SpaHandleFactory *factory)
|
||||||
{
|
{
|
||||||
SpaResult res;
|
SpaResult res;
|
||||||
unsigned int i;
|
|
||||||
SpaHandle *handle;
|
SpaHandle *handle;
|
||||||
const void *interface;
|
const void *interface;
|
||||||
|
void *state = NULL;
|
||||||
|
|
||||||
printf ("factory name:\t\t'%s'\n", factory->name);
|
printf ("factory name:\t\t'%s'\n", factory->name);
|
||||||
printf ("factory info:\n");
|
printf ("factory info:\n");
|
||||||
|
|
@ -293,16 +301,16 @@ inspect_factory (const SpaHandleFactory *factory)
|
||||||
|
|
||||||
printf ("factory interfaces:\n");
|
printf ("factory interfaces:\n");
|
||||||
|
|
||||||
for (i = 0; ; i++) {
|
while (true) {
|
||||||
const SpaInterfaceInfo *info;
|
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)
|
if (res == SPA_RESULT_ENUM_END)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
printf ("can't enumerate interfaces: %d\n", res);
|
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) {
|
if ((res = handle->get_interface (handle, info->interface_id, &interface)) < 0) {
|
||||||
printf ("can't get interface: %d\n", res);
|
printf ("can't get interface: %d\n", res);
|
||||||
|
|
@ -326,7 +334,7 @@ main (int argc, char *argv[])
|
||||||
SpaResult res;
|
SpaResult res;
|
||||||
void *handle;
|
void *handle;
|
||||||
SpaEnumHandleFactoryFunc enum_func;
|
SpaEnumHandleFactoryFunc enum_func;
|
||||||
unsigned int i;
|
void *state = NULL;
|
||||||
|
|
||||||
if ((handle = dlopen (argv[1], RTLD_NOW)) == NULL) {
|
if ((handle = dlopen (argv[1], RTLD_NOW)) == NULL) {
|
||||||
printf ("can't load %s\n", argv[1]);
|
printf ("can't load %s\n", argv[1]);
|
||||||
|
|
@ -337,10 +345,10 @@ main (int argc, char *argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; ;i++) {
|
while (true) {
|
||||||
const SpaHandleFactory *factory;
|
const SpaHandleFactory *factory;
|
||||||
|
|
||||||
if ((res = enum_func (i, &factory)) < 0) {
|
if ((res = enum_func (&factory, &state)) < 0) {
|
||||||
if (res != SPA_RESULT_ENUM_END)
|
if (res != SPA_RESULT_ENUM_END)
|
||||||
printf ("can't enumerate factories: %d\n", res);
|
printf ("can't enumerate factories: %d\n", res);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue