Use types with known sizes where we can, easier to serialize

Add iterator for POD and use it to implement some demarshalling.
This commit is contained in:
Wim Taymans 2017-03-07 11:56:43 +01:00
parent 23d09d5b60
commit f92b68c3c3
77 changed files with 839 additions and 695 deletions

View file

@ -61,7 +61,7 @@ struct _SpaV4l2Monitor {
struct udev* udev;
struct udev_monitor *umonitor;
struct udev_enumerate *enumerate;
unsigned int index;
uint32_t index;
struct udev_list_entry *devices;
V4l2Item uitem;
@ -83,7 +83,7 @@ v4l2_udev_open (SpaV4l2Monitor *this)
static void
fill_item (V4l2Item *item, struct udev_device *udevice)
{
unsigned int i;
uint32_t i;
const char *str;
if (item->udevice)
@ -253,7 +253,7 @@ spa_v4l2_monitor_set_event_callback (SpaMonitor *monitor,
static SpaResult
spa_v4l2_monitor_enum_items (SpaMonitor *monitor,
SpaMonitorItem **item,
unsigned int index)
uint32_t index)
{
SpaResult res;
SpaV4l2Monitor *this;
@ -340,10 +340,10 @@ v4l2_monitor_init (const SpaHandleFactory *factory,
SpaHandle *handle,
const SpaDict *info,
const SpaSupport *support,
unsigned int n_support)
uint32_t n_support)
{
SpaV4l2Monitor *this;
unsigned int i;
uint32_t i;
if (factory == NULL || handle == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
@ -384,7 +384,7 @@ static const SpaInterfaceInfo v4l2_monitor_interfaces[] =
static SpaResult
v4l2_monitor_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info,
unsigned int index)
uint32_t index)
{
if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -93,7 +93,7 @@ typedef struct {
enum v4l2_memory memtype;
V4l2Buffer buffers[MAX_BUFFERS];
unsigned int n_buffers;
uint32_t n_buffers;
bool source_enabled;
SpaSource source;
@ -415,10 +415,10 @@ spa_v4l2_source_node_set_event_callback (SpaNode *node,
static SpaResult
spa_v4l2_source_node_get_n_ports (SpaNode *node,
unsigned int *n_input_ports,
unsigned int *max_input_ports,
unsigned int *n_output_ports,
unsigned int *max_output_ports)
uint32_t *n_input_ports,
uint32_t *max_input_ports,
uint32_t *n_output_ports,
uint32_t *max_output_ports)
{
if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
@ -437,9 +437,9 @@ spa_v4l2_source_node_get_n_ports (SpaNode *node,
static SpaResult
spa_v4l2_source_node_get_port_ids (SpaNode *node,
unsigned int n_input_ports,
uint32_t n_input_ports,
uint32_t *input_ids,
unsigned int n_output_ports,
uint32_t n_output_ports,
uint32_t *output_ids)
{
if (node == NULL)
@ -474,7 +474,7 @@ spa_v4l2_source_node_port_enum_formats (SpaNode *node,
uint32_t port_id,
SpaFormat **format,
const SpaFormat *filter,
unsigned int index)
uint32_t index)
{
SpaV4l2Source *this;
SpaResult res;
@ -726,9 +726,9 @@ spa_v4l2_source_node_port_alloc_buffers (SpaNode *node,
SpaDirection direction,
uint32_t port_id,
SpaAllocParam **params,
unsigned int n_params,
uint32_t n_params,
SpaBuffer **buffers,
unsigned int *n_buffers)
uint32_t *n_buffers)
{
SpaV4l2Source *this;
SpaV4l2State *state;
@ -965,10 +965,10 @@ v4l2_source_init (const SpaHandleFactory *factory,
SpaHandle *handle,
const SpaDict *info,
const SpaSupport *support,
unsigned int n_support)
uint32_t n_support)
{
SpaV4l2Source *this;
unsigned int i;
uint32_t i;
const char *str;
if (factory == NULL || handle == NULL)
@ -1032,7 +1032,7 @@ static const SpaInterfaceInfo v4l2_source_interfaces[] =
static SpaResult
v4l2_source_enum_interface_info (const SpaHandleFactory *factory,
const SpaInterfaceInfo **info,
unsigned int index)
uint32_t index)
{
if (factory == NULL || info == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;

View file

@ -322,7 +322,7 @@ find_format_info_by_media_type (SpaMediaType type,
}
static SpaVideoFormat
enum_filter_format (const SpaFormat *filter, unsigned int index)
enum_filter_format (const SpaFormat *filter, uint32_t index)
{
SpaVideoFormat video_format = SPA_VIDEO_FORMAT_UNKNOWN;
@ -330,7 +330,7 @@ enum_filter_format (const SpaFormat *filter, unsigned int index)
filter->body.media_type.value == SPA_MEDIA_TYPE_IMAGE)) {
if (filter->body.media_subtype.value == SPA_MEDIA_SUBTYPE_RAW) {
SpaPODProp *p;
unsigned int n_values;
uint32_t n_values;
const uint32_t *values;
if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_FORMAT)))
@ -449,7 +449,7 @@ static SpaResult
spa_v4l2_enum_format (SpaV4l2Source *this,
SpaFormat **format,
const SpaFormat *filter,
unsigned int index)
uint32_t index)
{
SpaV4l2State *state = &this->state[0];
int res, n_fractions;
@ -547,7 +547,7 @@ do_frmsize:
SpaPODProp *p;
const SpaRectangle step = { 1, 1 }, *values;
uint32_t range;
unsigned int i, n_values;
uint32_t i, n_values;
/* check if we have a fixed frame size */
if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_SIZE)))
@ -650,7 +650,7 @@ have_size:
if (filter) {
SpaPODProp *p;
uint32_t range;
unsigned int i, n_values;
uint32_t i, n_values;
const SpaFraction step = { 1, 1 }, *values;
if (!(p = spa_format_find_prop (filter, SPA_PROP_ID_VIDEO_FRAMERATE)))
@ -1024,9 +1024,9 @@ spa_v4l2_use_buffers (SpaV4l2Source *this, SpaBuffer **buffers, uint32_t n_buffe
static SpaResult
mmap_init (SpaV4l2Source *this,
SpaAllocParam **params,
unsigned int n_params,
uint32_t n_params,
SpaBuffer **buffers,
unsigned int *n_buffers)
uint32_t *n_buffers)
{
SpaV4l2State *state = &this->state[0];
struct v4l2_requestbuffers reqbuf;
@ -1136,9 +1136,9 @@ read_init (SpaV4l2Source *this)
static SpaResult
spa_v4l2_alloc_buffers (SpaV4l2Source *this,
SpaAllocParam **params,
unsigned int n_params,
uint32_t n_params,
SpaBuffer **buffers,
unsigned int *n_buffers)
uint32_t *n_buffers)
{
SpaResult res;
SpaV4l2State *state = &this->state[0];

View file

@ -25,7 +25,7 @@ extern const SpaHandleFactory spa_v4l2_monitor_factory;
SpaResult
spa_enum_handle_factory (const SpaHandleFactory **factory,
unsigned int index)
uint32_t index)
{
if (factory == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;