EMMA2 API User Manual for ELU
EMMA2 API User Manual for ELU
EMMA2 API
CONTENTS
1 Introduction ....................................................................................................................... 2
2 Architecture....................................................................................................................... 3
2.1 Example of ELU API Use...................................................................................... 8
3 Function Prototypes ........................................................................................................ 13
MMAC_ELU_Initialise .................................................................................................13
MMAC_ELU_Close.....................................................................................................14
MMAC_ELU_Reset.....................................................................................................15
MMAC_ELU_SelectedReset.......................................................................................16
MMAC_ELU_SetEventMask.......................................................................................17
MMAC_ELU_ModifyEventMask..................................................................................19
MMAC_ELU_GetEventMask ......................................................................................21
MMAC_ELU_SetExtendedEventMask .......................................................................23
MMAC_ELU_ModifyExtendedEventMask ..................................................................25
MMAC_ELU_GetExtendedEventMask .......................................................................26
MMAC_ELU_FreeExtendedEventMask .....................................................................27
MMAC_ELU_SetEventNotifyFunction ........................................................................28
MMAC_ELU_SetErrorNotifyFunction .........................................................................29
MMAC_ELU_Start ......................................................................................................30
MMAC_ELU_Stop.......................................................................................................31
MMAC_ELU_GetRTS .................................................................................................32
MMAC_ELU_GetPacketCount ...................................................................................33
MMAC_ELU_SetIndependentEvent ...........................................................................34
MMAC_ELU_GetPcrValue..........................................................................................35
4 Data Structures ............................................................................................................... 36
5 Revision History .............................................................................................................. 39
2
2 Architecture
The ELU API provides an abstraction layer to the ELU hardware. The ELU logs events enabled by the
application and stores them in a buffer.
The application must open up a device using the demux API before it can access the Event Log Unit. The
function MMAC_DEMUX_OpenDevice() returns a unique deviceId, which is passed to the ELU API
functions to identify the hardware device being used. Each device has its own event buffer, which is used
to capture the events logged by that device.
The ELU stores events in the buffer until a number of events, configured by the application, have been
logged. At this point a callback function is called with a device identifier, the number of events captured
and a pointer to where the events are located. The event buffers are double buffered internally within the
ELU API, allowing the application time to use the buffered data before that buffer is required again. It is
the responsibility of the application to have finished with the data held in the buffer passed to it before this
buffer is used again. The format of the data held in the buffer is in the form of an array of event structures.
The event structure is shown below.
eventDescriptor (UI32)
pid (UI16)
packetNumber (UI32)
time (UI32)
The eventDescriptor is a bit mask that identifies which event(s) occurred. The bit fields for the
eventDescriptor bit mask are defined in the header file elu.h. The pid field is the 13 bit transport stream
packet identifier number. The packetNumber is the number of the stored packet, which caused the event.
The time is the ELU internal Record Time Stamp at the time the event occurred.
The ELU API also provides the means to interrogate the ELU to find out the current value of the packet
count for each device and the record time stamp.
Initialisation
Prior to using any of the functions in this document, it is necessary to initialise certain modules by making
the following calls:
MMAC_RTOS_Initialise()
MMAC_DEMUX_Initialise()
MMAC_RECORD_Initialise()
The next step is to make a call to MMAC_ELU_Initialise() which will initialise the system resources
and start the ELU sub system. At this stage the ELU API is capable of capturing and handling events, so
ELU API calls can be made to set up events.
Re-configuring
The services may be re-configured without having to go through the entire initialisation process by three
simple steps.
1. Stop the ELU event logging by a call to MMAC_ELU_Stop().
2. Re-configure as below
MMAC_ELU_SetNumEvents(). If the API sub system is required to log a different number of events
before the callback function is called, then this function is used.
MMAC_ELU_SetEventMask(). If existing PID filters with triggerable events are to be modified or
an additional PID filter requires events to be logged then a call to this function is used.
3
MMAC_ELU_SetEventNotifyFunction(). This function is used to register new callback
functions with the ELU API for dealing with events stored in the event logging buffers. The callback
function is called when the number events in the buffer equals that of the parameter passed to the
function, numberOfEvents.
MMAC_ELU_SetErrorNotifyFunction(). This function is used to register new callback
functions with the ELU API for dealing with errors generated by the ELU module. The callback
function is called whenever an error occurs.
3. Re-start the ELU by a call to MMAC_ELU_Start().
Extended Events
The extended events that can be captured are I, B and P pictures, group start codes and sequence header
codes. To capture these events the application must carry out the following operations.
1. Stop the ELU event logging by a call to MMAC_ELU_Stop().
2. Allocate a demux general PES filter to capture the video PES stream containing the extended events to
be captured using MMAC_DEMUX_AllocateGeneralPidFilter(). To ensure that the PID filter
can capture PES data set the pidType parameter to MMAC_DEMUX_PID_FILTER_PES_TYPE.
3. Allocate one of the first 4 SRU PID filters to capture the same video PES stream using the function
MMAC_RECORD_AllocatePidFilter(). Ensure that the SRU filter is one of the first four by
setting the eluExtEvent parameter to MMAC_TRUE.
4. Set the required event mask for the video stream using the function
MMAC_ELU_SetExtendedEventMask().
5. The extended event mask can be modified using MMAC_ELU_ModifyExtendedEventMask() or
the contents retrieved using MMAC_ELU_GetExtendedEventMask().
6. (Re-)Start the ELU by a call to MMAC_ELU_Start().
Closing
When the ELU operations have completed and there are no more requirements for the ELU, the ELU API
should first be stopped using the function MMAC_ELU_Stop() and then closed using
MMAC_ELU_Close(). This will de-allocate the system resources, reset the callback pointers, shut down
the ELU sub system and disable the ELU hardware. After this function has been called if the ELU is
required again, the initialisation function needs to be called as if it were being used for the first time.
4
Function List
The ELU API specifies a set of functions to control the event logging unit and ELU API sub system.
Function Name Description
MMAC_ELU_Initialise This function will initialise the system resources
and start the ELU sub system.
MMAC_ELU_Reset This function will reset the ELU sub system to an
initial state.
MMAC_ELU_SetEventMask This function is used to set up an event mask for a
particular PID being recorded.
MMAC_ELU_GetEventMask This function returns the current event mask that is
set for a particular PID being recorded.
MMAC_ELU_ModifyEventMask This function modifies an existing event mask that
has been set for a particular PID being recorded.
MMAC_ELU_SetExtendedEventMask This function is used to setup an extended event
mask for a particular PID being recorded.
MMAC_ELU_ModifyExtendedEventMask This function modifies an existing extended event
mask that has been set for a particular PID being
recorded.
MMAC_ELU_GetExtendedEventMask This function returns the current extended event
mask that is set for a particular PID being
recorded.
MMAC_ELU_FreeExtendedEventMask This function release an extended event mask.
MMAC_ELU_SetEventNotifyFunction This function registers a callback function with the
ELU API for dealing with events that are stored in
the event logging buffers. The callback function is
called when the number events in the buffer equals
that of the parameter passed to the function,
numberOfEvents.
MMAC_ELU_SetErrorNotifyFunction This function is used to register a callback function
with the ELU API for dealing with errors generated
by the ELU module. The callback function is called
whenever an error occurs on any device.
MMAC_ELU_Start This function is used to enable the Event Logging
Service. After a call to this function events will start
to be stored in the event logging buffers.
MMAC_ELU_Stop This function is used to disable the Event Logging
Service. After a call to this function, events will
stop being stored in the event logging buffers.
MMAC_ELU_GetBuffer This function can be called to retrieve any events
that are remaining in the event logging buffers after
a call to MMAC_ELU_Stop ().
MMAC_ELU_GetRTS This function returns the current value of the ELU
counter.
MMAC_ELU_GetPacketCount This function returns the current value of the ELU
packet counter.
5
Return Codes
The meanings of the result codes returned by the driver are described in the following table and defined as
the type MMAC_ELU_RESULT_CODE:
Result Code Description
MMAC_ELU_OK A function has completed successfully.
MMAC_ELU_FAILED The function has failed.
MMAC_ELU_INVALID_CHANNEL The supplied channel is invalid
MMAC_ELU_ALREADY_INITIALISED A call to the function
MMAC_ELU_Initialise() was made while
the ELU API was already initialised.
MMAC_ELU_PID_NOT_AVAILABLE An attempt to enable events for a PID that has
not been allocated in the SRU.
MMAC_ELU_ALREADY_STARTED The service has already been started.
MMAC_ELU_NOT_STARTED The service has not been started.
MMAC_ELU_INVALID_DEVICE The specified device is invalid.
MMAC_ELU_INVALID_PARAMETER A function was called with an invalid
parameter.
MMAC_ELU_INVALID_FILTER The supplied filter is invalid.
MMAC_ELU_FILTER_IN_USE The supplied filter is already in use.
MMAC_ELU_FAILED A function has not completed successfully.
MMAC_ELU_NOT_INITIALISED A call to a function was made without calling
MMAC_ELU_Initialise() first.
Includes
In order to use this API, the following header files must be included, in the following order:
#include “mmac/types.h”
#include “mmac/rtos.h”
#include “mmac/mmac_config.h”
#include “mmac/demux.h”
#include “mmac/file.h”
#include “mmac/record.h”
#include “mmac/elu.h”
Initialisations
Prior to using any functions of the ELU API, the following functions must be called:
MMAC_RTOS_Initialise()
MMAC_DEMUX_Initialise()
MMAC_RECORD_Initialise()
6
API Configuration
A number of configurable options, in the form of “#define”s are defined in the ELU section of the
mmac_config.h source file clearly marked by the comment:
/************************************************************/
/* */
/* MMAC ELU SETUP */
/* */
/************************************************************/
7
2.1 Example of ELU API Use
/**********************************************************************/
/* This code provides an example of how to use the ELU API */
/* for Event Logging. */
/* The code sets up the ELU API to log events on channel A */
/* and channel B. */
/* Channel A events are: */
/* MMAC_ELU_EVENT_SECTION_COMPLETE */
/* Channel B events are: */
/* MMAC_ELU_EVENT_PACKET_EDIT */
/* MMAC_ELU_EVENT_PCR */
/* */
/* Channel A will call the callback function after 10 events */
/* Channel B will call the callback function after each event */
/**********************************************************************/
#include “mmac/types.h”
#include “mmac/rtos.h”
#include “mmac/mmac_config.h”
#include “mmac/demux.h”
#include “mmac/elu.h”
/* Global variables */
MMAC_BOOL circBufferFull1 = MMAC_FALSE;
MMAC_BOOL circBufferFull2 = MMAC_FALSE;
MMAC_ELU_EVENT circularChannelEventStore1[CIRCULAR_BUFFER_SIZE];
MMAC_ELU_EVENT circularChannelEventStore2[CIRCULAR_BUFFER_SIZE];
UI32 circularStoreWritePointer1, circularStoreReadPointer1;
UI32 circularStoreWritePointer2, circularStoreReadPointer2;
typedef enum
{
WRITE_SUCCESS = 0,
WRITE_FAIL
}CIRC_BUFFER_WRITE_RESPONSE;
typedef enum
{
READ_SUCCESS = 0,
NO_DATA
}CIRC_BUFFER_READ_RESPONSE;
/* Forward declarations */
void Notify1(MMAC_DEMUX_DEVICE_HANDLE device,
UI16 numEvents, MMAC_ELU_EVENT events[]);
void Notify2(MMAC_DEMUX_DEVICE_HANDLE device,
UI16 numEvents, MMAC_ELU_EVENT events[]);
void ELU_Setup(void);
void main(void)
{
MMAC_ELU_EVENT workingEvent;
ELU_Setup();
8
while(1)
{
/* do some main code here */
if(ReadFromCircBuffer(&circularStoreWritePointer1,
&circularStoreReadPointer1,
&circularChannelEventStore1,&workingEvent,
CIRCULAR_BUFFER_SIZE) == READ_SUCCESS)
{
/* Do something with event data here*/
}
if(ReadFromCircBuffer(&circularStoreWritePointer1,
&circularStoreReadPointer1,
&circularChannelEventStore1,&workingEvent,
CIRCULAR_BUFFER_SIZE)== READ_SUCCESS)
{
/* Do something with event data here*/
}
if(circBufferFull1 == MMAC_TRUE)
{
/* Do something with event data here otherwise data will be lost */
circBufferFull1 = MMAC_FALSE;
}
/* do some main code here */
if(circBufferFull2 == MMAC_TRUE)
{
/* Do something with event data here otherwise data will be lost */
circBufferFull2 = MMAC_FALSE;
}
9
/* Complete Initialisation procedure */
MMAC_RTOS_Initialise();
MMAC_DEMUX_Initialise();
MMAC_RECORD_Initialise();
MMAC_ELU_Initialise();
/************************************************************************/
/* Function:- Notify1 */
/* This function called by the ELU subsystem to handle the event stored */
/* in the */
/* first record buffer. */
/************************************************************************/
while((readBufferPointer!=numEvents)&&(circBufferFull1!=MMAC_TRUE))
{
if (WriteToCircBuffer(&circularStoreWritePointer1,
&circularStoreReadPointer1,
&circularChannelEventStore1,
&event[readBufferPointer],
CIRCULAR_BUFFER_SIZE)== WRITE_SUCCESS)
{
readBufferPointer++;
}
10
else
{
circBufferFull1 = MMAC_TRUE;
}
}
}
/************************************************************************/
/* Function: Notify2. */
/* This function called by the ELU subsystem to handle the event stored */
/* in the */
/* second record buffer. */
/************************************************************************/
/************************************************************************/
/* Function: WriteToCircBuffer. */
/* This function called to save an event to a circular event buffer. */
/************************************************************************/
if(((*writePTR+1)==*readPTR)||
(((*writePTR+1)==buffSize)&&(*readPTR==0)))
{
response = WRITE_FAIL;
}
else
{
events[*writePTR].event_descriptor = event->event_descriptor;
events[*writePTR].pid = event->pid;
events[*writePTR].packet_number = event->packet_number;
events[*writePTR].time = event->time;
events[*writePTR].PCR = event->PCR;
*writePTR++;
if(*writePTR == buffSize)
{
*writePTR = 0;
11
}
}
return(response);
}
/************************************************************************/
/* Function: ReadFromCircBuffer. */
/* This function called to read an event from a circular event buffer. */
/************************************************************************/
CIRC_BUFFER_WRITE_RESPONSE ReadFromCircBuffer(UI32 *writePTR,
UI32 *readPTR,
MMAC_ELU_EVENT *events,
MMAC_ELU_EVENT *event,
UI32 buffSize);
{
CIRC_BUFFER_READ_RESPONSE response = READ_SUCCESS;
if (*writePTR == *readPTR)
{
response = NO_DATA;
}
else
{
event->event_descriptor = events[*readPTR].event_descriptor;
event->pid = events[*readPTR].pid;
event->packet_number = events[*readPTR].packet_number;
event->time = events[*readPTR].time;
event->PCR = events[*readPTR].PCR;
readPTR++;
if(*readPTR == buffSize)
{
*readPTR = 0;
}
}
return(response);
}
12
3 Function Prototypes
MMAC_ELU_Initialise
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_Initialise (void)
Includes
None
Inputs
None
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_ALREADY_INITIALISED
MMAC_ELU_FAILED
Description
This function initialises the ELU hardware and sets up the ELU API software prior to any other ELU API
function calls. ELU buffers are allocated from the system heap of size MMAC_ELU_BUFFER_SIZE as
defined in the file “mmac_config.h”.
If any of the initialisation tasks fail then the function will return MMAC_ELU_FAILED.
If the ELU API is already initialised then this function will do nothing and return
MMAC_ELU_ALREADY_INITIALISED.
See Also
MMAC_ELU_Reset
MMAC_ELU_Close
Sample Code
< tba >
13
MMAC_ELU_Close
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_Close (void)
Includes
None
Inputs
None
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
Description
If the ELU API is not initialised then this function will do nothing and return
MMAC_ELU_NOT_INITIALISED.
This function resets the ELU hardware and the ELU API, for all of the ELU devices and deallocates any
resources previously allocated by MMAC_ELU_Initialise(). Once this function has been called, the
ELU driver will need to be initialised before it can be used again, by calling MMAC_ELU_Initialise().
The function returns MMAC_ELU_FAILED if any of the internal Close operations fail.
See Also
MMAC_ELU_Initialise
MMAC_ELU_Reset
Sample Code
< tba >
14
MMAC_ELU_Reset
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_Reset (MMAC_DEMUX_DEVICE_HANDLE deviceId)
Includes
None
Inputs
deviceId This is a device handle which identifies the device to be reset. The device handle
deviceId is generated by a call to the MMAC_DEMUX_OpenDevice() function.
This device handle can then be used throughout the demux, ELU and SRU API
modules.
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_DEVICE
Description
This function performs a software reset on the ELU API for the device specified by the input parameter
deviceId. The software is reset to the same state as immediately after a call to the initialisation function
MMAC_ELU_Initialise().
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the specified device, deviceId, does not have event logging capability then
MMAC_ELU_INVALID_DEVICE is returned.
See Also
MMAC_ELU_Initialise
MMAC_ELU_Close
Sample Code
< tba >
15
MMAC_ELU_SelectedReset
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_SelectedReset (
MMAC_DEMUX_DEVICE_HANDLE deviceId,
MMAC_BOOL resetEventLog,
MMAC_BOOL resetCamEvent,
MMAC_BOOL resetAdaptationEvent
)
Includes
None
Inputs
deviceId This is a device handle which identifies the device for the selected-reset. The
device handle deviceId is generated by a call to the
MMAC_DEMUX_OpenDevice() function. This device handle can then be used
throughout the demux, ELU and SRU API modules.
resetEventlog Indicator to reset or not EventLog events.
resetCamEvent Indicator to reset or not Cam events.
resetAdaptationEvent Indicator to reset or not Adaptation events.
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_DEVICE
Description
This function performs a selected software reset on the ELU API for the device specified by the input
parameter deviceId and for specific type of event (index-event log, cam-event or adaptation event). The
selection of a reset in a particular type of event will be activated with a value of MMAC_TRUE for the
corresponding parameter.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the specified device, deviceId, does not have event logging capability then
MMAC_ELU_INVALID_DEVICE is returned.
See Also
MMAC_ELU_Initialise
MMAC_ELU_Reset
MMAC_ELU_Close
Sample Code
< tba >
16
MMAC_ELU_SetEventMask
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_SetEventMask (
MMAC_DEMUX_DEVICE_HANDLE deviceId,
UI32 *filterId,
MMAC_ELU_PID_TYPE pid,
MMAC_ELU_EVENT_MASK eventMask
)
Includes
None
Inputs
deviceId This is a device handle which identifies the device on which to set the event
mask. The device handle deviceId is generated by a call to the
MMAC_DEMUX_OpenDevice() function. This device handle can then be used
throughout the demux, ELU and SRU API modules.
pid The packet identifier for which to apply the event mask.
eventMask The event mask that is to be set up for the corresponding PID filter. It is created
by ORing together any combination of the following bit fields:
MMAC_ELU_EVENT_NONE
MMAC_ELU_EVENT_PAYLOAD_START
MMAC_ELU_EVENT_TS_CLEAR
MMAC_ELU_EVENT_TS_EVEN
MMAC_ELU_EVENT_TS_ODD
MMAC_ELU_EVENT_FILTER_PASS
MMAC_ELU_EVENT_SECTION_COMPLETE
MMAC_ELU_EVENT_SECTION_START
MMAC_ELU_EVENT_SECTION_END
MMAC_ELU_EVENT_DISCONTINUITY
MMAC_ELU_EVENT_RANDOM_ACCESS
MMAC_ELU_EVENT_ES_PRIORITY
MMAC_ELU_EVENT_PCR
MMAC_ELU_EVENT_OPCR
MMAC_ELU_EVENT_SPLICE_POINT
MMAC_ELU_EVENT_TS_PRIVATE
MMAC_ELU_EVENT_ADAPTATION_EXTEND
MMAC_ELU_EVENT_PACKET_REPLACE
MMAC_ELU_EVENT_PACKET_INSERT
MMAC_ELU_EVENT_PACKET_EDIT
MMAC_ELU_EVENT_PID
MMAC_ELU_EVENT_AUX
MMAC_ELU_EVENT_AUX_CS_CHANGE
(The following event masks only apply to filters 0 and 1)
MMAC_ELU_EVENT_PICTURE_START
MMAC_ELU_EVENT_CODE_1
MMAC_ELU_EVENT_CODE_2
MMAC_ELU_EVENT_CODE_3
MMAC_ELU_EVENT_CODE_4
MMAC_ELU_EVENT_CODE_5
MMAC_ELU_EVENT_CODE_6
Outputs
filterId A unique handle that can be used to access the event mask which has been set.
17
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_DEVICE
MMAC_ELU_PID_NOT_AVAILABLE
Description
This function is used to set an event mask, eventMask, for a packet identifier, pid, on the input transport
stream identified by the device handle, device. When the ELU API sets up the event mask for a particular
pid, it returns a unique handle to it called filterId.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the specified device deviceId does not have event logging capability then
MMAC_ELU_INVALID_DEVICE is returned.
If the PID, pid is not currently set-up to be recorded by the SRU module for the device, deviceId then
MMAC_ELU_PID_NOT_AVAILABLE is returned.
See Also
MMAC_ELU_ModifyEventMask
MMAC_ELU_GetEventMaskx
Sample Code
< tba >
18
MMAC_ELU_ModifyEventMask
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_ModifyEventMask (
UI32 filterId,
MMAC_ELU_EVENT_MASK eventMask
);
Inputs
filterId A unique handle used for accessing a previously set event mask.
eventMask The event mask that is to be set up for the corresponding PID filter. It is created
by ORing together any combination of the following bit fields:
MMAC_ELU_EVENT_NONE
MMAC_ELU_EVENT_PAYLOAD_START
MMAC_ELU_EVENT_TS_CLEAR
MMAC_ELU_EVENT_TS_EVEN
MMAC_ELU_EVENT_TS_ODD
MMAC_ELU_EVENT_FILTER_PASS
MMAC_ELU_EVENT_SECTION_COMPLETE
MMAC_ELU_EVENT_SECTION_START
MMAC_ELU_EVENT_SECTION_END
MMAC_ELU_EVENT_DISCONTINUITY
MMAC_ELU_EVENT_RANDOM_ACCESS
MMAC_ELU_EVENT_ES_PRIORITY
MMAC_ELU_EVENT_PCR
MMAC_ELU_EVENT_OPCR
MMAC_ELU_EVENT_SPLICE_POINT
MMAC_ELU_EVENT_TS_PRIVATE
MMAC_ELU_EVENT_ADAPTATION_EXTEND
MMAC_ELU_EVENT_PACKET_REPLACE
MMAC_ELU_EVENT_PACKET_INSERT
MMAC_ELU_EVENT_PACKET_EDIT
MMAC_ELU_EVENT_PID
MMAC_ELU_EVENT_AUX
MMAC_ELU_EVENT_AUX_CS_CHANGE
(The following event masks only apply to filters 0 and 1)
MMAC_ELU_EVENT_PICTURE_START
MMAC_ELU_EVENT_CODE_1
MMAC_ELU_EVENT_CODE_2
MMAC_ELU_EVENT_CODE_3
MMAC_ELU_EVENT_CODE_4
MMAC_ELU_EVENT_CODE_5
MMAC_ELU_EVENT_CODE_6
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_FILTER
19
Description
This function is used to modify a previously set-up event mask to eventMask. When the event mask was
initially set using MMAC_ELU_SetEventMask() a unique filter handle, filterId was assigned to it. This is
used to reference the exact event mask to [Link] MMAC_ELU_PARAMETER_CHECKING is defined as
MMAC_YES then the following checks are carried out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the filter, filterId is invalid then MMAC_ELU_INVALID_FILTER is returned.
See Also
MMAC_ELU_SetEventMask
MMAC_ELU_GetEventMask
Sample Code
< tba >
20
MMAC_ELU_GetEventMask
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_GetEventMask (
UI32 filterId,
MMAC_ELU_PID_TYPE *pid,
MMAC_ELU_EVENT_MASK *eventMask
)
Inputs
filterId A unique handle used for accessing a previously set event mask.
Outputs
pid The packet identifier to which the event mask has been applied.
eventMask The current event mask settings for the corresponding PID. This mask is a
combination of the following flags:
MMAC_ELU_EVENT_PAYLOAD_START
MMAC_ELU_EVENT_TS_CLEAR
MMAC_ELU_EVENT_TS_EVEN
MMAC_ELU_EVENT_TS_ODD
MMAC_ELU_EVENT_FILTER_PASS
MMAC_ELU_EVENT_SECTION_COMPLETE
MMAC_ELU_EVENT_SECTION_START
MMAC_ELU_EVENT_SECTION_END
MMAC_ELU_EVENT_DISCONTINUITY
MMAC_ELU_EVENT_RANDOM_ACCESS
MMAC_ELU_EVENT_ES_PRIORITY
MMAC_ELU_EVENT_PCR
MMAC_ELU_EVENT_OPCR
MMAC_ELU_EVENT_SPLICE_POINT
MMAC_ELU_EVENT_TS_PRIVATE
MMAC_ELU_EVENT_ADAPTATION_EXTEND
MMAC_ELU_EVENT_PACKET_REPLACE
MMAC_ELU_EVENT_PACKET_INSERT
MMAC_ELU_EVENT_PACKET_EDIT
MMAC_ELU_EVENT_PID
MMAC_ELU_EVENT_AUX
MMAC_ELU_EVENT_AUX_CS_CHANGE
(The following event masks only apply to filters 0 and 1)
MMAC_ELU_EVENT_PICTURE_START
MMAC_ELU_EVENT_CODE_1
MMAC_ELU_EVENT_CODE_2
MMAC_ELU_EVENT_CODE_3
MMAC_ELU_EVENT_CODE_4
MMAC_ELU_EVENT_CODE_5
MMAC_ELU_EVENT_CODE_6
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_FILTER
21
Description
This function is used to obtain the pid and eventMask settings enabled on the PID filter identified by
filterId.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the filter, filterId is invalid then MMAC_ELU_INVALID_FILTER is returned.
See Also
MMAC_ELU_SetEventMask
MMAC_ELU_ModifyEventMask
Sample Code
< tba >
22
MMAC_ELU_SetExtendedEventMask
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_SetExtendedEventMask (
MMAC_DEMUX_DEVICE_HANDLE deviceId,
MMAC_DEMUX_PID_FILTER_HANDLE pidFilterHandle,
MMAC_ELU_PID_TYPE pid,
MMAC_ELU_EXTENDED_EVENT_MASK extendedEventMask,
UI32 *extendedFilterId
)
Inputs
deviceId This is a device handle which identifies the device on which to set the extended
event mask. The device handle deviceId is generated by a call to the
MMAC_DEMUX_OpenDevice() function. This device handle can then be used
throughout the demux, ELU and SRU API modules.
pidFilterHandle This is a PID filter handle which identifies the PID filter in the demux that is set
to filter packets with a PID, pid. The demux PID filter must be a PES filter which
is allocated using the function
MMAC_DEMUX_AllocateGeneralPidFilter() with the pidType parameter
set to MMAC_DEMUX_PID_FILTER_PES_TYPE.
pid The packet identifier for which to apply the event mask.
extendedEventMask The event mask that is to be set up for the corresponding PID filter. It is created
by ORing together any combination of the following bit fields:
MMAC_ELU_EXTENDED_EVENT_NONE
MMAC_ELU_EXTENDED_EVENT_SEQUENCE_HEADER
MMAC_ELU_EXTENDED_EVENT_I_PICTURE
MMAC_ELU_EXTENDED_EVENT_P_PICTURE
MMAC_ELU_EXTENDED_EVENT_B_PICTURE
MMAC_ELU_EXTENDED_EVENT_GROUP_START
Outputs
extendedFilterId A unique handle that can be used to access the extended event mask which has
been set.
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_DEVICE
MMAC_ELU_INVALID_PARAMETER
MMAC_ELU_FILTER_IN_USE
MMAC_ELU_PID_NOT_AVAILABLE
Description
This function is used to set an extended event mask, extendedEventMask, for a packet identifier, pid, on
the input transport stream identified by the device handle, device. The pid must already be setup for
filtering on the PID filter identified by pidFilterHandle. When the ELU API sets up the extended event
mask for a particular pid, it returns a unique handle to it called extendedFilterId. There can only be a
maximum of MMAC_ELU_MAX_EXTENDED_EVENTS extended event masks set at any one time. Once an
event mask is finished with it can be released using the function
MMAC_ELU_FreeExtendedEventMask().
23
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the specified device deviceId does not have event logging capability then
MMAC_ELU_INVALID_DEVICE is returned.
If the PID, pid is not currently set-up to be recorded by the SRU module for the device, deviceId then
MMAC_ELU_PID_NOT_AVAILABLE is returned.
If there are no free extended event triggers in the ELU (MMAC_ELU_MAX_EXTENDED_EVENTS) then
return MMAC_ELU_FILTER_IN_USE.
If the PID filter identified by pidFilterHandle is not a demux PES filter then
MMAC_ELU_INVALID_PARAMETER is returned.
See Also
MMAC_ELU_ModifyExtendedEventMask
MMAC_ELU_GetExtendedEventMask
MMAC_ELU_FreeExtendedEventMask
Sample Code
< tba >
24
MMAC_ELU_ModifyExtendedEventMask
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_ModifyExtendedEventMask (
UI32 extendedFilterId,
MMAC_ELU_EXTENDED_EVENT_MASK extendedEventMask
)
Inputs
extendedFilterId A unique handle used for accessing a previously set extended event mask.
extendedEventMask The extended event mask that is to be set up for the corresponding PID filter. It
is created by ORing together any combination of the following bit fields:
MMAC_ELU_EXTENDED_EVENT_NONE
MMAC_ELU_EXTENDED_EVENT_SEQUENCE_HEADER
MMAC_ELU_EXTENDED_EVENT_I_PICTURE
MMAC_ELU_EXTENDED_EVENT_P_PICTURE
MMAC_ELU_EXTENDED_EVENT_B_PICTURE
MMAC_ELU_EXTENDED_EVENT_GROUP_START
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_FILTER
Description
This function is used to modify a previously setup extended event mask to extendedEventMask. When the
event mask was initially set using MMAC_ELU_SetExtendedEventMask() a unique filter handle,
extendedFilterId was assigned to it. This is used to reference the exact event mask to modify.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the filter, extendedFilterId is invalid then MMAC_ELU_INVALID_FILTER is returned.
See Also
MMAC_ELU_SetExtendedEventMask
MMAC_ELU_GetExtendedEventMask
MMAC_ELU_FreeExtendedEventMask
Sample Code
< tba >
25
MMAC_ELU_GetExtendedEventMask
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_GetExtendedEventMask (
UI32 extendedFilterId,
MMAC_ELU_PID_TYPE *pid,
MMAC_ELU_EXTENDED_EVENT_MASK *extendedEventMask
)
Inputs
extendedFilterId A unique handle used for accessing a previously set extended event mask.
Outputs
pid The packet identifier to which the event mask has been applied.
extendedEventMask The current extended event mask settings for the corresponding PID. This mask
is a combination of the following flags:
MMAC_ELU_EXTENDED_EVENT_NONE
MMAC_ELU_EXTENDED_EVENT_SEQUENCE_HEADER
MMAC_ELU_EXTENDED_EVENT_I_PICTURE
MMAC_ELU_EXTENDED_EVENT_P_PICTURE
MMAC_ELU_EXTENDED_EVENT_B_PICTURE
MMAC_ELU_EXTENDED_EVENT_GROUP_START
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_FILTER
Description
This function is used to obtain the pid and extendedEventMask settings enabled on the PID filter identified
by filterId.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the filter, extendedFilterId is invalid then MMAC_ELU_INVALID_FILTER is returned.
See Also
MMAC_ELU_SetExtendedEventMask
MMAC_ELU_ModifyExtendedEventMask
MMAC_ELU_FreeExtendedEventMask
Sample Code
< tba >
26
MMAC_ELU_FreeExtendedEventMask
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_FreeExtendedEventMask (
UI32 extendedFilterId
)
Inputs
extendedFilterId A unique handle used for accessing a previously set extended event mask.
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_FILTER
Description
This function is used to release a previously setup extended event mask to extendedEventMask. When the
event mask was initially set using MMAC_ELU_SetExtendedEventMask() a unique filter handle,
extendedFilterId was assigned to it. This is used to reference the exact event mask to modify. There can
only be a maximum of MMAC_ELU_MAX_EXTENDED_EVENTS extended event masks setup at any one
time.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the filter, extendedFilterId is invalid then MMAC_ELU_INVALID_FILTER is returned.
See Also
MMAC_ELU_SetExtendedEventMask
MMAC_ELU_ModifyExtendedEventMask
MMAC_ELU_GetExtendedEventMask
Sample Code
< tba >
27
MMAC_ELU_SetEventNotifyFunction
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_SetEventNotifyFunction (
MMAC_DEMUX_DEVICE_HANDLE deviceId,
UI16 numberOfEvents,
MMAC_ELU_NOTIFY_CALLBACK callback
)
Inputs
deviceId This is a device handle that identifies the device for which to set the event notify
function. The device handle deviceId is generated by a call to the
MMAC_DEMUX_OpenDevice() function. This device handle can then be used
throughout the demux, ELU and SRU API modules.
numberOfEvents The number of events that will cause a callback.
callback A pointer to a function that will be called when numberOfEvents events have
occurred.
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_FAILED
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_DEVICE
MMAC_ELU_INVALID_PARAMETER
Description
This function is used to set up a callback function that will handle the stored events held in the buffer for
the device specified, deviceId. The function callback will get called when numberOfEvents, events have
been received by the ELU. An event notify callback function must be set-up before events can be logged.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If callback is NULL then MMAC_ELU_INVALID_PARAMETER is returned.
If the specified device deviceId does not have event logging capability then
MMAC_ELU_INVALID_DEVICE is returned.
If numberOfEvents is 0 or greater than MMAC_ELU_MAX_EVENTS then
MMAC_ELU_INVALID_PARAMETER is returned.
See Also
None
Sample Code
< tba >
28
MMAC_ELU_SetErrorNotifyFunction
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_SetErrorNotifyFunction (
MMAC_DEMUX_DEVICE_HANDLE deviceId,
MMAC_ELU_ERROR_NOTIFY_CALLBACK callback
)
Inputs
device This is a device handle which identifies the device for which to set the error
notify function. The device handle deviceId is generated by a call to the
MMAC_DEMUX_OpenDevice() function. This device handle can then be used
throughout the demux, ELU and SRU API modules.
callback A pointer to a function that will be called in the event of an error.
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_FAILED
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_DEVICE
Description
This function is used to set up a callback function, callback that will handle errors generated by the ELU.
When an error occurs the function callback is called from within a high priority task. As callback is called
from a high priority task, it is important that the function completes and returns quickly. If any time
consuming operations need to be performed these should be done by another task, which is woken up by
callback.
If callback is NULL then error notification for device, deviceId is disabled. It is not necessary to have an
error notification callback installed before event logging is enabled.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the specified device deviceId does not have event logging capability then
MMAC_ELU_INVALID_DEVICE is returned.
See Also
None
Sample Code
< tba >
29
MMAC_ELU_Start
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_Start (
MMAC_DEMUX_DEVICE_HANDLE deviceId
)
Inputs
deviceId This is a device handle which identifies the device to start event logging for. The
device handle deviceId is generated by a call to the
MMAC_DEMUX_OpenDevice() function. This device handle can then be used
throughout the demux, ELU and SRU API modules.
Outputs
None.
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_FAILED
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_DEVICE
MMAC_ELU_ALREADY_STARTED
Description
This function is used to start the event logging service for the device, deviceId specified. After a call to
this function the events will be logged on the specified device (deviceId).
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the specified device deviceId does not have event logging capability then
MMAC_ELU_INVALID_DEVICE is returned.
If event logging is already started on the device, deviceId then this function will return
MMAC_ELU_ALREADY_STARTED.
See Also
MMAC_ELU_Stop
Sample Code
< tba >
30
MMAC_ELU_Stop
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_Stop (MMAC_DEMUX_DEVICE_HANDLE deviceId)
Inputs
device This is a device handle which identifies the device to stop event logging for. The
device handle deviceId is generated by a call to the
MMAC_DEMUX_OpenDevice() function. This device handle can then be
used throughout the demux, ELU and SRU API modules.
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_FAILED
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_DEVICE
MMAC_ELU_NOT_STARTED
Description
This function is used to stop the event logging service for the device, deviceId specified. After a call to this
function, no further events will be logged on the specified device (deviceId).
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If the specified device deviceId does not have event logging capability then
MMAC_ELU_INVALID_DEVICE is returned.
If event logging is stopped on the device, deviceId then this function will return
MMAC_ELU_NOT_STARTED.
See Also
MMAC_ELU_Start
Sample Code
< tba >
31
MMAC_ELU_GetRTS
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_GetRTS (UI32 *rts)
Inputs
None
Outputs
rts A pointer to the variable where the current record time stamp value will be stored.
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_INVALID_PARAMETER
MMAC_ELU_NOT_INITIALISED
Description
This function sets the variable pointed to by rts with the current value of the ELU Record Time Stamp.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If rts is NULL, then MMAC_ELU_INVALID_PARAMETER is returned.
See Also
None
Sample Code
< tba >
32
MMAC_ELU_GetPacketCount
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_GetPacketCount (
MMAC_DEMUX_DEVICE_HANDLE deviceId,
UI32 *packetCount
)
Inputs
deviceId This is a device handle which identifies the device to get the packet count for.
The device handle deviceId is generated by a call to the
MMAC_DEMUX_OpenDevice() function. This device handle can then be used
throughout the demux, ELU and SRU API modules.
Outputs
packetCount A pointer to the variable where the current packet count value will be stored.
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_FAILED
MMAC_ELU_INVALID_PARAMETER
MMAC_ELU_NOT_INITIALISED
MMAC_ELU_INVALID_DEVICE
Description
This function sets the variable pointed to by packetCount with the value of the current packet counter for
the specified device.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
If packetCount is NULL then return MMAC_ELU_INVALID_PARAMETER.
See Also
None
Sample Code
< tba >
33
MMAC_ELU_SetIndependentEvent
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_SetIndependentEvent (
MMAC_BOOL Internaltick, MMAC_BOOL sectionMatch
)
Inputs
Internaltick This argument determines to enable or not the notification by internal tick events.
SectionMatch. Boolean to determine sending or not notifications caused by section-match
events.
Outputs
None
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
Description
This function is used to activate or not the notifications of the special events (internal tick and section-
match events). The value MMAC_TRUE will allow to enable or switch on the notifications for the
corresponding variables.
If MMAC_ELU_PARAMETER_CHECKING is defined as MMAC_YES then the following checks are carried
out:
If the ELU API is not initialised then MMAC_ELU_NOT_INITIALISED is returned.
See Also
None
Sample Code
< tba >
34
MMAC_ELU_GetPcrValue
Function Prototype
MMAC_ELU_RESULT_CODE MMAC_ELU_GetPcrValue(
MMAC_DEMUX_DEVICE_HANDLE deviceId,
UI32 packetCount,
UI32* pcrValue
)
Inputs
deviceId The device handle on which to extract the Pcr value.
packetCount The packet number of the PCR packet. This value determines the order-number
of the packet from the starting of the recording.
Outputs
PcrValue The PCR value extracted from SRU buffer and corresponding for the packet
number given.
Event Notification
N/A
Return Codes
MMAC_ELU_OK
MMAC_ELU_NOT_INITIALISED
Description
This function finds the pcrValue payload, of the PCR that has caused the PCR event, in the SRU buffer
and extract the PCR value from it. For it, the parameter deviceId and packetCount will be required to
determine the device handle and the number of the packet to extract from.
See Also
None
Sample Code
< tba >
35
4 Data Structures
All the following definitions are defined in “mmac/elu.h”.
MMAC_ELU_RESULT_CODE
Enumeration defining possible return codes for the ELU API.
typedef enum
{
MMAC_ELU_OK,
MMAC_ELU_FAILED,
MMAC_ELU_NOT_INITIALISED,
MMAC_ELU_ALREADY_INITIALISED,
MMAC_ELU_PID_NOT_AVAILABLE,
MMAC_ELU_ALREADY_STARTED,
MMAC_ELU_INVALID_CHANNEL,
MMAC_ELU_INVALID_DEVICE,
MMAC_ELU_INVALID_PARAMETER,
MMAC_ELU_FILTER_IN_USE,
MMAC_ELU_INVALID_FILTER,
MMAC_ELU_NOT_STARTED
} MMAC_ELU_RESULT_CODE;
MMAC_ELU_PID_TYPE
PID values are specified using 13 bits. Use the following definition when referring to PID values.
typedef UI16 MMAC_ELU_PID_TYPE;
MMAC_ELU_EVENT_MASK
ELU event masks are specified using the following set of defines.
typedef UI32 MMAC_ELU_EVENT_MASK;
36
#define MMAC_ELU_EVENT_CODE_1 (0x02000000)
#define MMAC_ELU_EVENT_CODE_2 (0x04000000)
#define MMAC_ELU_EVENT_CODE_3 (0x08000000)
#define MMAC_ELU_EVENT_CODE_4 (0x10000000)
#define MMAC_ELU_EVENT_CODE_5 (0x20000000)
#define MMAC_ELU_EVENT_CODE_6 (0x40000000)
#define MMAC_ELU_EVENT_FIRST_RECORD_PACKET (0x80000000)
MMAC_ELU_EXTENDED_EVENT_MASK
ELU extended event masks are specified using the following set of defines.
typedef UI32 MMAC_ELU_EXTENDED_EVENT_MASK;
MMAC_ELU_NOTIFY_EVENT_MASK
ELU events are notified using the following set of defines.
typedef UI32 MMAC_ELU_NOTIFY_EVENT_MASK;
37
MMAC_ELU_EVENT
This is the structure used for passing event notification up to the application via the notify callback. The
application defines how many events are passed back at a time, so the events are passed as an array of the
MMAC_ELU_EVENT structure. The maximum number of events that can be passed at any one time is
MMAC_ELU_MAX_EVENTS.
typedef struct
{
MMAC_ELU_NOTIFY_EVENT_MASK eventDescriptor;
MMAC_ELU_PID_TYPE pid;
UI32 packetNumber;
UI32 time;
}MMAC_ELU_EVENT;
38
5 Revision History
Title: API Specification: Event Logging Unit (ELU)
Ref: API_ELU.doc
39