source: svn/newcon3bcm2_21bu/nexus/modules/transport/7552/include/nexus_recpump.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 35.8 KB
Line 
1/***************************************************************************
2 *     (c)2007-2011 Broadcom Corporation
3 *
4 *  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5 *  and may only be used, duplicated, modified or distributed pursuant to the terms and
6 *  conditions of a separate, written license agreement executed between you and Broadcom
7 *  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8 *  no license (express or implied), right to use, or waiver of any kind with respect to the
9 *  Software, and Broadcom expressly reserves all rights in and to the Software and all
10 *  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11 *  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12 *  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
13 *
14 *  Except as expressly set forth in the Authorized License,
15 *
16 *  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17 *  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18 *  and to use this information only in connection with your use of Broadcom integrated circuit products.
19 *
20 *  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21 *  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22 *  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23 *  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24 *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25 *  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26 *  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27 *  USE OR PERFORMANCE OF THE SOFTWARE.
28 *
29 *  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30 *  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31 *  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32 *  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33 *  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34 *  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35 *  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36 *  ANY LIMITED REMEDY.
37 *
38 * $brcm_Workfile: nexus_recpump.h $
39 * $brcm_Revision: 52 $
40 * $brcm_Date: 12/19/11 9:09a $
41 *
42 * Module Description:
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /nexus/modules/transport/7400/include/nexus_recpump.h $
47 *
48 * 52   12/19/11 9:09a erickson
49 * SWDEPRECATED-2425: fix comments
50 *
51 * 51   11/17/11 10:25a erickson
52 * SW7420-2076: clarify NEXUS_RecpumpStatus.hasIndex
53 *
54 * 50   11/4/11 9:53a erickson
55 * SW7358-179: fix comment on
56 *  NEXUS_RecpumpAddPidChannelSettings.pidTypeSettings.video.pid
57 *
58 * 49   10/28/11 1:26p erickson
59 * SW7346-523: remove timestamp.parityCheckDisable in favor of extending
60 *  NEXUS_TransportTimestampType
61 *
62 * 48   9/8/11 12:16p jtna
63 * SW7425-1218: add NEXUS_RecpumpOpenSettings.data/index.heap
64 *
65 * 47   8/31/11 12:18p erickson
66 * SWDEPRECATED-2425: update comments on NEXUS_RecpumpFlowControl
67 *
68 * 46   8/25/11 3:29p erickson
69 * SW7346-454: add NEXUS_RecpumpStatus.rave.index
70 *
71 * 45   7/7/11 4:44p erickson
72 * SW7346-275: add NEXUS_RecpumpSettings.timestamp.parityCheckDisable
73 *
74 * 44   5/27/11 2:58p erickson
75 * SW7346-203: allow configuration of 4 start code ranges for
76 *  NEXUS_PidType_eOther indexing
77 *
78 * 43   5/13/11 2:04p erickson
79 * SW7335-957: add API for BXPT_Rave_SetTpitEcms
80 *
81 * 42   4/12/11 2:05p erickson
82 * SWDEPRECATED-2425: update comments
83 *
84 * 41   4/11/11 11:09a erickson
85 * SWDEPRECATED-2425: update comments
86 *
87 * 40   2/7/11 2:23p erickson
88 * SW7335-1036: add
89 *  NEXUS_Recpump_GetDataBufferWithWrap/NEXUS_Recpump_GetIndexBufferWithWr
90 *  ap
91 *
92 * 39   2/7/11 10:42a erickson
93 * SW7342-333: add NEXUS_NUM_TPIT_PIDS
94 *
95 * 38   1/20/11 2:15p erickson
96 * SW7420-1392: add NEXUS_RecpumpOpenSettings.useSecureHeap
97 *
98 * 37   1/5/11 1:51p vsilyaev
99 * SW7420-1113: Added 'Auto' option for bandHoldEn, enables flow control
100 *  if recpump is sourced by a playpump
101 *
102 * 36   12/17/10 3:19p erickson
103 * SW7420-1285: add null_allowed attribute
104 *
105 * 35   12/16/10 5:13p erickson
106 * SW7422-151: add NEXUS_RecpumpAddPidChannelSettings.useRPipe
107 *
108 * 34   12/14/10 3:18p erickson
109 * SW7420-1285: add null_allowed attribute
110 *
111 * 33   12/9/10 3:32p erickson
112 * SW7420-1308: use unconditional nexus_dma_types.h in the public API
113 *
114 * 32   10/29/10 2:55p erickson
115 * SWDEPRECATED-2425: clarify doing file i/o in dataReady callback
116 *
117 * 31   10/11/10 5:03p erickson
118 * SW7420-1113: added NEXUS_RecpumpSettings.bandHold
119 *
120 * 30   10/1/10 9:51a erickson
121 * SW7420-1009: support NEXUS_ANY_ID
122 *
123 * 29   8/10/10 4:08p erickson
124 * SW7420-934: rename NEXUS_Recpump_DataWriteComplete/IndexWriteComplete
125 *  to NEXUS_Recpump_DataReadComplete/IndexReadComplete
126 *
127 * 28   8/6/10 9:58a erickson
128 * SW7400-2858: added NEXUS_RecpumpSettings.data.useBufferSize
129 *
130 * 27   6/21/10 4:32p erickson
131 * SW7405-4249: added index option for NEXUS_PidType_eOther for indexing
132 *  audio-only or scrambled streams
133 *
134 * 26   6/9/10 11:31a mphillip
135 * SW7550-398: Enable encrypted PVR for 7550
136 *
137 * 25   2/17/10 10:13a erickson
138 * SW7335-675: added NEXUS_TransportModuleSettings.tpit settings for
139 *  idleEventTimeout and recordEventTimeout
140 *
141 * 24   1/27/10 4:02p erickson
142 * SW7400-2664: added NEXUS_RecpumpSettings.tpit options
143 *
144 * 23   1/8/10 10:11a erickson
145 * SW7400-2645: refactored TPIT filter api for greater flexibility and
146 *  better use of HW. one TPIT indexer used per recpump. filters can be
147 *  set/reset to pid channels, whether recpump is started or stopped.
148 *
149 * 22   12/2/09 2:13p erickson
150 * SW7125-133: fix datatype for
151 *  NEXUS_RecpumpAddPidChannelSettings.tpit.filterIndex
152 *
153 * 21   11/9/09 5:07p erickson
154 * SW7405-3354: added NEXUS_RecpumpSettings.securityDmaDataFormat, default
155 *  to NEXUS_DmaDataFormat_eMpeg
156 *
157 * 20   11/3/09 10:59a erickson
158 * SW7550-60: add NEXUS_RecpumpSettings.outputTransportType for PES and ES
159 *  record support
160 *
161 * 19   10/19/09 10:40a erickson
162 * SWDEPRECATED-2425: add recpump bufferSize notes
163 *
164 * 18   7/16/09 12:43p erickson
165 * PR56657: added NEXUS_RecpumpOpenSettings.nullifyVct
166 *
167 * 17   6/23/09 8:49a erickson
168 * PR56058: clarify comments on dataReadyThreshold and dataReady callback
169 *
170 * 16   6/9/09 3:05p erickson
171 * PR55767: move timestampType from NEXUS_ParserBandSettings to
172 *  NEXUS_RecpumpSettings
173 *
174 * 15   6/9/09 10:54a erickson
175 * PR55843: added NEXUS_RecpumpStatus.data.bufferBase and
176 *  .index.bufferBase
177 *
178 * 14   5/29/09 3:05p erickson
179 * PR54002: rework TPIT api to support simultaneous SCD indexing and TPIT
180 *  filtering on the same pid
181 *
182 * 13   4/14/09 2:30p erickson
183 * PR54002: added tpit filtering mode
184 *
185 * 12   2/5/09 11:27a erickson
186 * PR35457: update comments
187 *
188 * 11   12/17/08 12:03a erickson
189 * PR50347: added NEXUS_RecpumpOpenSettings.dummyRecpump for conserving
190 *  memory on index-only record
191 *
192 * 10   10/22/08 11:39a erickson
193 * PR48216: allow transport to run with no dma or security modules
194 *
195 * 9   10/17/08 3:27p jgarrett
196 * PR 48011: Adding option for PID-based indexing
197 *
198 * 8   7/2/08 2:53p erickson
199 * PR41619: added comment about efficient dataReadyThreshold and atomSize
200 *  selection
201 *
202 * 7   6/25/08 5:50p vsilyaev
203 * PR 41869: Use keySlotHandle instead of keySlot[Number]
204 *
205 * 6   4/18/08 4:03p vsilyaev
206 * PR 41868: Added security API to playpump and recpump
207 *
208 * 5   2/7/08 10:20a erickson
209 * PR39384: added recpump dataReadyThreshold and atomSize. clarified
210 *  dataReadyCallback behavior.
211 *
212 * 4   2/1/08 5:05p vsilyaev
213 * PR 38682: Added attributes to mark destructor and shutdown functions
214 *
215 * 3   1/30/08 6:16p vsilyaev
216 * PR 38682: Added attributes for memory translation
217 *
218 * 2   1/22/08 9:49a erickson
219 * PR34925: remove numDescriptors. re-add code to flush ITB on ITB
220 * overflow.
221 *
222 * 1   1/18/08 2:15p jgarrett
223 * PR 38808: Merging to main branch
224 *
225 * Nexus_Devel/15   11/30/07 11:11a erickson
226 * PR35457: api update
227 *
228 * Nexus_Devel/14   11/29/07 2:24p erickson
229 * PR35457: doc update for 0.5 release
230 *
231 **************************************************************************/
232#ifndef NEXUS_RECPUMP_H__
233#define NEXUS_RECPUMP_H__
234
235#include "nexus_types.h"
236#include "nexus_pid_channel.h"
237#include "nexus_dma_types.h"
238
239#ifdef __cplusplus
240extern "C" {
241#endif
242
243/*=*
244The Recpump Interface provides data feeding for DVR record functionality.
245Each Interface corresponds to one hardware record channel (RAVE context).
246
247Each Recpump Interface captures two streams: data and index.
248The data stream is typically an MPEG2 TS stream with all of the selected pids muxed together. (See NEXUS_RecpumpSettings.outputTransportType for other output formats).
249The index stream, which is optional, contains SCT (start code table) entries which point to start codes in the data stream.
250
251To record without indexing, just leave NEXUS_RecpumpAddPidChannelSettings.pidTypeSettings.XXX.index = false when you add a pid channel.
252
253See nexus/examples/dvr/recpump.c for an example application.
254
255See NEXUS_RecordHandle for a high-level Record Interface.
256See NEXUS_PlaypumpHandle for the corresponding low-level DVR playback Interface.
257**/
258
259/**
260Summary:
261Handle for a Recpump Interface
262**/
263typedef struct NEXUS_Recpump *NEXUS_RecpumpHandle;
264
265/**
266Summary:
267Settings passed into NEXUS_Recpump_Open
268
269Description:
270Recpump's data.bufferSize (aka CDB) should be chosen based on maximum stream bitrate and worst-case latency in the system and
271a minimum segmentation of the buffer (required for pipelining I/O requests). It must be big enough to avoid overflow in all cases. For instance:
272
273    20Mbps * 250msec/segment * 4 segments = 20 * 1024 * 1024 / 8 * 250 / 1000 * 4 = 2.5M
274
275Recpump's index.bufferSize (aka ITB) should hold the maximum number of start codes and other SCT entries that can fit in a full
276data buffer. Worst case is a low bitrate stream. The following is an approximation:
277
278    2.5M CDB / 10K per picture * (16 slices/picture + 5 SC's for various overhead) = 5376 ITB's * 24 bytes/ITB = 126K
279
280Because the index data rate is much smaller and because it can be fully evacuated separately from the data buffer, index.bufferSize
281can be set smaller.
282
283For both data and index buffers, you should characterize your system and set your bufferSize values appropriately.
284**/
285typedef struct NEXUS_RecpumpOpenSettings
286{
287    struct
288    {
289        NEXUS_HeapHandle heap; /* optional heap for fifo allocation */
290        size_t bufferSize;  /* Size of record buffer that recpump will allocate, in bytes. */
291        unsigned alignment; /* Alignment of record buffer that recpump will allocate, in powers of 2 (i.e. 4 would be 2^4, or 16 byte aligned).
292                               Default is 12, which is 4K alignment. */
293        unsigned dataReadyThreshold; /* Threshold in bytes. The NEXUS_RecpumpSettings dataReady callback will be fired when pending data exceeds this threshold. Default is 20% of bufferSize.
294                                        A low number will produce more frequent dataReady callbacks.
295                                        A high number puts the system at risk for overflow.
296                                        If you are also specifying an atomSize, we recommend that dataReadyThreshold be a multiple of atomSize for efficiency. */
297        unsigned atomSize;  /* Optional atomSize. If the caller specifies atomSize, and always consumes data in multiples of atomSize, then Recpump can guarantee
298                               that GetBuffer will never return a number less than atomSize, even at the wrap around.
299                               One example where this is needed is DMA to a disk which requires 4K page size writes.
300                               This is only supported for NEXUS_TransportType_eTs output format. */
301    } data, index;
302
303    NEXUS_RecpumpHandle dummyRecpump; /* The dummy recpump has the CDB which this recpump will use as a bit bucket.
304                                         This recpump will have its own ITB for index-only record. */
305    unsigned nullifyVct; /* see nexus_recpump.c comments for documentation. */
306    bool useSecureHeap; /* use the heap set with NEXUS_MemoryType_eSecure */
307} NEXUS_RecpumpOpenSettings;
308
309/**
310Summary:
311Get default settings for the structure.
312
313Description:
314This is required in order to make application code resilient to the addition of new structure members in the future.
315**/
316void NEXUS_Recpump_GetDefaultOpenSettings(
317    NEXUS_RecpumpOpenSettings *pSettings /* [out] */
318    );
319
320/**
321Summary:
322Open a new Recpump Interface
323**/
324NEXUS_RecpumpHandle NEXUS_Recpump_Open( /* attr{destructor=NEXUS_Recpump_Close} */
325    unsigned index, /* The Nexus index for recpump. This index does not correspond to a physical RAVE context. NEXUS_ANY_ID is supported. */
326    const NEXUS_RecpumpOpenSettings *pSettings /* attr{null_allowed=y} */
327    );
328
329/**
330Summary:
331Close a Recpump Interface
332**/
333void NEXUS_Recpump_Close(
334    NEXUS_RecpumpHandle handle
335    );
336
337/**
338Summary:
339Controls flow-control of playpump by connected recpump
340
341Description:
342eDisable is the default for backward compatibility. eAuto may become the default in the future.
343for record of live streams, eDisable is preferred.
344for record of playback streams, eEnable is preferred; however, there are currently implementation issues. see comments in nexus_recpump.c for information.
345**/
346typedef enum NEXUS_RecpumpFlowControl {
347    NEXUS_RecpumpFlowControl_eDisable, /* recpump doesn't flow control playpump, so playpump could overflow recpump buffer */
348    NEXUS_RecpumpFlowControl_eEnable, /* recpump flow controls playpump, so playpump is paused by HW to prevent overflow of recpump buffer */
349    NEXUS_RecpumpFlowControl_eAuto,   /* flow control is activated based on type of source connected to the recpump. playpump has flow control; live does not. */
350    NEXUS_RecpumpFlowControl_eMax     
351} NEXUS_RecpumpFlowControl;
352
353#define NEXUS_NUM_ECM_TIDS 3
354
355/**
356Summary:
357Settings which are applied with NEXUS_Recpump_SetSettings.
358
359Description:
360Some are required before you can call NEXUS_Recpump_Start.
361**/
362typedef struct NEXUS_RecpumpSettings
363{
364    struct
365    {
366        size_t useBufferSize;         /* Limit the size of NEXUS_RecpumpOpenSettings.data.bufferSize at runtime.
367                                         This currently only applies to data, not index.
368                                         The user can repurpose memory at the end of the recpump buffer if useBufferSize < bufferSize. See NEXUS_RecpumpStatus.data.bufferBase.
369                                         If 0 (default), the whole bufferSize will be used. */
370        NEXUS_CallbackDesc dataReady; /* data.dataReady is required. index.dataReady is not required but is typically used for non-polling record.
371                                         A data or index dataReady callback is fired in these cases:
372                                         1) in response to a XPT or DMA interrupt if the amount of data in the buffer exceeds exceeds the dataReadyThreshold
373                                         2) at the end of a ReadComplete call if the data in the buffer exceeds the dataReadyThreshold
374                                         3) at wrap-around regardless of buffer level
375                                         If you receive a dataReady callback and do not call ReadComplete, no additional callback will be fired.
376                                         Your app should not do synchronous I/O in a dataReady callback. Instead, you should schedule asynchronous I/O (either by using an
377                                         async file I/O system call or by notifying another thread to start the I/O). */
378        NEXUS_CallbackDesc overflow;  /* Notification when data is dropped because there is no room in the buffer.
379                                         Under normal circumstances, this should never occur. If it does, please analyze your overall system
380                                         performance including I/O performance, interrupt response time and CPU load. */
381    } data, index;
382
383    NEXUS_DmaHandle securityDma;     /* Instance of DMA that is used for security processing, NULL if security processing is not required */
384    NEXUS_DmaDataFormat securityDmaDataFormat;
385    NEXUS_KeySlotHandle securityContext;
386
387    NEXUS_RecpumpFlowControl bandHold; /* If NEXUS_RecpumpFlowControl_eEnable, record will cause any incoming playback to hold when it meets the dataReadyThreshold (i.e. UPPER_THRESHOLD).
388                                        dataReadyThreshold should be set to a high percentage, like 90%. So, unless the app is polling, record will stop receiving
389                                        data when the app is doing file i/o. Unless you have a buffer in front of record which can continue receiving data
390                                        while playback is held, this is very inefficient.
391                                        If HW ever gets separate thresholds for data ready and for bandhold, the threshold setting for bandHold could change. */
392
393    NEXUS_TransportTimestampType timestampType; /* An additional timestamp will be prepended to the packets as they are recorded.
394                                                   If you are recording a playback stream that already has timestamps, this setting will only preserve those timestamps; it will not
395                                                   replace them with new timestamps.
396                                                   If you are recording a live stream that already has timestamps, you should set NEXUS_InputBandSettings.packetLength to strip
397                                                   the incoming timestamps. Then, this setting can be used to add new timestamps if desired. */
398    NEXUS_TransportType outputTransportType; /* NEXUS_TransportType_eTs (default), eDssEs, eDssPes, eMpeg2Pes and eEs supported.
399                                         Recpump can strip TS or PES headers, but cannot add TS or PES headers.
400                                         Therefore conversion from TS -> PES or TS/PES -> ES is supported. PES/ES -> TS and ES -> PES is not. */
401
402    /* The following TPIT settings are only applied at NEXUS_Recpump_Start time. They apply to every TPIT filter in this Recpump.
403    You must create a pid channel and set at least one TPIT filter before calling Start in order for them to take effect. */
404    struct {
405        bool countRecordedPackets;  /* If true, then the recorded count in TPIT entries will be in units of packets; otherwise, bytes. */
406        bool storePcrMsb;           /* Store the 32 MSB of the PCR if true; store the 32 LSB if false (default) */
407        bool firstPacketEnable;     /* Store an index table entry for the first packet recorded. */
408        bool idleEventEnable;       /* Store an event if no other events have occurred for the NEXUS_TransportModuleSettings.tpit.idleEventTimeout duration. */
409        bool recordEventEnable;     /* Store an event if no packets have been recorded for the NEXUS_TransportModuleSettings.tpit.recordEventTimeout duration. */
410        struct {
411            bool enabled;   
412            unsigned evenTid;       /* table ID for even ECM packets */
413            unsigned oddTid;        /* table ID for odd ECM packets */
414        } ecmPair[NEXUS_NUM_ECM_TIDS]; /* user can filter multiple ECM table ID's simultaneously */       
415    } tpit;
416} NEXUS_RecpumpSettings;
417
418/**
419Summary:
420Get default settings for the structure.
421
422Description:
423This is required in order to make application code resilient to the addition of new structure members in the future.
424**/
425void NEXUS_Recpump_GetDefaultSettings(
426    NEXUS_RecpumpSettings *pSettings /* [out] */
427    );
428
429/**
430Summary:
431Get current NEXUS_RecpumpSettings
432**/
433void NEXUS_Recpump_GetSettings(
434    NEXUS_RecpumpHandle handle,
435    NEXUS_RecpumpSettings *pSettings /* [out] */
436    );
437
438/**
439Summary:
440Set new NEXUS_RecpumpSettings.
441
442Description:
443Some settings are required before calling NEXUS_Recpump_Start.
444Settings can be changed after Start.
445**/
446NEXUS_Error NEXUS_Recpump_SetSettings(
447    NEXUS_RecpumpHandle handle,
448    const NEXUS_RecpumpSettings *pSettings
449    );
450
451/**
452Summary:
453Start recording.
454
455Description:
456Actual recording may not start until the first pid channel is added.
457**/
458NEXUS_Error NEXUS_Recpump_Start(
459    NEXUS_RecpumpHandle handle
460    );
461
462/**
463Summary:
464Stop new data from entering record buffer, but callbacks and GetBuffer/ReadComplete still work.
465
466Description:
467This allows the user to get every byte out of the buffer. However user is still responsible to call
468NEXUS_Recpump_Stop when all data is extracted.
469**/
470void NEXUS_Recpump_StopData(
471    NEXUS_RecpumpHandle handle
472    );
473
474/**
475Summary:
476Stops recording.
477
478Description:
479After this function returns GetBuffer/ReadComplete couldn't be used to access recoreded data.
480**/
481void NEXUS_Recpump_Stop(
482    NEXUS_RecpumpHandle handle
483    );
484
485/**
486Summary:
487The TPIT parse table entry consists of enables for each bitfield in the transport
488packet that can be parsed. In most cases, there is also a value that the
489bitfield must match in order to have an index generated.
490**/
491typedef struct NEXUS_RecpumpTpitFilter
492{
493    unsigned pid;               /* The PID to build TPIT entries for. Nexus will set this automatically. This is included only to make the structure a passthrough to the lower-level SW. */
494    bool corruptionEnable;      /* Corrupt packet if it matches the filter criterion below. Disabled by default */
495    bool mpegMode;              /* Set true for TS, false for DSS. This is used for the config structure. */
496
497    union
498    {
499        struct
500        {
501            bool ecmPolarityChangeEn;
502
503            bool sectionFilterEn;
504
505            bool adaptationExtensionFlagEnable;         /* Store an index table entry if this bit is set and the adaptation_field_extension_flag matches the corresponding compare value. */
506            bool adaptationExtensionFlagCompValue;      /* The value to compare adaptation_field_extension_flag with. */
507
508            bool privateDataFlagEnable;                 /* Store an index table entry if this bit is set and the transport_private_data_flag matches the corresponding compare value. */
509            bool privateDataFlagCompValue;              /* The value to compare transport_private_data_flag with. */
510
511            bool splicingPointFlagEnable;               /* Store an index table entry if this bit is set and the splicing_point_flag matches SplicingPointFlagCompValue */
512            bool splicingPointFlagCompValue;            /* The value to compare splicing_point_flag with. */
513
514            bool opcrFlagEnable;                        /* Store an index table entry if this bit is set and the OPCR_flag matches the corresponding compare value */
515            bool opcrFlagCompValue;                     /* The value to compare OPCR_flag with. */
516
517            bool pcrFlagEnable;                         /* Store an index table entry if this bit is set and the PCR_flag matches the corresponding compare value */
518            bool pcrFlagCompValue;                      /* The value to compare PCR_flag with. */
519
520            bool esPriorityIndicatorEnable;             /* Store an index table entry if this bit is set and the elementary_stream_priority_indicator matches the corresponding compare value */
521            bool esPriorityIndicatorCompValue;          /* The value to compare elementary_stream_priority_indicator with. */
522
523            bool randomAccessIndicatorEnable;           /* Store an index table entry if this bit is set and the random_access_indicator matches the corresponding compare value */
524            bool randomAccessIndicatorCompValue;        /* The value to compare random_access_indicator with. */
525
526            bool discontinuityIndicatorEnable;          /* Store an index table entry if this bit is set and the discontinuity_indicator matches the corresponding compare value */
527            bool discontinuityIndicatorCompValue;       /* The value to compare discontinuity_indicator with. */
528
529            bool adaptationFieldChangeEnable;           /* Store an index table entry if a change is detected in the adaptation field control field (enable only) */
530
531            bool scramblingControlChangeEnable;         /* Store an index table entry if a change is detected in the scrambling control field control field (enable only) */
532
533            bool transportPriorityEnable;               /* Store an index table entry if this bit is set and the transport_priority matches the corresponding compare value */
534            bool transportPriorityCompValue;            /* The value to compare transport_priority with. */
535
536            bool payloadUnitStartEnable;                /* Store an index table entry if this bit is set and the payload_unit_start_indicator matches the corresponding compare value */
537            bool payloadUnitStartCompValue;             /* The value to compare payload_unit_start_indicator with. */
538        } mpeg;
539
540        struct
541        {
542            bool filterHdEnable;        /* Enable HD filtering for this PID. */
543            unsigned short hdFilter;    /* The HD value to filter on. Transport packet matching this value are NOT recorded. */
544
545            bool tcDetEn;           /* Store an index table entry if a valid timecode is contained in the packet (enable only) */
546
547            bool cwpDetEn;          /* Store an index table entry if a valid CWP is contained in the packet (enable only) */
548
549            bool rtsDetEn;          /* Store an index table entry if a valid RTS is contained in the packet (enable only) */
550
551            bool cffEn;             /* Store an index table entry if this bit is set and the current field flag matches the corresponding compare value */
552            bool cffComp;           /* The current field flag must match this value if the corresponding enable bit is set in order for an index table entry to be made */
553
554            bool mfEn;              /* Store an index table entry if this bit is set and the modifiable flag matches the corresponding compare value */
555            bool mfComp;            /* The modifiable flag must match this value if the corresponding enable bit is set in order for an index table entry to be made */
556
557            bool hdEn;              /* Store an index table entry for any bit set in this field and the respective compare bit matches the
558                                        respective header designator bit (only for valid HD i.e. unencrypted packets) */
559            uint8_t hdMask;         /* The header designator bits must bitwise match this value if the corresponding enable bit is set in order for an index table entry to be made.
560                                        (only for valid HD i.e. unencrypted packets) */
561
562            bool csAuxChangeEn;     /* Store an index table entry if a change is detected in the control sync for CWP packets (enable only) */
563
564            bool csChangeEn;        /* Store an index table entry if a change is detected in the control sync for content (non AUX)packets (enable only) */
565
566            bool cfChangeEn;        /* Store an index table entry if a change is detected in the control flag for content (non AUX)packets (enable only) */
567
568            bool bbEn;              /* Store an index table entry if this bit is set and the bundle boundary matches the corresponding compare value */
569            bool bbComp;            /* The bundle boundary must match this value if the corresponding enable bit is set in order for an index table entry to be made */
570        } dss;
571    } config;
572} NEXUS_RecpumpTpitFilter;
573
574#define NEXUS_NUM_STARTCODE_RANGES 4
575
576/**
577Summary:
578Settings used for NEXUS_Recpump_AddPidChannel
579**/
580typedef struct NEXUS_RecpumpAddPidChannelSettings
581{
582    NEXUS_PidType pidType;
583    struct
584    {
585        struct
586        {
587            bool index;                  /* index this video pid. You can only index one video pid. */
588            NEXUS_VideoCodec codec;      /* only needed if index is true */
589            uint16_t pid;                /* index using pid value, not pid channel. if pid==0x1fff (default) then generate index using the pid channel, not this pid value.
590                                            This is needed for indexing an allpass pid channel */
591        } video; /* settings for pidType == NEXUS_PidType_eVideo */
592        struct
593        {
594            bool index;                  /* index start codes based on the following ranges (default is all start codes) */
595            struct {
596                uint8_t low;
597                uint8_t high;
598            } startCodeRange[NEXUS_NUM_STARTCODE_RANGES]; 
599        } other; /* settings for pidType == NEXUS_PidType_eOther */
600    } pidTypeSettings;
601    bool useRPipe;
602} NEXUS_RecpumpAddPidChannelSettings;
603
604/**
605Summary:
606Get default settings for the structure.
607
608Description:
609This is required in order to make application code resilient to the addition of new structure members in the future.
610You can use default settings for all pids except an indexed video pid.
611**/
612void NEXUS_Recpump_GetDefaultAddPidChannelSettings(
613    NEXUS_RecpumpAddPidChannelSettings *pSettings /* [out] */
614    );
615
616/*
617Summary:
618Add a pid channel to be recorded.
619
620Description:
621You can add a pid channel before or after NEXUS_Recpump_Start.
622You cannot change the pid channel being indexed after starting.
623*/
624NEXUS_Error NEXUS_Recpump_AddPidChannel(
625    NEXUS_RecpumpHandle handle,
626    NEXUS_PidChannelHandle pidChannel,
627    const NEXUS_RecpumpAddPidChannelSettings *pSettings /* attr{null_allowed=y} NULL is allowed for default settings. */
628    );
629
630/*
631Summary:
632Remove a pid channel and stop recording it.
633
634Description:
635You can remove a pid channel before or after NEXUS_Recpump_Stop.
636*/
637NEXUS_Error NEXUS_Recpump_RemovePidChannel(
638    NEXUS_RecpumpHandle handle,
639    NEXUS_PidChannelHandle pidChannel
640    );
641
642/**
643Summary:
644Remove all pid channels and stop recording them.
645**/
646void NEXUS_Recpump_RemoveAllPidChannels(
647    NEXUS_RecpumpHandle handle
648    );
649
650/**
651Summary:
652Get a pointer and size for the next location in the buffer which has data which has been recorded.
653
654Description:
655The application is responsible for reading this data out of the buffer and notifying Recpump
656of how much it as read using NEXUS_Recpump_DataReadComplete.
657NEXUS_Recpump_GetDataBuffer is non-destructive. You can safely call it multiple times.
658**/
659NEXUS_Error NEXUS_Recpump_GetDataBuffer(
660    NEXUS_RecpumpHandle handle,
661    const void **pBuffer,   /* [out] attr{memory=cached} pointer to data which can be consumed */
662    size_t *pAmount         /* [out] number of recorded bytes which can be consumed */
663    );
664
665/**
666Summary:
667Get a pointer and size for the next location in the buffer, including possible wrap around, which has data which has been recorded.
668
669Description:
670The 'WithWrap' version only works if you are not using DMA encryption.
671If you request pBuffer2 and pAmount2, your atomSize will be ignored. All data will be returned.
672You can call NEXUS_Recpump_DataReadComplete with <= *pAmount + *pAmount2
673**/
674NEXUS_Error NEXUS_Recpump_GetDataBufferWithWrap(
675    NEXUS_RecpumpHandle handle,
676    const void **pBuffer,   /* [out] attr{memory=cached} pointer to data which can be consumed */
677    size_t *pAmount,        /* [out] number of recorded bytes pointed to by pBuffer which can be consumed */
678    const void **pBuffer2,  /* [out] attr{memory=cached} optional pointer to data after wrap which can be consumed */
679    size_t *pAmount2        /* [out] number of recorded bytes pointed to by pBuffer2 which can be consumed */
680    );
681
682/**
683Summary:
684Notify Recpump of how much data the application consumed from the buffer.
685
686Description:
687You can only call NEXUS_Recpump_DataReadComplete once after a NEXUS_Recpump_GetDataBuffer call.
688After calling it, you must call NEXUS_Recpump_GetDataBuffer before adding more data.
689**/
690NEXUS_Error NEXUS_Recpump_DataReadComplete(
691    NEXUS_RecpumpHandle handle,
692    size_t amount /* number of bytes the application has consumed */
693    );
694
695/* backward compatibility */
696#define NEXUS_Recpump_DataWriteComplete NEXUS_Recpump_DataReadComplete
697
698/**
699Summary:
700Get a pointer and size for the next location in the buffer which has data which has been recorded.
701
702Description:
703The application is responsible for reading this data out of the buffer and notifying Recpump
704of how much it as read using NEXUS_Recpump_IndexReadComplete.
705NEXUS_Recpump_GetIndexBuffer is non-destructive. You can safely call it multiple times.
706**/
707NEXUS_Error NEXUS_Recpump_GetIndexBuffer(
708    NEXUS_RecpumpHandle handle,
709    const void **pBuffer,   /* [out] attr{memory=cached} pointer to data which can be consumed */
710    size_t *pAmount         /* [out] number of recorded bytes which can be consumed */
711    );
712
713/**
714Summary:
715Get a pointer and size for the next location in the buffer, including possible wrap around, which has data which has been recorded.
716
717Description:
718The 'WithWrap' version only works if you are not using DMA encryption.
719If you request pBuffer2 and pAmount2, your atomSize will be ignored. All data will be returned.
720You can call NEXUS_Recpump_IndexReadComplete with <= *pAmount + *pAmount2
721**/
722NEXUS_Error NEXUS_Recpump_GetIndexBufferWithWrap(
723    NEXUS_RecpumpHandle handle,
724    const void **pBuffer,   /* [out] attr{memory=cached} pointer to data which can be consumed */
725    size_t *pAmount,        /* [out] number of recorded bytes pointed to by pBuffer which can be consumed */
726    const void **pBuffer2,  /* [out] attr{memory=cached} optional pointer to data after wrap which can be consumed */
727    size_t *pAmount2        /* [out] number of recorded bytes pointed to by pBuffer2 which can be consumed */
728    );
729
730/**
731Summary:
732Notify Recpump of how much data the application consumed from the buffer.
733
734Description:
735You can only call NEXUS_Recpump_IndexReadComplete once after a NEXUS_Recpump_GetIndexBuffer call.
736After calling it, you must call NEXUS_Recpump_GetIndexBuffer before adding more data.
737**/
738NEXUS_Error NEXUS_Recpump_IndexReadComplete(
739    NEXUS_RecpumpHandle handle,
740    size_t amount /* number of bytes the application has consumed */
741    );
742
743/* backward compatibility */
744#define NEXUS_Recpump_IndexWriteComplete NEXUS_Recpump_IndexReadComplete
745
746/**
747Summary:
748Status obtained from NEXUS_Recpump_GetStatus
749**/
750typedef struct NEXUS_RecpumpStatus
751{
752    bool hasIndex; /* If true, recpump is recording both data and index. This means at least one pid has index = true.
753                      If false, recpump is only recording data. */
754    struct
755    {
756        uint64_t bytesRecorded; /* Total bytes recorded since NEXUS_Recpump_Start */
757        size_t fifoDepth; /* Current depth of record fifo in bytes */
758        size_t fifoSize;  /* Size of record fifo in bytes. This could be less than the OpenSettings bufferSize because of
759                             internal alignment requirements. */
760        void *bufferBase; /* attr{memory=cached} Pointer to the base of the record buffer.
761                             This can be used for calculating your absolute position in the buffer. */
762    } data, index;
763
764    NEXUS_RecpumpOpenSettings openSettings; /* Settings used to open Recpump */
765   
766    struct {
767        unsigned index;
768    } rave;   
769} NEXUS_RecpumpStatus;
770
771/**
772Summary:
773Current status of the Recpump
774**/
775NEXUS_Error NEXUS_Recpump_GetStatus(
776    NEXUS_RecpumpHandle handle,
777    NEXUS_RecpumpStatus *pStatus /* [out] */
778    );
779
780/**
781Summary:
782Get default filter
783**/
784void NEXUS_Recpump_GetDefaultTpitFilter(
785    NEXUS_RecpumpTpitFilter *pFilter /* [out] */
786    );
787
788/* For 40nm silicon, NEXUS_NUM_TPIT_PIDS can be increased to 16 by defining it in nexus_platform_features.h */
789#ifndef NEXUS_NUM_TPIT_PIDS
790#define NEXUS_NUM_TPIT_PIDS 15
791#endif
792
793/**
794Summary:
795Set the TPIT filter for this pid channel
796
797Description:
798The TPIT filter will be removed if you call NEXUS_Recpump_SetTpitFilter with NULL
799or if you remove the pid channel.
800
801You are limited in the number of pid channels for TPIT filtering by NEXUS_NUM_TPIT_PIDS.
802
803NEXUS_Recpump_SetTpitFilter can be called before or after start.
804
805One TPIT filter per pid is allowed.
806**/
807NEXUS_Error NEXUS_Recpump_SetTpitFilter(
808    NEXUS_RecpumpHandle handle,
809    NEXUS_PidChannelHandle pidChannel,
810    const NEXUS_RecpumpTpitFilter *pFilter /* attr{null_allowed=y} set to NULL to disable TPIT filtering on this pid */
811    );
812
813#ifdef __cplusplus
814}
815#endif
816
817#endif
Note: See TracBrowser for help on using the repository browser.