summaryrefslogtreecommitdiff
path: root/modules/omx
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-04-06 18:44:47 +0200
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-04-06 18:44:47 +0200
commit2ec0ab1e04bff5543f6e9df896eb1b24a3b21622 (patch)
tree5cc57d4fddf5e9b1adedc1da61f2c6e31f7b4c0c /modules/omx
parent4a7c407a844d584885206008939e910ccd79fa73 (diff)
omx: formatting, 2 empty lines between functions
Diffstat (limited to 'modules/omx')
-rw-r--r--modules/omx/module.c8
-rw-r--r--modules/omx/omx.c53
2 files changed, 39 insertions, 22 deletions
diff --git a/modules/omx/module.c b/modules/omx/module.c
index b9d04cf..587d4ac 100644
--- a/modules/omx/module.c
+++ b/modules/omx/module.c
@@ -30,15 +30,17 @@ static struct vidisp* vid;
static struct omx_state omx;
+
static void destructor(void *arg)
{
struct vidisp_st *st = arg;
omx_display_disable(st->omx);
}
+
int omx_vidisp_alloc(struct vidisp_st **vp, const struct vidisp* vd,
- struct vidisp_prm *prm, const char *dev, vidisp_resize_h *resizeh,
- void *arg)
+ struct vidisp_prm *prm, const char *dev,
+ vidisp_resize_h *resizeh, void *arg)
{
struct vidisp_st *st;
@@ -105,6 +107,7 @@ int omx_vidisp_display(struct vidisp_st *st, const char *title,
return 0;
}
+
static int module_init(void)
{
if (omx_init(&omx) != 0) {
@@ -116,6 +119,7 @@ static int module_init(void)
omx_vidisp_alloc, NULL, omx_vidisp_display, NULL);
}
+
static int module_close(void)
{
/* HACK: not deinitializing OMX because of a hangup */
diff --git a/modules/omx/omx.c b/modules/omx/omx.c
index 8f1c069..e016b56 100644
--- a/modules/omx/omx.c
+++ b/modules/omx/omx.c
@@ -44,35 +44,42 @@ static void setHeader(OMX_PTR header, OMX_U32 size) {
}
* */
+
static OMX_ERRORTYPE EventHandler(OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
OMX_EVENTTYPE eEvent, OMX_U32 nData1, OMX_U32 nData2,
OMX_PTR pEventData)
{
(void) hComponent;
+
switch (eEvent) {
- case OMX_EventCmdComplete:
- debug("omx.EventHandler: Previous command completed\n"
- "d1=%x\td2=%x\teventData=%p\tappdata=%p\n",
- nData1, nData2, pEventData, pAppData);
- /* TODO: Put these event into a multithreaded queue,
- * properly wait for them in the issuing code */
- break;
- case OMX_EventError:
- warning("omx.EventHandler: Error event type "
- "data1=%x\tdata2=%x\n", nData1, nData2);
- break;
- default:
- warning("omx.EventHandler: Unknown event type %d\t"
- "data1=%x data2=%x\n", eEvent, nData1, nData2);
- return -1;
- break;
+
+ case OMX_EventCmdComplete:
+ debug("omx.EventHandler: Previous command completed\n"
+ "d1=%x\td2=%x\teventData=%p\tappdata=%p\n",
+ nData1, nData2, pEventData, pAppData);
+ /* TODO: Put these event into a multithreaded queue,
+ * properly wait for them in the issuing code */
+ break;
+
+ case OMX_EventError:
+ warning("omx.EventHandler: Error event type "
+ "data1=%x\tdata2=%x\n", nData1, nData2);
+ break;
+
+ default:
+ warning("omx.EventHandler: Unknown event type %d\t"
+ "data1=%x data2=%x\n", eEvent, nData1, nData2);
+ return -1;
+ break;
}
+
return 0;
}
-static OMX_ERRORTYPE EmptyBufferDone(
- OMX_HANDLETYPE hComponent,
- OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer)
+
+static OMX_ERRORTYPE EmptyBufferDone(OMX_HANDLETYPE hComponent,
+ OMX_PTR pAppData,
+ OMX_BUFFERHEADERTYPE* pBuffer)
{
(void) hComponent;
(void) pAppData;
@@ -83,6 +90,7 @@ static OMX_ERRORTYPE EmptyBufferDone(
return 0;
}
+
static OMX_ERRORTYPE FillBufferDone(OMX_HANDLETYPE hComponent,
OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer)
{
@@ -93,12 +101,14 @@ static OMX_ERRORTYPE FillBufferDone(OMX_HANDLETYPE hComponent,
return 0;
}
+
static struct OMX_CALLBACKTYPE callbacks = {
EventHandler,
EmptyBufferDone,
&FillBufferDone
};
+
int omx_init(struct omx_state* st)
{
OMX_ERRORTYPE err;
@@ -156,6 +166,7 @@ void omx_deinit(struct omx_state* st)
OMX_Deinit();
}
+
void omx_display_disable(struct omx_state* st)
{
(void)st;
@@ -180,6 +191,7 @@ void omx_display_disable(struct omx_state* st)
#endif
}
+
static void block_until_port_changed(OMX_HANDLETYPE hComponent,
OMX_U32 nPortIndex, OMX_BOOL bEnabled) {
@@ -205,6 +217,7 @@ static void block_until_port_changed(OMX_HANDLETYPE hComponent,
}
}
+
int omx_display_enable(struct omx_state* st,
int width, int height, int stride)
{
@@ -251,7 +264,6 @@ int omx_display_enable(struct omx_state* st,
goto exit;
}
-
err |= OMX_SetParameter(st->video_render,
OMX_IndexParamPortDefinition, &portdef);
block_until_port_changed(st->video_render, VIDEO_RENDER_PORT, true);
@@ -315,6 +327,7 @@ int omx_display_input_buffer(struct omx_state* st,
return 0;
}
+
int omx_display_flush_buffer(struct omx_state* st)
{
if (OMX_EmptyThisBuffer(st->video_render, st->buffers[0])