MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
stmr_queue.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2010 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 #ifndef _STMR_QUEUE_H_
26 #define _STMR_QUEUE_H_
27 
28 /*---includes for this file--------------------------------------------------*/
29 
30 #include "techtype.h"
31 #include "mherrors.h"
32 #include "stmr_util.h"
33 
34 /*---Constant and macro definitions for public use---------------------------*/
35 
36 /*---Enumerations for public use---------------------------------------------*/
37 
38 /*---Global type defs for public use-----------------------------------------*/
39 
40 typedef enum
41 {
42  QUEUE_EVENT_ITEM_INSERTED,
43  QUEUE_EVENT_ITEM_RELEASED
44 } MHEG5QueueEvent_t;
45 
46 typedef struct sMHEG5QueueItem
47 {
48  struct sMHEG5QueueItem *next;
49  U32BIT requestId;
50  U32BIT downloadId;
51  U8BIT *data;
52  U32BIT len;
53  U32BIT offset;
54  U64BIT position;
55  U64BIT base;
56  U32BIT timestamp;
57  BOOLEAN last;
58  U16BIT referenceCount;
60 
61 /*---Global variable declarations for public use-----------------------------*/
62 
63 /*---Global Function prototypes for public use-------------------------------*/
64 
65 
72 E_MhegErr MHEG5QueueInit(U8BIT *buffer, U32BIT bufferSize);
73 
74 
82 MHEG5QueueItem* MHEG5QueueAllocItem(U32BIT requestId, U32BIT len);
83 
84 
91 
92 
100 
101 
109 
110 
121 void MHEG5QueueUpdateItem(MHEG5QueueItem *item, U32BIT processed);
122 
123 
132 
133 
138 U32BIT MHEG5QueueGetBufferedBytes(void);
139 
140 
146 void MHEG5QueueEnableStreaming(U32BIT requestId);
147 
148 
153 void MHEG5QueueDisableStreaming(void);
154 
155 
160 BOOLEAN MHEG5QueueIsStreamingEnabled(void);
161 
162 
168 void MHEG5QueueReleaseRequestItems(U32BIT requestId);
169 
170 
177 void MHEG5QueueReleaseItems(U32BIT requestId, U64BIT marker);
178 
179 
184 void MHEG5QueueReleaseAllItems(void);
185 
186 
193 void MHEG5QueueRegisterInsertCallback(void (*callback)(U32BIT downloadId,
194  U64BIT base,
195  U64BIT position,
196  U32BIT len,
197  BOOLEAN last));
198 
199 
206 void MHEG5QueueRegisterReleaseCallback(void (*callback)(U32BIT requestId,
207  U64BIT base,
208  U64BIT position,
209  U32BIT len,
210  BOOLEAN last));
211 
212 
217 void MHEG5QueueTerm(void);
218 
219 
220 #endif /*_STMR_QUEUE_H*/
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...
Definition: stmr_queue.c:406
BOOLEAN MHEG5QueueIsValidItem(MHEG5QueueItem *item)
Tell whether the item returned by MHEG5QueueGetHeadItem is valid. If the item is invalid, then streaming is disabled.
Definition: stmr_queue.c:384
Utilitiy functions for IC Streamer.
U32BIT MHEG5QueueGetBufferedBytes(void)
Return number of buffered bytes in the queue (regardless of request)
Definition: stmr_queue.c:570
Definition: stmr_queue.h:46
MHEG5QueueItem * MHEG5QueueAllocItem(U32BIT requestId, U32BIT len)
Allocate a new queue item and initialise with request ID and block length.
Definition: stmr_queue.c:241
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 e...
Definition: stmr_queue.c:786
void MHEG5QueueTerm(void)
Terminate queue manager.
Definition: stmr_queue.c:799
MHEG5 engine interface error codes.
void MHEG5QueueReleaseAllItems(void)
Release all queue items - clear the queue completely.
Definition: stmr_queue.c:749
void MHEG5QueueReleaseRequestItems(U32BIT requestId)
Release all queue items that are related to a given request.
Definition: stmr_queue.c:636
void MHEG5QueueEnableStreaming(U32BIT requestId)
Allow streaming data from the queue.
Definition: stmr_queue.c:584
System Wide Global Technical Data Type Definitions.
BOOLEAN MHEG5QueueIsStreamingEnabled(void)
Tell whether streaming is enabled.
Definition: stmr_queue.c:626
void MHEG5QueueInsertItem(MHEG5QueueItem *item)
Insert a queue item into the queue.
Definition: stmr_queue.c:279
void MHEG5QueueReleaseItems(U32BIT requestId, U64BIT marker)
Release queue items that are related to a given request up to a marker.
Definition: stmr_queue.c:680
MHEG5QueueItem * MHEG5QueueGetHeadItem(void)
Return the item at the head of the queue (the next item to consume). The function returns an "invalid...
Definition: stmr_queue.c:336
E_MhegErr MHEG5QueueInit(U8BIT *buffer, U32BIT bufferSize)
Initialise queue manager.
Definition: stmr_queue.c:128
void MHEG5QueueReleaseItem(MHEG5QueueItem *item)
Release an item from the queue. If the item is no longer in the queue (because the queue has been cle...
Definition: stmr_queue.c:477
void MHEG5QueueDisableStreaming(void)
Do not allow streaming data from the queue.
Definition: stmr_queue.c:609
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 ...
Definition: stmr_queue.c:771
Definition: glue_ulong.h:109