Open-AVB AVTP Pipeline SDK  1.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
openavb_mediaq_pub.h
Go to the documentation of this file.
1 /*************************************************************************************************************
2 Copyright (c) 2012-2015, Symphony Teleca Corporation, a Harman International Industries, Incorporated company
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS LISTED "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS LISTED BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 Attributions: The inih library portion of the source code is licensed from
26 Brush Technology and Ben Hoyt - Copyright (c) 2009, Brush Technology and Copyright (c) 2009, Ben Hoyt.
27 Complete license and copyright information can be found at
28 https://github.com/benhoyt/inih/commit/74d2ca064fb293bc60a77b0bd068075b293cf175.
29 *************************************************************************************************************/
30 
31 /*
32 * HEADER SUMMARY : Circular queue for passing data between interfaces
33 * and mappers.
34 */
35 
36 #ifndef OPENAVB_MEDIA_Q_PUB_H
37 #define OPENAVB_MEDIA_Q_PUB_H 1
38 
39 #include "openavb_types_pub.h"
40 #include "openavb_avtp_time_pub.h"
41 
49 typedef struct {
53 
57  void *pPubData;
58 
62 
65 
68 
70  bool taken;
71 
73  void *pPubMapData;
74 
76  void *pPvtMapData;
77 
79  void *pPvtIntfData;
81 
87 typedef struct {
89  // Shared properties
91 
96 
100  void *pPubMapInfo;
101 
103  // Private properties
106 
109 
111  void *pPvtMapInfo;
112 
115 } media_q_t;
116 
124 
135 void openavbMediaQThreadSafeOn(media_q_t *pMediaQ);
136 
152 bool openavbMediaQSetSize(media_q_t *pMediaQ, int itemCount, int itemSize);
153 
173 bool openavbMediaQAllocItemMapData(media_q_t *pMediaQ, int itemPubMapSize, int itemPvtMapSize);
174 
188 bool openavbMediaQAllocItemIntfData(media_q_t *pMediaQ, int itemIntfSize);
189 
199 bool openavbMediaQDelete(media_q_t *pMediaQ);
200 
212 void openavbMediaQSetMaxLatency(media_q_t *pMediaQ, U32 maxLatencyUsec);
213 
221 void openavbMediaQSetMaxStaleTail(media_q_t *pMediaQ, U32 maxStaleTailUsec);
222 
236 
248 void openavbMediaQHeadUnlock(media_q_t *pMediaQ);
249 
260 bool openavbMediaQHeadPush(media_q_t *pMediaQ);
261 
278 media_q_item_t* openavbMediaQTailLock(media_q_t *pMediaQ, bool ignoreTimestamp);
279 
287 void openavbMediaQTailUnlock(media_q_t *pMediaQ);
288 
297 bool openavbMediaQTailPull(media_q_t *pMediaQ);
298 
309 bool openavbMediaQTailItemTake(media_q_t *pMediaQ, media_q_item_t* pItem);
310 
320 bool openavbMediaQTailItemGive(media_q_t *pMediaQ, media_q_item_t* pItem);
321 
329 bool openavbMediaQUsecTillTail(media_q_t *pMediaQ, U32 *pUsecTill);
330 
342 bool openavbMediaQIsAvailableBytes(media_q_t *pMediaQ, U32 bytes, bool ignoreTimestamp);
343 
352 U32 openavbMediaQCountItems(media_q_t *pMediaQ, bool ignoreTimestamp);
353 
363 bool openavbMediaQAnyReadyItems(media_q_t *pMediaQ, bool ignoreTimestamp);
364 
365 #endif // OPENAVB_MEDIA_Q_PUB_H
void * pPvtIntfInfo
For use internally by the interface.
Definition: openavb_mediaq_pub.h:114
AVTP time structure.
Definition: openavb_avtp_time_pub.h:50
bool openavbMediaQTailItemTake(media_q_t *pMediaQ, media_q_item_t *pItem)
Take ownership from the MediaQ of an item.
bool openavbMediaQIsAvailableBytes(media_q_t *pMediaQ, U32 bytes, bool ignoreTimestamp)
Check if the number of bytes are available.
Media Queue structure.
Definition: openavb_mediaq_pub.h:87
void * pPvtMediaQInfo
For use internally in the media queue.
Definition: openavb_mediaq_pub.h:108
void * pPubData
The structure of this memory will be defined per mapper in a public header.
Definition: openavb_mediaq_pub.h:57
void openavbMediaQTailUnlock(media_q_t *pMediaQ)
Unlock the tail item without removing it from the queue.
void * pPvtIntfData
For use internally by the interface. Often may not be used.
Definition: openavb_mediaq_pub.h:79
void openavbMediaQThreadSafeOn(media_q_t *pMediaQ)
Enable thread safe access for this media queue.
void openavbMediaQHeadUnlock(media_q_t *pMediaQ)
Unlock the head item.
media_q_item_t * openavbMediaQHeadLock(media_q_t *pMediaQ)
Get pointer to the head item and lock it.
AVTP Time public interface.
void openavbMediaQSetMaxLatency(media_q_t *pMediaQ, U32 maxLatencyUsec)
Sets the maximum latency expected.
U32 openavbMediaQCountItems(media_q_t *pMediaQ, bool ignoreTimestamp)
Count number of available MediaQ items.
void * pPubMapData
Public extra map data.
Definition: openavb_mediaq_pub.h:73
bool openavbMediaQTailPull(media_q_t *pMediaQ)
Unlock the tail item and remove it from the queue.
bool openavbMediaQTailItemGive(media_q_t *pMediaQ, media_q_item_t *pItem)
Give itme ownership back to the MediaQ.
bool openavbMediaQDelete(media_q_t *pMediaQ)
Destroy the queue.
bool openavbMediaQSetSize(media_q_t *pMediaQ, int itemCount, int itemSize)
Set size of media queue.
uint32_t U32
Unsigned 32 bit type.
Definition: openavb_types_base_pub.h:85
media_q_item_t * openavbMediaQTailLock(media_q_t *pMediaQ, bool ignoreTimestamp)
Get pointer to the tail item and lock it.
char * pMediaQDataFormat
Common name for mapping data format.
Definition: openavb_mediaq_pub.h:95
bool openavbMediaQUsecTillTail(media_q_t *pMediaQ, U32 *pUsecTill)
Get microseconds until tail is ready.
U32 itemSize
Size of the data item.
Definition: openavb_mediaq_pub.h:67
avtp_time_t * pAvtpTime
In a talker process this is the capture time.
Definition: openavb_mediaq_pub.h:52
void * pPvtMapInfo
For use internally by the mapper.
Definition: openavb_mediaq_pub.h:111
void openavbMediaQSetMaxStaleTail(media_q_t *pMediaQ, U32 maxStaleTailUsec)
Sets the maximum stale tail.
void * pPubMapInfo
Defined per mapper in the public header.
Definition: openavb_mediaq_pub.h:100
bool openavbMediaQAllocItemMapData(media_q_t *pMediaQ, int itemPubMapSize, int itemPvtMapSize)
Alloc item map data.
bool taken
Flag indicating mediaQ item has been taken by a call to openavbMediaQTailItemTake() ...
Definition: openavb_mediaq_pub.h:70
bool openavbMediaQAllocItemIntfData(media_q_t *pMediaQ, int itemIntfSize)
Alloc item interface data.
Media Queue Item structure.
Definition: openavb_mediaq_pub.h:49
U32 dataLen
Length of data in item.
Definition: openavb_mediaq_pub.h:64
bool openavbMediaQHeadPush(media_q_t *pMediaQ)
Unlock the head item and make it available.
bool openavbMediaQAnyReadyItems(media_q_t *pMediaQ, bool ignoreTimestamp)
Check if there are any ready MediaQ items.
U32 readIdx
Read index.
Definition: openavb_mediaq_pub.h:61
void * pPvtMapData
For use internally by mapping modules. Often may not be used.
Definition: openavb_mediaq_pub.h:76
media_q_t * openavbMediaQCreate()
Create a media queue.