| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2002-2007, 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: tspsimgr.h $ |
|---|
| 11 | * $brcm_Revision: 4 $ |
|---|
| 12 | * $brcm_Date: 1/18/07 12:10p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/lib/tspsi/tspsimgr.h $ |
|---|
| 19 | * |
|---|
| 20 | * 4 1/18/07 12:10p ahulse |
|---|
| 21 | * PR27186: Differentiate between parser and input bands. AKA, fixing |
|---|
| 22 | * bmessage from playback source |
|---|
| 23 | * |
|---|
| 24 | * 3 12/14/06 12:00p jjordan |
|---|
| 25 | * PR26473: add get timeout capability |
|---|
| 26 | * |
|---|
| 27 | * 2 10/11/05 6:23p mphillip |
|---|
| 28 | * PR17300: Increased from 32 to 64 (after all, it's only RAM) |
|---|
| 29 | * |
|---|
| 30 | * 1 2/7/05 11:34p dlwin |
|---|
| 31 | * Merge down for release 2005_REFSW_MERGETOMAIN: |
|---|
| 32 | * |
|---|
| 33 | * Irvine_BSEAVSW_Devel/3 11/4/04 1:02p erickson |
|---|
| 34 | * PR13141: added pmt pid to PMT callback |
|---|
| 35 | * |
|---|
| 36 | * Irvine_BSEAVSW_Devel/2 7/21/04 12:07p erickson |
|---|
| 37 | * PR11682: refactored so that finer-grain control is available, without |
|---|
| 38 | * breaking existing api |
|---|
| 39 | * |
|---|
| 40 | * Irvine_BSEAVSW_Devel/2 9/16/03 2:40p erickson |
|---|
| 41 | * support c++, added #ifndef wrapper |
|---|
| 42 | * include bsettop.h because this header file is not a part of the settop |
|---|
| 43 | * api, therefore |
|---|
| 44 | * it shouldn't assume it |
|---|
| 45 | * |
|---|
| 46 | * Irvine_BSEAVSW_Devel/1 9/10/03 4:33p marcusk |
|---|
| 47 | * initial version |
|---|
| 48 | * |
|---|
| 49 | ****************************************************************/ |
|---|
| 50 | #ifndef TSPSIMGR_H__ |
|---|
| 51 | #define TSPSIMGR_H__ |
|---|
| 52 | |
|---|
| 53 | #include "bsettop.h" |
|---|
| 54 | |
|---|
| 55 | #ifdef __cplusplus |
|---|
| 56 | extern "C" { |
|---|
| 57 | #endif |
|---|
| 58 | |
|---|
| 59 | typedef struct |
|---|
| 60 | { |
|---|
| 61 | uint16_t pid; |
|---|
| 62 | uint8_t streamType; |
|---|
| 63 | uint16_t ca_pid; |
|---|
| 64 | } EPID; |
|---|
| 65 | |
|---|
| 66 | #define MAX_PROGRAM_MAP_PIDS 12 |
|---|
| 67 | typedef struct |
|---|
| 68 | { |
|---|
| 69 | uint16_t program_number; |
|---|
| 70 | uint16_t map_pid; |
|---|
| 71 | uint8_t version; |
|---|
| 72 | uint16_t pcr_pid; |
|---|
| 73 | uint16_t ca_pid; |
|---|
| 74 | uint8_t num_video_pids; |
|---|
| 75 | EPID video_pids[MAX_PROGRAM_MAP_PIDS]; |
|---|
| 76 | uint8_t num_audio_pids; |
|---|
| 77 | EPID audio_pids[MAX_PROGRAM_MAP_PIDS]; |
|---|
| 78 | uint8_t num_other_pids; |
|---|
| 79 | EPID other_pids[MAX_PROGRAM_MAP_PIDS]; |
|---|
| 80 | } PROGRAM_INFO_T; |
|---|
| 81 | |
|---|
| 82 | #define MAX_PROGRAMS_PER_CHANNEL 64 |
|---|
| 83 | typedef struct |
|---|
| 84 | { |
|---|
| 85 | uint8_t version; |
|---|
| 86 | uint16_t transport_stream_id; |
|---|
| 87 | uint32_t sectionBitmap; |
|---|
| 88 | uint16_t num_programs; |
|---|
| 89 | PROGRAM_INFO_T program_info[MAX_PROGRAMS_PER_CHANNEL]; |
|---|
| 90 | } CHANNEL_INFO_T; |
|---|
| 91 | |
|---|
| 92 | /** |
|---|
| 93 | Summary: |
|---|
| 94 | Populate a CHANNEL_INFO_T structure by scanning PSI information on |
|---|
| 95 | a band. |
|---|
| 96 | |
|---|
| 97 | Description: |
|---|
| 98 | This call waits for a PAT, then waits for the PMT's for each program, |
|---|
| 99 | then builds the structure. |
|---|
| 100 | |
|---|
| 101 | If you want finer-grain control, use the other tspsimgr functions below. |
|---|
| 102 | **/ |
|---|
| 103 | bresult tsPsi_getChannelInfo( CHANNEL_INFO_T *p_chanInfo, bband_t band, bstream_t stream ); |
|---|
| 104 | |
|---|
| 105 | /** |
|---|
| 106 | Set the timeout values for various blocking operations in tspsimgr. |
|---|
| 107 | **/ |
|---|
| 108 | void tsPsi_setTimeout( int patTimeout, int pmtTimeout ); |
|---|
| 109 | |
|---|
| 110 | /** |
|---|
| 111 | Get the timeout values for various blocking operations in tspsimgr. |
|---|
| 112 | **/ |
|---|
| 113 | void tsPsi_getTimeout( int *patTimeout, int *pmtTimeout ); |
|---|
| 114 | |
|---|
| 115 | /** |
|---|
| 116 | Summary: |
|---|
| 117 | Synchronous call to read the PAT, using the patTimeout. |
|---|
| 118 | |
|---|
| 119 | Description: |
|---|
| 120 | bufferSize should be >= TS_PSI_MAX_PSI_TABLE_SIZE in order to read the PAT. |
|---|
| 121 | |
|---|
| 122 | Return Values: |
|---|
| 123 | Returns the number of bytes read. |
|---|
| 124 | -1 for an error. |
|---|
| 125 | 0 for no PAT read. |
|---|
| 126 | >0 for successful PAT read. |
|---|
| 127 | **/ |
|---|
| 128 | int tsPsi_getPAT(bband_t band, void *buffer, unsigned bufferSize, bstream_t stream ); |
|---|
| 129 | |
|---|
| 130 | /** |
|---|
| 131 | Callback used by tsPsi_getPMTs |
|---|
| 132 | **/ |
|---|
| 133 | typedef void (*tsPsi_PMT_callback)(void *context, uint16_t pmt_pid, const void *pmt, unsigned pmtSize); |
|---|
| 134 | |
|---|
| 135 | /** |
|---|
| 136 | Summary: |
|---|
| 137 | Read PMT's for each program specified in the PAT. |
|---|
| 138 | |
|---|
| 139 | Description: |
|---|
| 140 | This will launch multiple bmessage_stream's and call the callback as each |
|---|
| 141 | PMT is read. |
|---|
| 142 | **/ |
|---|
| 143 | bresult tsPsi_getPMTs(bband_t band, |
|---|
| 144 | const void *pat, unsigned patSize, |
|---|
| 145 | tsPsi_PMT_callback callback, void *context, bstream_t stream); |
|---|
| 146 | |
|---|
| 147 | /** |
|---|
| 148 | Summary: |
|---|
| 149 | Parse a PMT structure into a PROGRAM_INFO_T structure. |
|---|
| 150 | **/ |
|---|
| 151 | void tsPsi_parsePMT(const void *pmt, unsigned pmtSize, PROGRAM_INFO_T *p_programInfo); |
|---|
| 152 | |
|---|
| 153 | #ifdef __cplusplus |
|---|
| 154 | } |
|---|
| 155 | #endif |
|---|
| 156 | |
|---|
| 157 | #endif /* TSPSIMGR_H__ */ |
|---|