MHEG5  18.9.0
MHEG5 Documentation
Macros | Functions
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"
#include "stmr_dl.h"

Go to the source code of this file.

Macros

#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)
 
#define MIN_THRESHOLD_SIZE   1048576
 

Functions

void SendSignalToTask (void)
 
E_MhegErr MHEG5QueueInit (U8BIT *buffer, U32BIT bufferSize)
 Initialise queue manager. More...
 
MHEG5QueueItemMHEG5QueueAllocItem (U32BIT requestId, U32BIT len)
 Allocate a new queue item and initialise with request ID and block length. More...
 
void MHEG5QueueInsertItem (MHEG5QueueItem *item)
 Insert a queue item into the queue. More...
 
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. More...
 
BOOLEAN MHEG5QueueIsValidItem (MHEG5QueueItem *item)
 Tell whether the item returned by MHEG5QueueGetHeadItem is valid. If the item is invalid, then streaming is disabled. More...
 
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. More...
 
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. More...
 
U32BIT MHEG5QueueGetBufferedBytes (void)
 Return number of buffered bytes in the queue (regardless of request) More...
 
void MHEG5QueueEnableStreaming (U32BIT requestId)
 Allow streaming data from the queue. More...
 
void MHEG5QueueDisableStreaming (void)
 Do not allow streaming data from the queue. More...
 
BOOLEAN MHEG5QueueIsStreamingEnabled (void)
 Tell whether streaming is enabled. More...
 
void MHEG5QueueReleaseRequestItems (U32BIT requestId)
 Release all queue items that are related to a given request. More...
 
void MHEG5QueueReleaseItems (U32BIT requestId, U64BIT marker)
 Release queue items that are related to a given request up to a marker. More...
 
void MHEG5QueueReleaseAllItems (void)
 Release all queue items - clear the queue completely. More...
 
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. More...
 
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. More...
 
void MHEG5QueueTerm (void)
 Terminate queue manager. More...
 

Detailed Description

IC Streamer queue manager.

Date
21/10/2010
Author
Omri Barel

Definition in file stmr_queue.c.

Macro Definition Documentation

#define DBG (   x)

Definition at line 68 of file stmr_queue.c.

#define MIN_THRESHOLD_SIZE   1048576

Definition at line 73 of file stmr_queue.c.

#define PDBG (   x)    TRACE(TICS, x)

Definition at line 67 of file stmr_queue.c.

#define QDBG_ALLOC (   x)

Definition at line 44 of file stmr_queue.c.

#define QDBG_CHECK

Definition at line 40 of file stmr_queue.c.

#define QDBG_FREE (   x)

Definition at line 45 of file stmr_queue.c.

#define QDBG_FUNC_END (   x)

Definition at line 52 of file stmr_queue.c.

#define QDBG_FUNC_START (   x)

Definition at line 51 of file stmr_queue.c.

#define QUEUE_CHECK ( )    QueueCheck()

Definition at line 56 of file stmr_queue.c.

#define QUEUE_PRINT ( )

Definition at line 64 of file stmr_queue.c.

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

Definition at line 241 of file stmr_queue.c.

void MHEG5QueueDisableStreaming ( void  )

Do not allow streaming data from the queue.

Returns
Nothing

Definition at line 609 of file stmr_queue.c.

void MHEG5QueueEnableStreaming ( U32BIT  requestId)

Allow streaming data from the queue.

Parameters
requestIdRequest for which streaming is enabled
Returns
Nothing

Definition at line 584 of file stmr_queue.c.

U32BIT MHEG5QueueGetBufferedBytes ( void  )

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

Returns
Number of buffered bytes

Definition at line 570 of file stmr_queue.c.

MHEG5QueueItem* MHEG5QueueGetHeadItem ( 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.

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

Definition at line 336 of file stmr_queue.c.

E_MhegErr MHEG5QueueInit ( U8BIT buffer,
U32BIT  bufferSize 
)

Initialise queue manager.

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

Definition at line 128 of file stmr_queue.c.

void MHEG5QueueInsertItem ( MHEG5QueueItem item)

Insert a queue item into the queue.

Parameters
itemItem to be inserted (allocated using QueueAllocItem)
Returns
Nothing

Definition at line 279 of file stmr_queue.c.

BOOLEAN MHEG5QueueIsStreamingEnabled ( void  )

Tell whether streaming is enabled.

Returns
TRUE if streaming is enabled, FALSE otherwise

Definition at line 626 of file stmr_queue.c.

BOOLEAN MHEG5QueueIsValidItem ( MHEG5QueueItem item)

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

Definition at line 384 of file stmr_queue.c.

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

Definition at line 771 of file stmr_queue.c.

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

Definition at line 786 of file stmr_queue.c.

void MHEG5QueueReleaseAllItems ( void  )

Release all queue items - clear the queue completely.

Returns
Nothing

Definition at line 749 of file stmr_queue.c.

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.

Parameters
itemQueue item to release
Returns
Nothing

Definition at line 477 of file stmr_queue.c.

void MHEG5QueueReleaseItems ( U32BIT  requestId,
U64BIT  marker 
)

Release queue items that are related to a given request up to a marker.

Parameters
requestIdRequest ID
markernew position
Returns
Nothing

Definition at line 680 of file stmr_queue.c.

void MHEG5QueueReleaseRequestItems ( U32BIT  requestId)

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

Parameters
requestIdRequest ID
Returns
Nothing

Definition at line 636 of file stmr_queue.c.

void MHEG5QueueTerm ( void  )

Terminate queue manager.

Returns
Nothing

Definition at line 799 of file stmr_queue.c.

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

Definition at line 406 of file stmr_queue.c.

void SendSignalToTask ( void  )