0% found this document useful (0 votes)
4 views39 pages

EMMA2 API User Manual for ELU

The document provides a user manual for the EMMA2 API, specifically detailing the Event Logging Unit (ELU) and its functionalities. It includes information on the architecture, function prototypes, initialization, event logging, and error handling within the ELU API. Additionally, it outlines the necessary configurations and provides examples of API usage for event logging in applications.

Uploaded by

gwoodstccd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views39 pages

EMMA2 API User Manual for ELU

The document provides a user manual for the EMMA2 API, specifically detailing the Event Logging Unit (ELU) and its functionalities. It includes information on the architecture, function prototypes, initialization, event logging, and error handling within the ELU API. Additionally, it outlines the necessary configurations and provides examples of API usage for event logging in applications.

Uploaded by

gwoodstccd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

User’s Manual

EMMA2 API

ELU (Event Logging Unit)

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

Book No: S16753EE1V0UM00 Doc No: MMAC0020, Issue: 1.1


© NEC Electronics Corporation 2002, 2003 Publication Date: 2003-06-27
The information is this document is subject to change without notice – it is
the reader’s responsibility to check that this is the latest available version.

This document includes company confidential information. It should only be


released to third parties under a Non-Disclosure Agreemant.
1 Introduction
The Event Log Unit (ELU) is used to monitor the incoming transport stream(s) that are being recorded by
the Stream Record Unit (SRU). The ELU logs events, which occur in the recorded stream(s) in a buffer,
which can then be used by the application to keep track of the recorded stream. There are a number of
events that can be logged by the ELU. Each event can be enabled independently by the application.
The ELU API specifies a set of functions to set up and control the ELU hardware and manage ELU
interrupts.

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 */
/* */
/************************************************************/

These options are:


Define Default Meaning
MMAC_ELU_BUFFER_SIZE 0x200000 Specifies the default size of the ELU
buffers in bytes.
MMAC_ELU_HISR_STACK_SIZE 1024 Size of the ELU HISR stack in bytes.
MMAC_ELU_TASK_STACK_SIZE 4096 Size of the ELU main task stack in bytes.
MMAC_ELU_TASK_PRIORITY 80 Priority of the ELU main task.0 is highest
priority, 255 is the lowest.
MMAC_ELU_PARAMETER_CHECKING MMAC_NO When defined, enables API level range
checking and validation.

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”

#define MAX_FILTER = 32;


#define CIRCULAR_BUFFER_SIZE = 100;

/* 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();

/* do other program setup here */

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*/
}

/* do main code here */

if(ReadFromCircBuffer(&circularStoreWritePointer1,
&circularStoreReadPointer1,
&circularChannelEventStore1,&workingEvent,
CIRCULAR_BUFFER_SIZE)== READ_SUCCESS)
{
/* Do something with event data here*/
}

/* do some main code 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;
}

/* do some main code here */


}
}

/* ELU API Setup and Configuration Code */


void ELU_Setup(void)
{
/* Setup and initialise local variables */
MMAC_ELU_EVENTS_TYPE numberOfEvents = 10;
/* Used to specifiy the events required for a trigger */
MMAC_ELU_EVENT_MASK eventMask = MMAC_ELU_EVENT_SECTION_COMPLETE;
/* Used to store required PIDs for ELU triggers 1st recording */
MMAC_ELU_PID_TYPE record1_PID[16]={2011,4300,1212,1412,0};
/* Used to store required PIDs for ELU triggers on 2nd recording */
MMAC_ELU_PID_TYPE record2_PID[16]={7013,3230,2534,2342,7856,4563,0};
UI32 filter;
/* Used for storing the demux device Ids */
MMAC_DEMUX_DEVICE_HANDLE deviceId1;
MMAC_DEMUX_DEVICE_HANDLE deviceId2;

/* Setup and initialise Global variables */


circularStoreWritePointer1 = 0;
circularStoreReadPointer1 = circularStoreWritePointer1;
circularStoreWritePointer2 = 0;
circularStoreReadPointer2 = circularStoreWritePointer2;

9
/* Complete Initialisation procedure */
MMAC_RTOS_Initialise();
MMAC_DEMUX_Initialise();
MMAC_RECORD_Initialise();
MMAC_ELU_Initialise();

/* Insert code here for Opening 2 demux devices */

/* Insert code here for setting up 1st recording */

/* Setup event logging for 1st recording */


filter = 0;
while(record1_PID[filter] != 0)
{
MMAC_ELU_SetEventMask(deviceId1, filter,
Record1_PID[filter], eventMask);
filter++;
}

MMAC_ELU_SetEventNotifyFunction(deviceId1, numberOfEvents, Notify1);


MMAC_ELU_Start(deviceId1);

/* Modify variables for channel B*/


numberOfEvents = 0;
eventMask = MMAC_ELU_EVENT_PACKET_EDIT | MMAC_ELU_PCR_FLAG;

/* Setup event logging for 2nd recording */


filter = 16;
while(record2_PID[filter] != 0)
{
MMAC_ELU_SetEventMask(deviceId2, filter,
record2_PID[filter], eventMask);
filter++;
}
MMAC_ELU_SetEventNotifyFunction(deviceId2, numberOfEvents, Notify2);
MMAC_ELU_Start(deviceId2);
}

/************************************************************************/
/* Function:- Notify1 */
/* This function called by the ELU subsystem to handle the event stored */
/* in the */
/* first record buffer. */
/************************************************************************/

void Notify1 (MMAC_DEMUX_DEVICE_HANDLE device,


UI16 numEvents, MMAC_ELU_EVENT events[])
{
UI16 readBufferPointer = 0;

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. */
/************************************************************************/

void Notify2 (MMAC_DEMUX_DEVICE_HANDLE device, UI16 numEvents,


MMAC_ELU_EVENT events[])
{
UI16 readBufferPointer = 0;
while((readBufferPointer!=numEvents)&&(circBufferFull2!=MMAC_TRUE))
{
if (WriteToCircBuffer(&circularStoreWritePointer2,
&circularStoreReadPointer2,
&circularChannelEventStore2,
&event[readBufferPointer],
CIRCULAR_BUFFER_SIZE)== WRITE_SUCCESS)
{
readBufferPointer++;
}
else
{
circBufferFull2 = MMAC_TRUE;
}
}
}

/************************************************************************/
/* Function: WriteToCircBuffer. */
/* This function called to save an event to a circular event buffer. */
/************************************************************************/

CIRC_BUFFER_WRITE_RESPONSE WriteToCircBuffer(UI32 *writePTR,


UI32 *readPTR,
MMAC_ELU_EVENT *events,
MMAC_ELU_EVENT *event,
UI32 buffSize);
{
CIRC_BUFFER_WRITE_RESPONSE response = WRITE_SUCCESS;

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;

#define MMAC_ELU_EVENT_NONE (0x00000000)


#define MMAC_ELU_EVENT_PAYLOAD_START (0x00000001)
#define MMAC_ELU_EVENT_TS_CLEAR (0x00000002)
#define MMAC_ELU_EVENT_TS_EVEN (0x00000004)
#define MMAC_ELU_EVENT_TS_ODD (0x00000008)
#define MMAC_ELU_EVENT_FILTER_PASS (0x00000010)
#define MMAC_ELU_EVENT_SECTION_COMPLETE (0x00000020)
#define MMAC_ELU_EVENT_SECTION_START (0x00000040)
#define MMAC_ELU_EVENT_SECTION_END (0x00000080)
#define MMAC_ELU_EVENT_DISCONTINUITY (0x00000100)
#define MMAC_ELU_EVENT_RANDOM_ACCESS (0x00000200)
#define MMAC_ELU_EVENT_ES_PRIORITY (0x00000400)
#define MMAC_ELU_EVENT_PCR (0x00000800)
#define MMAC_ELU_EVENT_OPCR (0x00001000)
#define MMAC_ELU_EVENT_SPLICE_POINT (0x00002000)
#define MMAC_ELU_EVENT_TS_PRIVATE (0x00004000)
#define MMAC_ELU_EVENT_ADAPTATION_EXTEND (0x00008000)
#define MMAC_ELU_EVENT_PACKET_REPLACE (0x00010000)
#define MMAC_ELU_EVENT_PACKET_INSERT (0x00020000)
#define MMAC_ELU_EVENT_PACKET_EDIT (0x00040000)
#define MMAC_ELU_EVENT_PID (0x00080000)
#define MMAC_ELU_EVENT_AUX (0x00100000)
#define MMAC_ELU_EVENT_AUX_CS_CHANGE (0x00200000)
#define MMAC_ELU_EVENT_INTERNAL_TICK (0x00400000)
#define MMAC_ELU_EVENT_SECTION_MATCH (0x00800000)
#define MMAC_ELU_EVENT_PICTURE_START (0x01000000)

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;

#define MMAC_ELU_EXTENDED_EVENT_NONE (0x00000000)


#define MMAC_ELU_EXTENDED_EVENT_SEQUENCE_HEADER (0x01000000)
#define MMAC_ELU_EXTENDED_EVENT_I_PICTURE (0x02000000)
#define MMAC_ELU_EXTENDED_EVENT_P_PICTURE (0x04000000)
#define MMAC_ELU_EXTENDED_EVENT_B_PICTURE (0x08000000)
#define MMAC_ELU_EXTENDED_EVENT_GROUP_START (0x10000000)

MMAC_ELU_NOTIFY_EVENT_MASK
ELU events are notified using the following set of defines.
typedef UI32 MMAC_ELU_NOTIFY_EVENT_MASK;

#define MMAC_ELU_NOTIFY_EVENT_NONE (0x00000000)


#define MMAC_ELU_NOTIFY_EVENT_PAYLOAD_START (0x00000001)
#define MMAC_ELU_NOTIFY_EVENT_TS_CLEAR (0x00000002)
#define MMAC_ELU_NOTIFY_EVENT_TS_EVEN (0x00000004)
#define MMAC_ELU_NOTIFY_EVENT_TS_ODD (0x00000008)
#define MMAC_ELU_NOTIFY_EVENT_FILTER_PASS (0x00000010)
#define MMAC_ELU_NOTIFY_EVENT_SECTION_COMPLETE (0x00000020)
#define MMAC_ELU_NOTIFY_EVENT_SECTION_START (0x00000040)
#define MMAC_ELU_NOTIFY_EVENT_SECTION_END (0x00000080)
#define MMAC_ELU_NOTIFY_EVENT_DISCONTINUITY (0x00000100)
#define MMAC_ELU_NOTIFY_EVENT_RANDOM_ACCESS (0x00000200)
#define MMAC_ELU_NOTIFY_EVENT_ES_PRIORITY (0x00000400)
#define MMAC_ELU_NOTIFY_EVENT_PCR (0x00000800)
#define MMAC_ELU_NOTIFY_EVENT_OPCR (0x00001000)
#define MMAC_ELU_NOTIFY_EVENT_SPLICE_POINT (0x00002000)
#define MMAC_ELU_NOTIFY_EVENT_TS_PRIVATE (0x00004000)
#define MMAC_ELU_NOTIFY_EVENT_ADAPTATION_EXTEND (0x00008000)
#define MMAC_ELU_NOTIFY_EVENT_PICTURE_START (0x00010000)
#define MMAC_ELU_NOTIFY_EVENT_CODE_1 (0x00020000)
#define MMAC_ELU_NOTIFY_EVENT_CODE_2 (0x00040000)
#define MMAC_ELU_NOTIFY_EVENT_CODE_3 (0x00080000)
#define MMAC_ELU_NOTIFY_EVENT_CODE_4 (0x00100000)
#define MMAC_ELU_NOTIFY_EVENT_CODE_5 (0x00200000)
#define MMAC_ELU_NOTIFY_EVENT_CODE_6 (0x00400000)
#define MMAC_ELU_NOTIFY_EVENT_SEQUENCE_HEADER (0x01000000)
#define MMAC_ELU_NOTIFY_EVENT_I_PICTURE (0x02000000)
#define MMAC_ELU_NOTIFY_EVENT_P_PICTURE (0x04000000)
#define MMAC_ELU_NOTIFY_EVENT_B_PICTURE (0x08000000)
#define MMAC_ELU_NOTIFY_EVENT_GROUP_START (0x10000000)
#define MMAC_ELU_NOTIFY_EVENT_INTERNAL_TICK (0x20000000)
#define MMAC_ELU_NOTIFY_EVENT_SECTION_MATCH (0x40000000)
#define MMAC_ELU_NOTIFY_EVENT_FIRST_RECORD_PACKET (0x80000000)

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;

#define MMAC_ELU_MAX_EVENTS (32)


#define MMAC_ELU_MAX_EXTENDED_EVENTS (2)

typedef void (*MMAC_ELU_NOTIFY_CALLBACK) (


MMAC_DEMUX_DEVICE_HANDLE deviceId,
UI16 numEvents,
MMAC_ELU_EVENT events[]
);

typedef void (*MMAC_ELU_ERROR_NOTIFY_CALLBACK) ( void );

38
5 Revision History
Title: API Specification: Event Logging Unit (ELU)
Ref: API_ELU.doc

Date Doc API Details of change Ref.


Ver. Ver.
0.01 MMAC MSM Function names. M-DP
0.02 Changed to approved style and modify for EMMA2 M-TH
0.03 Changes resulting from meeting with Tokyo
0.04 Changes resulting from documentation style definition
0.05 Corrected the ELU example section
0.06 Additional return codes added
0.07 Changes resulting from a document review
0.08 Changes resulting from API implementation
0.09 Changes to MMAC_ELU_EVENT_MASK typedef
0.10 Changes resulting from initial level 1&2 testing of ELU.
Added the MMAC_ELU_Close() function
0.11 Changes resulting from SRU API review
0.12 Changes resulting from ELU API review
0.13 Replaced references to SRU API with record API
0.14 Changes required for EMMA2 ES2.0
0.15 Modify the event mask enum to be a series of defines.
0.16 New functions to select notification from independant
events.
2001-09-24 0.17 New functions:
To get pcr-value (MMAC_ELU_GetPcrValue()).
To do a selective reset (MMAC_SelectedReset()).
2002-08-06 0.18 Reformatted M-RJI
2002-12-09 1.0 For release – same as v0.18 M-RJI
2003-06-27 1.1 Doc number added. M-RJI

39

You might also like