source: svn/newcon3bcm2_21bu/nexus/lib/playback_ip/apps/ip_streamer.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: 22.8 KB
Line 
1/******************************************************************************
2 *    (c)2008-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: ip_streamer.h $
39 * $brcm_Revision: 46 $
40 * $brcm_Date: 12/19/11 12:56a $
41 *
42 * Module Description:
43 *  ip streamer include file
44 *
45 * Revision History:
46 *
47 * $brcm_Log: /nexus/lib/playback_ip/apps/ip_streamer.h $
48 *
49 * 46   12/19/11 12:56a ssood
50 * SW7231-516: raaga encoding support: added changes to support running
51 *  raaga based xcode alongside the local decode on BMC
52 *
53 * 45   12/8/11 7:40p ssood
54 * SW7231-516: enhance ip_streamer to stream out raaga encoded TS streams
55 *  from live or file sources
56 *
57 * 44   10/18/11 7:25a ssood
58 * SW7425-889: enabled audio in the live xcoded streams for streaming to
59 *  iOS devices
60 *
61 * 43   10/14/11 10:18a ssood
62 * SW7425-889: initial check-in for enabling audio in the live xcoded
63 *  streams
64 *
65 * 42   9/26/11 10:22a ssood
66 * SW7346-341: Add PVR Decryption support for file streaming
67 *
68 * 41   8/27/11 7:37p ssood
69 * SW7425-1077: lowered the number of recpumps for streaming to allow 4
70 *  FCC clients on VMS
71 *
72 * 40   8/5/11 3:13p ssood
73 * SW7425-1040: add fast channel change support to IP Sessions
74 *
75 * 39   7/15/11 2:13p ssood
76 * SW7346-309: move MAX_PROGRAMS_PER_FREQUENCY out of LIVE_STREAMING flag
77 *
78 * 38   7/14/11 12:01p ssood
79 * SW7346-309: Add support for Streaming from Satellite Source
80 *
81 * 37   6/18/11 11:52a ssood
82 * SW7425-718: 3128 related changes: use different frontend resources for
83 *  each streaming session even though it is same channel
84 *
85 * 36   4/29/11 2:10p ssood
86 * SW7425-175: more changes to handle stop/start condition on xcoded
87 *  sessions
88 *
89 * 35   3/18/11 6:44p ssood
90 * SW7420-1616: allow app to pass-in dma handle
91 *
92 * 34   3/16/11 4:55p ssood
93 * SW7420-1616: initial check-in for pvr encryption support
94 *
95 * 33   2/17/11 6:24p ssood
96 * SW7425-59: initial check-in for audio passthru support for transcoded
97 *  channels
98 *
99 * 32   1/20/11 3:28p ssood
100 * SW7425-59: switch decode to live mode in xcode path + all ces related
101 *  changes + support for 2nd xcode client
102 *
103 * 31   12/31/10 3:25p ssood
104 * SW7425-59: add change to support clean stop/stop sequence w/ 7425
105 *  xcoder + insert PAT/PMT into outgoing stream
106 *
107 * 30   12/30/10 1:06p ssood
108 * SW7425-59: surround all 7425 transcoder changes w/
109 *  NEXUS_HAS_VIDEO_ENCODER compile flag
110 *
111 * 29   12/30/10 12:55p ssood
112 * SW7425-59: initial 7425 transcoder support on h/w platform (no PSI, no
113 *  PCRs, no Audio in xcoded stream)
114 *
115 * 28   12/28/10 12:28p ssood
116 * SW7425-59: Add support for using HDMI-in as the source for
117 *  transcoding+streaming out
118 *
119 * 27   12/26/10 10:45p ssood
120 * SW7425-59: Add support for 7425 transcoder
121 *
122 * 26   9/2/10 3:11p garetht
123 * SW7420-1046: Add support for sending 6xQAM256 streams to the cablecard
124 *
125 * 25   8/12/10 11:28a ssood
126 * SW7420-883: fixed compiler error for non-transcode case
127 *
128 * 24   8/12/10 11:24a ssood
129 * SW7420-883: added support for streaming same transcoding session to
130 *  multiple clients
131 *
132 * 23   7/27/10 2:08p ssood
133 * SW7420-883: add transcoding support to IP Streamer (no audio
134 *  transcoding yet)
135 *
136 * 22   1/27/10 10:18a ssood
137 * SW7420-454: conditionally compile Live Streaming Code using
138 *  LIVE_STREAMING_SUPPORT
139 *
140 * 21   1/14/10 6:41p ssood
141 * SW7408-47: Add support to compile IP Streamer App on platforms w/ no
142 *  frontend support
143 *
144 * 20   12/22/09 11:03a ssood
145 * SW7420-454: add timeshift support for live streaming
146 *
147 * 19   12/15/09 9:38a ssood
148 * SW7420-454: Add support to share a parser band among clients using same
149 *  frequency & channel numbers
150 *
151 * 18   11/20/09 1:35p jrubio
152 * SW7335-537: change number of recpumps
153 *
154 * 17   11/17/09 2:58p ssood
155 * SW7420-454: Enhance IP Streamer to stream files from local disk
156 *
157 * 16   11/2/09 3:56p ssood
158 * SW7420-340: add support for recording a live stream
159 *
160 * 15   10/20/09 6:33p ssood
161 * SW7420-340: remove nexus playback, audio, video decoder dependencies
162 *  for SMS compilation
163 *
164 * 14   10/11/09 8:52p ssood
165 * SW7420-340: added support to bind ip_streamer to a particular network
166 *  interface
167 *
168 * 13   10/10/09 10:49p ssood
169 * SW7420-340: Changes to allow non-Broadcom DLNA clients play live
170 *  content
171 *
172 * 12   10/9/09 12:29p ssood
173 * SW7420-340: add support to play live streams on non-Broadcom clients
174 *
175 * 11   10/7/09 3:46p ssood
176 * SW7420-340: added STANDL
177 *
178 * 10   10/6/09 12:18p ssood
179 * SW7420-340: Add DTCP/IP support to ip_streamer & IP Applib
180 *
181 * 9   10/2/09 5:08p ssood
182 * SW7420-340: Adapt number of resources as per # of video decoders needed
183 *  for SMS/VMS differentiation
184 *
185 * 8   10/2/09 4:12p ssood
186 * SW7420-340: add logic to recover from buffer overflow condition (caused
187 *  by client backing up)
188 *
189 * 7   10/2/09 11:54a ssood
190 * SW7420-340: increased the max programs per channels to 24
191 *
192 * 6   9/29/09 11:01p ssood
193 * SW7420-340: return error to client if PSI acquisition fails + wait for
194 *  signal lock
195 *
196 * 5   9/25/09 6:31p ismailk
197 * SW7405-3080: Add a field for the serverIp addr in the
198 *  IpStreamerGlobalCfg structure.
199 *
200 * 4   9/25/09 5:15p ssood
201 * SW7420-340: Add support for VSB frontend
202 *
203 * 3   9/17/09 2:25p ssood
204 * SW7420-340: include nexus files pertaining to ip streaming only
205 *
206 * 2   9/16/09 2:33p ssood
207 * SW7420-340: print debug stats
208 *
209 * 1   9/16/09 10:50a ssood
210 * SW7420-340: Adding example apps for demonstrating IP Streaming & Client
211 *  features of IP Applib
212 *
213 ******************************************************************************/
214#ifndef __IP_STREAMER_H__
215#define __IP_STREAMER_H__
216
217#include <stdio.h>
218#include "bstd.h"
219#include "bkni.h"
220#include "bkni_multi.h"
221#include "nexus_file_fifo.h"
222
223#ifdef NEXUS_HAS_7043_TRANSCODER
224#include "nexus_transcoder.h"
225#endif
226
227#ifdef NEXUS_HAS_VIDEO_ENCODER
228#include "b_os_lib.h"
229#include "nexus_video_encoder.h"
230#include "nexus_audio_encoder.h"
231#endif
232#if NEXUS_HAS_STREAM_MUX
233#include "nexus_stream_mux.h"
234#endif
235
236#if NEXUS_HAS_HDMI_INPUT
237#include "nexus_hdmi_input.h"
238#endif
239
240/* TODO: confirm what jitter we can have on DoCSYS/IP Path */
241#define DOCSIS_IP_NETWORK_JITTER 100
242#define IP_STREAMER_DEFAULT_SERVER_PORT 5000
243#define IP_STREAMER_DEFAULT_DTCP_IP_PORT 8000
244
245/* Max Number of concurrent sessions that need to be supported for a platform */
246#define IP_STREAMER_MAX_THREADS 8
247
248/* set only when no local decoding needs to be performed */
249#ifdef B_RUN_STANDALONE
250#undef NEXUS_NUM_VIDEO_DECODERS
251#define NEXUS_NUM_VIDEO_DECODERS 0
252#endif
253
254/* Resource allocation for SMS/VMS Platforms: tied to # of Video Decoders */
255#ifdef NEXUS_HAS_VIDEO_ENCODER
256/* For transcoding case, we need to reserve atleast one decoder and thus max of two video decoders are reserved for main/pip windows */
257#define IP_STREAMER_NUM_VIDEO_DECODERS_RESERVED_FOR_LOCAL_DECODE 2
258#else
259#define IP_STREAMER_NUM_VIDEO_DECODERS_RESERVED_FOR_LOCAL_DECODE NEXUS_NUM_VIDEO_DECODERS
260#endif
261
262/* # of playback channels reserved for receiving Live IP content directly on the local client (from IP headend): 2 per decoder inorder to support Timeshifting case */
263#ifdef NEXUS_HAS_VIDEO_ENCODER
264/* for transcoding, 3 additional playback channels are reserved to allow mux to feed Audio, Video, and System data into playback for muxing purpose */
265#define IP_STREAMER_NUM_PLAYPUMPS_RESERVED_FOR_LOCAL_DECODE (IP_STREAMER_NUM_VIDEO_DECODERS_RESERVED_FOR_LOCAL_DECODE*2 + 3*NEXUS_NUM_VIDEO_ENCODERS)
266#else
267#define IP_STREAMER_NUM_PLAYPUMPS_RESERVED_FOR_LOCAL_DECODE (IP_STREAMER_NUM_VIDEO_DECODERS_RESERVED_FOR_LOCAL_DECODE*2)
268#endif
269/* keep half reserved for local decode & recording purposes and other half for streaming purposes */
270#define IP_STREAMER_NUM_RECPUMPS_RESERVED_FOR_LOCAL_DECODE (NEXUS_NUM_RECPUMPS/2 + 2) /* adding two more for local to allow 4 Primers for Fast Channel Change */
271/* one parser band each for main & pip */
272#define IP_STREAMER_NUM_PARSER_BANDS_RESERVED_FOR_LOCAL_DECODE IP_STREAMER_NUM_VIDEO_DECODERS_RESERVED_FOR_LOCAL_DECODE
273
274#ifdef B_HAS_VMS_GATEWAY
275/* For VMS, IP Streamer controls all the frontends, local decode App (BMC) uses IP to talk w/ DMS & thus doesn't need Frontends */
276#define IP_STREAMER_NUM_FRONTENDS_RESERVED_FOR_LOCAL_DECODE 0
277#else
278#define IP_STREAMER_NUM_FRONTENDS_RESERVED_FOR_LOCAL_DECODE IP_STREAMER_NUM_VIDEO_DECODERS_RESERVED_FOR_LOCAL_DECODE
279#endif
280
281#ifdef STREAMER_CABLECARD_SUPPORT
282#define IP_STREAMER_NUM_PLAYPUMPS_RESERVED_FOR_MPOD 2
283#define IP_STREAMER_NUM_RECPUMPS_RESERVED_FOR_MPOD 2
284#else
285#define IP_STREAMER_NUM_PLAYPUMPS_RESERVED_FOR_MPOD 0
286#define IP_STREAMER_NUM_RECPUMPS_RESERVED_FOR_MPOD 0
287#endif
288
289/* Max Number of IP Frontends for a platforms (1 per HW playback channel, aka Nexus Playpump channel) */
290#define IP_STREAMER_NUM_PLAYPUMPS ((NEXUS_NUM_PLAYPUMPS - IP_STREAMER_NUM_PLAYPUMPS_RESERVED_FOR_LOCAL_DECODE) - IP_STREAMER_NUM_PLAYPUMPS_RESERVED_FOR_MPOD)
291/* recording sessions over IP */
292#define IP_STREAMER_NUM_RECPUMPS_FOR_RECORD (2)
293#define IP_STREAMER_NUM_RECPUMPS_FOR_STREAMING (NEXUS_NUM_RECPUMPS - IP_STREAMER_NUM_RECPUMPS_RESERVED_FOR_LOCAL_DECODE - IP_STREAMER_NUM_RECPUMPS_RESERVED_FOR_MPOD - IP_STREAMER_NUM_RECPUMPS_FOR_RECORD)
294#define IP_STREAMER_NUM_PARSER_BANDS (NEXUS_NUM_PARSER_BANDS - IP_STREAMER_NUM_PARSER_BANDS_RESERVED_FOR_LOCAL_DECODE)
295/* Max Number of Frontends for a platform */
296#define IP_STREAMER_NUM_FRONTENDS NEXUS_MAX_FRONTENDS
297
298#ifdef NEXUS_HAS_VIDEO_ENCODER
299typedef struct TranscoderDst {
300    /* nexus resources needed to setup the decode and re-encode pipe */
301    NEXUS_Timebase timebase;
302    int displayIndex; /* compositor to connect to the video encoder */
303    int playpumpVideoIndex;
304    int playpumpAudioIndex;
305    int playpumpSystemDataIndex;
306    NEXUS_StcChannelHandle decodeStcChannel;
307    NEXUS_StcChannelHandle encodeStcChannel;
308    NEXUS_VideoDecoderHandle videoDecoder;
309    NEXUS_AudioDecoderHandle audioDecoder;
310    NEXUS_DisplayHandle displayTranscode;
311    NEXUS_VideoWindowHandle windowTranscode;
312    NEXUS_DisplayHandle displayMain;
313    NEXUS_VideoWindowHandle windowMain;
314
315    NEXUS_VideoEncoderHandle videoEncoder;
316    NEXUS_StreamMuxHandle streamMux;
317    NEXUS_AudioMuxOutputHandle audioMuxOutput;
318    NEXUS_AudioEncoderHandle audioEncoder;
319    NEXUS_PlaypumpHandle playpumpTranscodeVideo;
320    NEXUS_PlaypumpHandle playpumpTranscodeAudio;
321    NEXUS_PlaypumpHandle playpumpTranscodeSystemData;
322
323    NEXUS_PidChannelHandle transcodeVideoPidChannelCopy;
324    NEXUS_PidChannelHandle transcodeAudioPidChannelCopy;
325
326/* multi buffer to allow the background PSI packet to update CC while foreground one is waiting for TS mux pacing */
327#define IP_STREAMER_PSI_QUEUE_CNT 4 /* every second insert a PSI, so it takes 4 secs to circle; hopefully its transfer won't be delay that far */
328    void *pat[IP_STREAMER_PSI_QUEUE_CNT];
329    void *pmt[IP_STREAMER_PSI_QUEUE_CNT];
330    unsigned ccValue;
331        B_MutexHandle mutexSystemData;
332        B_SchedulerHandle schedulerSystemData;
333        B_SchedulerTimerId systemDataTimer;
334        B_ThreadHandle schedulerThread;
335        bool systemDataTimerIsStarted;
336    NEXUS_StreamMuxSystemData psi[2];
337    BKNI_EventHandle finishEvent;  /* set when Finished callback is received from Mux mgr */
338    bool inUse;
339    int refCount;
340    bool started; /* set when transcoding is started on this context */
341    int contextId; /* transcoder context id */
342} TranscoderDst; 
343#endif /* NEXUS_HAS_VIDEO_ENCODER */
344
345#define MAX_PROGRAMS_PER_FREQUENCY 24
346#if B_HAS_LIVE_STREAMING
347typedef struct QamSrc {
348    NEXUS_FrontendHandle frontendHandle;
349    int frequency;
350    int refCount;   /* how many streaming sessions are using this frontend */
351    B_PlaybackIpPsiInfo psi[MAX_PROGRAMS_PER_FREQUENCY];
352    int numProgramsFound; /* how many sub-channels are found in this frequency */
353    bool psiAcquiring; /* set if PSI info is been acquired */
354    bool skipFrontendTuning; /* set if frontend tuner is already setup during PSI discovery */
355    BKNI_EventHandle psiAcquiredEvent;  /* set when PSI aquisition is completed */
356    BKNI_EventHandle signalLockedEvent;  /* set when tuner locks in to the frequency */
357    bool started; /* set when Src is started */
358    BKNI_MutexHandle lock;  /* lock to synchronize simultaneous access to one src when it shared between multiple clients */
359#ifdef NEXUS_HAS_VIDEO_ENCODER
360    bool transcodeEnabled;  /* set when the 1st transcoding session is started for this qam frontend */
361#endif
362} QamSrc;
363
364typedef struct SatSrc {
365    NEXUS_FrontendHandle frontendHandle;
366    int frequency;
367    int refCount;   /* how many streaming sessions are using this frontend */
368    B_PlaybackIpPsiInfo psi[MAX_PROGRAMS_PER_FREQUENCY];
369    int numProgramsFound; /* how many sub-channels are found in this frequency */
370    bool psiAcquiring; /* set if PSI info is been acquired */
371    bool skipFrontendTuning; /* set if frontend tuner is already setup during PSI discovery */
372    BKNI_EventHandle psiAcquiredEvent;  /* set when PSI aquisition is completed */
373    BKNI_EventHandle signalLockedEvent;  /* set when tuner locks in to the frequency */
374    bool started; /* set when Src is started */
375    BKNI_MutexHandle lock;  /* lock to synchronize simultaneous access to one src when it shared between multiple clients */
376#ifdef NEXUS_HAS_VIDEO_ENCODER
377    bool transcodeEnabled;  /* set when the 1st transcoding session is started for this qam frontend */
378#endif
379} SatSrc;
380
381typedef struct IpSrc {
382    B_PlaybackIpHandle playbackIp;
383    NEXUS_PlaypumpHandle playpump;
384    char srcIpAddress[64];     /* IP Address of Receiving Host */
385    int srcPort;     /* Port # */
386    B_PlaybackIpProtocol srcProtocol; /* Protocol: UDP/RTP */
387    int refCount;   /* how many streaming sessions are using this frontend */
388    B_PlaybackIpPsiInfo psi[MAX_PROGRAMS_PER_FREQUENCY];
389    int numProgramsFound; /* how many sub-channels in this IP tuner */
390    bool psiAcquiring; /* set if PSI info is been acquired */
391    BKNI_EventHandle psiAcquiredEvent;  /* set when PSI aquisition is completed */
392    bool started; /* set when Src is started */
393    BKNI_MutexHandle lock;  /* lock to synchronize simultaneous access to one src when it shared between multiple clients */
394} IpSrc;
395
396typedef struct ParserBand {
397    NEXUS_ParserBand parserBand;
398    int frequency;
399    int subChannel;
400    int refCount;
401    BKNI_MutexHandle lock;  /* lock to synchronize simultaneous access to one parser band when it shared between multiple clients */
402    bool transcodeEnabled;  /* set when the 1st transcoding session is started for this parser band */
403#ifdef NEXUS_HAS_7043_TRANSCODER
404    IpStreamerTranscodeConfig transcode;
405#endif
406#ifdef NEXUS_HAS_VIDEO_ENCODER
407    TranscoderDst *transcoderDst; /* handle to the transcoder context */
408    IpStreamerTranscodeConfig transcode;
409#endif
410} ParserBand; 
411
412typedef struct IpDst {
413    NEXUS_RecpumpHandle recpumpHandle;
414    NEXUS_RecordHandle recordHandle;
415    NEXUS_FileRecordHandle fileRecordHandle;
416    NEXUS_FifoRecordHandle fifoFileHandle;
417    B_PlaybackIpLiveStreamingHandle liveStreamingHandle;
418    bool inUse;
419    BKNI_EventHandle dataReadyEvent; /* indicates when data is available in the recpump buffer */
420} IpDst; 
421
422typedef struct RecDst {
423    NEXUS_RecpumpHandle recpumpHandle;
424    NEXUS_RecordHandle recordHandle;
425    NEXUS_FileRecordHandle fileRecordHandle;
426    bool inUse;
427} RecDst; 
428
429#ifdef NEXUS_HAS_7043_TRANSCODER
430typedef struct RemuxDst {
431    NEXUS_RemuxHandle remuxHandle;
432    NEXUS_Transcoder_OutputPortHandle transcoderOutputPortHandle;
433    NEXUS_TranscoderHandle videoTranscoderHandle;
434    NEXUS_TranscoderHandle audioTranscoderHandle;
435    bool inUse;
436    int refCount;
437} RemuxDst; 
438#endif
439#ifdef NEXUS_HAS_HDMI_INPUT
440typedef struct HdmiSrc {
441    int hdmiInputId;
442    NEXUS_Timebase timebase;
443    NEXUS_HdmiInputHandle hdmiInput;
444#ifdef NEXUS_HAS_VIDEO_ENCODER
445    TranscoderDst *transcoderDst; /* handle to the transcoder context */
446#endif
447    bool inUse;
448    int refCount;
449} HdmiSrc; 
450#endif
451#endif /* B_HAS_LIVE_STREAMING */
452
453typedef struct FileSrc {
454#ifdef NEXUS_HAS_VIDEO_ENCODER
455    TranscoderDst *transcoderDst; /* handle to the transcoder context */
456#endif
457    NEXUS_PlaypumpHandle playpumpHandle;
458    NEXUS_PlaybackHandle playbackHandle;
459    NEXUS_FilePlayHandle filePlayHandle;
460    NEXUS_StcChannelHandle playbackStcChannel;
461    NEXUS_PlaybackPidChannelSettings playbackPidSettings;
462    B_PlaybackIpFileStreamingHandle fileStreamingHandle;
463    bool inUse;
464    int refCount;
465} FileSrc; 
466
467/* state info common to all threads */
468typedef struct IpStreamerGlobalCtx {
469    IpStreamerGlobalCfg globalCfg;
470    void *dtcpCtx;
471
472#if B_HAS_LIVE_STREAMING
473    /* list of all available vsb sources: one per vsb tuner */
474    BKNI_MutexHandle vsbSrcMutex;
475    QamSrc vsbSrcList[NEXUS_MAX_FRONTENDS];
476
477    /* list of all available qam sources: one per qam tuner */
478    BKNI_MutexHandle qamSrcMutex;
479    QamSrc qamSrcList[NEXUS_MAX_FRONTENDS];
480    /* list of all available ip sources: one per playback channel */
481    BKNI_MutexHandle ipSrcMutex; /* lock to synchronize access to the list of ip srcs */
482    IpSrc ipSrcList[NEXUS_NUM_PLAYPUMPS];
483    /* list of all available sat sources: one per qam tuner */
484    BKNI_MutexHandle satSrcMutex;
485    SatSrc satSrcList[NEXUS_MAX_FRONTENDS];
486
487    /* list of all available pid parsers */
488    BKNI_MutexHandle parserBandMutex;
489    ParserBand parserBandList[NEXUS_NUM_PARSER_BANDS];
490    /* list of all available Ip destinations: one per rave context */
491    BKNI_MutexHandle ipDstMutex; /* lock to synchronize access to the list of ip srcs */
492    IpDst ipDstList[NEXUS_NUM_RECPUMPS/2];
493
494    /* list of all available record destinations: one per rave context */
495    BKNI_MutexHandle recDstMutex;
496    RecDst recDstList[NEXUS_NUM_RECPUMPS/2];
497
498#if NEXUS_HAS_7043_TRANSCODER
499    /* list of all available remux destinations */
500    BKNI_MutexHandle remuxDstMutex;
501    RemuxDst remuxDstList[NEXUS_NUM_REMUX];
502#endif
503#ifdef NEXUS_HAS_VIDEO_ENCODER
504    /* list of all available remux destinations */
505    BKNI_MutexHandle transcoderDstMutex;
506    TranscoderDst transcoderDstList[NEXUS_NUM_VIDEO_ENCODERS];
507#endif
508#ifdef NEXUS_HAS_HDMI_INPUT
509    BKNI_MutexHandle hdmiSrcMutex;
510    HdmiSrc hdmiSrcList[NEXUS_NUM_HDMI_INPUTS];
511#endif
512#endif /* B_HAS_LIVE_STREAMING */
513
514    /* following fields are only used when IP Streamer is used in the standalone mode (i.e. w/o DLNA DMS) */
515    /* listening socket's fd */
516    int listeningFd;
517} IpStreamerGlobalCtx;
518
519/* per thread state info */
520typedef struct IpStreamerCtx
521{
522    IpStreamerGlobalCtx *globalCtx;
523    IpStreamerConfig cfg;
524
525    IpStreamerSrc srcType;
526    B_PlaybackIpSocketState socketState;
527#if B_HAS_LIVE_STREAMING
528    NEXUS_PidChannelHandle videoPidChannel;
529    NEXUS_PidChannelHandle audioPidChannel;
530    NEXUS_PidChannelHandle pcrPidChannel;
531    NEXUS_PidChannelHandle patPidChannel;
532    NEXUS_PidChannelHandle pmtPidChannel;
533#ifdef STREAMER_CABLECARD_SUPPORT
534    NEXUS_PidChannelHandle caPidChannel;
535#endif
536    IpSrc *ipSrc;   /* either ipSrc or qamSrc point is valid based on srcType */
537    QamSrc *qamSrc;
538    QamSrc *vsbSrc;
539    SatSrc *satSrc;
540#ifdef NEXUS_HAS_HDMI_INPUT
541    HdmiSrc *hdmiSrc;
542#endif
543    NEXUS_FrontendQamSettings qamSettings;
544    NEXUS_FrontendSatelliteSettings satSettings;
545    NEXUS_FrontendVsbSettings vsbSettings;
546    ParserBand *parserBandPtr;
547    RecDst *recDst;
548    IpDst *ipDst;
549#endif /* B_HAS_LIVE_STREAMING */
550    FileSrc *fileSrc;
551    uint64_t curBytesReceived;  /* # of bytes received from a live channel: either streamed on IP or recorded locally */
552    int underflowWarningCount;  /* how many seconds we haven't received any new data in the streaming/recording buffer */
553
554    bool ipStreamingInProgress; /* set when we are streaming a live channel to an IP client */
555    bool fileStreamingInProgress; /* set when we are streaming a media file to an IP client */
556    bool localRecordingInProgress; /* set when we are recording to local disk */
557    bool overflow; /* set when we overflow happeneded */
558    bool skipPsiAcquisition; /* if set, skip PSI acquisition, gets set when same channel is re-tuned */
559#ifdef B_HAS_DTCP_IP
560        void *AkeHandle;
561        void *dtcpCtx;
562#endif
563    bool transcodeEnabled;
564#ifdef NEXUS_HAS_7043_TRANSCODER
565    RemuxDst *remuxDst;
566    ParserBand *remuxParserBandPtr;
567    NEXUS_PidChannelHandle remuxVideoPidChannel;
568    NEXUS_PidChannelHandle remuxAudioPidChannel;
569    NEXUS_PidChannelHandle remuxPcrPidChannel;
570    bool transcodingInProgress; /* set when we are transcoding a session */
571#endif
572#ifdef NEXUS_HAS_VIDEO_ENCODER
573    TranscoderDst *transcoderDst;
574    NEXUS_PidChannelHandle transcodeVideoPidChannel;
575    NEXUS_PidChannelHandle transcodeAudioPidChannel;
576    NEXUS_PidChannelHandle transcodePcrPidChannel;
577    NEXUS_PidChannelHandle transcodePatPidChannel;
578    NEXUS_PidChannelHandle transcodePmtPidChannel;
579    bool transcodingInProgress; /* set when we are transcoding a session */
580#endif
581#ifdef NEXUS_HAS_SECURITY
582    NEXUS_KeySlotHandle pvrEncKeyHandle;
583    NEXUS_KeySlotHandle pvrDecKeyHandle;
584#endif
585}IpStreamerCtx;
586#endif /* __IP_STREAMER_H__ */
Note: See TracBrowser for help on using the repository browser.