| 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_lib.h $ |
|---|
| 39 | * $brcm_Revision: 36 $ |
|---|
| 40 | * $brcm_Date: 12/8/11 7:40p $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * ip streamer interface include file |
|---|
| 44 | * |
|---|
| 45 | * Revision History: |
|---|
| 46 | * |
|---|
| 47 | * $brcm_Log: /nexus/lib/playback_ip/apps/ip_streamer_lib.h $ |
|---|
| 48 | * |
|---|
| 49 | * 36 12/8/11 7:40p ssood |
|---|
| 50 | * SW7231-516: enhance ip_streamer to stream out raaga encoded TS streams |
|---|
| 51 | * from live or file sources |
|---|
| 52 | * |
|---|
| 53 | * 35 10/14/11 10:18a ssood |
|---|
| 54 | * SW7425-889: initial check-in for enabling audio in the live xcoded |
|---|
| 55 | * streams |
|---|
| 56 | * |
|---|
| 57 | * 34 10/7/11 6:10p ssood |
|---|
| 58 | * SW7346-341: allow apps to pass-in the key slot pointer |
|---|
| 59 | * |
|---|
| 60 | * 33 9/30/11 10:32p ssood |
|---|
| 61 | * SW7346-341: assigned more friendly name for the PVR decryption related |
|---|
| 62 | * variables |
|---|
| 63 | * |
|---|
| 64 | * 32 9/29/11 7:03p ssood |
|---|
| 65 | * SW7346-312: Expose QAM Annex & Symbol Rate settings to DMS app |
|---|
| 66 | * |
|---|
| 67 | * 31 9/9/11 9:26a micl |
|---|
| 68 | * SW7425-1077: IBC SAT changes |
|---|
| 69 | * |
|---|
| 70 | * 30 8/22/11 12:21p ssood |
|---|
| 71 | * SW7425-1040: add logic to Skip PSI probing for FCC & provide end of |
|---|
| 72 | * streaming callback |
|---|
| 73 | * |
|---|
| 74 | * 29 8/10/11 1:44p micl |
|---|
| 75 | * SW7425-1075: Adding QAM statuses to AppLibs DMS |
|---|
| 76 | * |
|---|
| 77 | * 28 8/5/11 3:14p ssood |
|---|
| 78 | * SW7425-1040: add fast channel change support to IP Sessions |
|---|
| 79 | * |
|---|
| 80 | * 27 7/14/11 12:01p ssood |
|---|
| 81 | * SW7346-309: Add support for Streaming from Satellite Source |
|---|
| 82 | * |
|---|
| 83 | * 26 6/30/11 12:15a ssood |
|---|
| 84 | * SW7425-813: add support to transcode & stream session alongside main & |
|---|
| 85 | * pip decode |
|---|
| 86 | * |
|---|
| 87 | * 25 6/20/11 11:13p ssood |
|---|
| 88 | * SW7425-751: add configurable option for nav & nav files |
|---|
| 89 | * |
|---|
| 90 | * 24 3/18/11 6:44p ssood |
|---|
| 91 | * SW7420-1616: allow app to pass-in dma handle |
|---|
| 92 | * |
|---|
| 93 | * 23 3/16/11 4:55p ssood |
|---|
| 94 | * SW7420-1616: initial check-in for pvr encryption support |
|---|
| 95 | * |
|---|
| 96 | * 22 1/2/11 5:26p ssood |
|---|
| 97 | * SW7420-1257: added support to stream encoded frame using unicast for |
|---|
| 98 | * local client |
|---|
| 99 | * |
|---|
| 100 | * 21 12/31/10 3:25p ssood |
|---|
| 101 | * SW7425-59: add change to support clean stop/stop sequence w/ 7425 |
|---|
| 102 | * xcoder + insert PAT/PMT into outgoing stream |
|---|
| 103 | * |
|---|
| 104 | * 20 12/30/10 1:06p ssood |
|---|
| 105 | * SW7425-59: surround all 7425 transcoder changes w/ |
|---|
| 106 | * NEXUS_HAS_VIDEO_ENCODER compile flag |
|---|
| 107 | * |
|---|
| 108 | * 19 12/30/10 12:55p ssood |
|---|
| 109 | * SW7425-59: initial 7425 transcoder support on h/w platform (no PSI, no |
|---|
| 110 | * PCRs, no Audio in xcoded stream) |
|---|
| 111 | * |
|---|
| 112 | * 18 12/28/10 12:28p ssood |
|---|
| 113 | * SW7425-59: Add support for using HDMI-in as the source for |
|---|
| 114 | * transcoding+streaming out |
|---|
| 115 | * |
|---|
| 116 | * 17 12/26/10 10:45p ssood |
|---|
| 117 | * SW7425-59: Add support for 7425 transcoder |
|---|
| 118 | * |
|---|
| 119 | * 16 11/23/10 11:55a ssood |
|---|
| 120 | * SW7420-1257: initial check-in for rtp/udp streaming support in |
|---|
| 121 | * ip_streamer for Video Conferencing Demo |
|---|
| 122 | * |
|---|
| 123 | * 15 8/12/10 11:24a ssood |
|---|
| 124 | * SW7420-883: added support for streaming same transcoding session to |
|---|
| 125 | * multiple clients |
|---|
| 126 | * |
|---|
| 127 | * 14 8/6/10 6:33p ssood |
|---|
| 128 | * SW7420-883: allow only one transcoding session at a time |
|---|
| 129 | * |
|---|
| 130 | * 13 8/5/10 7:32a ssood |
|---|
| 131 | * SW7420-883: added support for allowing external apps to configure |
|---|
| 132 | * transcoding parameters into ip streamer library |
|---|
| 133 | * |
|---|
| 134 | * 12 7/30/10 2:17p garetht |
|---|
| 135 | * SW7420-919: Add CableCARD support to Ip_streamer |
|---|
| 136 | * |
|---|
| 137 | * 11 7/27/10 2:08p ssood |
|---|
| 138 | * SW7420-883: add transcoding support to IP Streamer (no audio |
|---|
| 139 | * transcoding yet) |
|---|
| 140 | * |
|---|
| 141 | * 10 4/15/10 7:49p sgundime |
|---|
| 142 | * SW7420-689: time seek range support is added. |
|---|
| 143 | * |
|---|
| 144 | * 10 4/15/10 7:33p sgundime |
|---|
| 145 | * SW7420-689: Time seek range support is added. |
|---|
| 146 | * |
|---|
| 147 | * 9 1/27/10 10:18a ssood |
|---|
| 148 | * SW7420-454: conditionally compile Live Streaming Code using |
|---|
| 149 | * LIVE_STREAMING_SUPPORT |
|---|
| 150 | * |
|---|
| 151 | * 8 1/19/10 4:55p ssood |
|---|
| 152 | * SW7420-454: convert verbose output to be available via msg modules |
|---|
| 153 | * flags |
|---|
| 154 | * |
|---|
| 155 | * 7 1/14/10 6:41p ssood |
|---|
| 156 | * SW7408-47: Add support to compile IP Streamer App on platforms w/ no |
|---|
| 157 | * frontend support |
|---|
| 158 | * |
|---|
| 159 | * 6 12/23/09 1:48p ssood |
|---|
| 160 | * SW7420-454: new IpStreamer_SessionStatus() API to indicate session |
|---|
| 161 | * state & recording buffer duration |
|---|
| 162 | * |
|---|
| 163 | * 5 12/22/09 11:03a ssood |
|---|
| 164 | * SW7420-454: add timeshift support for live streaming |
|---|
| 165 | * |
|---|
| 166 | * 4 12/17/09 2:07p ssood |
|---|
| 167 | * SW7420-454: Add option to just open IP Streamer & IP library contexts |
|---|
| 168 | * for Media Probe purposes |
|---|
| 169 | * |
|---|
| 170 | * 3 12/7/09 6:19p ssood |
|---|
| 171 | * SW7420-454: converted timeOffset to floating point to match w/ DLNA NPT |
|---|
| 172 | * format |
|---|
| 173 | * |
|---|
| 174 | * 2 11/24/09 10:48a ssood |
|---|
| 175 | * SW7420-454: add option to allow apps to specify a specific interface |
|---|
| 176 | * name to receive live IP content |
|---|
| 177 | * |
|---|
| 178 | * 1 11/17/09 2:58p ssood |
|---|
| 179 | * SW7420-454: Enhance IP Streamer to stream files from local disk |
|---|
| 180 | * |
|---|
| 181 | * |
|---|
| 182 | ******************************************************************************/ |
|---|
| 183 | #ifndef __IP_STREAMER_LIB_H__ |
|---|
| 184 | #define __IP_STREAMER_LIB_H__ |
|---|
| 185 | |
|---|
| 186 | #include <stdio.h> |
|---|
| 187 | #include "bstd.h" |
|---|
| 188 | #include "bkni.h" |
|---|
| 189 | #include "bkni_multi.h" |
|---|
| 190 | |
|---|
| 191 | typedef enum { |
|---|
| 192 | IpStreamerSrc_eIp, /* For streaming out content coming from IP frontend */ |
|---|
| 193 | IpStreamerSrc_eQam, /* For streaming out content coming from QAM frontend */ |
|---|
| 194 | IpStreamerSrc_eVsb, /* For streaming out content coming from VSB frontend (off-air) */ |
|---|
| 195 | IpStreamerSrc_eStreamer, /* For streaming out content coming from Streamer input */ |
|---|
| 196 | IpStreamerSrc_eFile, /* For streaming out pre-recorded content from local disk */ |
|---|
| 197 | IpStreamerSrc_eSat, /* For streaming out content coming from Satellite frontend */ |
|---|
| 198 | IpStreamerSrc_eHdmi, /* For streaming out encoded content coming from HDMI in (BlueRay player) */ |
|---|
| 199 | IpStreamerSrc_eMax /* Max allowed enum */ |
|---|
| 200 | }IpStreamerSrc; |
|---|
| 201 | |
|---|
| 202 | typedef struct IpStreamerStreamingOutCfg { |
|---|
| 203 | char *streamingIpAddress; /* remote IP address to stream to */ |
|---|
| 204 | int streamingPort; /* remote Port # to stream to */ |
|---|
| 205 | B_PlaybackIpProtocol streamingProtocol; /* Protocol: UDP/RTP */ |
|---|
| 206 | char *url; /* url (file name) for RTP/UDP streaming */ |
|---|
| 207 | } IpStreamerStreamingOutCfg; |
|---|
| 208 | |
|---|
| 209 | typedef struct IpStreamerGlobalCfg{ |
|---|
| 210 | int dtcpAkePort; /* dtcp-ip port to receive AKE requests on */ |
|---|
| 211 | bool slaveMode; /* set for VMS, allows sharing of Nexus handles between two independent Apps */ |
|---|
| 212 | bool printStats; |
|---|
| 213 | char *serverIpAddress; |
|---|
| 214 | char interfaceName[16]; |
|---|
| 215 | char timeshiftDirPath[32]; /* directory where timeshifted files are stored */ |
|---|
| 216 | int timeshiftBufferInterval; /* how many seconds worth of stream should be cached in the timeshift buffer */ |
|---|
| 217 | int maxBitRate; /* max bitrate for the live sessions */ |
|---|
| 218 | #ifdef NEXUS_HAS_DMA |
|---|
| 219 | NEXUS_DmaHandle dmaHandle; /* Nexus M2M DMA handle */ |
|---|
| 220 | #endif |
|---|
| 221 | |
|---|
| 222 | /* following options need to be set only when IP Streamer is run in standalone mode (i.e. outside of DLNA DMS) */ |
|---|
| 223 | int listeningPort; /* port to receive HTTP requests on */ |
|---|
| 224 | bool accelSocket; /* once accelerated sockets are supported on 7420, this option can be enabled */ |
|---|
| 225 | char rootDir[64]; /* root directory */ |
|---|
| 226 | int numStreamingSessions; /* max # of streaming threads to start */ |
|---|
| 227 | int disableFrontend; /* if set, frontends (qam/vsb/ip) are not used for live streaming */ |
|---|
| 228 | IpStreamerStreamingOutCfg streamingCfg; |
|---|
| 229 | bool freeDmaHandle; |
|---|
| 230 | } IpStreamerGlobalCfg; |
|---|
| 231 | |
|---|
| 232 | #ifdef NEXUS_HAS_7043_TRANSCODER |
|---|
| 233 | typedef struct IpStreamerTranscodeConfig { |
|---|
| 234 | int transportBitrate; /* desired transport bitrate of transcoded stream */ |
|---|
| 235 | NEXUS_TransportType transportType; /* Transport type of the transcoded stream */ |
|---|
| 236 | bool outVideo; /* required to contain video in transcoded stream */ |
|---|
| 237 | NEXUS_VideoCodec outVideoCodec; /* video codec of transcoded stream */ |
|---|
| 238 | NEXUS_AspectRatio outAspectRatio; |
|---|
| 239 | int outFrameRate; |
|---|
| 240 | short outWidth; |
|---|
| 241 | short outHeight; |
|---|
| 242 | bool outAudio; /* required to contain Audio in transcoded stream */ |
|---|
| 243 | NEXUS_AudioCodec outAudioCodec; /* audio codec of transcoded stream */ |
|---|
| 244 | }IpStreamerTranscodeConfig; |
|---|
| 245 | #endif |
|---|
| 246 | |
|---|
| 247 | #ifdef NEXUS_HAS_VIDEO_ENCODER |
|---|
| 248 | typedef struct IpStreamerTranscodeConfig { |
|---|
| 249 | int transportBitrate; /* desired transport bitrate of transcoded stream */ |
|---|
| 250 | NEXUS_TransportType transportType; /* Transport type of the transcoded stream */ |
|---|
| 251 | bool outVideo; /* set if Video in enabled in transcoded stream */ |
|---|
| 252 | bool outAudio; /* set if Audio is enabled in transcoded stream */ |
|---|
| 253 | int outVideoPid; |
|---|
| 254 | int outPcrPid; |
|---|
| 255 | int outAudioPid; |
|---|
| 256 | NEXUS_VideoCodec outVideoCodec; /* video codec of transcoded stream */ |
|---|
| 257 | NEXUS_DisplayAspectRatio outAspectRatio; |
|---|
| 258 | NEXUS_VideoFrameRate outFrameRate; |
|---|
| 259 | unsigned outWidth; |
|---|
| 260 | unsigned outHeight; |
|---|
| 261 | NEXUS_AudioCodec outAudioCodec; /* audio codec of transcoded stream */ |
|---|
| 262 | int outPatPid; |
|---|
| 263 | int outPmtPid; |
|---|
| 264 | bool outInterlaced; |
|---|
| 265 | }IpStreamerTranscodeConfig; |
|---|
| 266 | #endif |
|---|
| 267 | |
|---|
| 268 | /* per session configuration */ |
|---|
| 269 | typedef struct IpStreamerConfig{ |
|---|
| 270 | IpStreamerSrc srcType; |
|---|
| 271 | |
|---|
| 272 | bool mediaProbeOnly; /* set this flag if the ip streaming context is being used for determining media probe info only */ |
|---|
| 273 | bool skipPsiAcquisition; /* set this flag if app already has PSI information for this file/channel */ |
|---|
| 274 | B_PlaybackIp_EventCallback eventCallback; /* callback function to receive any asynchronous events from the IP library */ |
|---|
| 275 | void *appCtx; |
|---|
| 276 | #if B_HAS_LIVE_STREAMING |
|---|
| 277 | /* QAM Src related settings */ |
|---|
| 278 | NEXUS_FrontendQamMode qamMode; /* qam modulation mode */ |
|---|
| 279 | NEXUS_FrontendQamAnnex qamAnnex; |
|---|
| 280 | NEXUS_FrontendSatelliteMode satMode; /* sat mode */ |
|---|
| 281 | int diseqcVoltage; |
|---|
| 282 | int symbolRate; |
|---|
| 283 | bool toneEnabled; |
|---|
| 284 | #endif |
|---|
| 285 | int frequency; /* frequency in Mhz (e.g. 333) */ |
|---|
| 286 | int subChannel; /* sub channel number: starts from 1 */ |
|---|
| 287 | #ifdef STREAMER_CABLECARD_SUPPORT |
|---|
| 288 | uint32_t sourceId; |
|---|
| 289 | #endif |
|---|
| 290 | #if B_HAS_LIVE_STREAMING |
|---|
| 291 | /* VSB Src related settings */ |
|---|
| 292 | NEXUS_FrontendVsbMode vsbMode; |
|---|
| 293 | #endif |
|---|
| 294 | /* IP Src related settings */ |
|---|
| 295 | int iphVersion; |
|---|
| 296 | char srcIpAddress[64]; /* IP Address of Receiving Host */ |
|---|
| 297 | int srcPort; /* Port # */ |
|---|
| 298 | char interfaceName[16]; /* Interface to send multicast join requests on */ |
|---|
| 299 | B_PlaybackIpProtocol srcProtocol; /* Protocol: UDP/RTP */ |
|---|
| 300 | bool accelSocket; /* once accelerated sockets are supported on 7420, this option can be enabled */ |
|---|
| 301 | |
|---|
| 302 | B_PlaybackIpSecurityProtocol security; /* which security protocol to use */ |
|---|
| 303 | |
|---|
| 304 | /* File Source related settings */ |
|---|
| 305 | off_t beginFileOffset; |
|---|
| 306 | off_t endFileOffset; |
|---|
| 307 | int playSpeed; /* speed at which to stream the file */ |
|---|
| 308 | double beginTimeOffset; /* stream file starting from these many seconds */ |
|---|
| 309 | double endTimeOffset; |
|---|
| 310 | |
|---|
| 311 | /* Record Destination related settings */ |
|---|
| 312 | bool recDstEnabled; /* if set, local recording is enabled */ |
|---|
| 313 | |
|---|
| 314 | /* Note: local data is being recorded in clear */ |
|---|
| 315 | char fileName[128]; /* name of the file where av data should be recorded to or streamed from */ |
|---|
| 316 | char indexFileName[128]; /* name of the file where av data index should be written to or used for streaming */ |
|---|
| 317 | char mediaInfoFilesDir[128]; /* directory name where the info & nav files should be created */ |
|---|
| 318 | |
|---|
| 319 | /* IP Destination related settings */ |
|---|
| 320 | bool ipDstEnabled; /* if set, live channel is streamed over the network */ |
|---|
| 321 | int streamingFd; /* socket to which av content needs to be streamed to */ |
|---|
| 322 | int streamingFdLocal; /* socket fd on which to stream data for local client */ |
|---|
| 323 | bool useLiveIpMode; /* true: Push mode (locks to incoming PCR); false: Pull Mode (receiver controls the sender) */ |
|---|
| 324 | bool encryptionEnabled; /* if set, streaming data is encrypted as per the Dst (DTCP/IP for Ip Dst & Plain AES for Local Rec Dst) */ |
|---|
| 325 | bool pvrEncryptionEnabled; /* if set, encrypt stream before writing to timeshift fifo & decrypt it before DTCP/IP */ |
|---|
| 326 | bool pvrDecryptionEnabled; /* if set, encrypt stream before writing to timeshift fifo & decrypt it before DTCP/IP */ |
|---|
| 327 | void *pvrDecKeyHandle; /* set if PvrDecEnabled field is set in the URL */ |
|---|
| 328 | int emiValue; /* EMI value for DTCP/IP headers */ |
|---|
| 329 | bool transcodeEnabled; /* if set, transcoding is enabled */ |
|---|
| 330 | bool usePlaybackForStreamingFiles; |
|---|
| 331 | #ifdef NEXUS_HAS_7043_TRANSCODER |
|---|
| 332 | IpStreamerTranscodeConfig transcode; |
|---|
| 333 | #endif |
|---|
| 334 | #ifdef NEXUS_HAS_VIDEO_ENCODER |
|---|
| 335 | IpStreamerTranscodeConfig transcode; |
|---|
| 336 | #endif |
|---|
| 337 | #ifdef NEXUS_HAS_HDMI_INPUT |
|---|
| 338 | int hdmiInputId; /* index of HDMI input to use */ |
|---|
| 339 | #endif |
|---|
| 340 | |
|---|
| 341 | IpStreamerStreamingOutCfg streamingCfg; /* contains configuration for streaming out using RTP/UDP protocols */ |
|---|
| 342 | |
|---|
| 343 | /* following options need to be set only when IP Streamer is run in standalone mode (i.e. outside of DLNA DMS) */ |
|---|
| 344 | bool headRequest; /* set when client sends HTTP HEAD request */ |
|---|
| 345 | } IpStreamerConfig; |
|---|
| 346 | |
|---|
| 347 | /* Initializes IP Streamers' global context for the given configuration */ |
|---|
| 348 | void * B_IpStreamer_Init(IpStreamerGlobalCfg *ipStreamerGlobalCfg); |
|---|
| 349 | void B_IpStreamer_UnInit(void *ipStreamerGlobalCtx); |
|---|
| 350 | |
|---|
| 351 | typedef struct IpStreamerOpenSettings { |
|---|
| 352 | int streamingFd; /* socket file descriptor using which live/file content should be streamed, not used for recording only or media probing case */ |
|---|
| 353 | int streamingFdLocal; /* socket fd on which to stream data for local client */ |
|---|
| 354 | char *requestUri; /* URI associated with this streaming context: identifies live vs file streaming, recording on/off */ |
|---|
| 355 | bool mediaProbeOnly; /* set this flag if the ip streaming context is being used for determining media probe info only */ |
|---|
| 356 | bool skipPsiAcquisition; /* set this flag if app already has PSI information for this file/channel */ |
|---|
| 357 | B_PlaybackIp_EventCallback eventCallback; /* callback function to receive any asynchronous events from the IP library */ |
|---|
| 358 | void *appCtx; |
|---|
| 359 | void *pvrDecKeyHandle; /* set if PvrDecEnabled field is set in the URL */ |
|---|
| 360 | }IpStreamerOpenSettings; |
|---|
| 361 | |
|---|
| 362 | /* Opens per session context for a give session configuration */ |
|---|
| 363 | void *B_IpStreamer_SessionOpen(void *ipStreamerGlobalCtx, IpStreamerOpenSettings *openSettings); |
|---|
| 364 | void B_IpStreamer_SessionClose(void *ipStreamerCtx); |
|---|
| 365 | |
|---|
| 366 | /* returns the PSI info associated with a live channel in psiOut */ |
|---|
| 367 | int B_IpStreamer_SessionAcquirePsiInfo(void *ipStreamerCtx, B_PlaybackIpPsiInfo *psiOut); |
|---|
| 368 | |
|---|
| 369 | /* Settings that can be updated when live streaming start is already called */ |
|---|
| 370 | typedef struct IpStreamerSettings |
|---|
| 371 | { |
|---|
| 372 | bool streamingEnabled; /* flag to indicate to live streaming thread that streaming has now been enabled (Fast Channel Change) */ |
|---|
| 373 | int streamingFd; /* socket fd on which to stream data on */ |
|---|
| 374 | } IpStreamerSettings; |
|---|
| 375 | /* Opens per session context for a give session configuration */ |
|---|
| 376 | int B_IpStreamer_SessionSetSettings(void *ipStreamerCtx, IpStreamerSettings *sessionSettings); |
|---|
| 377 | |
|---|
| 378 | /* Opens per session context for a give session configuration */ |
|---|
| 379 | int B_IpStreamer_SessionStart(void *ipStreamerCtx, B_PlaybackIpPsiInfo *psi); |
|---|
| 380 | void B_IpStreamer_SessionStop(void *ipStreamerCtx); |
|---|
| 381 | |
|---|
| 382 | typedef struct IpStreamerSessionStatus { |
|---|
| 383 | bool active; /* set as long as session is active (no underflow from source, client still alive & receiving, no recording error, etc.*/ |
|---|
| 384 | /* TODO: add more status fields like: socket state, bytes streamed, bytes recorded, etc. */ |
|---|
| 385 | int recordingDuration; /* duration in seconds of the session being recorded */ |
|---|
| 386 | }IpStreamerSessionStatus; |
|---|
| 387 | |
|---|
| 388 | /* returns true if Streaming session is successfully ongoing, false otherwise where upon app should stop & close streaming session */ |
|---|
| 389 | void B_IpStreamer_SessionStatus(void *ipStreamerCtx, IpStreamerSessionStatus *status); |
|---|
| 390 | |
|---|
| 391 | /* frontend statuses that can be returned */ |
|---|
| 392 | typedef enum IpStreamer_FrontendMode |
|---|
| 393 | { |
|---|
| 394 | /* satellite modes */ |
|---|
| 395 | IpStreamer_FrontendMode_eDvb, |
|---|
| 396 | IpStreamer_FrontendMode_eDss, |
|---|
| 397 | IpStreamer_FrontendMode_eDcii, |
|---|
| 398 | IpStreamer_FrontendMode_eQpskTurbo, |
|---|
| 399 | IpStreamer_FrontendMode_eTurboQpsk=IpStreamer_FrontendMode_eQpskTurbo, |
|---|
| 400 | IpStreamer_FrontendMode_e8pskTurbo, |
|---|
| 401 | IpStreamer_FrontendMode_eTurbo8psk=IpStreamer_FrontendMode_e8pskTurbo, |
|---|
| 402 | IpStreamer_FrontendMode_eTurbo, |
|---|
| 403 | IpStreamer_FrontendMode_eQpskLdpc, |
|---|
| 404 | IpStreamer_FrontendMode_e8pskLdpc, |
|---|
| 405 | IpStreamer_FrontendMode_eLdpc, |
|---|
| 406 | IpStreamer_FrontendMode_eBlindAcquisition, |
|---|
| 407 | |
|---|
| 408 | /* cable modes */ |
|---|
| 409 | IpStreamer_FrontendMode_e16, |
|---|
| 410 | IpStreamer_FrontendMode_e32, |
|---|
| 411 | IpStreamer_FrontendMode_e64, |
|---|
| 412 | IpStreamer_FrontendMode_e128, |
|---|
| 413 | IpStreamer_FrontendMode_e256, |
|---|
| 414 | IpStreamer_FrontendMode_e512, |
|---|
| 415 | IpStreamer_FrontendMode_e1024, |
|---|
| 416 | IpStreamer_FrontendMode_e2048, |
|---|
| 417 | IpStreamer_FrontendMode_e4096, |
|---|
| 418 | IpStreamer_FrontendMode_eAuto_64_256, /* Automatically scan both QAM-64 and QAM-256. |
|---|
| 419 | Not available on all chipsets. */ |
|---|
| 420 | /* terrestrial modes */ |
|---|
| 421 | IpStreamer_FrontendMode_eDvbt, |
|---|
| 422 | IpStreamer_FrontendMode_eDvbt2, |
|---|
| 423 | IpStreamer_FrontendMode_eIsdbt, |
|---|
| 424 | |
|---|
| 425 | IpStreamer_FrontendMode_eMax |
|---|
| 426 | } IpStreamer_FrontendMode; |
|---|
| 427 | |
|---|
| 428 | typedef enum IpStreamer_FrontendAnnex |
|---|
| 429 | { |
|---|
| 430 | IpStreamer_FrontendQamAnnex_eA, |
|---|
| 431 | IpStreamer_FrontendQamAnnex_eB, |
|---|
| 432 | IpStreamer_FrontendQamAnnex_eMax |
|---|
| 433 | } IpStreamer_FrontendAnnex; |
|---|
| 434 | |
|---|
| 435 | typedef enum IpStreamer_FrontendInversion |
|---|
| 436 | { |
|---|
| 437 | IpStreamer_FrontendInversion_eScan, |
|---|
| 438 | IpStreamer_FrontendInversion_eNormal, |
|---|
| 439 | IpStreamer_FrontendInversion_eI, |
|---|
| 440 | IpStreamer_FrontendInversion_eQ, |
|---|
| 441 | IpStreamer_FrontendInversion_eMax |
|---|
| 442 | } IpStreamer_FrontendInversion; |
|---|
| 443 | |
|---|
| 444 | typedef struct IpStreamerSoftDecision { |
|---|
| 445 | int i; |
|---|
| 446 | int q; |
|---|
| 447 | }IpStreamerSoftDecision; |
|---|
| 448 | |
|---|
| 449 | /*returns 0 if successful, else return 1 */ |
|---|
| 450 | int B_IpStreamer_GetFrontendSoftDecision(void * dlnaGlobalCtx, int frontendNo, IpStreamerSoftDecision *softDecision, int length); |
|---|
| 451 | |
|---|
| 452 | typedef struct IpStreamerStatus { |
|---|
| 453 | IpStreamer_FrontendMode mode; |
|---|
| 454 | IpStreamer_FrontendInversion spectralInversion; |
|---|
| 455 | |
|---|
| 456 | unsigned codeRateNumerator; /* Code rate detected */ |
|---|
| 457 | unsigned codeRateDenominator; |
|---|
| 458 | unsigned frequency; /* actual tuner frequency */ |
|---|
| 459 | |
|---|
| 460 | bool tunerLocked; /* true if the tuner is locked */ |
|---|
| 461 | bool demodLocked; /* true if the demodulator is locked */ |
|---|
| 462 | bool bertLocked; /* true if the BER tester is locked. If so, see berEstimate. */ |
|---|
| 463 | |
|---|
| 464 | unsigned channel; /* Channel number */ |
|---|
| 465 | unsigned symbolRate; /* In baud */ |
|---|
| 466 | int symbolRateError; /* In baud */ |
|---|
| 467 | |
|---|
| 468 | int carrierOffset; /* In Hz */ |
|---|
| 469 | int carrierError; /* In Hz */ |
|---|
| 470 | unsigned sampleClock; /* In Hz */ |
|---|
| 471 | unsigned outputBitRate; /* Output bit rate in bps */ |
|---|
| 472 | |
|---|
| 473 | unsigned ifAgcLevel; /* IF AGC level in units of 1/10 percent */ |
|---|
| 474 | unsigned rfAgcLevel; /* tuner AGC level in units of 1/10 percent */ |
|---|
| 475 | unsigned intAgcLevel; /* Internal AGC level in units of 1/10 percent */ |
|---|
| 476 | unsigned snrEstimate; /* SNR in 1/100 dB */ |
|---|
| 477 | unsigned berEstimate; /* Bit error rate as log10 of 0.0-1.0 range. |
|---|
| 478 | 1.0 => 100% => 0 |
|---|
| 479 | 0.1 => 10% => -1 |
|---|
| 480 | 0.01 => 1% => -2 |
|---|
| 481 | 0 => 0% => 1 (special value for NONE) |
|---|
| 482 | If bertLocked == false, it's set to 1. */ |
|---|
| 483 | |
|---|
| 484 | unsigned fecPhase; /* 0, 90, 180, 270 */ |
|---|
| 485 | unsigned fecCorrected; /* cumulative block correctable errors */ |
|---|
| 486 | unsigned fecUncorrected; /* cumulative block uncorrectable errors */ |
|---|
| 487 | unsigned fecClean; /* cumulative clean block count */ |
|---|
| 488 | unsigned bitErrCorrected; /* cumulative bit correctable errors */ |
|---|
| 489 | unsigned reacquireCount; /* cumulative reacquisition count */ |
|---|
| 490 | unsigned berErrors; /* BER error count - valid if bertLocked is true */ |
|---|
| 491 | unsigned preViterbiErrorCount; /* accumulated pre-Viterbi error count */ |
|---|
| 492 | unsigned mpegErrors; /* mpeg frame error count */ |
|---|
| 493 | unsigned mpegCount; /* total mpeg frame count */ |
|---|
| 494 | unsigned ifAgc; /* if agc value from hw unmodified */ |
|---|
| 495 | unsigned rfAgc; /* rf agc value from hw unmodified */ |
|---|
| 496 | unsigned agf; /* AGF integrator value */ |
|---|
| 497 | unsigned timeElapsed; /* time elapsed in milliseconds since the last call to NEXUS_Frontend_ResetStatus. |
|---|
| 498 | the elapsed time is measured at the same time that the rest of the values in NEXUS_FrontendSatelliteStatus are captured. */ |
|---|
| 499 | |
|---|
| 500 | float power; |
|---|
| 501 | |
|---|
| 502 | unsigned chipId; |
|---|
| 503 | unsigned chipVersion; |
|---|
| 504 | unsigned bondingOption; |
|---|
| 505 | unsigned apMicrocodeVersion; |
|---|
| 506 | unsigned hostConfigurationVersion; |
|---|
| 507 | |
|---|
| 508 | /* cable specifics */ |
|---|
| 509 | bool receiverLock; |
|---|
| 510 | bool fecLock; |
|---|
| 511 | int dsChannelPower; |
|---|
| 512 | IpStreamer_FrontendAnnex annex; |
|---|
| 513 | }IpStreamerStatus; |
|---|
| 514 | |
|---|
| 515 | int B_IpStreamer_GetFrontendStatus(void * dlnaGlobalCtx, int frontendNo, IpStreamerSrc *src, IpStreamerStatus *status); |
|---|
| 516 | |
|---|
| 517 | #ifdef NEXUS_HAS_VIDEO_ENCODER |
|---|
| 518 | bool B_IpStreamer_InsertPatPmtTables(void *ipStreamerCtx); |
|---|
| 519 | #endif |
|---|
| 520 | |
|---|
| 521 | #endif /* __IP_STREAMER_LIB_H__ */ |
|---|