Example #1
0
void queue_free_all(struct queue *queue)
{
	struct list *list = queue->head;

	list_free_all(list);
	__queue_init(queue);
}
Example #2
0
struct queue *queue_alloc(void)
{
	struct queue *queue;

	queue = malloc(sizeof(struct queue));
	if (queue)
		__queue_init(queue);

	return queue;
}
/*
 * constructor & destructor
 */
void PortBase::__PortBase(void)
{
    buffer_hdrs = NULL;
    nr_buffer_hdrs = 0;
    buffer_hdrs_completion = false;

    custom_mem_alloc = NULL;
    custom_mem_free = NULL;
    custom_mem_userdata = NULL;

    mem_alignment = 0;

    pthread_mutex_init(&hdrs_lock, NULL);
    pthread_cond_init(&hdrs_wait, NULL);

    __queue_init(&bufferq);
    pthread_mutex_init(&bufferq_lock, NULL);

    __queue_init(&retainedbufferq);
    pthread_mutex_init(&retainedbufferq_lock, NULL);

    __queue_init(&markq);
    pthread_mutex_init(&markq_lock, NULL);

    state = OMX_PortEnabled;
    pthread_mutex_init(&state_lock, NULL);

    memset(&portdefinition, 0, sizeof(portdefinition));
    ComponentBase::SetTypeHeader(&portdefinition, sizeof(portdefinition));
    memset(definition_format_mimetype, 0, OMX_MAX_STRINGNAME_SIZE);
    portdefinition.format.audio.cMIMEType = &definition_format_mimetype[0];
    portdefinition.format.video.cMIMEType = &definition_format_mimetype[0];
    portdefinition.format.image.cMIMEType = &definition_format_mimetype[0];

    memset(&audioparam, 0, sizeof(audioparam));

    owner = NULL;
    appdata = NULL;
    callbacks = NULL;

    cbase = NULL;
}