| [2] | 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2002, 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: tsplayer.h $ |
|---|
| 11 | * $brcm_Revision: Irvine_BSEAVSW_Devel/25 $ |
|---|
| 12 | * $brcm_Date: 11/15/02 3:44p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: Transport Stream Index Player |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /SetTop/bcmplayer/tsplayer.h $ |
|---|
| 19 | * |
|---|
| 20 | * Irvine_BSEAVSW_Devel/25 11/15/02 3:44p vsilyaev |
|---|
| 21 | * Added support for new 'stat' callback, this callback uset to get begin |
|---|
| 22 | * and end file offsets. |
|---|
| 23 | * |
|---|
| 24 | * Irvine_HDDemo_Devel\24 4/16/02 11:55a marcusk |
|---|
| 25 | * Changed parameter values to be singed. |
|---|
| 26 | * |
|---|
| 27 | * Irvine_HDDemo_Devel\23 4/16/02 10:33a marcusk |
|---|
| 28 | * Updated to use unified interface with bcmplayer. |
|---|
| 29 | * |
|---|
| 30 | * Irvine_HDDemo_Devel\2 4/16/02 1:24p erickson |
|---|
| 31 | * Removed const from reset |
|---|
| 32 | * |
|---|
| 33 | * Irvine_HDDemo_Devel\1 4/16/02 12:55p erickson |
|---|
| 34 | * Moved from SetTop/dvrtable |
|---|
| 35 | * Added reset |
|---|
| 36 | * Added version to allocate/reset |
|---|
| 37 | * |
|---|
| 38 | * |
|---|
| 39 | ***************************************************************************/ |
|---|
| 40 | #ifndef TSPLAYER_H |
|---|
| 41 | #define TSPLAYER_H |
|---|
| 42 | |
|---|
| 43 | #include "tsindexer.h" |
|---|
| 44 | #include "playertypes.h" |
|---|
| 45 | |
|---|
| 46 | #ifdef __cplusplus |
|---|
| 47 | extern "C" { |
|---|
| 48 | #endif |
|---|
| 49 | |
|---|
| 50 | typedef struct sTsPlayer sTsPlayer; |
|---|
| 51 | |
|---|
| 52 | typedef struct |
|---|
| 53 | { |
|---|
| 54 | unsigned long startOffset; /* Starting offset of data */ |
|---|
| 55 | unsigned long byteCount; /* Number of bytes to transfer */ |
|---|
| 56 | unsigned long startOffsetHi; /* 31:8 - Reserved, 7:0 - msbyte of starting address */ |
|---|
| 57 | } sTpEntry; |
|---|
| 58 | |
|---|
| 59 | /** |
|---|
| 60 | * Allocate a new sTsPlayer. |
|---|
| 61 | * |
|---|
| 62 | * Return values: |
|---|
| 63 | * NULL = error |
|---|
| 64 | * Pointer to allocated sTsPlayer. |
|---|
| 65 | **/ |
|---|
| 66 | sTsPlayer *tsplayer_allocate( |
|---|
| 67 | BP_READ_CB readCb, /* Callback tsplayer uses to read the index. |
|---|
| 68 | fread() works fine, but you can use your own callback. */ |
|---|
| 69 | BP_TELL_CB tellCb, /* Callback tsplayer uses to tell the location of the index. |
|---|
| 70 | ftell() works fine, but you can use your own callback. |
|---|
| 71 | ftello() does not work (therefore you can't have |
|---|
| 72 | >2GB indexes.) */ |
|---|
| 73 | BP_SEEK_CB seekCb, /* Callback tsplayer uses to seek to a location in the index. |
|---|
| 74 | fseek() works fine, but you can use your own callback. |
|---|
| 75 | fseeko() does not work (therefore you can't have |
|---|
| 76 | >2GB indexes.) */ |
|---|
| 77 | void *sctFp, /* Pointer to be passed to the callback functions. If you |
|---|
| 78 | are using fread()/fseek()/ftell(), then this should be the |
|---|
| 79 | corresponding FILE*. */ |
|---|
| 80 | int version /* Set compatibility version. If version == -1, |
|---|
| 81 | tsplayer will operator in its latest version. The |
|---|
| 82 | major #'s of tsindexer and tsplayer must match. */ |
|---|
| 83 | ); |
|---|
| 84 | |
|---|
| 85 | /** |
|---|
| 86 | * Reset sTsPlayer to post-allocate state. |
|---|
| 87 | * |
|---|
| 88 | * Return values: |
|---|
| 89 | * -1 on error |
|---|
| 90 | * 0 on success |
|---|
| 91 | **/ |
|---|
| 92 | int tsplayer_reset( |
|---|
| 93 | sTsPlayer *p_tsp, /* tsplayer allocated by tsplayer_alloc() */ |
|---|
| 94 | BP_READ_CB readCb, /* Callback tsplayer uses to read the index. |
|---|
| 95 | fread() works fine, but you can use your own callback. */ |
|---|
| 96 | BP_TELL_CB tellCb, /* Callback tsplayer uses to tell the location of the index. |
|---|
| 97 | ftell() works fine, but you can use your own callback. |
|---|
| 98 | ftello() does not work (therefore you can't have |
|---|
| 99 | >2GB indexes.) */ |
|---|
| 100 | BP_SEEK_CB seekCb, /* Callback tsplayer uses to seek to a location in the index. |
|---|
| 101 | fseek() works fine, but you can use your own callback. |
|---|
| 102 | fseeko() does not work (therefore you can't have |
|---|
| 103 | >2GB indexes.) */ |
|---|
| 104 | void *sctFp, /* Pointer to be passed to the callback functions. If you |
|---|
| 105 | are using fread()/fseek()/ftell(), then this should be the |
|---|
| 106 | corresponding FILE*. */ |
|---|
| 107 | int version /* Set compatibility version. If version == -1, |
|---|
| 108 | tsplayer will operator in its latest version. The |
|---|
| 109 | major #'s of tsindexer and tsplayer must match. */ |
|---|
| 110 | ); |
|---|
| 111 | |
|---|
| 112 | /** |
|---|
| 113 | * Free a sTsPlayer when done. |
|---|
| 114 | * |
|---|
| 115 | * Return values: |
|---|
| 116 | * none |
|---|
| 117 | **/ |
|---|
| 118 | void tsplayer_free( |
|---|
| 119 | sTsPlayer *p_tsp /* tsplayer allocated by tsplayer_alloc() */ |
|---|
| 120 | ); |
|---|
| 121 | |
|---|
| 122 | /** |
|---|
| 123 | * Set a parameter. See eBpParam documentation in playertypes.h for the various parameters |
|---|
| 124 | * that can be set and the corresponding meanings of paramEnum and value. |
|---|
| 125 | * |
|---|
| 126 | * Return values: |
|---|
| 127 | * 0 = success |
|---|
| 128 | * -1 = failure |
|---|
| 129 | **/ |
|---|
| 130 | int tsplayer_setParam( |
|---|
| 131 | sTsPlayer * const p_tsp, /* tsplayer allocated by tsplayer_alloc() */ |
|---|
| 132 | eBpParam param, |
|---|
| 133 | int paramEnum, |
|---|
| 134 | long value |
|---|
| 135 | ); |
|---|
| 136 | |
|---|
| 137 | /** |
|---|
| 138 | * Get a parameter. See eBpParam documentation in playertypes.h for the various parameters |
|---|
| 139 | * that can be gotten and the corresponding meanings of p_paramEnum and p_value. |
|---|
| 140 | * |
|---|
| 141 | * Return values: |
|---|
| 142 | * 0 = success |
|---|
| 143 | * -1 = failure |
|---|
| 144 | **/ |
|---|
| 145 | int tsplayer_getParam( |
|---|
| 146 | sTsPlayer * const p_tsp, /* tsplayer allocated by tsplayer_alloc() */ |
|---|
| 147 | eBpParam param, |
|---|
| 148 | int * const p_paramEnum, |
|---|
| 149 | long * const p_value |
|---|
| 150 | ); |
|---|
| 151 | |
|---|
| 152 | /** |
|---|
| 153 | * Get the offset and size of the next chunk of mpeg to be sent to the decoder. |
|---|
| 154 | * |
|---|
| 155 | * Return values: |
|---|
| 156 | * 0 = success |
|---|
| 157 | * -1 = failure |
|---|
| 158 | **/ |
|---|
| 159 | char tsplayer_getNextPlayEntry( |
|---|
| 160 | sTsPlayer * const p_tsp, /* tsplayer allocated by tsplayer_alloc() */ |
|---|
| 161 | sTpEntry * const p_tpEntry |
|---|
| 162 | ); |
|---|
| 163 | |
|---|
| 164 | /** |
|---|
| 165 | * This function enables the debuging feature of the tsplayer. |
|---|
| 166 | * When debugging is enabled, tsplayer automatically compares |
|---|
| 167 | * the stream data with the start code data it is extracting from |
|---|
| 168 | * the sct file. This feature should be used with care, as it could negatively |
|---|
| 169 | * effect performance. |
|---|
| 170 | * |
|---|
| 171 | * Return values: |
|---|
| 172 | * none |
|---|
| 173 | **/ |
|---|
| 174 | void tsplayer_verifyIndexWithStream( |
|---|
| 175 | sTsPlayer * const p_tsp, /* tsplayer allocated by tsplayer_alloc() */ |
|---|
| 176 | void *streamFp, /* file pointer to the stream file */ |
|---|
| 177 | int streamIsLE /* 0 (stream is big endian), 1 (stream is little endian) */ |
|---|
| 178 | ); |
|---|
| 179 | |
|---|
| 180 | /** |
|---|
| 181 | * This function dumps the values stored internally in the ts player. |
|---|
| 182 | * This can be used to help debug problems. |
|---|
| 183 | * |
|---|
| 184 | * Return values: |
|---|
| 185 | * none |
|---|
| 186 | **/ |
|---|
| 187 | void tsplayer_dumpDebugInfo( |
|---|
| 188 | sTsPlayer * const p_tsp /* tsplayer allocated by tsplayer_alloc() */ |
|---|
| 189 | ); |
|---|
| 190 | |
|---|
| 191 | /** |
|---|
| 192 | * Set stat callback for ts player. |
|---|
| 193 | * |
|---|
| 194 | * Return values: |
|---|
| 195 | * 0 = success |
|---|
| 196 | * -1 = failure |
|---|
| 197 | **/ |
|---|
| 198 | int tsplayer_set_statcb( |
|---|
| 199 | sTsPlayer *p_tsp, /* tsplayer allocated by tsplayer_alloc() */ |
|---|
| 200 | BP_STAT_CB statCb /* pointer to stat function */ |
|---|
| 201 | ); |
|---|
| 202 | |
|---|
| 203 | |
|---|
| 204 | #ifdef __cplusplus |
|---|
| 205 | } |
|---|
| 206 | #endif |
|---|
| 207 | |
|---|
| 208 | #endif |
|---|