source: svn/newcon3bcm2_21bu/nexus/modules/transport/7552/include/nexus_playpump.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: 27.3 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_playpump.h $
39 * $brcm_Revision: 45 $
40 * $brcm_Date: 12/20/11 1:44p $
41 *
42 * Module Description:
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /nexus/modules/transport/7400/include/nexus_playpump.h $
47 *
48 * 45   12/20/11 1:44p vsilyaev
49 * SW7425-2034: Used 32-bit type for program id (pid) types
50 *
51 * 44   11/29/11 11:39a erickson
52 * SW7420-2129: get current default heap using NEXUS_P_DefaultHeap
53 *
54 * 43   10/24/11 1:38p erickson
55 * SWDEPRECATED-2425: improve comments on picking fifoSize
56 *
57 * 42   10/17/11 12:06p jtna
58 * SW7425-1383: merge NEXUS_Playpump_GetAllPassPidChannelIndex
59 *
60 * 41   8/29/11 1:55p erickson
61 * SW7420-1148: NULL is allowed for trusted client
62 *
63 * 40   8/25/11 10:53a erickson
64 * SW7420-1148: can't allow NULL For NEXUS_PlaypumpOpenSettings because
65 *  untrusted client must set the heap
66 *
67 * 39   7/21/11 2:27p jtna
68 * SW7125-1015: added NEXUS_Playpump_SubmitScatterGatherDescriptor()
69 *
70 * 38   1/28/11 8:53a erickson
71 * SW7420-1440: fix destructor and secondary_destructor options for
72 *  NEXUS_Playpump_OpenPidChannel
73 *
74 * 37   12/13/10 6:59p vsilyaev
75 * SW7425-39: Added support for MUX input
76 *
77 * 36   12/9/10 3:32p erickson
78 * SW7420-1308: use unconditional nexus_dma_types.h in the public API
79 *
80 * 35   12/7/10 5:46p erickson
81 * SW7420-1148: added null_allowed, boundsHeap
82 *
83 * 34   10/14/10 12:34p erickson
84 * SW7420-1148: add secondary_destructor to support
85 *  NEXUS_Playpump_ClosePidChannel, verify function attr in one place,
86 *  support multiple param verifications per ioctl
87 *
88 * 32   10/1/10 9:41a erickson
89 * SW7420-1009: support NEXUS_ANY_ID
90 *
91 * 31   8/10/10 3:33p erickson
92 * SW7420-934: rename NEXUS_Playpump_ReadComplete to
93 *  NEXUS_Playpump_WriteComplete
94 *
95 * 30   6/11/10 6:58p mphillip
96 * SW7125-463: Allow the user to configure DMA data format in playpump
97 *
98 * 29   6/9/10 11:31a mphillip
99 * SW7550-398: Enable encrypted PVR for 7550
100 *
101 * 28   1/21/10 5:56p vsilyaev
102 * SW3556-1003: Added option to disable timestamp reordering inside bmedia
103 *
104 * 27   11/3/09 9:55a erickson
105 * SW7405-3308: add teiError callback
106 *
107 * 26   10/1/09 5:02p erickson
108 * SW7405-3087: add continuity count error checking and callback. default
109 *  off.
110 *
111 * 25   6/11/09 3:52p erickson
112 * PR55767: add NEXUS_PlaypumpSettings.timestamp.forceRestamping
113 *
114 * 24   5/28/09 11:31a erickson
115 * PR55461: add PCR-based pacing
116 *
117 * 23   5/15/09 12:48p vsilyaev
118 * PR 55193: Added function to return last parsed PTS by the media library
119 *
120 * 22   4/3/09 2:59p erickson
121 * PR35457: update comments
122 *
123 * 21   1/26/09 11:03a vsilyaev
124 * PR 51579: Adding originalTransportType to the PlaypumpSettings
125 *
126 * 20   12/4/08 3:29p vsilyaev
127 * PR 49993: Added code to inform application about errors detected during
128 *  stream parsing
129 *
130 * 19   12/1/08 12:53p erickson
131 * PR49676: add comments on pidChannelIndex requirements for allPass pid
132 *  channels
133 *
134 * 18   11/6/08 12:51p erickson
135 * PR35457: update comment
136 *
137 * 17   10/30/08 10:26p erickson
138 * PR47132: added NEXUS_PlaypumpSettings.blindSync
139 *
140 * 16   10/27/08 11:20a erickson
141 * PR47232: added pacingTsRangeError to NEXUS_PlaypumpStatus
142 *
143 * 15   10/22/08 11:39a erickson
144 * PR48216: allow transport to run with no dma or security modules
145 *
146 * 14   10/16/08 4:20p jgarrett
147 * PR 47951: Adding index to status
148 *
149 * 13   10/9/08 5:48p erickson
150 * PR47232: added NEXUS_PlaypumpSettings.timestamp.resetPacing
151 *
152 * 12   10/7/08 11:31p erickson
153 * PR47232: extend NEXUS_PlaypumpSettings timestamp settings. reorganized
154 *  into a nested structure.
155 *
156 * 11   10/6/08 1:59a erickson
157 * PR47232: added NEXUS_Playpump_SetPause for IP STB throttling
158 *
159 * 10   10/6/08 1:30a erickson
160 * PR47232: added NEXUS_PlaypumpSettings.pacingMaxError
161 *
162 * 9   9/4/08 12:47p erickson
163 * PR46315: added NEXUS_PlaypumpSettings.allPass
164 *
165 * 8   7/29/08 3:07p erickson
166 * PR45199: added NEXUS_PlaypumpSettings.maxDataRate
167 *
168 * 7   6/25/08 5:50p vsilyaev
169 * PR 41869: Use keySlotHandle instead of keySlot[Number]
170 *
171 * 6   6/24/08 11:50a vsilyaev
172 * PR 38347: Use separate timestamps for audio and video streams
173 *
174 * 5   5/30/08 10:53a erickson
175 * PR34925: add comment
176 *
177 * 4   4/18/08 4:03p vsilyaev
178 * PR 41868: Added security API to playpump and recpump
179 *
180 * 3   2/1/08 5:05p vsilyaev
181 * PR 38682: Added attributes to mark destructor and shutdown functions
182 *
183 * 2   1/25/08 2:35p vsilyaev
184 * PR 38682: Added handling of 'attr' to the function arguments
185 *
186 * 1   1/18/08 2:15p jgarrett
187 * PR 38808: Merging to main branch
188 *
189 * Nexus_Devel/19   1/9/08 3:22p erickson
190 * PR34925: update docs
191 *
192 * Nexus_Devel/18   12/20/07 2:07p vsilyaev
193 * PR 37574: Added playRate for playpump
194 *
195 * Nexus_Devel/17   12/4/07 2:38p erickson
196 * PR36068: remove timestampEnabled
197 *
198 * Nexus_Devel/16   11/30/07 11:11a erickson
199 * PR35457: api update
200 *
201 * Nexus_Devel/15   11/29/07 2:24p erickson
202 * PR35457: doc update for 0.5 release
203 *
204 * Nexus_Devel/14   11/19/07 1:19p erickson
205 * PR34925: split demux.h into separate interface files
206 *
207 * Nexus_Devel/13   10/19/07 4:05p vsilyaev
208 * PR 36291: Added datatype for S/G playpump
209 *
210 * Nexus_Devel/12   10/15/07 2:54p vsilyaev
211 * PR 35824: Added NEXUS_Playpump_GetDefaultSettings
212 *
213 * Nexus_Devel/11   10/12/07 5:03p vsilyaev
214 * PR 35824: Added flag to enable/disable timestamps
215 *
216 * Nexus_Devel/10   10/11/07 6:25p vsilyaev
217 * PR 35824: Added more playback code
218 *
219 * Nexus_Devel/9   10/10/07 5:09p vsilyaev
220 * PR 35824: Added dependent include files
221 *
222 * Nexus_Devel/8   10/9/07 3:21p vsilyaev
223 * PR 35824: Demoted Playpump_Pause to private function
224 *
225 * Nexus_Devel/7   10/9/07 2:10p vsilyaev
226 * PR 35824: Reworked playpump API
227 *
228 * Nexus_Devel/6   10/4/07 12:26p erickson
229 * PR34925: api updates
230 *
231 * Nexus_Devel/5   10/3/07 9:50a erickson
232 * PR34925: coding convention
233 *
234 * Nexus_Devel/4   9/26/07 3:11p erickson
235 * PR34925: initial playpump checkin
236 *
237 * Nexus_Devel/3   9/11/07 6:28p erickson
238 * PR34254: update
239 *
240 * Nexus_Devel/2   8/28/07 11:57a erickson
241 * PR34254: update
242 *
243 **************************************************************************/
244#ifndef NEXUS_PLAYPUMP_H__
245#define NEXUS_PLAYPUMP_H__
246
247#include "nexus_types.h"
248#include "nexus_pid_channel.h"
249#include "nexus_dma_types.h"
250
251#ifdef __cplusplus
252extern "C" {
253#endif
254
255/**
256Summary:
257Handle for the Playpump Interface.
258
259Description:
260The Playpump Interface provides data feeding for PVR playback functionality.
261Each Interface corresponds to one hardware playback channel.
262
263See nexus/examples/playpump.c for an example application.
264
265See NEXUS_PlaybackHandle for a high-level Playback Interface.
266See NEXUS_RecpumpHandle for the corresponding low-level PVR record Interface.
267See NEXUS_VideoDecoderHandle and NEXUS_AudioDecoderHandle for decoder-based PVR and trick mode options.
268**/
269typedef struct NEXUS_Playpump *NEXUS_PlaypumpHandle;
270
271/**
272Summary:
273Settings used in NEXUS_Playpump_Open
274**/
275typedef struct NEXUS_PlaypumpOpenSettings
276{
277    size_t fifoSize;            /* size of playpump's fifo in bytes.
278                                   The minimum size depends on the maximum bitrate of your streams and the system latency for filling the buffers.
279                                   The system latency depends on i/o performance and OS scheduling.
280                                   If the size chosen is too small, you will underflow the decoders. */
281    unsigned alignment;         /* You may want to specify the alignment of the fifo allocation to prevent any wasted buffer because of memory alignment requirements.
282                                   See NEXUS_Playppump_ReadComplete and its skip parameter for more information about alignment requirements. */
283    unsigned numDescriptors;    /* More descriptors are needed to perform certain trick modes. See NEXUS_Playpump_GetBuffer for details. */
284    bool streamMuxCompatible;     /* If set to true,  this playpump could be used with the StreamMux module */
285
286    NEXUS_HeapHandle heap;      /* optional heap for fifo allocation */
287    NEXUS_HeapHandle boundsHeap; /* optional heap to bounds check all scatter-gather descriptors */
288} NEXUS_PlaypumpOpenSettings;
289
290/**
291Summary:
292Get default settings for the structure.
293
294Description:
295This is required in order to make application code resilient to the addition of new strucutre members in the future.
296**/
297void NEXUS_Playpump_GetDefaultOpenSettings(
298    NEXUS_PlaypumpOpenSettings *pSettings /* [out] */
299    );
300
301/**
302Summary:
303Open a new Playpump interface.
304**/
305NEXUS_PlaypumpHandle NEXUS_Playpump_Open( /* attr{destructor=NEXUS_Playpump_Close} */
306    unsigned index, /* index of hardware playback channel. NEXUS_ANY_ID is supported. */
307    const NEXUS_PlaypumpOpenSettings *pSettings /* attr{null_allowed=y} may be NULL for default settings */
308    );
309
310/**
311Summary:
312Close the Playpump interface.
313**/
314void NEXUS_Playpump_Close(
315    NEXUS_PlaypumpHandle playpump
316    );
317
318/**
319Summary:
320Determines method of feeding data into playpump.
321**/
322typedef enum NEXUS_PlaypumpMode
323{
324    NEXUS_PlaypumpMode_eFifo,         /* Playpump allocates a block of memory which serves as the playback fifo.
325                                         The user must copy data into this buffer with the CPU or DMA. */
326    NEXUS_PlaypumpMode_eSegment,      /* This is like Fifo, except the user must prepend NEXUS_PlaypumpSegment headers to every data block. */
327    NEXUS_PlaypumpMode_eScatterGather /* DEPRECATED: use NEXUS_Playpump_SubmitScatterGatherDescriptor() instead.
328                                         In this mode, playpump's fifo is a fifo of NEXUS_PlaypumpDesc structures. Each descriptor has a pointer to
329                                         the data to be played. That data is not copied but is read directly into transport hardware. */
330} NEXUS_PlaypumpMode;
331
332/**
333Summary:
334Base rate for normal play used in NEXUS_PlaypumpSettings.playRate.
335**/
336#define NEXUS_NORMAL_PLAY_SPEED 1000
337
338/**
339Summary:
340Settings for playpump
341**/
342typedef struct NEXUS_PlaypumpSettings
343{
344    NEXUS_TransportType transportType;          /* Type of data stream going into playpump. Note that if the data must be packetized,
345                                                   you can get the resulting NEXUS_TransportType from NEXUS_PidChannelStatus. */
346
347    NEXUS_TransportType originalTransportType;  /* If the user packetizes intput to playpump, this describes the input. If there is no
348                                                   packetization, this is member should be set to NEXUS_TransportType_eUnknown. */
349
350    bool continuityCountEnabled;                /* If true, transport will check for correct continuity counters and discard bad packets.
351                                                   This must be set to false for trick modes. Default is false. */
352
353    /* Type of original transport stream */
354    NEXUS_PlaypumpMode mode;                    /* Method of pushing data into playpump. This setting determines the format of data the app will feed to playpump. */
355    NEXUS_CallbackDesc dataCallback;            /* Callback when space becomes available. User should call NEXUS_Playpump_GetBuffer.
356                                                   You will not receive another callback until NEXUS_Playpump_GetBuffer is called. */
357    NEXUS_CallbackDesc errorCallback;           /* Callback called when error was detected in ptocessing of the stream data */
358    NEXUS_CallbackDesc ccError;                 /* Continuity Count Error - raised when continuity counter of next packet does not have the next counter value.
359                                                   continuityCountEnabled must be set to true. See NEXUS_PidChannelStatus.continuityCountErrors to get a count of errors per pid. */
360    NEXUS_CallbackDesc teiError;                /* Transport Error Indicator - error status from a demodulator */
361
362    int playRate;                               /* Rate in units of NEXUS_NORMAL_PLAY_SPEED. It's used for certain type of streams to control the direction of presentation time. */
363
364    NEXUS_DmaHandle securityDma;                /* Instance of DMA that is used for security processing, NULL if security processing is not required */
365    NEXUS_DmaDataFormat securityDmaDataFormat;
366    NEXUS_KeySlotHandle securityContext;
367
368    unsigned maxDataRate;                       /* Maximum data rate for the playback parser band in units of bits per second. Default is typically 108000000 (i.e. 108 Mbps).
369                                                   If you increase this, you need to analyze total transport bandwidth and overall system bandwidth. */
370    bool blindSync;                             /* Force transport to not look for sync bytes. */
371
372    /* all pass settings */
373    bool allPass;                               /* If true, NEXUS_Playpump_OpenPidChannel's pid param is ignored and the resulting pid channel can be used for all-pass record.
374                                                   Also set acceptNullPackets to true if you want to capture the entire stream.
375                                                   When opening the allPass pid channel, set NEXUS_PlaypumpOpenPidChannelSettings.pidSettings.pidChannelIndex to the HwPidChannel obtained
376                                                   from NEXUS_ParserBand_GetAllPassPidChannelIndex(). */
377    bool acceptNullPackets;                     /* If true and allPass is true, NULL packets are not discarded. */
378
379
380    struct {
381        NEXUS_TransportTimestampType type;      /* The type of timestamping in this stream. */
382        uint16_t pcrPacingPid;                  /* Some chips can pace playback using a PCR pid. Set timestamp.pcrPacingPid to a non-zero value and set timestamp.pacing = true. */
383
384        bool pacing;                            /* If true, pace this stream using embedded timestamp information or using pcr-based pacing.
385                                                   For timestamp-based pacing, set timestampType as well.
386                                                   For pcr-based pacing, set pcrPacingPid as well. */
387        unsigned pacingMaxError;                /* Set the maximum allowable timestamp error (TS_RANGE_ERROR) used during playback pacing. */
388        NEXUS_Timebase timebase;                /* Timebase used for timestamp. Use NEXUS_Timebase_eInvalid for freerun. */
389        bool parityCheckDisable;                /* Set true to disable timestamp parity check. */
390        bool pacingOffsetAdjustDisable;         /* Set true to adjust the pacing timestamps with the reference offset */
391        bool resetPacing;                       /* Set true if you want the pacing start bit reset when a TS_RANGE_ERROR interrupt occurs */
392        bool forceRestamping;                   /* Set true if you want to restamp the incoming timestamps or if you are recording and want to add timestamps */
393    } timestamp;
394
395} NEXUS_PlaypumpSettings;
396
397/**
398Summary:
399Settings used in NEXUS_Playpump_OpenPidChannel
400**/
401typedef struct NEXUS_PlaypumpOpenPidChannelSettings
402{
403    NEXUS_PidChannelSettings pidSettings;
404    NEXUS_PidType pidType;
405    bool allowTimestampReordering;                     /* For some media formats it's required to reorder timestamps prior to sending data to the decoders, this flag controls whether playpump would reourder timestamps */
406    union
407    {
408        struct
409        {
410            NEXUS_AudioCodec codec; /* Audio codec information is required for VOB substream id remapping. */
411        } audio;
412    } pidTypeSettings;
413} NEXUS_PlaypumpOpenPidChannelSettings;
414
415/**
416Summary:
417Get default settings for the structure.
418
419Description:
420This is required in order to make application code resilient to the addition of new strucutre members in the future.
421**/
422void NEXUS_Playpump_GetDefaultOpenPidChannelSettings(
423    NEXUS_PlaypumpOpenPidChannelSettings *pSettings /* [out] */
424    );
425
426/*
427Summary:
428Open a playpump NEXUS_PidChannelHandle.
429
430Description:
431This differs from a pid channel opened by NEXUS_PidChannel_Open because it
432allows Playpump to get additional information about the pid.
433NEXUS_Playpump_OpenPidChannel can be called before or after Start and Stop.
434*/
435NEXUS_PidChannelHandle NEXUS_Playpump_OpenPidChannel( /* attr{destructor=NEXUS_PidChannel_Close;secondary_destructor=NEXUS_Playpump_ClosePidChannel} */
436    NEXUS_PlaypumpHandle playpump,
437    unsigned pid,                   /* Substream selector.
438                                       For TS, this is the PID.
439                                       For PES, this is the Stream ID.
440                                       For ES, this is ignored. */
441    const NEXUS_PlaypumpOpenPidChannelSettings *pSettings /* attr{null_allowed=y} may be NULL for default settings */
442    );
443
444/*
445Summary:
446This function closes a pid channel opened by NEXUS_Playpump_OpenPidChannel
447*/
448NEXUS_Error NEXUS_Playpump_ClosePidChannel(
449    NEXUS_PlaypumpHandle playpump,
450    NEXUS_PidChannelHandle pidChannel
451    );
452
453/*
454Summary:
455Close all pid channels opened by NEXUS_Playpump_OpenPidChannel
456*/
457void NEXUS_Playpump_CloseAllPidChannels(
458    NEXUS_PlaypumpHandle playpump
459    );
460
461/**
462Summary:
463Get default settings for the structure.
464
465Description:
466This is required in order to make application code resilient to the addition of new strucutre members in the future.
467**/
468void NEXUS_Playpump_GetDefaultSettings(
469    NEXUS_PlaypumpSettings *pSettings /* [out] */
470    );
471
472/**
473Summary:
474Get current settings
475**/
476void NEXUS_Playpump_GetSettings(
477    NEXUS_PlaypumpHandle playpump,
478    NEXUS_PlaypumpSettings *pSettings /* [out] */
479    );
480
481/**
482Summary:
483Set new settings
484
485Description:
486If you use NEXUS_Playback, be aware that it will call this function with NEXUS_PlaybackSettings.playpumpSettings
487any will overwrite any application use of this function.
488**/
489NEXUS_Error NEXUS_Playpump_SetSettings(
490    NEXUS_PlaypumpHandle playpump,
491    const NEXUS_PlaypumpSettings *pSettings
492    );
493
494/**
495Summary:
496Start playback
497
498Description:
499After calling this function, the app is responsible to call NEXUS_Playpump_GetBuffer,
500feed in data, then call NEXUS_Playpump_WriteComplete.
501**/
502NEXUS_Error NEXUS_Playpump_Start(
503    NEXUS_PlaypumpHandle playpump
504    );
505
506/**
507Summary:
508Stop playback
509**/
510void NEXUS_Playpump_Stop(
511    NEXUS_PlaypumpHandle playpump
512    );
513
514/*
515Summary:
516Throw away all data currently in playback fifo.
517
518Description:
519This does not flush any downstream consumer like a decoders.
520See NEXUS_VideoDecoder_Flush and NEXUS_AudioDecoder_Flush.
521*/
522NEXUS_Error NEXUS_Playpump_Flush(
523    NEXUS_PlaypumpHandle playpump
524    );
525
526/*
527Summary:
528Get a pointer and size for the next location in the buffer which can accept playpump data.
529
530Description:
531NEXUS_Playpump_GetBuffer is non-destructive. You can safely call it multiple times.
532
533The buffer and size returned by NEXUS_Playpump_GetBuffer are valid until you call NEXUS_Playpump_Flush or NEXUS_Playpump_WriteComplete.
534
535The size returned by NEXUS_Playpump_GetBuffer can be limited by two things: space in the ring buffer or free descriptors
536used to send data to the transport block. If you are performing trick modes with lots of small reads,
537you may find that NEXUS_Playpump_GetBuffer says there is no space available even though
538NEXUS_PlaypumpStatus reports free space. The solution is to increase the number of descriptors
539in NEXUS_PlaypumpOpenSettings.
540*/
541NEXUS_Error NEXUS_Playpump_GetBuffer(
542    NEXUS_PlaypumpHandle playpump,
543    void **pBuffer, /* [out] attr{memory=cached} pointer to memory mapped region that is ready for playback data */
544    size_t *pSize /* [out] total number of writeable, contiguous bytes which buffer is pointing to */
545    );
546
547/**
548Summary:
549Notify Playpump of how much data was added into the buffer.
550
551Description:
552You can only call NEXUS_Playpump_WriteComplete once after a NEXUS_Playpump_GetBuffer call.
553After calling it, you must call NEXUS_Playpump_GetBuffer before adding more data.
554
555The skip parameter allows an application to copy data into the playpump buffer with
556whatever alignment it desired. This is needed for "direct I/O" from disk drives which requires
557all memory access to be page aligned (e.g. 4K).
558**/
559NEXUS_Error NEXUS_Playpump_WriteComplete(
560    NEXUS_PlaypumpHandle playpump,
561    size_t skip,            /* skip is the number of bytes at the beginning of the current buffer pointer
562                               which Playpump should skip over. */
563    size_t amountUsed       /* amountUsed is the number of bytes, following any skip bytes,
564                               which Playpump should feed into transport. */
565    );
566
567/* backward compatibility */
568#define NEXUS_Playpump_ReadComplete NEXUS_Playpump_WriteComplete
569
570/**
571Summary:
572Playpump scatter gather Descriptor
573**/
574typedef struct NEXUS_PlaypumpScatterGatherDescriptor
575{
576    void *addr;    /* attr{memory=cached} address of memory region */
577    size_t length; /* size of the memory region */
578} NEXUS_PlaypumpScatterGatherDescriptor;
579
580/**
581Summary:
582Submit scatter gather descriptor to playpump
583**/
584NEXUS_Error NEXUS_Playpump_SubmitScatterGatherDescriptor(
585    NEXUS_PlaypumpHandle playpump,
586    const NEXUS_PlaypumpScatterGatherDescriptor *pDesc, /* attr{nelem=numDescriptors} */
587    size_t numDescriptors,
588    size_t *pNumConsumed /* [out] */
589    );
590
591/**
592Summary:
593Status returned by NEXUS_Playpump_GetStatus
594**/
595typedef struct NEXUS_PlaypumpStatus
596{
597    bool started;               /* Has NEXUS_Playpump_Start been called? */
598    size_t fifoDepth;           /* Depth in bytes of the playback buffer */
599    size_t fifoSize;            /* Size in bytes of the playback buffer */
600    size_t descFifoDepth;       /* Number of active (i.e. busy) descriptors */
601    size_t descFifoSize;        /* Number of allocated descriptors */
602    void *bufferBase;           /* attr{memory=cached} Pointer to the base of the playback buffer.
603                                   This can be used for calculating your exact position
604                                   in the buffer for alignment considerations. */
605    uint64_t bytesPlayed;       /* Total number of bytes played since starting */
606    unsigned index;             /* Index of this playpump */
607
608    unsigned pacingTsRangeError; /* Number of TS_RANGE_ERROR's if pacing is activated. */
609    unsigned syncErrors;         /* count of sync errors found in the stream */
610    unsigned resyncEvents;       /* count of resync handled in the stream */
611    unsigned streamErrors;       /* count of other errors found in the stream */
612    NEXUS_PtsType mediaPtsType;    /* Type of the current PTS */
613    uint32_t mediaPts;    /* if playpump does inline media streeam conversion (i.e. AVI to PES), then this is the last known PTS (in units of 45KHz) for the first converted pid (track) */
614} NEXUS_PlaypumpStatus;
615
616/**
617Summary:
618Get current status of playpump
619**/
620NEXUS_Error NEXUS_Playpump_GetStatus(
621    NEXUS_PlaypumpHandle playpump,
622    NEXUS_PlaypumpStatus *pStatus /* [out] */
623    );
624
625/**
626Summary:
627Signature used in NEXUS_PlaypumpSegment.signature when in NEXUS_PlaypumpMode_eSegment mode.
628**/
629#define NEXUS_PLAYPUMP_SEGMENT_SIGNATURE ((((uint32_t)'B')<<24) | (((uint32_t)'P')<<16 ) | (((uint32_t)'L')<<8) | 0)
630
631/**
632Summary:
633Segment header used in NEXUS_PlaypumpMode_eSegment mode.
634
635Description:
636When feeding data into Playpump, the user must prepend NEXUS_PlaypumpSegment before every data block.
637**/
638typedef struct NEXUS_PlaypumpSegment
639{
640    uint32_t length;    /* Size of the segment. This includes the size of the NEXUS_PlaypumpSegment header and all data following the header. */
641    uint64_t offset;    /* 64 bit offset in the source file for this segment */
642    uint32_t timestamp; /* timestamp for this segment */
643    struct {
644        uint16_t stream_id;
645        int16_t  timestamp_delta;
646    } timestamp_delta[9];
647    uint32_t signature; /* This field must be set to BPLAYPUMP_SEGMENT_SIGNATURE. Nexus uses this to validate the segmented data stream. */
648} NEXUS_PlaypumpSegment;
649
650/**
651Summary:
652Descriptor used in NEXUS_PlaypumpMode_eScatterGather mode to address data to be read into transport hardware.
653
654Description:
655Memory must be physically contiguous.
656**/
657typedef struct NEXUS_PlaypumpDesc
658{
659    void *addr;    /* attr{memory=cached} address of memory region.
660                      This address is currently not converted to/from Linux kernel mode. Therefore NEXUS_PlaypumpMode_eScatterGather is only usable
661                      in Linux user mode. */
662    size_t length; /* size of the memory region */
663} NEXUS_PlaypumpDesc;
664
665/**
666Summary:
667Pause or unpause the transport playback hardware
668
669Description:
670This does not pause decoders; it pauses the transport playback hardware state machine (aka "micro pause").
671Be aware this could result in loss of data if the application unpauses before a consumer
672is attached. Nexus normally uses this same hardware pause to ensure this does not occur.
673**/
674NEXUS_Error NEXUS_Playpump_SetPause(
675    NEXUS_PlaypumpHandle playpump,
676    bool paused
677    );
678
679/**
680Summary:
681Suspend or resume pacing
682
683Description:
684NEXUS_PlaypumpSettings.timebase.pacing must be true for this to be used.
685**/
686NEXUS_Error NEXUS_Playpump_SuspendPacing(
687    NEXUS_PlaypumpHandle playpump,
688    bool suspended
689    );
690
691/**
692Summary:
693Determine the PID channel that will be used in allPass mode.
694 
695Description:
696Each playpump will use a different PID channel when operating in
697allPass mode. This API provides the channel number for the given
698playpump.
699**/
700NEXUS_Error NEXUS_Playpump_GetAllPassPidChannelIndex(
701    NEXUS_PlaypumpHandle playpump, 
702    unsigned *pHwPidChannel
703    );
704
705#ifdef __cplusplus
706}
707#endif
708
709#endif
Note: See TracBrowser for help on using the repository browser.