MHEG5  15.3.0
source/ics/src/stmr_queue.c File Reference

IC Streamer queue manager. More...

#include <string.h>
#include "stb_os.h"
#include "glue_memory.h"
#include "glue_debug.h"
#include "mh5profile.h"
#include "stmr_queue.h"
#include "stmr_common.h"
#include "stmr_task.h"

Defines

#define QDBG_CHECK
#define QDBG_ALLOC(x)
#define QDBG_FREE(x)
#define QDBG_FUNC_START(x)
#define QDBG_FUNC_END(x)
#define QUEUE_CHECK()   QueueCheck()
#define QUEUE_PRINT()
#define PDBG(x)   TRACE(TICS, x)
#define DBG(x)

Functions

void SendSignalToTask (void)
E_MhegErr MHEG5QueueInit (U8BIT *buffer, U32BIT bufferSize)
 Initialise queue manager.
MHEG5QueueItemMHEG5QueueAllocItem (U32BIT requestId, U32BIT len)
 Allocate a new queue item and initialise with request ID and block length.
void MHEG5QueueInsertItem (MHEG5QueueItem *item)
 Insert a queue item into the queue.
MHEG5QueueItemMHEG5QueueGetHeadItem (void)
 Return the item at the head of the queue (the next item to consume). The function returns an "invalid" item if streaming is disabled. It returns NULL if the queue is empty. Task : STREAMING.
BOOLEAN MHEG5QueueIsValidItem (MHEG5QueueItem *item)
 Tell whether the item returned by MHEG5QueueGetHeadItem is valid. If the item is invalid, then streaming is disabled.
void MHEG5QueueUpdateItem (MHEG5QueueItem *item, U32BIT processed)
 Update the number of bytes processed in a queue item. The same item will be returned by the next call to MHEG5QueueGetHeadItem. If the item is no longer in the queue (because the queue has been cleared), the item is freed and no changes are made to the queue or to the item.
void MHEG5QueueReleaseItem (MHEG5QueueItem *item)
 Release an item from the queue. If the item is no longer in the queue (because the queue has been cleared), the item is freed and no changes are made to the queue.
U32BIT MHEG5QueueGetBufferedBytes (void)
 Return number of buffered bytes in the queue (regardless of request)
void MHEG5QueueEnableStreaming (U32BIT requestId)
 Allow streaming data from the queue.
void MHEG5QueueDisableStreaming (void)
 Do not allow streaming data from the queue.
BOOLEAN MHEG5QueueIsStreamingEnabled (void)
 Tell whether streaming is enabled.
void MHEG5QueueReleaseRequestItems (U32BIT requestId)
 Release all queue items that are related to a given request.
void MHEG5QueueReleaseAllItems (void)
 Release all queue items - clear the queue completely.
void MHEG5QueueRegisterInsertCallback (void(*callback)(U32BIT downloadId, U64BIT base, U64BIT position, U32BIT len, BOOLEAN last))
 Register notification callback for item insertion event. If a callback is already registered for the event, it will be replaced.
void MHEG5QueueRegisterReleaseCallback (void(*callback)(U32BIT requestId, U64BIT base, U64BIT position, U32BIT len, BOOLEAN last))
 Register notification callback for item release events. If a callback is already registered for the event, it will be replaced.
void MHEG5QueueTerm (void)
 Terminate queue manager.

Detailed Description

IC Streamer queue manager.

Date:
21/10/2010
Author:
Omri Barel

Function Documentation

MHEG5QueueItem* MHEG5QueueAllocItem ( U32BIT  requestId,
U32BIT  len 
)

Allocate a new queue item and initialise with request ID and block length.

Parameters:
requestIdRequest ID
lenSize of stream data block in bytes
Returns:
Newly allocated item, or NULL if cannot be allocated
void MHEG5QueueDisableStreaming ( void  )

Do not allow streaming data from the queue.

Returns:
Nothing
void MHEG5QueueEnableStreaming ( U32BIT  requestId)

Allow streaming data from the queue.

Parameters:
requestIdRequest for which streaming is enabled
Returns:
Nothing
U32BIT MHEG5QueueGetBufferedBytes ( void  )

Return number of buffered bytes in the queue (regardless of request)

Returns:
Number of buffered bytes

Return the item at the head of the queue (the next item to consume). The function returns an "invalid" item if streaming is disabled. It returns NULL if the queue is empty. Task : STREAMING.

Return the item at the head of the queue (the next item to consume). The function returns an "invalid" item if streaming is disabled. It returns NULL if the queue is empty.

Returns:
Pointer to item, or NULL if queue is empty
E_MhegErr MHEG5QueueInit ( U8BIT *  buffer,
U32BIT  bufferSize 
)

Initialise queue manager.

Parameters:
bufferBuffer to use for queue items
bufferSizeSize of buffer in bytes
Returns:
Nothing

Insert a queue item into the queue.

Parameters:
itemItem to be inserted (allocated using QueueAllocItem)
Returns:
Nothing
BOOLEAN MHEG5QueueIsStreamingEnabled ( void  )

Tell whether streaming is enabled.

Returns:
TRUE if streaming is enabled, FALSE otherwise

Tell whether the item returned by MHEG5QueueGetHeadItem is valid. If the item is invalid, then streaming is disabled.

Parameters:
itemQueue item to check
Returns:
TRUE if item is valid, FALSE otherwise
void MHEG5QueueRegisterInsertCallback ( void(*)(U32BIT downloadId, U64BIT base, U64BIT position, U32BIT len, BOOLEAN last)  callback)

Register notification callback for item insertion event. If a callback is already registered for the event, it will be replaced.

Parameters:
callbackItem insertion callback
Returns:
Nothing
void MHEG5QueueRegisterReleaseCallback ( void(*)(U32BIT requestId, U64BIT base, U64BIT position, U32BIT len, BOOLEAN last)  callback)

Register notification callback for item release events. If a callback is already registered for the event, it will be replaced.

Parameters:
callbackItem release callback
Returns:
Nothing
void MHEG5QueueReleaseAllItems ( void  )

Release all queue items - clear the queue completely.

Returns:
Nothing

Release an item from the queue. If the item is no longer in the queue (because the queue has been cleared), the item is freed and no changes are made to the queue.

Parameters:
itemQueue item to release
Returns:
Nothing
void MHEG5QueueReleaseRequestItems ( U32BIT  requestId)

Release all queue items that are related to a given request.

Parameters:
requestIdRequest ID
Returns:
Nothing
void MHEG5QueueTerm ( void  )

Terminate queue manager.

Returns:
Nothing
void MHEG5QueueUpdateItem ( MHEG5QueueItem item,
U32BIT  processed 
)

Update the number of bytes processed in a queue item. The same item will be returned by the next call to MHEG5QueueGetHeadItem. If the item is no longer in the queue (because the queue has been cleared), the item is freed and no changes are made to the queue or to the item.

Parameters:
itemQueue item to update
processedNumber of bytes processed
Returns:
Nothing
 All Data Structures Files Functions Variables Typedefs Defines