| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2008, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: $ |
|---|
| 11 | * $brcm_Revision: $ |
|---|
| 12 | * $brcm_Date: $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: stream api implementation, only circular buffer capture, |
|---|
| 15 | * no message filters. |
|---|
| 16 | * |
|---|
| 17 | * Revision History: |
|---|
| 18 | * |
|---|
| 19 | * $brcm_Log: $ |
|---|
| 20 | * |
|---|
| 21 | * |
|---|
| 22 | ***************************************************************************/ |
|---|
| 23 | #include "bsettop_stream.h" |
|---|
| 24 | #include "bsettop_smessage.h" |
|---|
| 25 | |
|---|
| 26 | #include "bchp_xpt_dpcr0.h" |
|---|
| 27 | #include "bchp_xpt_pcroffset.h" |
|---|
| 28 | #include "bstd.h" |
|---|
| 29 | #include "bkni.h" |
|---|
| 30 | #include "bsettop_p_stream.h" |
|---|
| 31 | #include "vprimer.h" |
|---|
| 32 | #include "gist.h" |
|---|
| 33 | |
|---|
| 34 | BDBG_MODULE(bstream); |
|---|
| 35 | #ifndef TUNER_BAND |
|---|
| 36 | #define TUNER_BAND 0 |
|---|
| 37 | #endif |
|---|
| 38 | |
|---|
| 39 | #define INVALID_PID 0xFFFF |
|---|
| 40 | |
|---|
| 41 | #define DEFAULT_OFFSET_THRESHOLD ( 0x08 ) |
|---|
| 42 | #define DEFAULT_MAX_PCR_ERROR ( 0xFF ) |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | /* Match values in bmvd.c */ |
|---|
| 46 | #define DEF_CDB_SIZE_SD 362496 |
|---|
| 47 | #define DEF_ITB_SIZE_SD 32768 |
|---|
| 48 | #define DEF_CDB_SIZE_HD 2457600 |
|---|
| 49 | #define DEF_ITB_SIZE_HD 131072 |
|---|
| 50 | |
|---|
| 51 | #define CDB_SCALER 3 |
|---|
| 52 | #define ITB_SCALER 2 |
|---|
| 53 | |
|---|
| 54 | static bstream_config s_stream_config = { DEF_CDB_SIZE_HD * CDB_SCALER, DEF_ITB_SIZE_HD * ITB_SCALER}; /* Make larger to account for display offset */ |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | static struct bstream s_streams[BSETTOP_MAX_STREAMS] = |
|---|
| 58 | { |
|---|
| 59 | { false, 0, B_INVALID_PIDCH, DEF_PARSER_BAND, { { {INVALID_PID}},{{INVALID_PID, 0}},INVALID_PID} ,NULL,NULL}, |
|---|
| 60 | { false, 1, B_INVALID_PIDCH, DEF_PARSER_BAND, { { {INVALID_PID}},{{INVALID_PID, 0}},INVALID_PID} ,NULL,NULL}, |
|---|
| 61 | { false, 2, B_INVALID_PIDCH, DEF_PARSER_BAND, { { {INVALID_PID}},{{INVALID_PID, 0}},INVALID_PID} ,NULL,NULL} |
|---|
| 62 | }; |
|---|
| 63 | |
|---|
| 64 | static bstream_mpeg s_def_stream_mpeg = { {{INVALID_PID}}, {{ INVALID_PID,0}},INVALID_PID}; |
|---|
| 65 | |
|---|
| 66 | static VPrimer_Handle s_primer; |
|---|
| 67 | #ifndef WriteReg32 |
|---|
| 68 | #define WriteReg32(reg,val) BREG_Write32(GetREG(),reg,val) |
|---|
| 69 | #endif |
|---|
| 70 | #ifndef ReadReg32 |
|---|
| 71 | #define ReadReg32(reg) BREG_Read32(GetREG(),reg) |
|---|
| 72 | #endif |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | /* |
|---|
| 76 | Summary: |
|---|
| 77 | Create and configure rave context |
|---|
| 78 | */ |
|---|
| 79 | BERR_Code bstream_p_init_rave_ctx(bstream_t stream,int pid_ch) |
|---|
| 80 | { |
|---|
| 81 | BERR_Code berr; |
|---|
| 82 | BXPT_Rave_AvSettings AvCtxCfg; |
|---|
| 83 | if (stream->hRaveCx == NULL) |
|---|
| 84 | { |
|---|
| 85 | berr = BERR_INVALID_PARAMETER; |
|---|
| 86 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 87 | goto ExitFunc; |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | berr = BXPT_Rave_AddPidChannel(stream->hRaveCx, pid_ch, false); |
|---|
| 91 | if (BERR_SUCCESS != berr) |
|---|
| 92 | { |
|---|
| 93 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 94 | goto ExitFunc; |
|---|
| 95 | } |
|---|
| 96 | berr = BXPT_DisablePidChannel(GetXPT(), pid_ch); |
|---|
| 97 | if (BERR_SUCCESS != berr) |
|---|
| 98 | { |
|---|
| 99 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 100 | goto ExitFunc; |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | berr = BXPT_Rave_GetAvConfig(stream->hRaveCx, &AvCtxCfg); |
|---|
| 104 | if (BERR_SUCCESS != berr) |
|---|
| 105 | { |
|---|
| 106 | goto ExitFunc; |
|---|
| 107 | } |
|---|
| 108 | AvCtxCfg.InputFormat = BAVC_StreamType_eTsMpeg; |
|---|
| 109 | AvCtxCfg.OutputFormat = BAVC_StreamType_eEs; |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | /* default all EsRange off, then allow codecs to turn on what's needed */ |
|---|
| 113 | AvCtxCfg.EsRanges[0].Enable = false; |
|---|
| 114 | AvCtxCfg.EsRanges[1].Enable = false; |
|---|
| 115 | AvCtxCfg.EsRanges[2].Enable = false; |
|---|
| 116 | AvCtxCfg.EsRanges[3].Enable = false; |
|---|
| 117 | |
|---|
| 118 | switch (stream->mpeg.video[0].format) { |
|---|
| 119 | case BAVC_VideoCompressionStd_eH264: |
|---|
| 120 | AvCtxCfg.ItbFormat = BAVC_ItbEsType_eAvcVideo; |
|---|
| 121 | AvCtxCfg.StreamIdHi = 0xEF; |
|---|
| 122 | AvCtxCfg.StreamIdLo = 0xBD; |
|---|
| 123 | AvCtxCfg.EsRanges[0].RangeHi = 0xFE; /* everything */ |
|---|
| 124 | AvCtxCfg.EsRanges[0].RangeLo = 0x00; |
|---|
| 125 | AvCtxCfg.EsRanges[0].RangeIsASlice = false; |
|---|
| 126 | AvCtxCfg.EsRanges[0].Enable = true; |
|---|
| 127 | break; |
|---|
| 128 | case BAVC_VideoCompressionStd_eVC1: |
|---|
| 129 | AvCtxCfg.ItbFormat = BAVC_ItbEsType_eVc1Video; |
|---|
| 130 | AvCtxCfg.StreamIdHi = 0xEF; |
|---|
| 131 | AvCtxCfg.StreamIdLo = 0xBD; |
|---|
| 132 | AvCtxCfg.EsRanges[0].RangeHi = 0xFE; /* everything */ |
|---|
| 133 | AvCtxCfg.EsRanges[0].RangeLo = 0x00; |
|---|
| 134 | AvCtxCfg.EsRanges[0].RangeIsASlice = false; |
|---|
| 135 | AvCtxCfg.EsRanges[0].Enable = true; |
|---|
| 136 | break; |
|---|
| 137 | case BAVC_VideoCompressionStd_eMPEG2: |
|---|
| 138 | AvCtxCfg.ItbFormat = BAVC_ItbEsType_eMpeg2Video; |
|---|
| 139 | AvCtxCfg.StreamIdHi = 0xEF; |
|---|
| 140 | AvCtxCfg.StreamIdLo = 0xE0; |
|---|
| 141 | AvCtxCfg.EsRanges[0].RangeHi = 0xAF; /* MPEG slices */ |
|---|
| 142 | AvCtxCfg.EsRanges[0].RangeLo = 0x01; |
|---|
| 143 | AvCtxCfg.EsRanges[0].RangeIsASlice = true; |
|---|
| 144 | AvCtxCfg.EsRanges[0].Enable = true; |
|---|
| 145 | AvCtxCfg.EsRanges[1].RangeHi = 0xBF; /* start of frame */ |
|---|
| 146 | AvCtxCfg.EsRanges[1].RangeLo = 0xB0; |
|---|
| 147 | AvCtxCfg.EsRanges[1].RangeIsASlice = false; |
|---|
| 148 | AvCtxCfg.EsRanges[1].Enable = true; |
|---|
| 149 | AvCtxCfg.EsRanges[2].RangeHi = 0x0; /* start of picture */ |
|---|
| 150 | AvCtxCfg.EsRanges[2].RangeLo = 0x0; |
|---|
| 151 | AvCtxCfg.EsRanges[2].RangeIsASlice = false; |
|---|
| 152 | AvCtxCfg.EsRanges[2].Enable = true; |
|---|
| 153 | break; |
|---|
| 154 | |
|---|
| 155 | case BAVC_VideoCompressionStd_eMPEG4Part2: |
|---|
| 156 | AvCtxCfg.ItbFormat = BAVC_ItbEsType_eMpeg4Part2; |
|---|
| 157 | AvCtxCfg.StreamIdHi = 0xEF; |
|---|
| 158 | AvCtxCfg.StreamIdLo = 0xE0; |
|---|
| 159 | AvCtxCfg.EsRanges[0].RangeHi = 0x2F; |
|---|
| 160 | AvCtxCfg.EsRanges[0].RangeLo = 0x00; |
|---|
| 161 | AvCtxCfg.EsRanges[0].RangeIsASlice = true; |
|---|
| 162 | AvCtxCfg.EsRanges[0].Enable = true; |
|---|
| 163 | AvCtxCfg.EsRanges[1].RangeHi = 0xB8; |
|---|
| 164 | AvCtxCfg.EsRanges[1].RangeLo = 0xB0; |
|---|
| 165 | AvCtxCfg.EsRanges[1].RangeIsASlice = false; |
|---|
| 166 | AvCtxCfg.EsRanges[1].Enable = true; |
|---|
| 167 | break; |
|---|
| 168 | case BAVC_VideoCompressionStd_eAVS: |
|---|
| 169 | AvCtxCfg.ItbFormat = BAVC_ItbEsType_eAvsVideo; |
|---|
| 170 | AvCtxCfg.StreamIdHi = 0xEF; |
|---|
| 171 | AvCtxCfg.StreamIdLo = 0xE0; |
|---|
| 172 | AvCtxCfg.EsRanges[0].RangeHi = 0xAF; /* AVS slices */ |
|---|
| 173 | AvCtxCfg.EsRanges[0].RangeLo = 0x00; |
|---|
| 174 | AvCtxCfg.EsRanges[0].RangeIsASlice = true; |
|---|
| 175 | AvCtxCfg.EsRanges[0].Enable = true; |
|---|
| 176 | AvCtxCfg.EsRanges[1].RangeHi = 0xBF; /* start of frame and pictures */ |
|---|
| 177 | AvCtxCfg.EsRanges[1].RangeLo = 0xB0; |
|---|
| 178 | AvCtxCfg.EsRanges[1].RangeIsASlice = false; |
|---|
| 179 | AvCtxCfg.EsRanges[1].Enable = true; |
|---|
| 180 | break; |
|---|
| 181 | default: |
|---|
| 182 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 183 | berr = BERR_INVALID_PARAMETER; |
|---|
| 184 | goto ExitFunc; |
|---|
| 185 | } |
|---|
| 186 | #if 0 |
|---|
| 187 | |
|---|
| 188 | AvCtxCfg.InputFormat = BAVC_StreamType_eTsMpeg; |
|---|
| 189 | AvCtxCfg.OutputFormat = BAVC_StreamType_eEs; |
|---|
| 190 | AvCtxCfg.ItbFormat = BAVC_ItbEsType_eMpeg2Video; |
|---|
| 191 | AvCtxCfg.StreamIdHi = 0xEF; |
|---|
| 192 | AvCtxCfg.StreamIdLo = 0xE0; |
|---|
| 193 | AvCtxCfg.EsRanges[0].RangeHi = 0xAF; |
|---|
| 194 | AvCtxCfg.EsRanges[0].RangeLo = 0x01; |
|---|
| 195 | AvCtxCfg.EsRanges[0].RangeIsASlice = true; |
|---|
| 196 | AvCtxCfg.EsRanges[0].Enable = true; |
|---|
| 197 | AvCtxCfg.EsRanges[1].RangeHi = 0xBF; |
|---|
| 198 | AvCtxCfg.EsRanges[1].RangeLo = 0xB0; |
|---|
| 199 | AvCtxCfg.EsRanges[1].RangeIsASlice = false; |
|---|
| 200 | AvCtxCfg.EsRanges[1].Enable = true; |
|---|
| 201 | AvCtxCfg.EsRanges[2].RangeHi = 0x0; |
|---|
| 202 | AvCtxCfg.EsRanges[2].RangeLo = 0x0; |
|---|
| 203 | AvCtxCfg.EsRanges[2].RangeIsASlice = false; |
|---|
| 204 | AvCtxCfg.EsRanges[2].Enable = true; |
|---|
| 205 | AvCtxCfg.EsRanges[3].RangeHi = 0x0; |
|---|
| 206 | AvCtxCfg.EsRanges[3].RangeLo = 0x0; |
|---|
| 207 | AvCtxCfg.EsRanges[3].RangeIsASlice = false; |
|---|
| 208 | AvCtxCfg.EsRanges[3].Enable = false; |
|---|
| 209 | #endif |
|---|
| 210 | berr = BXPT_Rave_SetAvConfig(stream->hRaveCx, &AvCtxCfg); |
|---|
| 211 | if (BERR_SUCCESS != berr) |
|---|
| 212 | { |
|---|
| 213 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 214 | goto ExitFunc; |
|---|
| 215 | } |
|---|
| 216 | berr = BXPT_Rave_DisableContext(stream->hRaveCx); |
|---|
| 217 | if (BERR_SUCCESS != berr) |
|---|
| 218 | { |
|---|
| 219 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 220 | goto ExitFunc; |
|---|
| 221 | } |
|---|
| 222 | berr = BXPT_Rave_FlushContext(stream->hRaveCx); |
|---|
| 223 | if (BERR_SUCCESS != berr) |
|---|
| 224 | { |
|---|
| 225 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 226 | goto ExitFunc; |
|---|
| 227 | } |
|---|
| 228 | |
|---|
| 229 | ExitFunc: |
|---|
| 230 | return berr; |
|---|
| 231 | } |
|---|
| 232 | |
|---|
| 233 | /* |
|---|
| 234 | Summary: |
|---|
| 235 | Create the rave context for this channel |
|---|
| 236 | */ |
|---|
| 237 | |
|---|
| 238 | |
|---|
| 239 | static BERR_Code bstream_p_init_ctx(bstream_t stream, int pid_ch) |
|---|
| 240 | { |
|---|
| 241 | BERR_Code berr; |
|---|
| 242 | static BAVC_CdbItbConfig cdb_itb_config; |
|---|
| 243 | static BXPT_PcrOffset_Defaults pcrOffsetDefaults; |
|---|
| 244 | int32_t picBuflength; |
|---|
| 245 | |
|---|
| 246 | BXVD_GetBufferConfig(GetXVD(),&cdb_itb_config,&picBuflength); |
|---|
| 247 | #if 1 |
|---|
| 248 | cdb_itb_config.UsePictureCounter = true; |
|---|
| 249 | #if SUPPORT_DST_PLATFORM |
|---|
| 250 | cdb_itb_config.Cdb.Length = cdb_itb_config.Cdb.Length; /* not used HD FCC */ |
|---|
| 251 | cdb_itb_config.Itb.Length = cdb_itb_config.Itb.Length; |
|---|
| 252 | #else |
|---|
| 253 | cdb_itb_config.Cdb.Length = cdb_itb_config.Cdb.Length * 3; /* * 3 for HD FCC */ |
|---|
| 254 | cdb_itb_config.Itb.Length = cdb_itb_config.Itb.Length * 3; |
|---|
| 255 | #endif |
|---|
| 256 | cdb_itb_config.Cdb.Alignment = 8; |
|---|
| 257 | cdb_itb_config.Cdb.LittleEndian = false; |
|---|
| 258 | cdb_itb_config.Itb.Alignment = 8; |
|---|
| 259 | cdb_itb_config.Itb.LittleEndian = false; |
|---|
| 260 | #endif |
|---|
| 261 | stream->pid_ch = pid_ch; |
|---|
| 262 | |
|---|
| 263 | |
|---|
| 264 | berr = BXPT_Rave_AllocContext(GetRAVE(), BXPT_RaveCx_eAv, &cdb_itb_config, &(stream->hRaveCx)); |
|---|
| 265 | if (BERR_SUCCESS != berr) |
|---|
| 266 | { |
|---|
| 267 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 268 | return berr; |
|---|
| 269 | } |
|---|
| 270 | |
|---|
| 271 | berr = bstream_p_init_rave_ctx(stream,pid_ch); |
|---|
| 272 | if (berr != BERR_SUCCESS) |
|---|
| 273 | { |
|---|
| 274 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 275 | } |
|---|
| 276 | |
|---|
| 277 | BXPT_PcrOffset_GetChannelDefSettings(GetXPT(), 0, &pcrOffsetDefaults); |
|---|
| 278 | pcrOffsetDefaults.UsePcrTimeBase = true; |
|---|
| 279 | pcrOffsetDefaults.WhichPcr = BCHP_XPT_PCROFFSET_STC0_TIMEBASE_SEL_TIMEBASE_SEL_Timebase_0; |
|---|
| 280 | berr = BXPT_PcrOffset_Open(GetXPT(), stream->pid_ch, &pcrOffsetDefaults, &(stream->hPcrOffset)); |
|---|
| 281 | if (berr != BERR_SUCCESS) |
|---|
| 282 | { |
|---|
| 283 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 284 | } |
|---|
| 285 | |
|---|
| 286 | return berr; |
|---|
| 287 | } |
|---|
| 288 | /* |
|---|
| 289 | Summary: |
|---|
| 290 | Free the rave context for this channel |
|---|
| 291 | */ |
|---|
| 292 | |
|---|
| 293 | static void bstream_p_done(bstream_t stream) |
|---|
| 294 | { |
|---|
| 295 | if (stream->hPcrOffset) |
|---|
| 296 | { |
|---|
| 297 | BXPT_PcrOffset_Close(stream->hPcrOffset); |
|---|
| 298 | stream->hPcrOffset = NULL; |
|---|
| 299 | } |
|---|
| 300 | if (stream->hRaveCx) |
|---|
| 301 | { |
|---|
| 302 | BXPT_Rave_FreeContext(stream->hRaveCx); |
|---|
| 303 | } |
|---|
| 304 | } |
|---|
| 305 | |
|---|
| 306 | |
|---|
| 307 | /* |
|---|
| 308 | Summary: |
|---|
| 309 | For enabling streamer input. |
|---|
| 310 | */ |
|---|
| 311 | |
|---|
| 312 | bband_t bstreamer_attach(bobject_t id, bstream_mpeg_type mpeg_type) |
|---|
| 313 | { |
|---|
| 314 | return TUNER_BAND; |
|---|
| 315 | } |
|---|
| 316 | /* |
|---|
| 317 | Summary: |
|---|
| 318 | Reset mpeg program structure to the default. |
|---|
| 319 | */ |
|---|
| 320 | |
|---|
| 321 | void bstream_mpeg_init(bstream_mpeg *mpeg) |
|---|
| 322 | { |
|---|
| 323 | |
|---|
| 324 | *mpeg = s_def_stream_mpeg; |
|---|
| 325 | return; |
|---|
| 326 | } |
|---|
| 327 | /* |
|---|
| 328 | Summary: |
|---|
| 329 | Returns the current global configuration settings. |
|---|
| 330 | */ |
|---|
| 331 | |
|---|
| 332 | bresult bstream_get_config(bstream_config *config) |
|---|
| 333 | { |
|---|
| 334 | *config = s_stream_config; |
|---|
| 335 | return b_ok; |
|---|
| 336 | } |
|---|
| 337 | /* |
|---|
| 338 | Summary: |
|---|
| 339 | Sets the current global configuration settings. |
|---|
| 340 | */ |
|---|
| 341 | |
|---|
| 342 | bresult bstream_set_config(bstream_config *config) |
|---|
| 343 | { |
|---|
| 344 | s_stream_config = *config; |
|---|
| 345 | return b_ok; |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | void bstream_callback(void *data) |
|---|
| 349 | { |
|---|
| 350 | } |
|---|
| 351 | |
|---|
| 352 | #if 1 |
|---|
| 353 | /* |
|---|
| 354 | Summary: |
|---|
| 355 | Reset the PCR offset context. |
|---|
| 356 | */ |
|---|
| 357 | void bstream_p_pcroffset_update(bstream_t stream) |
|---|
| 358 | { |
|---|
| 359 | BXPT_PcrOffset_RegenOffset_isr(stream->hPcrOffset); |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | /* |
|---|
| 363 | Summary: |
|---|
| 364 | Configure the PCR offset context. |
|---|
| 365 | */ |
|---|
| 366 | |
|---|
| 367 | |
|---|
| 368 | void bstream_pcroffset_config_context(bstream_t stream) |
|---|
| 369 | { |
|---|
| 370 | BXPT_PcrOffset_Settings settings; |
|---|
| 371 | BXPT_PcrOffset_GetSettings(stream->hPcrOffset,&settings); |
|---|
| 372 | settings.PidChannelNum = stream->pcr_pid_ch; |
|---|
| 373 | #if 1 |
|---|
| 374 | settings.OffsetThreshold = 8; |
|---|
| 375 | settings.MaxPcrError = 0xFF; |
|---|
| 376 | settings.TimestampDisable = false; |
|---|
| 377 | settings.UseHostPcrs = false; |
|---|
| 378 | settings.CountMode = BXPT_PcrOffset_StcCountMode_eMod300; /* not DSS */ |
|---|
| 379 | #endif |
|---|
| 380 | BXPT_PcrOffset_SetSettings(stream->hPcrOffset,&settings); |
|---|
| 381 | } |
|---|
| 382 | |
|---|
| 383 | /* |
|---|
| 384 | Summary: |
|---|
| 385 | Configure the PCR offset pid channel. |
|---|
| 386 | */ |
|---|
| 387 | |
|---|
| 388 | |
|---|
| 389 | void bstream_p_pcroffset_pid_ch_config(bstream_t stream,int pid_ch) |
|---|
| 390 | { |
|---|
| 391 | BXPT_PcrOffset_EnableOffset(stream->hPcrOffset,pid_ch,false,true); |
|---|
| 392 | } |
|---|
| 393 | #else |
|---|
| 394 | /* |
|---|
| 395 | Summary: |
|---|
| 396 | Reset the PCR offset context. |
|---|
| 397 | */ |
|---|
| 398 | |
|---|
| 399 | void bstream_p_pcroffset_clear_status(int ch) |
|---|
| 400 | { |
|---|
| 401 | uint32_t offset = PCROFFSET_GET_CONTEXT_OFFSET(ch); |
|---|
| 402 | #if (BCHP_CHIP == 7002) || (BCHP_CHIP == 7550) || (BCHP_CHIP == 7552) |
|---|
| 403 | |
|---|
| 404 | /* invalidate offset and re-aquire */ |
|---|
| 405 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_VALID + offset, 0); |
|---|
| 406 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_STATUS_0 + offset, 0 ); |
|---|
| 407 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_STATUS_1 + offset, 0 ); |
|---|
| 408 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_STATUS_2 + offset, 0 ); |
|---|
| 409 | #elif (BCHP_CHIP == 3563) |
|---|
| 410 | WriteReg32(BCHP_XPT_PCROFFSET0_OFFSET_STATUS_0 + offset, 0 ); |
|---|
| 411 | WriteReg32(BCHP_XPT_PCROFFSET0_OFFSET_STATUS_1 + offset, 0 ); |
|---|
| 412 | #endif |
|---|
| 413 | } |
|---|
| 414 | |
|---|
| 415 | void bstream_p_pcroffset_update(bstream_t stream) |
|---|
| 416 | { |
|---|
| 417 | uint32_t Reg,offset,flags; |
|---|
| 418 | |
|---|
| 419 | offset = PCROFFSET_GET_CONTEXT_OFFSET(stream->pid_ch); |
|---|
| 420 | |
|---|
| 421 | flags = bos_enter_critical(); |
|---|
| 422 | |
|---|
| 423 | /* re write PCR Pid channel */ |
|---|
| 424 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_CONTEXT0_PP_PCR_PID_CH_NUM + offset); |
|---|
| 425 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_PP_PCR_PID_CH_NUM + offset, Reg); |
|---|
| 426 | |
|---|
| 427 | bos_exit_critical(flags); |
|---|
| 428 | } |
|---|
| 429 | |
|---|
| 430 | static void bstream_p_pcroffset_pid_ch_config(uint8_t pid_ch,int ch) |
|---|
| 431 | { |
|---|
| 432 | uint32_t Reg; |
|---|
| 433 | uint32_t RegAddr; |
|---|
| 434 | RegAddr = BCHP_XPT_PCROFFSET_PID_CONFIG_TABLE_i_ARRAY_BASE + pid_ch * sizeof(uint32_t); |
|---|
| 435 | Reg = ReadReg32(RegAddr); |
|---|
| 436 | Reg &= ~( |
|---|
| 437 | BCHP_MASK( XPT_PCROFFSET_PID_CONFIG_TABLE_i, JITTER_DIS ) | |
|---|
| 438 | BCHP_MASK( XPT_PCROFFSET_PID_CONFIG_TABLE_i, FIXED_OFFSET_EN ) | |
|---|
| 439 | BCHP_MASK( XPT_PCROFFSET_PID_CONFIG_TABLE_i, PCROFFSET_EN ) | |
|---|
| 440 | BCHP_MASK( XPT_PCROFFSET_PID_CONFIG_TABLE_i, OFFSET_INDEX ) |
|---|
| 441 | ); |
|---|
| 442 | Reg |= ( |
|---|
| 443 | BCHP_FIELD_DATA(XPT_PCROFFSET_PID_CONFIG_TABLE_i, JITTER_DIS, 0) | |
|---|
| 444 | BCHP_FIELD_DATA(XPT_PCROFFSET_PID_CONFIG_TABLE_i, FIXED_OFFSET_EN, 0) | |
|---|
| 445 | BCHP_FIELD_DATA(XPT_PCROFFSET_PID_CONFIG_TABLE_i, PCROFFSET_EN, 1 ) | |
|---|
| 446 | BCHP_FIELD_DATA(XPT_PCROFFSET_PID_CONFIG_TABLE_i, OFFSET_INDEX, ch) |
|---|
| 447 | ); |
|---|
| 448 | WriteReg32(RegAddr, Reg); |
|---|
| 449 | } |
|---|
| 450 | /* |
|---|
| 451 | Summary: |
|---|
| 452 | Configure the PCR offset context. |
|---|
| 453 | */ |
|---|
| 454 | |
|---|
| 455 | |
|---|
| 456 | void bstream_pcroffset_config_context(bstream_t stream) |
|---|
| 457 | { |
|---|
| 458 | uint32_t Reg; |
|---|
| 459 | uint32_t offset; |
|---|
| 460 | |
|---|
| 461 | BDBG_ASSERT(stream); |
|---|
| 462 | |
|---|
| 463 | if (stream->pcr_pid_ch == B_INVALID_PIDCH) |
|---|
| 464 | return; |
|---|
| 465 | |
|---|
| 466 | //printf("%s (%d,%d)\n",__FUNCTION__,stream->pid_ch,stream->pid_ch); |
|---|
| 467 | |
|---|
| 468 | offset = PCROFFSET_GET_CONTEXT_OFFSET(stream->pid_ch); |
|---|
| 469 | /* Setup STC0 as source for PCR OFFSET generation and ensure context is disabled */ |
|---|
| 470 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_CONTEXT0_PCROFFSET_CTRL + offset); |
|---|
| 471 | Reg &= ~( |
|---|
| 472 | BCHP_MASK(XPT_PCROFFSET_CONTEXT0_PCROFFSET_CTRL, STC_SEL) | |
|---|
| 473 | BCHP_MASK(XPT_PCROFFSET_CONTEXT0_PCROFFSET_CTRL, CTXT_ENABLE) |
|---|
| 474 | ); |
|---|
| 475 | /* Update PCR OFFSET after 2 successive threshold interrupts */ |
|---|
| 476 | Reg |= BCHP_MASK(XPT_PCROFFSET_CONTEXT0_PCROFFSET_CTRL, TWO_ERR_ACQ); |
|---|
| 477 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_PCROFFSET_CTRL + offset, Reg); |
|---|
| 478 | |
|---|
| 479 | /* Clear PCR OFFSET status regs */ |
|---|
| 480 | bstream_p_pcroffset_clear_status(stream->pid_ch); |
|---|
| 481 | |
|---|
| 482 | /* Reset PCR OFFSET */ |
|---|
| 483 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET + offset); |
|---|
| 484 | Reg &= ~BCHP_MASK(XPT_PCROFFSET_CONTEXT0_OFFSET, PCR_OFFSET); |
|---|
| 485 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET + offset, Reg); |
|---|
| 486 | |
|---|
| 487 | /* Invalidate PCR OFFSET VALID */ |
|---|
| 488 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_VALID + offset); |
|---|
| 489 | Reg &= ~BCHP_MASK(XPT_PCROFFSET_CONTEXT0_OFFSET_VALID, PCR_OFFSET_VALID); |
|---|
| 490 | Reg |= BCHP_FIELD_DATA(XPT_PCROFFSET_CONTEXT0_OFFSET_VALID, PCR_OFFSET_VALID, 0); |
|---|
| 491 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_VALID + offset, Reg); |
|---|
| 492 | |
|---|
| 493 | /* Setup timebase0 as source of PCR OFFSET block */ |
|---|
| 494 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_STC0_TIMEBASE_SEL); |
|---|
| 495 | Reg &= ~BCHP_MASK(XPT_PCROFFSET_STC0_TIMEBASE_SEL, TIMEBASE_SEL); |
|---|
| 496 | Reg |= BCHP_FIELD_ENUM(XPT_PCROFFSET_STC0_TIMEBASE_SEL, TIMEBASE_SEL, Timebase_0); |
|---|
| 497 | WriteReg32(BCHP_XPT_PCROFFSET_STC0_TIMEBASE_SEL, Reg); |
|---|
| 498 | |
|---|
| 499 | /* Setup threshold offset */ |
|---|
| 500 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_THRESHOLD + offset); |
|---|
| 501 | Reg &= ~BCHP_MASK(XPT_PCROFFSET_CONTEXT0_OFFSET_THRESHOLD, OFFSET_THRESHOLD); |
|---|
| 502 | Reg |= BCHP_FIELD_DATA(XPT_PCROFFSET_CONTEXT0_OFFSET_THRESHOLD, OFFSET_THRESHOLD, DEFAULT_OFFSET_THRESHOLD); |
|---|
| 503 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_THRESHOLD + offset, Reg ); |
|---|
| 504 | |
|---|
| 505 | /* Setup Maximum Error threshold */ |
|---|
| 506 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_MAX_ERROR + offset); |
|---|
| 507 | Reg &= ~BCHP_MASK(XPT_PCROFFSET_CONTEXT0_OFFSET_MAX_ERROR, MAX_ERROR); |
|---|
| 508 | Reg |= BCHP_FIELD_DATA(XPT_PCROFFSET_CONTEXT0_OFFSET_MAX_ERROR, MAX_ERROR, DEFAULT_MAX_PCR_ERROR); |
|---|
| 509 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_MAX_ERROR + offset, Reg); |
|---|
| 510 | |
|---|
| 511 | /* Setup PCR Pid channel */ |
|---|
| 512 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_CONTEXT0_PP_PCR_PID_CH_NUM + offset); |
|---|
| 513 | Reg &= ~BCHP_MASK(XPT_PCROFFSET_CONTEXT0_PP_PCR_PID_CH_NUM, PCR_PID_CH_NUM); |
|---|
| 514 | Reg |= BCHP_FIELD_DATA(XPT_PCROFFSET_CONTEXT0_PP_PCR_PID_CH_NUM, PCR_PID_CH_NUM, stream->pcr_pid_ch); |
|---|
| 515 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_PP_PCR_PID_CH_NUM + offset, Reg); |
|---|
| 516 | |
|---|
| 517 | |
|---|
| 518 | /* Put this offset context into acquire mode */ |
|---|
| 519 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_STATE + offset); |
|---|
| 520 | Reg &= ~BCHP_MASK(XPT_PCROFFSET_CONTEXT0_OFFSET_STATE, OFFSET_STATE); |
|---|
| 521 | Reg |= BCHP_FIELD_DATA(XPT_PCROFFSET_CONTEXT0_OFFSET_STATE, OFFSET_STATE, 1); |
|---|
| 522 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_OFFSET_STATE + offset, Reg); |
|---|
| 523 | |
|---|
| 524 | /* Enable the context after the config is done. */ |
|---|
| 525 | Reg = ReadReg32(BCHP_XPT_PCROFFSET_CONTEXT0_PCROFFSET_CTRL + offset); |
|---|
| 526 | Reg |= ( |
|---|
| 527 | BCHP_FIELD_DATA( XPT_PCROFFSET_CONTEXT0_PCROFFSET_CTRL, STC_SEL, 0) | |
|---|
| 528 | BCHP_FIELD_DATA( XPT_PCROFFSET_CONTEXT0_PCROFFSET_CTRL, CTXT_ENABLE, 1 ) |
|---|
| 529 | ); |
|---|
| 530 | WriteReg32(BCHP_XPT_PCROFFSET_CONTEXT0_PCROFFSET_CTRL + offset, Reg); |
|---|
| 531 | } |
|---|
| 532 | #endif |
|---|
| 533 | /* |
|---|
| 534 | Summary: |
|---|
| 535 | Configure the xpt pid channel. |
|---|
| 536 | */ |
|---|
| 537 | |
|---|
| 538 | BERR_Code bstream_p_config_xpt_pid_ch(int pid_ch, unsigned short pid, bband_t Band) |
|---|
| 539 | { |
|---|
| 540 | BERR_Code berr; |
|---|
| 541 | berr = BXPT_RequestPidChannel(GetXPT(), pid_ch); |
|---|
| 542 | if (BERR_SUCCESS != berr) |
|---|
| 543 | { |
|---|
| 544 | BDBG_MSG(("%s:%d: BXPT_RequestPidChannel already allocated. (not an error!)\n", __FILE__, __LINE__)); |
|---|
| 545 | } |
|---|
| 546 | berr = BXPT_ConfigurePidChannel(GetXPT(), pid_ch, pid, Band); |
|---|
| 547 | if (BERR_SUCCESS != berr) |
|---|
| 548 | { |
|---|
| 549 | BDBG_ERR(("%s:%d: BXPT_ConfigurePidChannel (err = %x)\n", __FILE__, __LINE__,berr)); |
|---|
| 550 | // Never free PID channels !!!! BXPT_FreePidChannel(GetXPT(), pid_ch); |
|---|
| 551 | goto ExitError; |
|---|
| 552 | } |
|---|
| 553 | berr = BXPT_EnablePidChannel(GetXPT(), pid_ch); |
|---|
| 554 | if (BERR_SUCCESS != berr) |
|---|
| 555 | { |
|---|
| 556 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 557 | goto ExitError; |
|---|
| 558 | } |
|---|
| 559 | |
|---|
| 560 | ExitError: |
|---|
| 561 | return berr; |
|---|
| 562 | } |
|---|
| 563 | |
|---|
| 564 | /* |
|---|
| 565 | Summary: |
|---|
| 566 | Find available stream. |
|---|
| 567 | */ |
|---|
| 568 | |
|---|
| 569 | static bstream_t bstream_p_find_stream(void) |
|---|
| 570 | { |
|---|
| 571 | int i; |
|---|
| 572 | |
|---|
| 573 | for (i = 0; i < BSETTOP_MAX_STREAMS; ++i) |
|---|
| 574 | { |
|---|
| 575 | if (!s_streams[i].in_use && s_streams[i].hRaveCx) |
|---|
| 576 | return(bstream_t)&s_streams[i]; |
|---|
| 577 | } |
|---|
| 578 | return NULL; |
|---|
| 579 | } |
|---|
| 580 | /* |
|---|
| 581 | Summary: |
|---|
| 582 | Config transport parser for input from band |
|---|
| 583 | */ |
|---|
| 584 | |
|---|
| 585 | static BERR_Code bstream_p_config_parser(BXPT_Handle hXpt, bband_t band) |
|---|
| 586 | { |
|---|
| 587 | BERR_Code berr; |
|---|
| 588 | BXPT_InputBandConfig ib_config; |
|---|
| 589 | BXPT_DataSource DataSource; |
|---|
| 590 | unsigned int WhichSource; |
|---|
| 591 | |
|---|
| 592 | BXPT_GetInputBandConfig(hXpt, band, &ib_config); |
|---|
| 593 | |
|---|
| 594 | /* for 700x playback to main transport parser is not possible */ |
|---|
| 595 | BXPT_P_CLEAR_PB_FLAG(band); |
|---|
| 596 | |
|---|
| 597 | ib_config.ClockPolSel = BXPT_Polarity_eActiveHigh; |
|---|
| 598 | ib_config.SyncPolSel = BXPT_Polarity_eActiveHigh; |
|---|
| 599 | ib_config.DataPolSel = BXPT_Polarity_eActiveHigh; |
|---|
| 600 | ib_config.ValidPolSel = BXPT_Polarity_eActiveHigh; |
|---|
| 601 | ib_config.ErrorPolSel = BXPT_Polarity_eActiveHigh; |
|---|
| 602 | ib_config.EnableErrorInput = false; |
|---|
| 603 | ib_config.SyncDetectEn = false; |
|---|
| 604 | ib_config.UseSyncAsValid = false; |
|---|
| 605 | ib_config.ForceValid = false; |
|---|
| 606 | ib_config.LsbFirst = false; |
|---|
| 607 | ib_config.IbPktLength = 0xbc; |
|---|
| 608 | berr = BXPT_SetInputBandConfig(hXpt, band, &ib_config); |
|---|
| 609 | if (BERR_SUCCESS != berr) |
|---|
| 610 | { |
|---|
| 611 | goto ExitError; |
|---|
| 612 | } |
|---|
| 613 | #if 1 |
|---|
| 614 | BXPT_SetParserEnable(GetXPT(),band,true); |
|---|
| 615 | #else |
|---|
| 616 | { |
|---|
| 617 | BXPT_ParserConfig pb_config; |
|---|
| 618 | berr = BXPT_GetParserConfig(hXpt, band, &pb_config); |
|---|
| 619 | if (BERR_SUCCESS != berr) |
|---|
| 620 | { |
|---|
| 621 | goto ExitError; |
|---|
| 622 | } |
|---|
| 623 | pb_config.Reg |= 0; /* we set fields directly */ |
|---|
| 624 | berr = BXPT_SetParserConfig(hXpt, band, &pb_config); |
|---|
| 625 | if (BERR_SUCCESS != berr) |
|---|
| 626 | { |
|---|
| 627 | goto ExitError; |
|---|
| 628 | } |
|---|
| 629 | } |
|---|
| 630 | #endif |
|---|
| 631 | BXPT_GetParserDataSource( hXpt, band,&DataSource,&WhichSource); |
|---|
| 632 | WhichSource = PARSER_BAND; |
|---|
| 633 | #ifdef ACB612 |
|---|
| 634 | BDBG_ASSERT(WhichSource == 5); |
|---|
| 635 | #else |
|---|
| 636 | BDBG_ASSERT(WhichSource == 1); |
|---|
| 637 | #endif |
|---|
| 638 | berr = BXPT_SetParserDataSource(hXpt, band, DataSource, WhichSource); |
|---|
| 639 | if (BERR_SUCCESS != berr) |
|---|
| 640 | { |
|---|
| 641 | goto ExitError; |
|---|
| 642 | } |
|---|
| 643 | |
|---|
| 644 | berr = BXPT_SetParserEnable(hXpt, band, true); |
|---|
| 645 | if (BERR_SUCCESS != berr) |
|---|
| 646 | { |
|---|
| 647 | goto ExitError; |
|---|
| 648 | } |
|---|
| 649 | return BERR_SUCCESS; |
|---|
| 650 | ExitError: |
|---|
| 651 | return berr; |
|---|
| 652 | } |
|---|
| 653 | /* |
|---|
| 654 | Summary: |
|---|
| 655 | Module initialization function. |
|---|
| 656 | */ |
|---|
| 657 | |
|---|
| 658 | void bstream_init(void) |
|---|
| 659 | { |
|---|
| 660 | int i; |
|---|
| 661 | BERR_Code berr = BERR_SUCCESS; |
|---|
| 662 | static bool s_bstream_init = false; |
|---|
| 663 | |
|---|
| 664 | if (s_bstream_init) |
|---|
| 665 | return; |
|---|
| 666 | |
|---|
| 667 | #if (BCHP_CHIP == 7002) |
|---|
| 668 | if (0x1000000 == MEMORY_SIZE) |
|---|
| 669 | { |
|---|
| 670 | s_stream_config.cdb_size = DEF_CDB_SIZE_SD * CDB_SCALER; |
|---|
| 671 | s_stream_config.itb_size = DEF_ITB_SIZE_SD * ITB_SCALER; |
|---|
| 672 | } |
|---|
| 673 | #endif |
|---|
| 674 | |
|---|
| 675 | vprimer_init(); |
|---|
| 676 | if (BERR_SUCCESS != vprimer_open(&s_primer)) |
|---|
| 677 | { |
|---|
| 678 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 679 | goto ExitError; |
|---|
| 680 | } |
|---|
| 681 | |
|---|
| 682 | for (i = 0; i < BSETTOP_MAX_STREAMS; ++i) |
|---|
| 683 | { |
|---|
| 684 | berr = bstream_p_init_ctx(&s_streams[i],i); |
|---|
| 685 | if (BERR_SUCCESS != berr) |
|---|
| 686 | { |
|---|
| 687 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 688 | goto ExitError; |
|---|
| 689 | } |
|---|
| 690 | } |
|---|
| 691 | s_bstream_init = true; |
|---|
| 692 | |
|---|
| 693 | |
|---|
| 694 | return; |
|---|
| 695 | ExitError: |
|---|
| 696 | for (i = 0; i < BSETTOP_MAX_STREAMS; ++i) |
|---|
| 697 | { |
|---|
| 698 | bstream_p_done(&s_streams[i]); |
|---|
| 699 | } |
|---|
| 700 | } |
|---|
| 701 | |
|---|
| 702 | /* |
|---|
| 703 | Summary: |
|---|
| 704 | Open stream and allocate transport channels |
|---|
| 705 | */ |
|---|
| 706 | |
|---|
| 707 | bstream_t bstream_open(bband_t band, const bstream_mpeg *mpeg) |
|---|
| 708 | { |
|---|
| 709 | BERR_Code berr; |
|---|
| 710 | bstream_t stream; |
|---|
| 711 | |
|---|
| 712 | BDBG_ASSERT(mpeg); |
|---|
| 713 | |
|---|
| 714 | bstream_init(); |
|---|
| 715 | |
|---|
| 716 | berr = bstream_p_config_parser(GetXPT(),band); |
|---|
| 717 | if (BERR_SUCCESS != berr) |
|---|
| 718 | { |
|---|
| 719 | BDBG_ERR(("%s bstream_p_config_parser failed\n",__func__)); |
|---|
| 720 | goto ExitError; |
|---|
| 721 | } |
|---|
| 722 | |
|---|
| 723 | stream = bstream_p_find_stream(); |
|---|
| 724 | |
|---|
| 725 | if (!stream) |
|---|
| 726 | { |
|---|
| 727 | BDBG_WRN(("%s no more streams available.\n",__FUNCTION__)); |
|---|
| 728 | goto ExitError; |
|---|
| 729 | } |
|---|
| 730 | |
|---|
| 731 | stream->band = band; |
|---|
| 732 | stream->mpeg = *mpeg; |
|---|
| 733 | stream->pcr_pid_ch = B_INVALID_PIDCH; |
|---|
| 734 | |
|---|
| 735 | if (stream->mpeg.video[0].pid != 0) |
|---|
| 736 | { |
|---|
| 737 | berr = bstream_p_config_xpt_pid_ch(stream->pid_ch,stream->mpeg.video[0].pid,stream->band); |
|---|
| 738 | if (BERR_SUCCESS != berr) |
|---|
| 739 | { |
|---|
| 740 | goto ExitError; |
|---|
| 741 | } |
|---|
| 742 | |
|---|
| 743 | if (stream->mpeg.pcr_pid == stream->mpeg.video[0].pid) |
|---|
| 744 | stream->pcr_pid_ch = stream->pid_ch; |
|---|
| 745 | // bstream_p_pcroffset_pid_ch_config(stream,stream->pid_ch); |
|---|
| 746 | } |
|---|
| 747 | if ((stream->mpeg.audio[0].pid != 0)) |
|---|
| 748 | { |
|---|
| 749 | if (stream->mpeg.pcr_pid == stream->mpeg.audio[0].pid) |
|---|
| 750 | stream->pcr_pid_ch = B_AUDIO_PIDCH; |
|---|
| 751 | } |
|---|
| 752 | |
|---|
| 753 | if ((stream->mpeg.pcr_pid != 0) && (stream->pcr_pid_ch == B_INVALID_PIDCH)) |
|---|
| 754 | { |
|---|
| 755 | BDBG_ERR(("%s:%d stream->mpeg.pcr_pid = 0x%04x, stream->pid_ch = %d", __FUNCTION__, __LINE__,stream->mpeg.pcr_pid,stream->pid_ch)); |
|---|
| 756 | stream->pcr_pid_ch = B_PCR_PIDCH + stream->pid_ch; |
|---|
| 757 | berr = bstream_p_config_xpt_pid_ch(stream->pcr_pid_ch,stream->mpeg.pcr_pid,stream->band); |
|---|
| 758 | if (BERR_SUCCESS != berr) |
|---|
| 759 | { |
|---|
| 760 | goto ExitError; |
|---|
| 761 | } |
|---|
| 762 | bstream_p_pcroffset_pid_ch_config(stream,stream->pcr_pid_ch); |
|---|
| 763 | } |
|---|
| 764 | |
|---|
| 765 | berr = BXPT_Rave_DisableContext(stream->hRaveCx); |
|---|
| 766 | if (BERR_SUCCESS != berr) |
|---|
| 767 | { |
|---|
| 768 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 769 | goto ExitError; |
|---|
| 770 | } |
|---|
| 771 | berr = BXPT_Rave_FlushContext(stream->hRaveCx); |
|---|
| 772 | if (BERR_SUCCESS != berr) |
|---|
| 773 | { |
|---|
| 774 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 775 | goto ExitError; |
|---|
| 776 | } |
|---|
| 777 | |
|---|
| 778 | berr = vprimer_attach(s_primer,stream->hRaveCx,stream->mpeg.video[0].format/*,stream->hPcrOffset*/); |
|---|
| 779 | if (BERR_SUCCESS != berr) |
|---|
| 780 | { |
|---|
| 781 | goto ExitError; |
|---|
| 782 | } |
|---|
| 783 | |
|---|
| 784 | berr = bstream_p_rave_enable(stream,true); |
|---|
| 785 | if (BERR_SUCCESS != berr) |
|---|
| 786 | { |
|---|
| 787 | goto ExitError; |
|---|
| 788 | } |
|---|
| 789 | |
|---|
| 790 | if (stream->pcr_pid_ch != B_INVALID_PIDCH) |
|---|
| 791 | { |
|---|
| 792 | bstream_p_pcr_config(GetXPT(), stream); |
|---|
| 793 | |
|---|
| 794 | /* Muliptle stream can have audio pids but share the same audio PID channel configuring prcoffset contexts with |
|---|
| 795 | width the same pcr pid channel will overright pcr_offset pid mapping table. Probably these calls are never necesarry |
|---|
| 796 | or only necessary when pcr pid is seperate from audio and video. */ |
|---|
| 797 | if ((stream->pcr_pid_ch != B_AUDIO_PIDCH) && (stream->mpeg.video[0].pid != stream->mpeg.pcr_pid)) |
|---|
| 798 | { |
|---|
| 799 | bstream_pcroffset_config_context(stream); |
|---|
| 800 | bstream_p_pcroffset_pid_ch_config(stream,stream->pcr_pid_ch); |
|---|
| 801 | } |
|---|
| 802 | } |
|---|
| 803 | |
|---|
| 804 | stream->in_use = true; |
|---|
| 805 | |
|---|
| 806 | return stream; |
|---|
| 807 | |
|---|
| 808 | ExitError: |
|---|
| 809 | if (stream) |
|---|
| 810 | bstream_close(stream); |
|---|
| 811 | return NULL; |
|---|
| 812 | } |
|---|
| 813 | /* |
|---|
| 814 | Summary: |
|---|
| 815 | Get rave context map |
|---|
| 816 | */ |
|---|
| 817 | BERR_Code bstream_p_get_rave_context_map(bstream_t stream,BAVC_XptContextMap *p_Map) |
|---|
| 818 | { |
|---|
| 819 | return BXPT_Rave_GetContextRegisters(stream->hRaveCx, p_Map); |
|---|
| 820 | } |
|---|
| 821 | /* |
|---|
| 822 | Summary: |
|---|
| 823 | Flush rave context |
|---|
| 824 | */ |
|---|
| 825 | BERR_Code bstream_p_rave_flush(bstream_t stream) |
|---|
| 826 | { |
|---|
| 827 | BERR_Code berr; |
|---|
| 828 | BDBG_ASSERT(stream); |
|---|
| 829 | BDBG_ASSERT(stream->hRaveCx); |
|---|
| 830 | berr = BXPT_Rave_FlushContext(stream->hRaveCx); |
|---|
| 831 | if (BERR_SUCCESS != berr) |
|---|
| 832 | { |
|---|
| 833 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 834 | return berr; |
|---|
| 835 | } |
|---|
| 836 | return berr; |
|---|
| 837 | } |
|---|
| 838 | /* |
|---|
| 839 | Summary: |
|---|
| 840 | Enable/Disable Rave Context |
|---|
| 841 | */ |
|---|
| 842 | BERR_Code bstream_p_rave_enable(bstream_t stream, bool enable) |
|---|
| 843 | { |
|---|
| 844 | BERR_Code rc; |
|---|
| 845 | BDBG_ASSERT(stream); |
|---|
| 846 | BDBG_ASSERT(stream->hRaveCx); |
|---|
| 847 | |
|---|
| 848 | if (enable) |
|---|
| 849 | { |
|---|
| 850 | rc = BXPT_Rave_EnableContext(stream->hRaveCx); |
|---|
| 851 | } |
|---|
| 852 | else |
|---|
| 853 | { |
|---|
| 854 | rc = BXPT_Rave_DisableContext(stream->hRaveCx); |
|---|
| 855 | } |
|---|
| 856 | if (BERR_SUCCESS != rc) |
|---|
| 857 | { |
|---|
| 858 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 859 | } |
|---|
| 860 | return rc; |
|---|
| 861 | } |
|---|
| 862 | |
|---|
| 863 | |
|---|
| 864 | /* |
|---|
| 865 | Summary: |
|---|
| 866 | Configure rave context |
|---|
| 867 | */ |
|---|
| 868 | BERR_Code bstream_p_attach_rave(bstream_t stream, bool attach) |
|---|
| 869 | { |
|---|
| 870 | BERR_Code berr; |
|---|
| 871 | BDBG_ASSERT(stream); |
|---|
| 872 | BDBG_ASSERT(stream->hRaveCx); |
|---|
| 873 | |
|---|
| 874 | if (attach) |
|---|
| 875 | { |
|---|
| 876 | berr = vprimer_detach(s_primer,stream->hRaveCx); |
|---|
| 877 | if (BERR_SUCCESS != berr) |
|---|
| 878 | { |
|---|
| 879 | goto ExitFunc; |
|---|
| 880 | } |
|---|
| 881 | } |
|---|
| 882 | else |
|---|
| 883 | { |
|---|
| 884 | berr = BXPT_Rave_DisableContext(stream->hRaveCx); |
|---|
| 885 | if (BERR_SUCCESS != berr) |
|---|
| 886 | { |
|---|
| 887 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 888 | goto ExitFunc; |
|---|
| 889 | } |
|---|
| 890 | berr = BXPT_Rave_FlushContext(stream->hRaveCx); |
|---|
| 891 | if (BERR_SUCCESS != berr) |
|---|
| 892 | { |
|---|
| 893 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 894 | goto ExitFunc; |
|---|
| 895 | } |
|---|
| 896 | /* Reattach to the CDB primer */ |
|---|
| 897 | berr = vprimer_attach(s_primer,stream->hRaveCx,stream->mpeg.video[0].format/*, stream->hPcrOffset*/); |
|---|
| 898 | if (BERR_SUCCESS != berr) |
|---|
| 899 | { |
|---|
| 900 | goto ExitFunc; |
|---|
| 901 | } |
|---|
| 902 | berr = BXPT_Rave_EnableContext(stream->hRaveCx); |
|---|
| 903 | if (BERR_SUCCESS != berr) |
|---|
| 904 | { |
|---|
| 905 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 906 | goto ExitFunc; |
|---|
| 907 | } |
|---|
| 908 | /* generate pcr offset entry */ |
|---|
| 909 | if (stream->pcr_pid_ch != B_INVALID_PIDCH) |
|---|
| 910 | { |
|---|
| 911 | bstream_pcroffset_config_context(stream); |
|---|
| 912 | } |
|---|
| 913 | } |
|---|
| 914 | |
|---|
| 915 | ExitFunc: |
|---|
| 916 | return berr; |
|---|
| 917 | |
|---|
| 918 | } |
|---|
| 919 | |
|---|
| 920 | void bstream_close(bstream_t stream) |
|---|
| 921 | { |
|---|
| 922 | BERR_Code berr; |
|---|
| 923 | berr = vprimer_detach(s_primer,stream->hRaveCx); |
|---|
| 924 | if (BERR_SUCCESS != berr) |
|---|
| 925 | { |
|---|
| 926 | BDBG_ERR(("%s:%d", __FILE__, __LINE__)); |
|---|
| 927 | } |
|---|
| 928 | bstream_p_rave_enable(stream,false); |
|---|
| 929 | berr = BXPT_DisablePidChannel(GetXPT(), stream->pid_ch); |
|---|
| 930 | // Never free PID channels !!!! BXPT_FreePidChannel(GetXPT(), stream->pid_ch); |
|---|
| 931 | if (stream->pcr_pid_ch && (stream->pcr_pid_ch != B_INVALID_PIDCH) && (stream->pcr_pid_ch != stream->pid_ch)) |
|---|
| 932 | { |
|---|
| 933 | berr = BXPT_DisablePidChannel(GetXPT(), stream->pcr_pid_ch); |
|---|
| 934 | // Never free PID channels !!!! BXPT_FreePidChannel(GetXPT(), stream->pcr_pid_ch); |
|---|
| 935 | } |
|---|
| 936 | stream->pcr_pid_ch = B_INVALID_PIDCH; |
|---|
| 937 | |
|---|
| 938 | stream->in_use = false; |
|---|
| 939 | } |
|---|
| 940 | |
|---|
| 941 | static uint32_t ts_clock_diff_avg = 0; |
|---|
| 942 | |
|---|
| 943 | bresult bstream_get_status(bstream_t stream, bstream_status *status ) |
|---|
| 944 | { |
|---|
| 945 | uint32_t ts_avg_rate; |
|---|
| 946 | uint32_t offset_valid; |
|---|
| 947 | uint32_t pcrHi,pcrLo; |
|---|
| 948 | |
|---|
| 949 | BXPT_PCR_GetLastPcr( GetDPCR(),&pcrHi,&pcrLo); |
|---|
| 950 | |
|---|
| 951 | status->band = stream->band; |
|---|
| 952 | status->mpeg = stream->mpeg; |
|---|
| 953 | status->stc = BXPT_PcrOffset_GetStc(stream->hPcrOffset) + BXPT_PcrOffset_GetOffset(stream->hPcrOffset); |
|---|
| 954 | status->pcr = pcrLo; |
|---|
| 955 | offset_valid = BXPT_PcrOffset_IsOffsetValid(stream->hPcrOffset); |
|---|
| 956 | if (ts_clock_diff_avg == 0) |
|---|
| 957 | { |
|---|
| 958 | ts_avg_rate = 0; |
|---|
| 959 | } |
|---|
| 960 | else |
|---|
| 961 | { |
|---|
| 962 | ts_avg_rate = g_running_clock.clock_freq/ts_clock_diff_avg; |
|---|
| 963 | } |
|---|
| 964 | status->tsrate = ts_avg_rate*188*8; |
|---|
| 965 | if (0 == (offset_valid & 1)) |
|---|
| 966 | { |
|---|
| 967 | return berr_timeout; |
|---|
| 968 | } |
|---|
| 969 | return b_ok; |
|---|
| 970 | } |
|---|
| 971 | #if 0 |
|---|
| 972 | struct bmessage_stream |
|---|
| 973 | { |
|---|
| 974 | int ch; |
|---|
| 975 | smessage_format format; |
|---|
| 976 | smessage_stream_params params; |
|---|
| 977 | unsigned pidch; |
|---|
| 978 | }; |
|---|
| 979 | |
|---|
| 980 | static struct bmessage_stream mstr; |
|---|
| 981 | |
|---|
| 982 | bresult bmessage_init(void *pdecode_cfgs) |
|---|
| 983 | { |
|---|
| 984 | BKNI_Memset(&mstr, 0, sizeof(struct bmessage_stream)); |
|---|
| 985 | return b_ok; |
|---|
| 986 | } |
|---|
| 987 | |
|---|
| 988 | void bmessage_uninit(void) |
|---|
| 989 | { |
|---|
| 990 | } |
|---|
| 991 | |
|---|
| 992 | #define B_INVALID_BAND ((bband_t)(-1)) |
|---|
| 993 | #define B_TSREC_0_PIDCH 2 |
|---|
| 994 | |
|---|
| 995 | bmessage_stream_t bmessage_open(smessage_format format) |
|---|
| 996 | { |
|---|
| 997 | bmessage_stream_t s; |
|---|
| 998 | switch (format) |
|---|
| 999 | { |
|---|
| 1000 | case bmessage_format_ts: |
|---|
| 1001 | s = &mstr; |
|---|
| 1002 | break; |
|---|
| 1003 | case bmessage_format_psi: |
|---|
| 1004 | s = &mstr; |
|---|
| 1005 | break; |
|---|
| 1006 | default: |
|---|
| 1007 | return NULL; /* not supported */ |
|---|
| 1008 | } |
|---|
| 1009 | |
|---|
| 1010 | if (s) |
|---|
| 1011 | { |
|---|
| 1012 | s->format = format; |
|---|
| 1013 | s->params.band = B_INVALID_BAND; |
|---|
| 1014 | s->pidch = (unsigned)(B_TSREC_0_PIDCH + s->ch); |
|---|
| 1015 | } |
|---|
| 1016 | return s; |
|---|
| 1017 | } |
|---|
| 1018 | |
|---|
| 1019 | static void b_empty_callback(void *cntxt) |
|---|
| 1020 | { |
|---|
| 1021 | return; |
|---|
| 1022 | } |
|---|
| 1023 | |
|---|
| 1024 | #define DEF_MSG_BUF_SIZE (32 * 188) |
|---|
| 1025 | #define FILTER_SIZE 16 |
|---|
| 1026 | |
|---|
| 1027 | void bmessage_stream_params_init(bmessage_stream_params *params, bmessage_stream_t stream) |
|---|
| 1028 | { |
|---|
| 1029 | unsigned int i; |
|---|
| 1030 | memset(params,0,sizeof(bmessage_stream_params)); |
|---|
| 1031 | params->band = B_INVALID_BAND; |
|---|
| 1032 | params->pid = 0; |
|---|
| 1033 | params->data_ready_callback = b_empty_callback; |
|---|
| 1034 | params->overflow = b_empty_callback; |
|---|
| 1035 | params->callback_context = NULL; |
|---|
| 1036 | params->buffer_size = DEF_MSG_BUF_SIZE; |
|---|
| 1037 | for (i = 0; i < FILTER_SIZE; i++) |
|---|
| 1038 | { |
|---|
| 1039 | params->filter.mask[i] = 0xFF; |
|---|
| 1040 | params->filter.excl[i] = 0xFF; |
|---|
| 1041 | } |
|---|
| 1042 | return; |
|---|
| 1043 | } |
|---|
| 1044 | |
|---|
| 1045 | bresult bmessage_start(bmessage_stream_t stream, const bmessage_stream_params *params) |
|---|
| 1046 | { |
|---|
| 1047 | BDBG_ERR(("Obsolete bmessage_start")); |
|---|
| 1048 | return b_ok; |
|---|
| 1049 | } |
|---|
| 1050 | |
|---|
| 1051 | bresult bmessage_get_buffer(bmessage_stream_t stream, const void ** p_bfr, size_t *length) |
|---|
| 1052 | { |
|---|
| 1053 | *p_bfr = NULL; |
|---|
| 1054 | *length = 10; |
|---|
| 1055 | BDBG_ERR(("Obsolete bmessage_get_buffer")); |
|---|
| 1056 | return b_ok; |
|---|
| 1057 | } |
|---|
| 1058 | bresult bmessage_read_complete(bmessage_stream_t stream, size_t amount_consumed) |
|---|
| 1059 | { |
|---|
| 1060 | BDBG_ERR(("Obsolete bmessage_read_complete")); |
|---|
| 1061 | return b_ok; |
|---|
| 1062 | } |
|---|
| 1063 | |
|---|
| 1064 | void bmessage_stop(bmessage_stream_t stream) |
|---|
| 1065 | { |
|---|
| 1066 | BDBG_ERR(("Obsolete bmessage_stop")); |
|---|
| 1067 | } |
|---|
| 1068 | |
|---|
| 1069 | void bmessage_close(bmessage_stream_t stream) |
|---|
| 1070 | { |
|---|
| 1071 | BDBG_ERR(("Obsolete bmessage_close")); |
|---|
| 1072 | } |
|---|
| 1073 | #endif |
|---|
| 1074 | |
|---|
| 1075 | #define RESET_FILTA 7 |
|---|
| 1076 | #define RESET_FILTB 8 |
|---|
| 1077 | #define RESET_FILTC 3 |
|---|
| 1078 | #define BXPT_PCR_TimeRef_eXpt 15 |
|---|
| 1079 | #define DEFAULT_OFFSET_THRESHOLD ( 0x08 ) |
|---|
| 1080 | #define DEFAULT_MAX_PCR_ERROR ( 0xFF ) |
|---|
| 1081 | |
|---|
| 1082 | static void bstream_p_pcr_lock2source(void) |
|---|
| 1083 | { |
|---|
| 1084 | uint32_t Reg; |
|---|
| 1085 | |
|---|
| 1086 | /* First Set Ref_Polarity to 0-None */ |
|---|
| 1087 | Reg = BREG_Read32(GetREG(), BCHP_XPT_DPCR0_LOOP_CTRL); |
|---|
| 1088 | Reg &= ~(BCHP_MASK( XPT_DPCR0_LOOP_CTRL, REF_POLARITY )); |
|---|
| 1089 | BREG_Write32( GetREG(), BCHP_XPT_DPCR0_LOOP_CTRL , Reg); |
|---|
| 1090 | |
|---|
| 1091 | /* do the follow 2 steps if time reference is non-xpt*/ |
|---|
| 1092 | /* 1) change frequency time reference in XPT_DPCR0_REF_PCR*/ |
|---|
| 1093 | /* 2) Set the packetmode to 1 for non_xpt reference*/ |
|---|
| 1094 | |
|---|
| 1095 | Reg = BREG_Read32(GetREG(), BCHP_XPT_DPCR0_LOOP_CTRL); |
|---|
| 1096 | Reg &= ~( |
|---|
| 1097 | BCHP_MASK( XPT_DPCR0_LOOP_CTRL, TIME_REF ) | |
|---|
| 1098 | BCHP_MASK( XPT_DPCR0_LOOP_CTRL, FILT_C ) | |
|---|
| 1099 | BCHP_MASK( XPT_DPCR0_LOOP_CTRL, FILT_B ) | |
|---|
| 1100 | BCHP_MASK( XPT_DPCR0_LOOP_CTRL, FILT_A ) |
|---|
| 1101 | ); |
|---|
| 1102 | Reg |= ( |
|---|
| 1103 | BCHP_FIELD_DATA( XPT_DPCR0_LOOP_CTRL, TIME_REF, BXPT_PCR_TimeRef_eXpt) | |
|---|
| 1104 | BCHP_FIELD_DATA( XPT_DPCR0_LOOP_CTRL, FILT_C, RESET_FILTC) | |
|---|
| 1105 | BCHP_FIELD_DATA( XPT_DPCR0_LOOP_CTRL, FILT_B, RESET_FILTB) | |
|---|
| 1106 | BCHP_FIELD_DATA( XPT_DPCR0_LOOP_CTRL, FILT_A, RESET_FILTA) |
|---|
| 1107 | ); |
|---|
| 1108 | BREG_Write32( GetREG(), BCHP_XPT_DPCR0_LOOP_CTRL, Reg); |
|---|
| 1109 | |
|---|
| 1110 | /* Set Ref_Polarity to 1*/ |
|---|
| 1111 | Reg = BREG_Read32(GetREG(), BCHP_XPT_DPCR0_LOOP_CTRL); |
|---|
| 1112 | Reg &= ~(BCHP_MASK( XPT_DPCR0_LOOP_CTRL, REF_POLARITY )); |
|---|
| 1113 | Reg |= BCHP_FIELD_DATA( XPT_DPCR0_LOOP_CTRL, REF_POLARITY, 1); |
|---|
| 1114 | BREG_Write32( GetREG(), BCHP_XPT_DPCR0_LOOP_CTRL , Reg); |
|---|
| 1115 | } |
|---|
| 1116 | |
|---|
| 1117 | #define XPR_PCR_DEF_MAX_PCR_ERROR 0xFF |
|---|
| 1118 | void bstream_p_pcr_config(BXPT_Handle hXpt, bstream_t stream) |
|---|
| 1119 | { |
|---|
| 1120 | uint32_t Reg; |
|---|
| 1121 | unsigned int flags; |
|---|
| 1122 | unsigned int ch; |
|---|
| 1123 | |
|---|
| 1124 | flags = bos_enter_critical(); |
|---|
| 1125 | |
|---|
| 1126 | ch = stream->pcr_pid_ch; |
|---|
| 1127 | |
|---|
| 1128 | /* Set PCR Channel and set Valid bit 0*/ |
|---|
| 1129 | Reg = BREG_Read32(GetREG(), BCHP_XPT_DPCR0_PID_CH); |
|---|
| 1130 | Reg &= ~( |
|---|
| 1131 | BCHP_MASK(XPT_DPCR0_PID_CH, PCR_PID_CH) | |
|---|
| 1132 | BCHP_MASK(XPT_DPCR0_PID_CH, PCR_PID_CH_VALID) |
|---|
| 1133 | ); |
|---|
| 1134 | Reg |= BCHP_FIELD_DATA(XPT_DPCR0_PID_CH, PCR_PID_CH, ch); |
|---|
| 1135 | BREG_Write32( GetREG(), BCHP_XPT_DPCR0_PID_CH , Reg); |
|---|
| 1136 | |
|---|
| 1137 | WriteReg32( BCHP_XPT_DPCR0_MAX_PCR_ERROR, XPR_PCR_DEF_MAX_PCR_ERROR); |
|---|
| 1138 | |
|---|
| 1139 | Reg = BREG_Read32(GetREG(), BCHP_XPT_DPCR0_CTRL); |
|---|
| 1140 | Reg &= ~( |
|---|
| 1141 | BCHP_MASK( XPT_DPCR0_CTRL, PCR_TWO_ERR_REACQUIRE_EN )| |
|---|
| 1142 | BCHP_MASK( XPT_DPCR0_CTRL, PCR_STC_LOAD_CTRL) |
|---|
| 1143 | ); |
|---|
| 1144 | Reg |= BCHP_FIELD_DATA( XPT_DPCR0_CTRL, PCR_TWO_ERR_REACQUIRE_EN, 1); |
|---|
| 1145 | BREG_Write32( GetREG(), BCHP_XPT_DPCR0_CTRL, Reg); |
|---|
| 1146 | |
|---|
| 1147 | BXPT_EnablePidChannel(hXpt, ch); |
|---|
| 1148 | |
|---|
| 1149 | /* Set the timebase select to xpt source */ |
|---|
| 1150 | bstream_p_pcr_lock2source(); |
|---|
| 1151 | |
|---|
| 1152 | /* Set PCR Valid bit to 1 */ |
|---|
| 1153 | Reg = BREG_Read32(GetREG(), BCHP_XPT_DPCR0_PID_CH ); |
|---|
| 1154 | Reg |= BCHP_FIELD_DATA(XPT_DPCR0_PID_CH, PCR_PID_CH_VALID, 1); |
|---|
| 1155 | BREG_Write32( GetREG(), BCHP_XPT_DPCR0_PID_CH, Reg); |
|---|
| 1156 | |
|---|
| 1157 | bos_exit_critical(flags); |
|---|
| 1158 | |
|---|
| 1159 | return ; |
|---|
| 1160 | } |
|---|
| 1161 | |
|---|
| 1162 | void bstream_update_mpeg(bstream_t stream, const bstream_mpeg *mpeg) |
|---|
| 1163 | { |
|---|
| 1164 | BDBG_ASSERT(stream); |
|---|
| 1165 | BDBG_ASSERT(mpeg); |
|---|
| 1166 | |
|---|
| 1167 | stream->mpeg = *mpeg; |
|---|
| 1168 | } |
|---|
| 1169 | |
|---|
| 1170 | int bstream_get_pid_ch(bstream_t stream) |
|---|
| 1171 | { |
|---|
| 1172 | if (!stream) return 0; |
|---|
| 1173 | |
|---|
| 1174 | return stream->pid_ch; |
|---|
| 1175 | } |
|---|