summaryrefslogtreecommitdiff
path: root/modules/omx/omx.h
blob: 5ca49bf78d6f441e8ec4bc682efc35a2ffaaa99d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * @file omx.h     Raspberry Pi VideoCoreIV OpenMAX interface
 *
 * Copyright (C) 2016 - 2017 Creytiv.com
 * Copyright (C) 2016 - 2017 Jonathan Sieber
 */

#ifdef RASPBERRY_PI
#include <IL/OMX_Core.h>
#include <IL/OMX_Video.h>
#include <IL/OMX_Broadcom.h>
#else
#include <OMX_Core.h>
#include <OMX_Component.h>
#include <OMX_Video.h>

#define OMX_VERSION 0x01010101
#define OMX_ERROR_NONE 0
#endif

#include <pthread.h>
#include <stdint.h>
#include <string.h>

/* Needed for usleep to appear */
#define _BSD_SOURCE
#include <unistd.h>

struct omx_state {
	pthread_mutex_t omx_mutex;

	OMX_HANDLETYPE video_render;
	OMX_BUFFERHEADERTYPE** buffers;
	int num_buffers;
	int current_buffer;

	int width, height;
};

int omx_init(struct omx_state* st);
void omx_deinit(struct omx_state* st);

int omx_display_input_buffer(struct omx_state* st,
	void** pbuf, uint32_t* plen);
int omx_display_flush_buffer(struct omx_state* st);

int omx_display_enable(struct omx_state* st,
	int width, int height, int stride);
void omx_display_disable(struct omx_state* st);