CAMEventHandler

Syntax

#include <cafe/camera/camera.h>

//enumerate event types
typedef enum _CAMERA_EVENT_TYPE
{
    CAMERA_DECODE_DONE = 0,
    CAMERA_DRC_DETACH

} CAMERA_EVENT_TYPE;

typedef struct _Camera_Event_Handler_Input
{ 
    CAMERA_EVENT_TYPE   type;    
    u32                 data0;   
    u32                 data1;   
    u32                 data2;   
} Camera_Event_Handler_Input;

typedef void
(*CAMEventHandler)(
    Camera_Event_Handler_Input    *event_handler_input
);

Parameters

event_handler_input Callback function pointer that is defined by CAMERA_EVENT_TYPE in the table below.

type data0 data1 data2
CAMERA_DECODE_DONE Pointer to the framebuffer (CAMSurface.imagePtr). Camera Handle (hCam). 1 if there was a decode error; 0 otherwise.
CAMERA_DRC_DETACH NOT SET. Camera Handle (hCam). NOT SET.

Return Values

None.

Description

CAMEventHandler is the callback function that the camera library uses to tell the application that an event has happened. This function has to be implemented by the application.

The CAMERA_DECODE_DONE event is triggered when camera library decodes a video frame from DRC camera and has it available for rendering. data2 would be set if there are errors while decoding the frame.

The CAMERA_DRC_DETACH event is triggered when the DRC detaches from Wii U for any reason. Camera driver automatically closes itself (CAMClose is called) when that happens. The application needs to call CAMOpen explicitly if a DRC connection is available again and camera input is required.

CAMEventHandler callback is designed for notification purposes only. As such, it should not have any heavy processing in it. Application must also take care that they never sleep in the callback or block its execution by waiting on a thread synchronization primitive like OSLockMutex.

Do Not Call From

Background Do not call this function from the background.

See Also

CAMSurface

Revision History

2013/05/08 Automated cleanup pass.
2012/08/02 Cleanup Pass.
2011/10/24 Initial version.


CONFIDENTIAL