Remove SpaQueue, use SpaList instead

This commit is contained in:
Wim Taymans 2016-11-09 12:57:51 +01:00
parent 89bc235924
commit d0f95fc323
20 changed files with 153 additions and 237 deletions

View file

@ -26,7 +26,7 @@
#include <spa/node.h>
#include <spa/video/format.h>
#include <spa/queue.h>
#include <spa/list.h>
#include <spa/log.h>
#include <spa/id-map.h>
#include <lib/debug.h>
@ -60,7 +60,8 @@ struct _V4l2Buffer {
bool outstanding;
bool allocated;
struct v4l2_buffer v4l2_buffer;
V4l2Buffer *next;
// V4l2Buffer *next;
SpaList list;
};
typedef struct _V4l2Format V4l2Format;
@ -112,7 +113,7 @@ typedef struct {
V4l2Buffer buffers[MAX_BUFFERS];
unsigned int n_buffers;
SpaQueue ready;
SpaList ready;
SpaPollFd fds[1];
SpaPollItem poll;
@ -854,11 +855,17 @@ spa_v4l2_source_node_process_output (SpaNode *node)
return SPA_RESULT_ERROR;
}
SPA_QUEUE_POP_HEAD (&state->ready, V4l2Buffer, next, b);
if (spa_list_is_empty (&state->ready)) {
output->status = SPA_RESULT_UNEXPECTED;
return SPA_RESULT_ERROR;
}
b = spa_list_first (&state->ready, V4l2Buffer, list);
if (b == NULL) {
output->status = SPA_RESULT_UNEXPECTED;
return SPA_RESULT_ERROR;
}
spa_list_remove (&b->list);
b->outstanding = true;
output->buffer_id = b->outbuf->id;
@ -1021,7 +1028,8 @@ v4l2_source_init (const SpaHandleFactory *factory,
this->props[1].props.prop_info = prop_info;
reset_v4l2_source_props (&this->props[1]);
SPA_QUEUE_INIT (&this->state[0].ready);
spa_list_init (&this->state[0].ready);
// SPA_QUEUE_INIT (&this->state[0].ready);
this->state[0].log = this->log;
this->state[0].info.flags = SPA_PORT_INFO_FLAG_LIVE;

View file

@ -885,8 +885,7 @@ mmap_read (SpaV4l2Source *this)
d = b->outbuf->datas;
d[0].size = buf.bytesused;
b->next = NULL;
SPA_QUEUE_PUSH_TAIL (&state->ready, V4l2Buffer, next, b);
spa_list_insert (state->ready.prev, &b->list);
return SPA_RESULT_OK;
}