source: svn/newcon3bcm2_21bu/nexus/modules/playback/include/nexus_playback.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.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_playback.h $
39 * $brcm_Revision: 48 $
40 * $brcm_Date: 12/20/11 1:43p $
41 *
42 * Module Description:
43 *
44 * Revision History:
45 *
46 * $brcm_Log: /nexus/modules/playback/include/nexus_playback.h $
47 *
48 * 48   12/20/11 1:43p vsilyaev
49 * SW7425-2034: Used 32-bit type for program id (pid) types
50 *
51 * 47   11/11/11 11:28a erickson
52 * SWDEPRECATED-2425: fix NEXUS_PlaybackHostTrickMode comments
53 *
54 * 46   10/12/11 9:32a erickson
55 * SW7425-1264: clarify automatic and custom trick modes
56 *
57 * 45   9/22/11 4:43p erickson
58 * SW7420-1965: add simple decoder support to nexus playback module
59 *
60 * 44   8/31/11 2:44p vsilyaev
61 * SW7420-1978: Add selection of index type for playback of MPEG-2 TS
62 *  files
63 *
64 * 43   8/29/11 10:32a erickson
65 * SW7425-1205: clarify NEXUS_PlaybackHostTrickMode_ePlayGop
66 *
67 * 42   8/12/11 9:40a erickson
68 * SW7358-83: add NEXUS_PlaybackTrickModeSettings.brcmTrickMode
69 *
70 * 41   6/17/11 2:33p erickson
71 * SWDEPRECATED-2425: update comments
72 *
73 * 40   5/26/11 7:32p vsilyaev
74 * SW7425-646: Added configurable 'gap' for timeshifting
75 *
76 * 39   12/14/10 3:25p erickson
77 * SW7420-1285: add null_allowed attribute
78 *
79 * 38   9/2/10 4:27p erickson
80 * SWDEPRECATED-1003: added NEXUS_PlaybackHostTrickMode_eTimeSkip
81 *
82 * 37   8/31/10 2:44p erickson
83 * SWGIGGSVIZIO-57: clarify comments for NEXUS_PlaybackMode_eFixedBitrate
84 *
85 * 36   8/9/10 8:15a erickson
86 * SW3548-3045: clarify comments
87 *
88 * 35   7/14/10 12:00p erickson
89 * SW7405-4621: change to nexus_base_os.h
90 *
91 * 34   7/14/10 10:32a erickson
92 * SW7405-4621: NEXUS_ThreadSettings requires nexus_base.h, for now.
93 *
94 * 33   6/29/10 3:20p erickson
95 * SW7405-4367: playback should flush when transitioning decoder skip
96 *  modes. also added NEXUS_PlaybackTrickModeSettings.avoidFlush option to
97 *  disable this behavior.
98 *
99 * 32   6/11/10 1:03p erickson
100 * SWDEPRECATED-2425: update comments
101 *
102 * 31   2/18/10 12:05p vsilyaev
103 * SW3556-913: Differentiate between index error and end of stream
104 *
105 * 30   1/13/10 5:41p vsilyaev
106 * SW3556-913: Added option control error handling for Play/Seek/SetTrick
107 *  operations
108 *
109 * 29   12/28/09 2:53p erickson
110 * SW3556-957: added comment to NEXUS_PlaybackTrickModeSettings about
111 *  trick mode limitations
112 *
113 * 28   12/17/09 6:16p vsilyaev
114 * SW3556-913: Added option to specify timeout on asynchronous I/O
115 *
116 * 27   12/17/09 5:52p vsilyaev
117 * SW3548-2677: Added configuration that allows user to choose what
118 *  context should be used for synchronous I/O
119 *
120 * 26   11/4/09 11:31a erickson
121 * SWDEPRECATED-2425: update comments for NEXUS_PlaybackTrickModeSettings
122 *  and related enums
123 *
124 * 25   7/21/09 5:57p vsilyaev
125 * PR 56977: Nexus playback always control audio and video decoder.
126 *  Provided way for the user to control the decoder slowmotion factor
127 *  using the playback trick API.
128 *
129 * 24   7/1/09 12:09p erickson
130 * PR56169: clarify comment
131 *
132 * 23   6/19/09 4:11p vsilyaev
133 * PR 56169: PR 53824: Allow user to sepcify max decodder rate. This
134 *  superceeds overrideStcTrick.
135 *
136 * 22   4/20/09 2:47p erickson
137 * PR54166: update comment for NEXUS_Playback_Seek
138 *
139 * 21   4/3/09 12:56p erickson
140 * PR53824: reenable stc trick modes. add
141 *  NEXUS_PlaybackTrickModeSettings.overrideStcTrick for additional app
142 *  control.
143 *
144 * 20   3/27/09 12:51p vsilyaev
145 * PR 50311: Return readPosition in the Nexus playback status. In
146 *  combination with the position it could be used to measure depth of
147 *  decoder and playback buffers in units of time.
148 *
149 * 19   2/2/09 2:26p erickson
150 * PR47815: added NEXUS_PlaybackHostTrickMode and
151 *  NEXUS_PlaybackTrickModeSettings.mode
152 *
153 * 18   1/26/09 11:04a vsilyaev
154 * PR 51579: Adding originalTransportType to the PlaypumpSettings
155 *
156 * 17   1/12/09 5:45p vsilyaev
157 * PR 50763: Improved seek to position 0 after rewind reached begining of
158 *  the file
159 *
160 * 16   12/19/08 5:59p vsilyaev
161 * PR 50214: Added callbacks and counters for parsing index files
162 *
163 * 15   12/10/08 2:57p vsilyaev
164 * PR 48760: Removed duplicated information
165 *
166 * 13   12/10/08 2:06a vsilyaev
167 * PR 48760: Using ES player for accurate progress monitor of MP3 streams
168 *
169 * 12   12/8/08 11:19a erickson
170 * PR49930: add NEXUS_PlaybackSettings.accurateSeek
171 *
172 * 11   11/19/08 1:29p erickson
173 * PR35457: update comments
174 *
175 * 10   10/16/08 3:37p erickson
176 * PR47673: add comment on NEXUS_PlaybackSettings.stcTrick
177 *
178 * 9   10/9/08 2:23p erickson
179 * PR47608: NEXUS_PlaybackSettings.stcChannel is now required for TSM
180 *  playback. NEXUS_PlaybackSettings.stcTrick was added for stc trick
181 *  modes.
182 *
183 * 8   6/24/08 4:07p erickson
184 * PR44107: rename to TrickMode
185 *
186 * 7   6/12/08 3:02p erickson
187 * PR43606: rename NEXUS_PlaybackStreamSettings to
188 *  NEXUS_PlaybackStartSettings
189 *
190 * 6   5/30/08 10:53a erickson
191 * PR34925: add comment
192 *
193 * 5   5/13/08 4:41p erickson
194 * PR42119: clarify comments, especially requirement that pidchannels be
195 *  opened before Start for some transport types
196 *
197 * 4   4/25/08 1:24p erickson
198 * PR41951: NEXUS_Playback_ClosePidChannel should return void
199 *
200 * 3   1/23/08 8:36p vobadm
201 * PR35457: update docs
202 *
203 * 2   1/23/08 5:16p erickson
204 * PR35457: update docs
205 *
206 * 1   1/18/08 2:36p jgarrett
207 * PR 38808: Merging to main branch
208 *
209 * Nexus_Devel/11   12/20/07 2:08p vsilyaev
210 * PR 37574: Use explicitly defined PLAY_SPEED
211 *
212 * Nexus_Devel/10   12/20/07 10:29a vsilyaev
213 * PR 38073: Updated to work with new bmedia_player
214 *
215 * Nexus_Devel/PR38073/1   12/18/07 4:57p vsilyaev
216 * PR 38073: Updated playback module to work exclusively with media player
217 *
218 * Nexus_Devel/9   11/29/07 2:28p erickson
219 * PR35457: doc update
220 *
221 * Nexus_Devel/8   11/16/07 12:38p vsilyaev
222 * PR 35824: Added STC trickmodes
223 *
224 * Nexus_Devel/7   11/12/07 2:35p erickson
225 * PR35824: added NEXUS_Playback_GetStatus
226 *
227 * Nexus_Devel/6   10/17/07 5:37p vsilyaev
228 * PR 35824: Added trickmode test
229 *
230 * Nexus_Devel/5   10/15/07 2:55p vsilyaev
231 * PR 35824: Added synchronization thunk layer
232 *
233 * Nexus_Devel/4   10/12/07 5:44p vsilyaev
234 * PR 35824: Added more implementation for playback module
235 *
236 * Nexus_Devel/2   10/10/07 5:33p vsilyaev
237 * PR 35824: Added association with the audio/video decoders
238 *
239 * Nexus_Devel/1   10/10/07 4:54p vsilyaev
240 * PR 35824: Playback module
241 *
242 **************************************************************************/
243#ifndef NEXUS_PLAYBACK_H__
244#define NEXUS_PLAYBACK_H__
245
246#include "nexus_base_os.h"
247#include "nexus_file.h"
248#include "nexus_playpump.h"
249#include "nexus_video_decoder.h"
250#include "nexus_video_decoder_trick.h"
251#include "nexus_audio_decoder.h"
252#if NEXUS_HAS_SIMPLE_DECODER
253#include "nexus_simple_video_decoder.h"
254#include "nexus_simple_audio_decoder.h"
255#else
256typedef void *NEXUS_SimpleVideoDecoderHandle;
257typedef void *NEXUS_SimpleAudioDecoderHandle;
258#endif
259
260#ifdef __cplusplus
261extern "C" {
262#endif
263
264/**
265Summary:
266Handle for the Playback Interface.
267
268Description:
269The Playback Interface provides high-level PVR playback functionality.
270It integrates the data feeding (NEXUS_PlaypumpHandle) and decoder control (NEXUS_VideoDecoder and NEXUS_AudioDecoder).
271
272It provides a set of trick mode options using host, decoder and transport based control.
273
274It integrates file I/O using NEXUS_FileHandle.
275
276It integrates with NEXUS_RecordHandle for timeshifting and continuous record.
277**/
278typedef struct NEXUS_Playback *NEXUS_PlaybackHandle;
279
280/**
281Summary:
282NEXUS_PlaybackLoopMode is a value you tell the playback engine what action to take
283when end of file and begining of file is reached.
284
285Description:
286We implemented loopmode as a callback because the app may take different actions
287at different times and because the app might need to be notified when
288loops take place. This accomplishes both.
289**/
290typedef enum NEXUS_PlaybackLoopMode
291{
292    NEXUS_PlaybackLoopMode_eLoop,   /* Loop to the other end of the stream */
293    NEXUS_PlaybackLoopMode_ePause,  /* Pause the decode at the current spot */
294    NEXUS_PlaybackLoopMode_ePlay,   /* Resume normal play at the beginning or pause at the end. */
295    NEXUS_PlaybackLoopMode_eMax
296} NEXUS_PlaybackLoopMode;
297
298/**
299Summary:
300NEXUS_PlaybackErrorHandlingMode is a value you tell the playback engine what action to take
301when error detected when reading or processing playback data.
302
303**/
304typedef enum NEXUS_PlaybackErrorHandlingMode
305{
306    NEXUS_PlaybackErrorHandlingMode_eIgnore,        /* Ignore error and proceed further */
307    NEXUS_PlaybackErrorHandlingMode_eAbort,         /* When error detected pause decoders and abort playback, Application should call NEXUS_Playback_Stop,
308                                                       application may be able to restart depending on the nature of the error. */
309    NEXUS_PlaybackErrorHandlingMode_eEndOfStream,   /* When error treat it as was end of stream, it then would trigger endOfStreamAction/beginningOfStreamAction callbacks */
310    NEXUS_PlaybackErrorHandlingMode_eMax
311} NEXUS_PlaybackErrorHandlingMode;
312
313/*
314Summary:
315General settings for Playback
316*/
317typedef struct NEXUS_PlaybackSettings
318{
319    NEXUS_PlaypumpHandle playpump;              /* playpump that is used by playback engine to feed data to the decoders */
320    NEXUS_StcChannelHandle stcChannel;          /* stcChannel is required for playback with TSM. */
321    NEXUS_PlaypumpSettings playpumpSettings;    /* configuration for the playpump. Note that this will overwrite any call to NEXUS_Playpump_SetSettings that you make. */
322    NEXUS_PlaybackLoopMode endOfStreamAction;   /* action that shall be taken at the end of stream */
323    NEXUS_PlaybackLoopMode beginningOfStreamAction; /* action that shall be taken at the begining of stream */
324    NEXUS_PlaybackErrorHandlingMode playErrorHandling;  /* action should be taken when error encountered while playing stream, this mode is used in either normal or trick play. */
325    NEXUS_PlaybackErrorHandlingMode seekErrorHandling;  /* action should be taken when error encountered while executing NEXUS_Playback_Seek function */
326    NEXUS_PlaybackErrorHandlingMode trickErrorHandling;  /* action should be taken when error encountered while executing NEXUS_Playback_TrickMode or NEXUS_Playback_Play functions */
327    NEXUS_CallbackDesc endOfStreamCallback;
328    NEXUS_CallbackDesc beginningOfStreamCallback;
329    NEXUS_CallbackDesc errorCallback;            /* Called when an I/O error happens. Playback could be paused internally, depending on the value of playErrorHandling */
330    NEXUS_CallbackDesc parsingErrorCallback;     /* Callback called when error was detected in processing of index or data payloads */
331    bool startPaused;   /* Start playback in a paused state. NEXUS_Playback_Play should be called after NEXUS_Playback_Start. */
332    bool timeshifting;  /* Enable timeshifting, e.g. when playback is reached end of file, it shall wait for record to pump more into the file */
333
334    bool stcTrick; /* If true, STC trick modes will be used instead of decoder trick modes for forward trick modes.
335                      See NEXUS_StcChannel_SetRate for details on STC trick modes.
336                      Must be set before NEXUS_Playback_Start.
337                      See NEXUS_PlaybackTrickModeSettings.maxDecoderRate for an override based on decoder capabilities.
338                      This is only used of mode == NEXUS_PlaybackHostTrickMode_eNone. For other values of mode, 'rateControl' is used. */
339
340    bool accurateSeek; /* When to a new location, or when resuming normal play from a trick mode, an algorithm can be run which
341                          attempts to resume play at the exact frame. This involves decoding but not displaying pictures from the random access point (e.g. I frame)
342                          until a certain timestamp is reached.
343                          The downside to this algorithm is that for high bitrate streams, this seek time may be long.
344                          Also, for streams with bad PTS's, the desired resume location may never occur.
345                          This feature defaults off. */
346    bool enableStreamProcessing; /* enable use of extra stream processing, type of processing is depend on the stream type. For example some ES streams are converted to the PES streams for better navigation */
347    unsigned ioTimeout; /* timeout for asynchronous I/O, ms */
348    struct {
349        unsigned endOfStreamGap; /* milliseconds to gap between end of playback and record which will not cause decode stuttering */
350        unsigned beginningOfStreamGap; /* milliseconds to gap between beginning of playback and truncating record which will not cause excess beginningOfStream events */
351    } timeshiftingSettings;
352} NEXUS_PlaybackSettings;
353
354
355/**
356Summary:
357Setting used for custom control of host and decoder trick modes
358
359Description:
360Please note that NEXUS_PlaybackHostTrickMode is misnamed. It can apply to both host and decoder trick modes.
361
362See NEXUS_PlaybackTrickModeSettings for a full discussion.
363**/
364typedef enum NEXUS_PlaybackHostTrickMode
365{
366    NEXUS_PlaybackHostTrickMode_eNone,      /* Automatic control. See NEXUS_PlaybackTrickModeSettings for full discussion. */
367
368    /* the following enums provide variations of custom control */
369    NEXUS_PlaybackHostTrickMode_eNormal,    /* Normal host playback, but NEXUS_PlaybackTrickModeSettings.rate will be used as decoder rate control. */
370    NEXUS_PlaybackHostTrickMode_ePlayI,     /* I frame host or decoder trick mode (as determined by NEXUS_PlaybackSkipControl).
371                                               If skipControl == NEXUS_PlaybackSkipControl_eHost, the mode_modifier specifies the # of I frames to skip. */
372    NEXUS_PlaybackHostTrickMode_ePlaySkipB, /* Plays all I's, all P's and some B's. mode_modifier specifies the # of adjacent B's to play before a skip.
373                                               Only supported for NEXUS_PlaybackSkipControl_eHost. */
374    NEXUS_PlaybackHostTrickMode_ePlayIP,    /* Play all I's and P's (i.e. skips all B's) with with eHost or eDecoder control (as determined by NEXUS_PlaybackSkipControl).
375                                               mode_modifier is ignored. */
376    NEXUS_PlaybackHostTrickMode_ePlaySkipP, /* Plays all I's and some P's. mode_modifier specifies the # of P's per GOP to decode.
377                                               Only supported for NEXUS_PlaybackSkipControl_eHost. */
378    NEXUS_PlaybackHostTrickMode_ePlayBrcm,  /* BRCM trick mode. mode_modifier is the rate in integer units of frames (e.g. -1 is 1x rewind, 2x is 2x fast-forward). */
379    NEXUS_PlaybackHostTrickMode_ePlayGop,   /* DQT/GOP trick mode. mode_modifier has three parts:
380                                                 mode_modifier % 100 is the number of frames per GOP to send to the decoder.
381                                                 mode_modifier / 100 is the number of GOPs to skip.
382                                                 the sign is the direction: negative is reverse, positive is forward. */
383    NEXUS_PlaybackHostTrickMode_eTimeSkip,  /* Host trick mode that attempts to give a constant trick mode rate by adapting to GOP size changes.
384                                               mode_modifier is the number of milliseconds between pictures that bcmplayer should try to output. */
385    NEXUS_PlaybackHostTrickMode_eMax
386} NEXUS_PlaybackHostTrickMode;
387
388/*
389Summary:
390Determines how NEXUS_PlaybackTrickModeSettings.rate is applied if mode != eNone
391*/
392typedef enum NEXUS_PlaybackRateControl
393{
394    NEXUS_PlaybackRateControl_eStream,  /* NEXUS_PlaybackTrickModeSettings.rate sets the STC trick rate. TSM is required.
395                                           As of now, this must be positive because HW STC only runs forward. */
396    NEXUS_PlaybackRateControl_eDecoder, /* NEXUS_PlaybackTrickModeSettings.rate sets the decoder rate. TSM is not used.
397                                           In this mode, 'rate' has two parts: the sign and the absolute value.
398                                           The sign determines forward/reverse direction and can be positive or negative.
399                                           The absolute value determines slow motion based on abs(rate)/NEXUS_NORMAL_PLAY_SPEED.
400                                           abs(rate) > NEXUS_NORMAL_PLAY_SPEED is not currently supported. */
401    NEXUS_PlaybackRateControl_eMax
402} NEXUS_PlaybackRateControl;
403
404/*
405Summary:
406Determines how frames are skipped if mode != eNone
407*/
408typedef enum NEXUS_PlaybackSkipControl
409{
410    NEXUS_PlaybackSkipControl_eHost,    /* host skips pictures. all values of NEXUS_PlaybackHostTrickMode supported. */
411    NEXUS_PlaybackSkipControl_eDecoder, /* decoder skips pictures. only eI and eIP modes supported. mode_modifer is unused. */
412    NEXUS_PlaybackSkipControl_eMax
413} NEXUS_PlaybackSkipControl;
414
415/*
416Summary:
417All parameters needed to specify a trick mode.
418
419Description:
420Playback will select from a variety of trick mode capabilities in order to achieve the rate. This could include
421host trick modes, PTS remapping, decode skip modes, STC trick modes, etc.
422
423Nexus exposes trick play in two modes: automatic and custom.
4241) In automatic mode, you simply set 'rate'. 'mode' must be left as the default value of eNone.
425    mode_modifier, rateControl and skipControl are unused.
4262) In custom mode, you set 'mode' to something other than eNone, then rate, mode_modifier, rateControl and skipControl are used.
427    NEXUS_PlaybackSettings.stcTrick is unused.
428
429In both automatic and custom mode, direction is determined by the sign of 'rate'.
430
431In custom mode, the sign of 'rate' must match the sign of 'mode_modifier'. For instance, if mode = eI and mode_modifier = -1, then the host
432is doing a reverse I-frame trick; therefore, if you want to add a 2x decoder slow motion, you must set rateControl = eDecoder
433and rate = -2*NEXUS_NORMAL_PLAY_SPEED.
434This is required because rate controls the display rate, which is independent of the host skip control.
435For instance, if rateControl = eStream, then an STC trick can be applied on top of a host or decoder skip mode.
436
437Some types of trick modes are very limited because of either hardware or codec limitations.
438For instance, using STC, decoder and host trick modes, a wide range of forward speeds and types are possible.
439However, only a small set of actual reverse speeds are possible and only with host trick modes.
440*/
441typedef struct NEXUS_PlaybackTrickModeSettings
442{
443    int rate; /* trick mode rate defined in NEXUS_NORMAL_PLAY_SPEED units.
444                   For NEXUS_PlaybackHostTrickMode_eNone, rate specifies the overall rate of the trick mode. Some examples are:
445
446                       NEXUS_NORMAL_PLAY_SPEED    = normal playback
447                       0                          = pause
448                       NEXUS_NORMAL_PLAY_SPEED/2  = 0.5x slow motion forward
449                       NEXUS_NORMAL_PLAY_SPEED*2  = 2x fast forward
450                       NEXUS_NORMAL_PLAY_SPEED*-1 = 1x rewind
451                       NEXUS_NORMAL_PLAY_SPEED*-7 = 7x rewind
452
453                   For other values of 'mode', the meaning of rate depends on rateControl and its value is factored in
454                   as only one part of the trick mode. */
455
456    /* custom trick mode control (only applies if 'mode' is other than eNone) */
457    NEXUS_PlaybackHostTrickMode mode; /* allows direct control of trick mode */
458    int mode_modifier; /* modifier of mode if skipControl = eHost. see NEXUS_PlaybackHostTrickMode for specific meanings.
459                          if skipControl = eDecoder, it must be left to default. */
460    NEXUS_PlaybackRateControl rateControl; /* sets the meaning of rate */
461    NEXUS_PlaybackSkipControl skipControl; /* selects whether specific NEXUS_PlaybackHostTrickMode modes will apply to decoder or host. */
462
463    /* general capabilities. these apply for all values of 'mode' */
464    unsigned maxDecoderRate; /* Maximum fast-forward playback rate supported by the decoder. Defined in NEXUS_NORMAL_PLAY_SPEED units.
465                                For forward rates up to and including this rate, Nexus will feed the entire stream to the decoders and then use either STC trick modes
466                                or host paced trickmode to achieve target rate.
467                                However, decoder bandwidth may prevent the system from achieving the desired rate.
468                                The maximum rate varies based on hardware capabilities, stream encoding and MEMC RTS settings.
469                                Because of this, the application can tell Playback exactly what rate it knows is achievable. For any trick mode about the maxDecoderRate,
470                                Nexus will use host-based trick modes to reduce the decoder bandwidth requirements.
471                                Also, if you want to use STC pause and not STC fast-forward, you can set maxDecoderRate = NEXUS_NORMAL_PLAY_SPEED. */
472
473    bool avoidFlush;     /* When making decoder trick mode transitions, it is not required that the pipeline be flushed.
474                            If there is a flush, the current position will be reset to the nearest random access point and the trick mode will be seen immediately.
475                            If there is no flush, the current position will not change, but the new trick mode will be delayed as the already-decoded pictures are fed out.
476                            Set avoidFlush = true to get the latter behavior.
477                            Any trick mode transition that changes the byte stream and could macroblock will always have a flush. */
478    bool brcmTrickMode; /* use broadcom trick modes for certain rates. set to false to avoid using brcm trick modes. */
479} NEXUS_PlaybackTrickModeSettings;
480
481/**
482Summary:
483State of Playback returned by NEXUS_Playback_GetStatus.
484**/
485typedef enum NEXUS_PlaybackState
486{
487    NEXUS_PlaybackState_eStopped,       /* Either never started or has been stopped. */
488    NEXUS_PlaybackState_ePlaying,       /* Normal playback */
489    NEXUS_PlaybackState_ePaused,        /* Decode is paused but can be resumed. */
490    NEXUS_PlaybackState_eTrickMode,     /* Some variety of trick mode in progress. */
491    NEXUS_PlaybackState_eAborted,       /* Aborted due to an internal error. App must stop and restart to continue playback. */
492    NEXUS_PlaybackState_eMax
493} NEXUS_PlaybackState;
494
495/**
496Summary:
497playback position in milliseconds
498**/
499typedef unsigned long NEXUS_PlaybackPosition;
500
501/**
502Summary:
503Mode used in NEXUS_PlaybackStartSettings
504**/
505typedef enum NEXUS_PlaybackMode
506{
507    NEXUS_PlaybackMode_eIndexed, /* use index to decode a stream */
508    NEXUS_PlaybackMode_eFixedBitrate, /* don't use index. for navigation use fixed bitrate provided with NEXUS_PlaybackStartSettings.bitrate */
509    NEXUS_PlaybackMode_eAutoBitrate, /* don't use index. for navigation use auto-detected bitrate in the stream. NEXUS_PlaybackStartSettings.bitrate is used as a hint */
510    NEXUS_PlaybackMode_eMax
511} NEXUS_PlaybackMode;
512
513/**
514Summary:
515Index file I/O mode used in NEXUS_PlaybackStartSettings
516
517Description:
518The nexus playback modules has some amount of synchronous file I/O originated from its internal execution
519environment, usually it completes reasonably fast, however there are cases where even small amount of I/O could cause large latencies.
520
521This enum gives options on internal execution context.
522**/
523typedef enum NEXUS_PlaybackIndexFileIo
524{
525    NEXUS_PlaybackIndexFileIo_eCallback, /* handle it directly in the callback */
526    NEXUS_PlaybackIndexFileIo_eModule,  /* switch from the callback to this module's context */
527    NEXUS_PlaybackIndexFileIo_eThread,  /* switch from the callback to a dedicated thread */
528    NEXUS_PlaybackIndexFileIo_eMax
529} NEXUS_PlaybackIndexFileIo;
530
531/**
532Summary:
533Selects type of the index when playing MPEG-2 TS file
534**/
535typedef enum NEXUS_PlaybackMpeg2TsIndexType
536{
537    NEXUS_PlaybackMpeg2TsIndexType_eAutoDetect, /* detect index file type based on the index content*/
538    NEXUS_PlaybackMpeg2TsIndexType_eNav,
539    NEXUS_PlaybackMpeg2TsIndexType_eSelf,       /* MPEG-2 TS file used as an index */
540    NEXUS_PlaybackMpeg2TsIndexType_eMax
541} NEXUS_PlaybackMpeg2TsIndexType;
542
543/**
544Summary:
545Structure used in NEXUS_Playback_Start
546**/
547typedef struct NEXUS_PlaybackStartSettings
548{
549    NEXUS_PlaybackMode mode; /* playback mode */
550    unsigned bitrate; /* stream bitrate, in bits per second. see NEXUS_PlaybackMode for options. */
551    NEXUS_PlaybackMpeg2TsIndexType mpeg2TsIndexType;
552    struct {
553        NEXUS_PlaybackIndexFileIo mode; /* control what context is used for index file I/O */
554        NEXUS_ThreadSettings threadSettings; /* if indexFileIo.mode == NEXUS_PlaybackIndexFileIo_eThread, this settings are used to spawn thread */
555    } indexFileIo;
556} NEXUS_PlaybackStartSettings;
557
558
559/*
560Summary:
561Create a new playback instance.
562*/
563NEXUS_PlaybackHandle NEXUS_Playback_Create(void);
564
565/*
566Summary:
567Destroy a playback instance.
568*/
569void NEXUS_Playback_Destroy(
570    NEXUS_PlaybackHandle playback
571    );
572
573/*
574Summary:
575Get default settings
576*/
577void NEXUS_Playback_GetDefaultStartSettings(
578    NEXUS_PlaybackStartSettings *pSettings /* [out] */
579    );
580
581/*
582Summary:
583Start playback.
584
585Description:
586If NEXUS_PlaybackSettings.startPaused is true, data flow through the media framework and into transport hardware does not begin
587until NEXUS_Playback_Play is called.
588
589For NEXUS_TransportTypes which use media framework, it's important that all PidChannels are opened before NEXUS_Playback_Start is called.
590*/
591NEXUS_Error NEXUS_Playback_Start(
592    NEXUS_PlaybackHandle playback,
593    NEXUS_FilePlayHandle file,
594    const NEXUS_PlaybackStartSettings *pSettings
595    );
596
597/*
598Summary:
599Stop playback.
600*/
601void NEXUS_Playback_Stop(
602    NEXUS_PlaybackHandle playback
603    );
604
605/*
606Summary:
607Status returned by NEXUS_Playback_GetStatus
608*/
609typedef struct NEXUS_PlaybackStatus
610{
611    NEXUS_PlaybackPosition position;          /* current timestamp of stream played, time in mSec */
612    NEXUS_PlaybackState state;          /* Current state of playback */
613    NEXUS_PlaybackTrickModeSettings trickModeSettings; /* Current trick mode settings */
614    unsigned fifoDepth;                 /* Depth in bytes of the playback buffer */
615    unsigned fifoSize;                  /* Size in bytes of the playback buffer */
616    uint64_t bytesPlayed;               /* Total number of bytes played since starting */
617    NEXUS_PlaybackPosition first;            /* first timestamp of stream played, time in mSec */
618    NEXUS_PlaybackPosition last;             /* last timestamp of stream played time in mSec */
619    unsigned indexErrors;               /* count of error discovered when parsing index */
620    unsigned dataErrors;                /* count of errors discovered when processing data payloads*/
621    NEXUS_PlaybackPosition readPosition;  /* current read position of the stream played, time in mSec */
622} NEXUS_PlaybackStatus;
623
624/*
625Summary:
626Get current status
627*/
628NEXUS_Error NEXUS_Playback_GetStatus(
629    NEXUS_PlaybackHandle playback,
630    NEXUS_PlaybackStatus *pStatus /* [out] */
631    );
632
633/*
634Summary:
635Pause playback after it has started.
636
637Description:
638It can only be called after playback has started.
639*/
640NEXUS_Error NEXUS_Playback_Pause(
641    NEXUS_PlaybackHandle playback
642    );
643
644/*
645Summary:
646Resume normal playback from pause or trick mode.
647
648Description:
649It can only be called after playback has been started.
650*/
651NEXUS_Error NEXUS_Playback_Play(
652    NEXUS_PlaybackHandle playback
653    );
654
655/*
656Summary:
657If you are paused, this will advance or reverse one frame.
658
659Description:
660It can only be called after playback has been started.
661*/
662NEXUS_Error NEXUS_Playback_FrameAdvance(
663    NEXUS_PlaybackHandle playback,
664    bool forward                        /* is it forward? otherwise, reverse. */
665    );
666
667/*
668Summary:
669Set a trick mode, either fast or slow, forward or reverse.
670
671Description:
672It can only be called after playback has started.
673*/
674NEXUS_Error NEXUS_Playback_TrickMode(
675    NEXUS_PlaybackHandle playback,
676    const NEXUS_PlaybackTrickModeSettings *pTrickModeSettings
677    );
678
679/**
680Summary:
681Get default settings for the structure.
682
683Description:
684This is required in order to make application code resilient to the addition of new structure members in the future.
685**/
686void NEXUS_Playback_GetDefaultTrickModeSettings(
687    NEXUS_PlaybackTrickModeSettings *pTrickModeSettings
688    );
689
690/**
691The following names are deprecated.
692**/
693#define NEXUS_Playback_GetDefaultTrickmodeSettings NEXUS_Playback_GetDefaultTrickModeSettings
694#define NEXUS_Playback_Trickmode NEXUS_Playback_TrickMode
695#define NEXUS_PlaybackState_eTrickmode NEXUS_PlaybackState_eTrickMode
696
697/**
698Summary:
699For use in the NEXUS_PlaybackTrickModeSettings.rate parameter
700
701Description:
702The value of this macro may change in the future and should not affect any application if relative values are used.
703**/
704#define NEXUS_NORMAL_PLAY_SPEED 1000
705
706/**
707Summary:
708Settings used in NEXUS_Playback_OpenPidChannel
709
710Description:
711When giving the audio or video decoder to playback, the app must not call API's the Playback is calling.
712If the app does, the collision will result in undefined behavior.
713
714Playback consumes all functions in nexus_video_decoder_trick.h and nexus_audio_decoder_trick.h.
715Playback also consumes NEXUS_VideoDecoder_SetStartPts if accurateSeek is enabled.
716
717The application should still call functions in nexus_video_decoder.h and nexus_audio_decoder.h.
718This includes functions like Start, Stop. Playback will not call them.
719**/
720typedef struct NEXUS_PlaybackPidChannelSettings
721{
722    NEXUS_PlaypumpOpenPidChannelSettings pidSettings;
723    union
724    {
725        struct
726        {
727            NEXUS_VideoDecoderHandle decoder; /* see above for API implications */
728            NEXUS_SimpleVideoDecoderHandle simpleDecoder; /* alternative to 'decoder' */
729            NEXUS_VideoCodec codec;
730            bool index;                  /* use index for this video pid. */
731        } video; /* settings for pidSettings.pidType == NEXUS_PidType_eVideo */
732        struct
733        {
734            NEXUS_AudioDecoderHandle primary;  /* see above for API implications */
735            NEXUS_AudioDecoderHandle secondary;  /* see above for API implications */
736            NEXUS_SimpleAudioDecoderHandle simpleDecoder; /* alternative to 'primary' and 'secondary' */
737        } audio; /* settings for pidSettings.pidType == NEXUS_PidType_eAudio */
738    } pidTypeSettings;
739} NEXUS_PlaybackPidChannelSettings;
740
741/**
742Summary:
743Seek to a new location in the stream
744
745Description:
746You cannot call NEXUS_Playback_Seek until after NEXUS_Playback_Start has been called.
747Playback does not have any file information until started, therefore no seek is possible.
748If you want to start from a location other than the beginning, do the following steps:
7491) call NEXUS_Playback_SetSettings with NEXUS_PlaybackSettings.startPaused = true
7502) call NEXUS_Playback_Start
7513) call NEXUS_Playback_Seek
7524) call NEXUS_Playback_Play
753**/
754NEXUS_Error NEXUS_Playback_Seek(
755    NEXUS_PlaybackHandle playback,
756    NEXUS_PlaybackPosition position /* new position */
757    );
758
759/**
760Summary:
761Get default settings for the structure.
762
763Description:
764This is required in order to make application code resilient to the addition of new structure members in the future.
765**/
766void NEXUS_Playback_GetDefaultPidChannelSettings(
767    NEXUS_PlaybackPidChannelSettings *pSettings /* [out] */
768    );
769
770/**
771Summary:
772NEXUS_Playback_OpenPidChannel can be called before or after Start and Stop.
773However, some transport types which use the media framework require that all pids be opened before Start.
774**/
775NEXUS_PidChannelHandle NEXUS_Playback_OpenPidChannel(
776    NEXUS_PlaybackHandle playback,
777    unsigned pid,
778    const NEXUS_PlaybackPidChannelSettings *pSettings /* attr{null_allowed=y} */
779    );
780
781/**
782Summary:
783NEXUS_Playback_GetPidChannelSettings is used to get current configuration for the pidChannel opened with NEXUS_Playback_OpenPidChannel
784
785Description:
786This function can fail if the pidChannel does not belong to this Playback.
787**/
788NEXUS_Error NEXUS_Playback_GetPidChannelSettings(
789    NEXUS_PlaybackHandle playback,
790    NEXUS_PidChannelHandle pidChannel,
791    NEXUS_PlaybackPidChannelSettings *pSettings /* [out] */
792    );
793
794/**
795Summary:
796NEXUS_Playback_SetPidChannelSettings is used to change current configuration for the pidChannel opened with NEXUS_Playback_OpenPidChannel
797
798Description:
799Main purpose of the NEXUS_Playback_SetPidChannelSettings is to change decoder assigment.
800**/
801NEXUS_Error NEXUS_Playback_SetPidChannelSettings(
802    NEXUS_PlaybackHandle playback,
803    NEXUS_PidChannelHandle pidChannel,
804    const NEXUS_PlaybackPidChannelSettings *pSettings
805    );
806
807/**
808Summary:
809Closes a pid channel opened by NEXUS_Playback_OpenPidChannel
810**/
811void NEXUS_Playback_ClosePidChannel(
812    NEXUS_PlaybackHandle playback,
813    NEXUS_PidChannelHandle pidChannel
814    );
815
816/**
817Summary:
818Close all pid channels opened by NEXUS_Playback_OpenPidChannel
819**/
820void NEXUS_Playback_CloseAllPidChannels(
821    NEXUS_PlaybackHandle playback
822    );
823
824/**
825Summary:
826Returns current configuration of playback
827**/
828void NEXUS_Playback_GetSettings(
829    NEXUS_PlaybackHandle playback,
830    NEXUS_PlaybackSettings *pSettings /* [out] */
831    );
832
833/**
834Summary:
835Get default settings for the structure.
836
837Description:
838This is required in order to make application code resilient to the addition of new structure members in the future.
839**/
840void NEXUS_Playback_GetDefaultSettings(
841    NEXUS_PlaybackSettings *pSettings /* [out] */
842    );
843
844/**
845Summary:
846Changes configuration of playback.
847
848Description:
849Some configuration (namely, playpump and playpumpSettings) can not be changed
850unless playback is stopped and all pids are closed.
851**/
852
853NEXUS_Error NEXUS_Playback_SetSettings(
854    NEXUS_PlaybackHandle playback,
855    const NEXUS_PlaybackSettings *pSettings
856    );
857
858#ifdef __cplusplus
859}
860#endif
861
862#endif /* NEXUS_PLAYBACK_H__ */
863
Note: See TracBrowser for help on using the repository browser.