| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2009, 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: bsettop_pvr.h $ |
|---|
| 11 | * $brcm_Revision: 39 $ |
|---|
| 12 | * $brcm_Date: 9/29/09 4:55p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/api/include/bsettop_pvr.h $ |
|---|
| 19 | * |
|---|
| 20 | * 39 9/29/09 4:55p vsilyaev |
|---|
| 21 | * SW7405-3107: Added new member to the bplayback_status to facilitate |
|---|
| 22 | * extraction of IP timeouts |
|---|
| 23 | * |
|---|
| 24 | * 38 6/24/09 6:48p vsilyaev |
|---|
| 25 | * PR53773: Adding DTCP/IP + SSL Support in Brutus |
|---|
| 26 | * |
|---|
| 27 | * PR53773/1 6/24/09 5:22p lwhite |
|---|
| 28 | * PR53773: Adding DTCP/IP + SSL Support in Brutus |
|---|
| 29 | * |
|---|
| 30 | * 37 6/22/09 7:11p vsilyaev |
|---|
| 31 | * PR 56180: Added max_decoder_rate |
|---|
| 32 | * |
|---|
| 33 | * 36 10/31/08 9:40a jgarrett |
|---|
| 34 | * PR 47230: Adding TTS Pacing |
|---|
| 35 | * |
|---|
| 36 | * PR47230/1 10/28/08 10:37a jjordan |
|---|
| 37 | * PR47230: Port TTS Pacing to Nexus |
|---|
| 38 | * |
|---|
| 39 | * 35 8/11/08 1:44p vsilyaev |
|---|
| 40 | * PR 45431: Allowed to use id_addr field as the domain name and increased |
|---|
| 41 | * its length |
|---|
| 42 | * |
|---|
| 43 | * 34 7/21/08 2:28p jgarrett |
|---|
| 44 | * PR 45013: Removing record index and data write callbacks |
|---|
| 45 | * |
|---|
| 46 | * 33 5/5/08 5:55p vsilyaev |
|---|
| 47 | * PR 42365: Added auxilary way of setting loopmode |
|---|
| 48 | * |
|---|
| 49 | * 32 3/6/08 2:01p vsilyaev |
|---|
| 50 | * PR 36248: Pass mpeg parameters into the brecord_file_open_network and |
|---|
| 51 | * bfile_posix_out_network |
|---|
| 52 | * |
|---|
| 53 | * 31 1/30/08 10:37a vsilyaev |
|---|
| 54 | * PR 39014: Added skip count for DQR trick modes |
|---|
| 55 | * |
|---|
| 56 | * 30 1/16/08 11:54a jgarrett |
|---|
| 57 | * PR 38608: Merging to main branch |
|---|
| 58 | * |
|---|
| 59 | * 29 1/3/08 10:32a vsilyaev |
|---|
| 60 | * PR37038: PR37038: convert continuous record to use beginning_of_stream |
|---|
| 61 | * callbacks |
|---|
| 62 | * |
|---|
| 63 | * PR37038/1 12/11/07 2:51p erickson |
|---|
| 64 | * PR37038: convert continuous record to use beginning_of_stream callbacks |
|---|
| 65 | * |
|---|
| 66 | * Netaccel_Devel/1 12/18/07 6:04p ssood |
|---|
| 67 | * PR38068: added trick play related options to socket params for HTTP |
|---|
| 68 | * network trickmode support |
|---|
| 69 | * |
|---|
| 70 | * 28 8/9/07 5:49p jgarrett |
|---|
| 71 | * PR 33830: Adding network record prototypes |
|---|
| 72 | * |
|---|
| 73 | * 27 6/28/07 4:36p vsilyaev |
|---|
| 74 | * PR 32609: Added option to start playback in paused state |
|---|
| 75 | * |
|---|
| 76 | * 26 5/17/07 1:17p vsilyaev |
|---|
| 77 | * PR 30310: Added bplayback_player_mode_by_gop type |
|---|
| 78 | * |
|---|
| 79 | * 25 4/19/07 7:28p jgarrett |
|---|
| 80 | * PR 30010: Add TCP support |
|---|
| 81 | * |
|---|
| 82 | * 24 12/7/06 10:48a jgarrett |
|---|
| 83 | * PR 26293: Adding missing prototype for bplayback_ip_close. |
|---|
| 84 | * |
|---|
| 85 | * 23 11/29/06 3:57p ssood |
|---|
| 86 | * PR26252: IP STB SW unification w/ Generic Brutus release |
|---|
| 87 | * |
|---|
| 88 | * 22 11/17/06 10:43a erickson |
|---|
| 89 | * PR25230: move bcmplayer from SetTop/bcmplayer to BSEAV/lib/bcmplayer. |
|---|
| 90 | * Remove SetTop from Brutus/Settop API build. |
|---|
| 91 | * |
|---|
| 92 | * 21 10/4/06 5:59p dlwin |
|---|
| 93 | * PR24714: Add support for RTSP protocol, merged from branch. |
|---|
| 94 | * |
|---|
| 95 | * PROD_IPSTB_REFSW_Devel/13 10/3/06 4:49p jjordan |
|---|
| 96 | * PR24714: Add support for RTSP protocol |
|---|
| 97 | * |
|---|
| 98 | * 20 9/12/06 5:13p erickson |
|---|
| 99 | * PR23062: added bplayback_player_mode_by_rate |
|---|
| 100 | * |
|---|
| 101 | * 19 7/26/06 9:38a dlwin |
|---|
| 102 | * PR22906: Merged into main-line, for: Integrate liveMedia open-source |
|---|
| 103 | * for RTP and RTCP support |
|---|
| 104 | * |
|---|
| 105 | * 18 7/12/06 3:18p ahulse |
|---|
| 106 | * PR16324: get playback / record time via call to bplayback_get_status / |
|---|
| 107 | * brecord_get_status |
|---|
| 108 | * |
|---|
| 109 | * 17 4/20/06 3:45p dlwin |
|---|
| 110 | * PR17547: add basic RTP support to NET_IF DMA kernel-mode driver, merged |
|---|
| 111 | * to main branch. |
|---|
| 112 | * |
|---|
| 113 | * PROD_IPSTB_REFSW_Devel/11 4/20/06 12:54p jjordan |
|---|
| 114 | * PR17547: add basic RTP support to NET_IF DMA kernel-mode driver |
|---|
| 115 | * |
|---|
| 116 | * 16 3/6/06 3:22p erickson |
|---|
| 117 | * PR19785: added decode_mode to public api |
|---|
| 118 | * |
|---|
| 119 | * 15 3/1/06 4:52p dlwin |
|---|
| 120 | * PR18981: PR18981: fix "live playback" and add config option |
|---|
| 121 | * IP_USE_LIVE_PLAYBACK |
|---|
| 122 | * |
|---|
| 123 | * PR18981/1 3/1/06 3:24p jjordan |
|---|
| 124 | * PR18981: fix "live playback" and add config option IP_USE_LIVE_PLAYBACK |
|---|
| 125 | * |
|---|
| 126 | * 14 1/9/06 2:47p dlwin |
|---|
| 127 | * PR 14867: Update documentation to reflect that for non-legacy |
|---|
| 128 | * platforms, the SettopAPI is thread safe. |
|---|
| 129 | * |
|---|
| 130 | * 13 11/30/05 3:14p vsilyaev |
|---|
| 131 | * PR 18183: Added FIFO file support |
|---|
| 132 | * |
|---|
| 133 | * 12 11/17/05 4:23p vsilyaev |
|---|
| 134 | * PR 18183: fixed some comments |
|---|
| 135 | * |
|---|
| 136 | * 11 10/13/05 4:48p dlwin |
|---|
| 137 | * PR 17547: Created the merge arrow for IP STB. |
|---|
| 138 | * |
|---|
| 139 | * 10 10/12/05 4:37p erickson |
|---|
| 140 | * PR17547: Add support for RTP (PROD_IPSTB_REFSW_Devel) |
|---|
| 141 | * |
|---|
| 142 | * 9 8/4/05 9:08a erickson |
|---|
| 143 | * PR16504: converted playpump_params.band to |
|---|
| 144 | * playpump_params.route_through_parser_band |
|---|
| 145 | * |
|---|
| 146 | * 8 7/27/05 3:29p vsilyaev |
|---|
| 147 | * PR 16385: Merge IP record feature |
|---|
| 148 | * |
|---|
| 149 | * PROD_IPSTB_REFSW_Devel/7 8/4/05 4:12p wesleyl |
|---|
| 150 | * PR15072: remove mpeg from brecord_params |
|---|
| 151 | * |
|---|
| 152 | * PROD_IPSTB_REFSW_Devel/6 8/4/05 2:45p wesleyl |
|---|
| 153 | * PR15072: Remove unncessary recording stuffs in bplayback_param |
|---|
| 154 | * |
|---|
| 155 | * PROD_IPSTB_REFSW_Devel/5 7/25/05 6:41p wesleyl |
|---|
| 156 | * PR15072: fix comments |
|---|
| 157 | * |
|---|
| 158 | * PROD_IPSTB_REFSW_Devel/4 7/15/05 4:04p wesleyl |
|---|
| 159 | * PR15072: Add IP record support |
|---|
| 160 | * |
|---|
| 161 | * PROD_IPSTB_REFSW_Devel/3 7/13/05 4:01p wesleyl |
|---|
| 162 | * PR15072: Modify bplayback_param for IP recording |
|---|
| 163 | * |
|---|
| 164 | * PROD_IPSTB_REFSW_Devel/2 7/10/05 2:29p wesleyl |
|---|
| 165 | * PR15072: Add callback functions to brecord_ip_param |
|---|
| 166 | * |
|---|
| 167 | * PROD_IPSTB_REFSW_Devel/1 6/30/05 11:07a wesleyl |
|---|
| 168 | * PR15072: Add IP record support |
|---|
| 169 | * |
|---|
| 170 | * 7 6/9/05 3:24p erickson |
|---|
| 171 | * PR15513: all pass record is now audio pid 0 or 0x1fff. large warnings |
|---|
| 172 | * now printed. |
|---|
| 173 | * |
|---|
| 174 | * 6 5/6/05 11:15a jjordan |
|---|
| 175 | * PR15200: make IP STB buffer scheme selectable |
|---|
| 176 | * |
|---|
| 177 | * 5 4/20/05 4:55p vsilyaev |
|---|
| 178 | * PR 14724: Added option to activate use of timestamps. |
|---|
| 179 | * |
|---|
| 180 | * 4 3/18/05 3:52p erickson |
|---|
| 181 | * PR14511: updated docs |
|---|
| 182 | * |
|---|
| 183 | * 3 2/16/05 4:44p erickson |
|---|
| 184 | * PR13959: remove #if's from public header files |
|---|
| 185 | * |
|---|
| 186 | * 2 2/12/05 11:06a dlwin |
|---|
| 187 | * Merge down for release 2005_REFSW_MERGETOMAIN: |
|---|
| 188 | * |
|---|
| 189 | * Irvine_BSEAVSW_Devel/48 2/8/05 9:45a jjordan |
|---|
| 190 | * PR13959: Initial checkin of IP STB |
|---|
| 191 | * |
|---|
| 192 | * Irvine_BSEAVSW_Devel/47 2/2/05 10:08a erickson |
|---|
| 193 | * PR14006: added file_close functions for playback and record |
|---|
| 194 | * |
|---|
| 195 | * Irvine_BSEAVSW_Devel/46 11/23/04 8:33p vsilyaev |
|---|
| 196 | * PR 13351: returned back bplayback_close. |
|---|
| 197 | * |
|---|
| 198 | * Irvine_BSEAVSW_Devel/45 11/23/04 6:54p vsilyaev |
|---|
| 199 | * PR 13351: Refactoring record API. |
|---|
| 200 | * |
|---|
| 201 | * Irvine_BSEAVSW_Devel/44 11/23/04 4:40p vsilyaev |
|---|
| 202 | * PR 13351: Refactoring playback API. |
|---|
| 203 | * |
|---|
| 204 | * Irvine_BSEAVSW_Devel/BESOTFPVR/3 11/13/04 1:56p vsilyaev |
|---|
| 205 | * Separated otfpvr to backend and frontend parts. |
|---|
| 206 | * Added band to the playback parameters added contstructor for otfpvr. |
|---|
| 207 | * |
|---|
| 208 | * Irvine_BSEAVSW_Devel/BESOTFPVR/2 11/12/04 1:37p vsilyaev |
|---|
| 209 | * Refactored playback interface. |
|---|
| 210 | * |
|---|
| 211 | * Irvine_BSEAVSW_Devel/BESOTFPVR/1 10/8/04 7:59p vsilyaev |
|---|
| 212 | * Added BESPVR suport |
|---|
| 213 | * |
|---|
| 214 | * Irvine_BSEAVSW_Devel/43 8/3/04 9:20a erickson |
|---|
| 215 | * PR11124: added comment about usage of file handles |
|---|
| 216 | * |
|---|
| 217 | * Irvine_BSEAVSW_Devel/42 6/29/04 11:28a erickson |
|---|
| 218 | * PR11135: updated deprecation notices for settop api |
|---|
| 219 | * |
|---|
| 220 | * Irvine_BSEAVSW_Devel/41 6/17/04 9:36a erickson |
|---|
| 221 | * PR11135: recpump callback enabled |
|---|
| 222 | * |
|---|
| 223 | * Irvine_BSEAVSW_Devel/40 4/14/04 11:59a vsilyaev |
|---|
| 224 | * PR 10613: Removed position callback. |
|---|
| 225 | * |
|---|
| 226 | * Irvine_BSEAVSW_Devel/39 1/6/04 12:07p vsilyaev |
|---|
| 227 | * PR 8850: Fixed compile warnings for non OS. |
|---|
| 228 | * |
|---|
| 229 | * Irvine_BSEAVSW_Devel/38 12/19/03 7:41p vsilyaev |
|---|
| 230 | * PR 8850: Fixed typo. |
|---|
| 231 | * |
|---|
| 232 | * Irvine_BSEAVSW_Devel/Irvine_BSEAVSW_Devel_7038/1 11/19/03 2:58p vsilyaev |
|---|
| 233 | * Make 7038 compile |
|---|
| 234 | * |
|---|
| 235 | * Irvine_BSEAVSW_Devel/36 11/10/03 2:38p erickson |
|---|
| 236 | * PR8563: added transport timestamp support to driver, settop api and |
|---|
| 237 | * bcmplayer |
|---|
| 238 | * |
|---|
| 239 | * Irvine_BSEAVSW_Devel/35 11/7/03 4:28p erickson |
|---|
| 240 | * PR8583: removing, fixing or implementing TODO's |
|---|
| 241 | * |
|---|
| 242 | * Irvine_BSEAVSW_Devel/34 11/4/03 2:42p erickson |
|---|
| 243 | * documentation changes |
|---|
| 244 | * |
|---|
| 245 | * Irvine_BSEAVSW_Devel/33 10/31/03 2:18p erickson |
|---|
| 246 | * fixed mpegvideo slowmotion rate. 0 or 1 is normal. 2 is 2x slowmotion. |
|---|
| 247 | * |
|---|
| 248 | * Irvine_BSEAVSW_Devel/32 10/31/03 11:58a erickson |
|---|
| 249 | * settop api changes after internal review |
|---|
| 250 | * |
|---|
| 251 | * Irvine_BSEAVSW_Devel/31 10/28/03 11:26a erickson |
|---|
| 252 | * settop api reworks after internal design view |
|---|
| 253 | * |
|---|
| 254 | * Irvine_BSEAVSW_Devel/30 10/22/03 11:22a erickson |
|---|
| 255 | * settop api pass-through type conversion |
|---|
| 256 | * |
|---|
| 257 | * Irvine_BSEAVSW_Devel/29 10/15/03 10:55a erickson |
|---|
| 258 | * no longer use "closure" for is_hits. I was getting segfaults in an app |
|---|
| 259 | * (for unknown, but obviously debuggable reasons), but I just don't |
|---|
| 260 | * think this is a good way to write a simple C api. This is the only |
|---|
| 261 | * example of closure in the public api. So I removed it. |
|---|
| 262 | * Also updated some comments. |
|---|
| 263 | * |
|---|
| 264 | * Irvine_BSEAVSW_Devel/28 10/13/03 2:08p erickson |
|---|
| 265 | * moved trickmode rate code into settop api and converted from two int |
|---|
| 266 | * parameters to a float |
|---|
| 267 | * |
|---|
| 268 | * Irvine_BSEAVSW_Devel/27 10/1/03 10:16a erickson |
|---|
| 269 | * updated information for docjet |
|---|
| 270 | * |
|---|
| 271 | * Irvine_BSEAVSW_Devel/26 9/30/03 1:13a erickson |
|---|
| 272 | * updated docjet documentation |
|---|
| 273 | * |
|---|
| 274 | * Irvine_BSEAVSW_Devel/25 9/18/03 5:05p erickson |
|---|
| 275 | * reworked settop api, driver and brutus directory structure |
|---|
| 276 | * |
|---|
| 277 | * Irvine_BSEAVSW_Devel/24 9/17/03 5:04p erickson |
|---|
| 278 | * updated documentation for DocJet |
|---|
| 279 | * |
|---|
| 280 | * Irvine_BSEAVSW_Devel/23 9/8/03 5:00p erickson |
|---|
| 281 | * changed goto api to return actual locations |
|---|
| 282 | * play() no longer requires useCurrentPTS flag |
|---|
| 283 | * pipes are now nonblocking |
|---|
| 284 | * |
|---|
| 285 | * Irvine_BSEAVSW_Devel/22 9/8/03 11:20a erickson |
|---|
| 286 | * combined all status into bplayback_get_status |
|---|
| 287 | * |
|---|
| 288 | * Irvine_BSEAVSW_Devel/21 9/5/03 3:25p erickson |
|---|
| 289 | * reworked pvr api and threading model. We're now using select to block |
|---|
| 290 | * on either the driver, |
|---|
| 291 | * the command interface or a timeshifting record. We no longer use |
|---|
| 292 | * mutexes. |
|---|
| 293 | * We've removed the getParam/setParam interface and replaced it with |
|---|
| 294 | * get_index_position, |
|---|
| 295 | * get_mpeg_position, get_state, goto_index, goto_timestamp, |
|---|
| 296 | * goto_mpegoffset. It should |
|---|
| 297 | * be much more flexible. |
|---|
| 298 | * |
|---|
| 299 | * Irvine_BSEAVSW_Devel/20 9/2/03 2:26p erickson |
|---|
| 300 | * allow multiple timeshift playbacks. NOTE: the implementation is |
|---|
| 301 | * flawed...for now |
|---|
| 302 | * |
|---|
| 303 | * Irvine_BSEAVSW_Devel/19 8/28/03 1:21p erickson |
|---|
| 304 | * numBytesPlayed is tracked in the settop and not from syslib |
|---|
| 305 | * |
|---|
| 306 | * Irvine_BSEAVSW_Devel/18 8/19/03 1:42p erickson |
|---|
| 307 | * added comment for future extensions |
|---|
| 308 | * |
|---|
| 309 | * Irvine_BSEAVSW_Devel/17 8/19/03 11:54a erickson |
|---|
| 310 | * initial brutus bringup in progress |
|---|
| 311 | * |
|---|
| 312 | * Irvine_BSEAVSW_Devel/16 8/18/03 4:53p erickson |
|---|
| 313 | * timeshifting pvr now working |
|---|
| 314 | * |
|---|
| 315 | * Irvine_BSEAVSW_Devel/15 8/18/03 3:47p erickson |
|---|
| 316 | * brutus bringup, in progress |
|---|
| 317 | * |
|---|
| 318 | * Irvine_BSEAVSW_Devel/14 8/18/03 11:02a erickson |
|---|
| 319 | * initial bringup for brutus 7320, still in progress |
|---|
| 320 | * |
|---|
| 321 | * Irvine_BSEAVSW_Devel/13 8/12/03 9:43a erickson |
|---|
| 322 | * changes after pre-review meeting |
|---|
| 323 | * |
|---|
| 324 | * Irvine_BSEAVSW_Devel/12 7/30/03 2:08p erickson |
|---|
| 325 | * removed all return value comments because we're standardized and they |
|---|
| 326 | * add nothing |
|---|
| 327 | * |
|---|
| 328 | * Irvine_BSEAVSW_Devel/11 7/29/03 6:03p erickson |
|---|
| 329 | * more rework |
|---|
| 330 | * |
|---|
| 331 | * Irvine_BSEAVSW_Devel/10 7/28/03 4:43p erickson |
|---|
| 332 | * more comment work |
|---|
| 333 | * |
|---|
| 334 | * Irvine_BSEAVSW_Devel/9 7/25/03 8:14p vsilyaev |
|---|
| 335 | * open now has two arguments. |
|---|
| 336 | * |
|---|
| 337 | * Irvine_BSEAVSW_Devel/8 7/25/03 4:22p erickson |
|---|
| 338 | * in the middle of rework, does not compile |
|---|
| 339 | * |
|---|
| 340 | * Irvine_BSEAVSW_Devel/7 7/9/03 5:19p erickson |
|---|
| 341 | * rework for new bband_t model |
|---|
| 342 | * |
|---|
| 343 | * Irvine_BSEAVSW_Devel/6 6/26/03 3:59p vsilyaev |
|---|
| 344 | * Use structure to pass parameters to the playback_start function. |
|---|
| 345 | * |
|---|
| 346 | * Irvine_BSEAVSW_Devel/5 6/24/03 5:29p vsilyaev |
|---|
| 347 | * Use brecord_file_t and bplayback_file_t instead bfile_in and bfile_out. |
|---|
| 348 | * |
|---|
| 349 | * Irvine_BSEAVSW_Devel/4 6/23/03 7:13p vsilyaev |
|---|
| 350 | * Added index format to the record start. |
|---|
| 351 | * |
|---|
| 352 | * Irvine_BSEAVSW_Devel/3 6/20/03 5:56p vsilyaev |
|---|
| 353 | * Added playback support. |
|---|
| 354 | * |
|---|
| 355 | * Irvine_BSEAVSW_Devel/2 6/16/03 8:18p vsilyaev |
|---|
| 356 | * Added constructors for file_in and file_out . |
|---|
| 357 | * |
|---|
| 358 | * Irvine_BSEAVSW_Devel/1 6/13/03 3:09p vsilyaev |
|---|
| 359 | * SetTop reference API. |
|---|
| 360 | * |
|---|
| 361 | * |
|---|
| 362 | ***************************************************************************/ |
|---|
| 363 | #ifndef BSETTOP_PVR_H__ |
|---|
| 364 | #define BSETTOP_PVR_H__ |
|---|
| 365 | |
|---|
| 366 | #include "bsettop_stream.h" |
|---|
| 367 | #include "bsettop_recpump.h" |
|---|
| 368 | |
|---|
| 369 | #ifdef __cplusplus |
|---|
| 370 | extern "C" |
|---|
| 371 | { |
|---|
| 372 | #endif |
|---|
| 373 | |
|---|
| 374 | /*=********************************************************* |
|---|
| 375 | PVR (personal video recorder) is a common name for playback and record |
|---|
| 376 | of digital video using a set-top's harddrive. It is also referred to as |
|---|
| 377 | DVR (digital video recorder). |
|---|
| 378 | |
|---|
| 379 | The Settop API handles All threading, indexing and file i/o issues |
|---|
| 380 | involved in implementing PVR. We support two index formats, and you can also |
|---|
| 381 | playback with no index. Indexes are required for trick modes. |
|---|
| 382 | |
|---|
| 383 | The Settop API supports trick modes and timeshifting |
|---|
| 384 | (simultaneous playback and record of the same stream). |
|---|
| 385 | |
|---|
| 386 | For legacy platforms (ie non-Magnum platforms), the Settop API in general is not re-entrant except for explicitly allowed. |
|---|
| 387 | However, you can call bplayback_get_status and brecord_get_status from another |
|---|
| 388 | thread. |
|---|
| 389 | |
|---|
| 390 | For non-legacy platforms, the Settop API in general is thread-safe unless explicitly noted. |
|---|
| 391 | |
|---|
| 392 | ************************************************************/ |
|---|
| 393 | |
|---|
| 394 | /* Playback API */ |
|---|
| 395 | |
|---|
| 396 | /* |
|---|
| 397 | Summary: |
|---|
| 398 | Opens a new playback object. |
|---|
| 399 | */ |
|---|
| 400 | bplayback_t bplayback_open(void); |
|---|
| 401 | |
|---|
| 402 | /* |
|---|
| 403 | Summary: |
|---|
| 404 | Open an IP playback channel. |
|---|
| 405 | */ |
|---|
| 406 | bplayback_t bplayback_ip_open(void); |
|---|
| 407 | |
|---|
| 408 | |
|---|
| 409 | /* |
|---|
| 410 | Summary: |
|---|
| 411 | Close a playback object. |
|---|
| 412 | */ |
|---|
| 413 | void bplayback_close( |
|---|
| 414 | bplayback_t playback /* Handle returned by bplayback_open */ |
|---|
| 415 | ); |
|---|
| 416 | |
|---|
| 417 | |
|---|
| 418 | /* |
|---|
| 419 | Summary: |
|---|
| 420 | Close an IP playback channel. |
|---|
| 421 | */ |
|---|
| 422 | void bplayback_ip_close( |
|---|
| 423 | bplayback_t playback /* Handle returned by bplayback_ip_open */ |
|---|
| 424 | ); |
|---|
| 425 | |
|---|
| 426 | |
|---|
| 427 | /* |
|---|
| 428 | Summary: |
|---|
| 429 | Open a playback file to pass to bplayback_start(). |
|---|
| 430 | Description: |
|---|
| 431 | The bplayback_file_t can be used for only one playback at a time. |
|---|
| 432 | */ |
|---|
| 433 | bplayback_file_t bplayback_file_open( |
|---|
| 434 | const char *mpeg_file_name, /* mpeg file name. Should include path relative to the |
|---|
| 435 | current directory of the application. */ |
|---|
| 436 | const char *index_file_name /* index file name. Should include path relative to the |
|---|
| 437 | current directory of the application. |
|---|
| 438 | Can be NULL for no index. |
|---|
| 439 | The format of the index is specified in the |
|---|
| 440 | index_format member of bplayback_params. */ |
|---|
| 441 | ); |
|---|
| 442 | |
|---|
| 443 | /** |
|---|
| 444 | Close a file after playback is stopped |
|---|
| 445 | **/ |
|---|
| 446 | void bplayback_file_close( |
|---|
| 447 | bplayback_file_t file |
|---|
| 448 | ); |
|---|
| 449 | |
|---|
| 450 | |
|---|
| 451 | /** |
|---|
| 452 | Summary: |
|---|
| 453 | State of bplayback returned by bplayback_get_status. |
|---|
| 454 | **/ |
|---|
| 455 | typedef enum bplayback_state { |
|---|
| 456 | bplayback_state_stopped, /* Not started or stopped. */ |
|---|
| 457 | bplayback_state_playing, /* Normal playback */ |
|---|
| 458 | bplayback_state_paused, /* Decode is paused but can be resumed. */ |
|---|
| 459 | bplayback_state_trickmode, /* Some variety of trick mode in progress. */ |
|---|
| 460 | bplayback_state_frameadvance /* In a paused state, but a frame advance is either |
|---|
| 461 | in progress or has been done since the pause. */ |
|---|
| 462 | } bplayback_state; |
|---|
| 463 | |
|---|
| 464 | /* |
|---|
| 465 | Summary: |
|---|
| 466 | PVR index formats. |
|---|
| 467 | */ |
|---|
| 468 | typedef enum bindex_format { |
|---|
| 469 | bindex_format_none, /* no index */ |
|---|
| 470 | bindex_format_sct, /* start code index created by hardware and |
|---|
| 471 | playable with tsplayer. See bcmplayer source and docs. */ |
|---|
| 472 | bindex_format_bcm /* Broadcom index created by bcmindexer and |
|---|
| 473 | playable with bcmplayer. See bcmplayer source and docs.*/ |
|---|
| 474 | } bindex_format; |
|---|
| 475 | |
|---|
| 476 | /** |
|---|
| 477 | Summary: |
|---|
| 478 | bplayback_loopmode is a value you can return from the end_of_file or beginning_of_file |
|---|
| 479 | callbacks to tell the playback engine what action to take. |
|---|
| 480 | |
|---|
| 481 | Description: |
|---|
| 482 | We implemented loopmode as a callback because the app may take different actions |
|---|
| 483 | at different times and because the app might need to be notified when |
|---|
| 484 | loops take place. This accomplishes both. |
|---|
| 485 | **/ |
|---|
| 486 | typedef enum bplayback_loopmode { |
|---|
| 487 | bplayback_loopmode_loop, /* Loop to the other end of the stream */ |
|---|
| 488 | bplayback_loopmode_pause, /* Pause the decode at the current spot */ |
|---|
| 489 | bplayback_loopmode_play /* Resume normal play at the beginning or pause at |
|---|
| 490 | the end. */ |
|---|
| 491 | } bplayback_loopmode; |
|---|
| 492 | |
|---|
| 493 | /** |
|---|
| 494 | Summary: |
|---|
| 495 | bplayback_position is passed on bplayback_callback's position callback. |
|---|
| 496 | |
|---|
| 497 | Description: |
|---|
| 498 | You can read various types of position information. The pointer members should |
|---|
| 499 | be tested for NULL first. If not NULL, then you can dereference them and read |
|---|
| 500 | valid values. Non-pointer members are always valid. |
|---|
| 501 | **/ |
|---|
| 502 | typedef struct bplayback_position { |
|---|
| 503 | off_t mpeg_file_offset; /* Position in the mpeg file. */ |
|---|
| 504 | bool has_index; /* If true, then the following index position values |
|---|
| 505 | are valid. */ |
|---|
| 506 | unsigned long index_offset; /* Offset of the current index entry in the index. |
|---|
| 507 | Only valid if has_index is true */ |
|---|
| 508 | unsigned long timestamp; /* Timestamp of the current index entry in the index. |
|---|
| 509 | Timestamp is different from PTS. Timestamp is generated |
|---|
| 510 | by bcmindexer, it begins at 0 for any recorded stream, |
|---|
| 511 | and is guaranteed to be continuous increasing throughout |
|---|
| 512 | the stream. The units of the timestamp depend on the |
|---|
| 513 | implementation of bcmindexer, but they are defaulted |
|---|
| 514 | to milliseconds. |
|---|
| 515 | Only valid if has_index is true */ |
|---|
| 516 | } bplayback_position; |
|---|
| 517 | |
|---|
| 518 | /* |
|---|
| 519 | Summary: |
|---|
| 520 | This strcuture is used to communicate the buffering scheme employed by the IP STB |
|---|
| 521 | */ |
|---|
| 522 | typedef enum bplayback_ip_buffer_scheme { |
|---|
| 523 | bplayback_ip_buffer_scheme_precharge, /* precharge the buffer only */ |
|---|
| 524 | bplayback_ip_buffer_scheme_stc_clock_steering /* steer the STC clock in response to buffer violations */ |
|---|
| 525 | } bplayback_ip_buffer_scheme; |
|---|
| 526 | |
|---|
| 527 | typedef struct bplayback_ip_params { |
|---|
| 528 | bplayback_ip_buffer_scheme buffer_scheme; |
|---|
| 529 | bool use_live_playback_mode; |
|---|
| 530 | } bplayback_ip_params; |
|---|
| 531 | |
|---|
| 532 | typedef struct bplayback_tts_params { |
|---|
| 533 | bool auto_detect; /* automatically detect if the stream is TTS or TS */ |
|---|
| 534 | unsigned long pacing_max_error; /* set the timestamp error bound, as used by the playback pacing logic */ |
|---|
| 535 | unsigned init_buf_depth; /* sets the initial buffer depth before playback begins, as used by the playback pacing logic */ |
|---|
| 536 | unsigned min_buf_depth; /* minimum buffer depth before tts throttle buffer depth violation */ |
|---|
| 537 | unsigned max_buf_depth; /* maximum buffer depth before tts throttle buffer depth violation */ |
|---|
| 538 | unsigned max_clock_mismatch; /* specify the maximum clock mismatch (in ppm) between server/encoder and STB */ |
|---|
| 539 | } bplayback_tts_params; |
|---|
| 540 | /* |
|---|
| 541 | Summary: |
|---|
| 542 | This structure used to communicate initial parameters to the |
|---|
| 543 | playback_start function. |
|---|
| 544 | */ |
|---|
| 545 | typedef struct bplayback_params { |
|---|
| 546 | int starting_index_offset; /* Offset into the index at which playback is to start. The meaning of the |
|---|
| 547 | offset depends on index format. -1 means end of file. */ |
|---|
| 548 | bindex_format index_format; /* Index format for the index_file_name passed to bplayback_file_open. */ |
|---|
| 549 | bool timestamp_enabled; /* If true, then a 4 byte timestamp has been prepended to every |
|---|
| 550 | transport packet. brecord_params.timestamp_enabled |
|---|
| 551 | must match. */ |
|---|
| 552 | |
|---|
| 553 | void *callback_context; /* Context pointer which is returned in the callback functions. |
|---|
| 554 | This could be the bplayback_t handle, or anything you'd like. */ |
|---|
| 555 | bplayback_loopmode (*end_of_stream)(void *context); /* Called out of the internal playback thread whenever |
|---|
| 556 | it reaches the end of the stream. You cannot call a settop api |
|---|
| 557 | function from this callback. */ |
|---|
| 558 | bplayback_loopmode (*beginning_of_stream)(void *context); /* Called out of the internal playback thread whenever |
|---|
| 559 | it reaches the beginning of the stream. You cannot call a settop api |
|---|
| 560 | function from this callback. */ |
|---|
| 561 | void (*error)(void *context); /* Called out of the internal playback thread whenever |
|---|
| 562 | the a fatal error happens. This means that the playback is about to be stopped. |
|---|
| 563 | You cannot call a settop api function from this callback. */ |
|---|
| 564 | bool route_through_parser_band; /* if true, playback shall be routed through a parser band */ |
|---|
| 565 | bool timestamp_active; /* use timestamps to dynamicaly control playback rate (pacing) */ |
|---|
| 566 | bool start_paused; /* start playback in paused state, bplayback_play function could be used to resume playback */ |
|---|
| 567 | bplayback_tts_params tts_params; |
|---|
| 568 | bplayback_ip_params ip_params; |
|---|
| 569 | struct { |
|---|
| 570 | bplayback_loopmode end_of_stream; /* shall match value returned by end_of_stream callback */ |
|---|
| 571 | bplayback_loopmode beginning_of_stream; /* shall match value returned by beginning_of_stream callback */ |
|---|
| 572 | } loopmode; |
|---|
| 573 | } bplayback_params; |
|---|
| 574 | |
|---|
| 575 | /* |
|---|
| 576 | Summary: |
|---|
| 577 | Required to initialize the bplayback_params structure. |
|---|
| 578 | */ |
|---|
| 579 | void |
|---|
| 580 | bplayback_params_init( |
|---|
| 581 | bplayback_params *params, /* [out] */ |
|---|
| 582 | bplayback_t playback /* required for possible resource-dependent defaults */ |
|---|
| 583 | ); |
|---|
| 584 | |
|---|
| 585 | /* |
|---|
| 586 | Summary: |
|---|
| 587 | Configures playback to be started (NOTE: does not actually start playback). |
|---|
| 588 | |
|---|
| 589 | Description: |
|---|
| 590 | If bplayback_start succeeds, it returns a digital stream handle which can |
|---|
| 591 | be decoded or recorded. |
|---|
| 592 | |
|---|
| 593 | Playback does not actually begin until the stream has a consumer. |
|---|
| 594 | Consumers could be decode or record or loopback through a live band. |
|---|
| 595 | */ |
|---|
| 596 | bstream_t bplayback_start( |
|---|
| 597 | bplayback_t playback, /* Handle returned by bplayback_open */ |
|---|
| 598 | bplaypump_t playpump, /* playpump object used to feed data into the system */ |
|---|
| 599 | const bstream_mpeg *mpeg, /* MPEG settings for the source */ |
|---|
| 600 | bplayback_file_t source, /* Source for the data */ |
|---|
| 601 | const bplayback_params *params /* pointer to the playback parameters */ |
|---|
| 602 | ); |
|---|
| 603 | |
|---|
| 604 | /* |
|---|
| 605 | Summary: |
|---|
| 606 | Configure playback to start in timeshifting mode. |
|---|
| 607 | |
|---|
| 608 | Description: |
|---|
| 609 | Timeshifting mode is when you are playing a stream that you are also recording. |
|---|
| 610 | The benefit of having an explicit timeshifting mode is that when playback |
|---|
| 611 | is tight to the end of the file and is waiting for data, it can go to sleep |
|---|
| 612 | until another record event happens. This reduces CPU load. |
|---|
| 613 | */ |
|---|
| 614 | bstream_t bplayback_start_timeshifting( |
|---|
| 615 | bplayback_t playback, /* Handle returned by bplayback_open */ |
|---|
| 616 | bplaypump_t playpump, /* playpump object used to feed data into the system */ |
|---|
| 617 | const bstream_mpeg *mpeg, /* MPEG settings for the source */ |
|---|
| 618 | bplayback_file_t source, /* source for the data */ |
|---|
| 619 | const bplayback_params *params, /* pointer to the playback parameters */ |
|---|
| 620 | brecord_t record /* Active record to which this playback is linked. */ |
|---|
| 621 | ); |
|---|
| 622 | |
|---|
| 623 | /* |
|---|
| 624 | Summary: |
|---|
| 625 | Stop timeshifting but do not stop playback. |
|---|
| 626 | |
|---|
| 627 | Description: |
|---|
| 628 | This function is only required to be called if you want to stop |
|---|
| 629 | record before stopping timeshifting playback. If you try to stop |
|---|
| 630 | record while still timeshifting, brecord_stop() will fail. |
|---|
| 631 | */ |
|---|
| 632 | bresult bplayback_stop_timeshifting( |
|---|
| 633 | bplayback_t playback /* Handle returned by bplayback_open */ |
|---|
| 634 | ); |
|---|
| 635 | |
|---|
| 636 | /* |
|---|
| 637 | Summary: |
|---|
| 638 | Stop playback. |
|---|
| 639 | Description: |
|---|
| 640 | If you are decoding the stream, the decode will be stopped as well. |
|---|
| 641 | */ |
|---|
| 642 | bresult bplayback_stop(bplayback_t playback); |
|---|
| 643 | |
|---|
| 644 | /* |
|---|
| 645 | Summary: |
|---|
| 646 | Mode for bcmplayer or tsplayer. |
|---|
| 647 | Description: |
|---|
| 648 | This translated to eBpPlayModeParam in BSEAV/lib/bcmplayer/include/playertypes.h. |
|---|
| 649 | */ |
|---|
| 650 | typedef enum bplayback_player_mode { |
|---|
| 651 | bplayback_player_mode_normal, /* Play all frames in the forward direction. "value" is forced to be 1. */ |
|---|
| 652 | bplayback_player_mode_i, /* Play Only I Frames. "value" is the number of I-frames to advance |
|---|
| 653 | each time, and can be positive or negative. |
|---|
| 654 | Note that this is the only valid reverse mode apart from Broadcom |
|---|
| 655 | Trick Modes (eBpPlayBrcm). */ |
|---|
| 656 | bplayback_player_mode_skip_b, /* Skip B frames. "value" is the number of |
|---|
| 657 | B's that should be shown before a single skip. For example, 1 |
|---|
| 658 | would mean play every-other B frame. If value >= the total |
|---|
| 659 | B's in a GOP, it is equivalent to eBpPlayNormal. */ |
|---|
| 660 | bplayback_player_mode_ip, /* Play all I and P Frames. Skip all B's. "value" is ignored. This can |
|---|
| 661 | by used with GOP-based or HITS streams. */ |
|---|
| 662 | bplayback_player_mode_skip_p, /* Skip trailing P frames in a GOP. |
|---|
| 663 | "value" is equal to the number of P's to be played per GOP. |
|---|
| 664 | If value >= the total P's in a GOP, it is equivalent to |
|---|
| 665 | eBpPlayIP. |
|---|
| 666 | Not supported in tsplayer. */ |
|---|
| 667 | bplayback_player_mode_brcm, /* Broadcom's Mpeg Trick Mode playback algorithm. |
|---|
| 668 | "value" is the number of frames to advance each time. It can be positive |
|---|
| 669 | or negative. A value of 1 is not allowed. |
|---|
| 670 | |
|---|
| 671 | However, for performance reasons we recommend only using values 2, -3,-2 and |
|---|
| 672 | -1 for GOP-based trick modes that can't be obtained from other modes, |
|---|
| 673 | otherwise use the other modes. |
|---|
| 674 | Not supported in tsplayer. */ |
|---|
| 675 | bplayback_player_mode_by_gop, /* Player will send portions of GOP's to decoder. |
|---|
| 676 | Display queue trick modes will be used in reverse. |
|---|
| 677 | "value" is the number of pictures per GOP to send. If value is negative, |
|---|
| 678 | then it is reverse. */ |
|---|
| 679 | bplayback_player_mode_by_rate /* The application specifies a rate. The Settop API, using player, |
|---|
| 680 | decoder, STC and any other means tries to achieve that exact rate. |
|---|
| 681 | "value" is the rate, in units of BPLAYBACK_NORMALPLAY_SPEED. */ |
|---|
| 682 | } bplayback_player_mode; |
|---|
| 683 | |
|---|
| 684 | /* |
|---|
| 685 | Summary: |
|---|
| 686 | All parameters needed to specify a trick mode. |
|---|
| 687 | */ |
|---|
| 688 | typedef struct bplayback_trickmode_params { |
|---|
| 689 | bplayback_player_mode mode; /* Basic type of trick mode to perform. */ |
|---|
| 690 | int mode_modifier; /* Each trick mode has a potential modifier. See the |
|---|
| 691 | bplayback_player_mode docs for more details. */ |
|---|
| 692 | unsigned slow_motion_rate; /* A slow motion rate can be added on to any trick mode. |
|---|
| 693 | It specifies the number of times the decoder should display each |
|---|
| 694 | field for a slow motion effect. Therefore 2 is a 2x slow |
|---|
| 695 | motion, 3 is a 3x slow motion, etc. 0 or 1 is no slow motion. */ |
|---|
| 696 | bplaypump_decode_mode decode_mode; /* decoder mode, instructs decoder to drop certains types of pictures */ |
|---|
| 697 | unsigned gop_skip_count; /* This parameter is used for DQT. It describes the number of gops to skip after a gop has been sent to decoder*/ |
|---|
| 698 | unsigned maxDecoderRate; /* Maximum fast playnack rate supported by the decoder, defined in BPLAYBACK_NORMALPLAY_SPEED units. |
|---|
| 699 | For forward rates up to this rate, implementation would feed entire stream to the decoders and then use either STC trick modes |
|---|
| 700 | or host paced trickmode, to achieve the target rate. |
|---|
| 701 | However, decoder bandwidth may prevent the system for achieving the desired rate. |
|---|
| 702 | The maximum rate varies based on hardware capabilities and stream encoding. |
|---|
| 703 | Because of this the application can tell Playback what exactly rate is expected to be supported. */ |
|---|
| 704 | } bplayback_trickmode_params; |
|---|
| 705 | |
|---|
| 706 | /* |
|---|
| 707 | Summary: |
|---|
| 708 | Required to initialize bplayback_trickmode_params |
|---|
| 709 | */ |
|---|
| 710 | void |
|---|
| 711 | bplayback_trickmode_params_init(bplayback_trickmode_params *params); |
|---|
| 712 | |
|---|
| 713 | /* |
|---|
| 714 | Summary: |
|---|
| 715 | Status returned by bplayback_get_status |
|---|
| 716 | */ |
|---|
| 717 | typedef struct bplayback_status { |
|---|
| 718 | bplayback_position position; /* Current position of playback. */ |
|---|
| 719 | off_t mpeg_file_size; /* Size of the mpeg file in bytes */ |
|---|
| 720 | bool has_index; /* Will be true if an index_file_name was passed |
|---|
| 721 | to bplayback_file_open and the |
|---|
| 722 | bplayback_params.index_format was not bindex_none. */ |
|---|
| 723 | unsigned long index_first_offset; /* First index offset. For non-circular files, this is always 0. */ |
|---|
| 724 | unsigned long index_last_offset; /* Last valid index offset. |
|---|
| 725 | index_last_offset-index_first_offset+1 == total index entries. */ |
|---|
| 726 | bplayback_state state; /* Current state of playback */ |
|---|
| 727 | bplayback_trickmode_params trickmode_params; /* Current trick mode params if state is |
|---|
| 728 | bplayback_trickmode. */ |
|---|
| 729 | unsigned long fifo_depth; /* Depth in bytes of the playback buffer */ |
|---|
| 730 | unsigned long fifo_size; /* Size in bytes of the playback buffer */ |
|---|
| 731 | off_t bytes_played; /* Total number of bytes played since starting */ |
|---|
| 732 | unsigned long first_timestamp; /* first timestamp if stream played - time in mSecs */ |
|---|
| 733 | unsigned long last_timestamp; /* last timestamp of stream played - time in mSecs */ |
|---|
| 734 | |
|---|
| 735 | unsigned num_read_errors; /* number of errors occurred when reading data from the mpeg file, for the case of network feed timeouts are also considered as errors */ |
|---|
| 736 | } bplayback_status; |
|---|
| 737 | |
|---|
| 738 | /* |
|---|
| 739 | Summary: |
|---|
| 740 | Get a variety of information about the status of playback |
|---|
| 741 | Description: |
|---|
| 742 | It will synchronize with the play thread, so it may block. |
|---|
| 743 | Index information will only be populated if there is an index. |
|---|
| 744 | It can only be called after playback has started. |
|---|
| 745 | */ |
|---|
| 746 | bresult bplayback_get_status( |
|---|
| 747 | bplayback_t p, |
|---|
| 748 | bplayback_status *status /* [out] */ |
|---|
| 749 | ); |
|---|
| 750 | |
|---|
| 751 | /* |
|---|
| 752 | Summary: |
|---|
| 753 | Pause playback after it has started. |
|---|
| 754 | Description: |
|---|
| 755 | It can only be called after playback has started. |
|---|
| 756 | */ |
|---|
| 757 | bresult bplayback_pause(bplayback_t p); |
|---|
| 758 | |
|---|
| 759 | /* |
|---|
| 760 | Summary: |
|---|
| 761 | Have the playback get as close as possible to the record data |
|---|
| 762 | when timeshifting. |
|---|
| 763 | Description: |
|---|
| 764 | This puts playback into normal play mode. |
|---|
| 765 | It can only be called after playback has started. |
|---|
| 766 | */ |
|---|
| 767 | bresult bplayback_catchup_record(bplayback_t p); |
|---|
| 768 | |
|---|
| 769 | /* |
|---|
| 770 | Summary: |
|---|
| 771 | Resume normal playback from pause or trick mode. |
|---|
| 772 | Description: |
|---|
| 773 | It can only be called after playback has started. |
|---|
| 774 | */ |
|---|
| 775 | bresult bplayback_play(bplayback_t p); |
|---|
| 776 | |
|---|
| 777 | /* |
|---|
| 778 | Summary: |
|---|
| 779 | If you are paused, this will advance or reverse one frame. |
|---|
| 780 | Description: |
|---|
| 781 | It can only be called after playback has started. |
|---|
| 782 | */ |
|---|
| 783 | bresult bplayback_frameadvance( |
|---|
| 784 | bplayback_t p, |
|---|
| 785 | bplayback_player_mode playermode, /* For forward, this should be bplayback_player_mode_normal. |
|---|
| 786 | For reverse, it can be either _i or _brcm. */ |
|---|
| 787 | bool forward /* is it forward? otherwise, reverse. */ |
|---|
| 788 | ); |
|---|
| 789 | |
|---|
| 790 | /* |
|---|
| 791 | Summary: |
|---|
| 792 | Set a trick mode, either fast or slow, forward or reverse. |
|---|
| 793 | Description: |
|---|
| 794 | It can only be called after playback has started. |
|---|
| 795 | */ |
|---|
| 796 | bresult bplayback_trickmode( |
|---|
| 797 | bplayback_t p, |
|---|
| 798 | const bplayback_trickmode_params *trickmode |
|---|
| 799 | ); |
|---|
| 800 | |
|---|
| 801 | /* |
|---|
| 802 | Summary: |
|---|
| 803 | Determine a trick mode using a rate. |
|---|
| 804 | |
|---|
| 805 | Description: |
|---|
| 806 | Use multiples or divisions of BPLAYBACK_NORMALPLAY_SPEED to specify a rate. |
|---|
| 807 | |
|---|
| 808 | Integer rates specify fast trick modes from a pre-determined table. As the rate |
|---|
| 809 | increases, the trick mode used will be faster, but it is no guarantee of actual speed. |
|---|
| 810 | A rate of 2 is the 2nd fast forward speed, and a rate of 3 is the 3rd fast forward |
|---|
| 811 | speed, which is faster than the 2nd. |
|---|
| 812 | |
|---|
| 813 | Fractional rates specify slow trick modes. |
|---|
| 814 | For instance: 0.5 is 2x slow motion. |
|---|
| 815 | |
|---|
| 816 | Negative rates are reverse, positive rates are forward. |
|---|
| 817 | |
|---|
| 818 | If you want exact rate (i.e. 7x will fast forward in exactly 7 times normal play), |
|---|
| 819 | you must use a brcm trick mode, or must use a host trick mode and decoder slow |
|---|
| 820 | motion based on your specific GOP structure. In this case, do not use this |
|---|
| 821 | function and populate the bplayback_trickmode_params structure directly. |
|---|
| 822 | This function does not provide exact rates nor is it intended to. |
|---|
| 823 | */ |
|---|
| 824 | bresult bplayback_get_trickmode_by_rate( |
|---|
| 825 | bplayback_t p, |
|---|
| 826 | int rate, /* The rate parameter should be used with the |
|---|
| 827 | BPLAYBACK_NORMALPLAY_SPEED macro in the following manner: |
|---|
| 828 | rate = BPLAYBACK_NORMALPLAY_SPEED*10 = 10th fast forward speed (NOTE: this is not 10x). |
|---|
| 829 | rate = BPLAYBACK_NORMALPLAY_SPEED/10 = 1/10 slow forward. |
|---|
| 830 | rate = BPLAYBACK_NORMALPLAY_SPEED*-10 = 10th fast rewind speed (NOTE: this is not -10x). |
|---|
| 831 | rate = BPLAYBACK_NORMALPLAY_SPEED/-10 = 1/10 slow rewind. |
|---|
| 832 | */ |
|---|
| 833 | bplayback_trickmode_params *trickmode /* [out] */ |
|---|
| 834 | ); |
|---|
| 835 | |
|---|
| 836 | /** |
|---|
| 837 | Summary: |
|---|
| 838 | For use in the rate parameter of bplayback_get_trickmode_by_rate. |
|---|
| 839 | Description: |
|---|
| 840 | The value of this parameter may change in the future and should not affect |
|---|
| 841 | any application. |
|---|
| 842 | **/ |
|---|
| 843 | #define BPLAYBACK_NORMALPLAY_SPEED 100 |
|---|
| 844 | |
|---|
| 845 | /* |
|---|
| 846 | Summary: |
|---|
| 847 | Goto a particular index, relative to your current position or the beginning. |
|---|
| 848 | Return value: |
|---|
| 849 | Actual index found |
|---|
| 850 | -1 on error |
|---|
| 851 | */ |
|---|
| 852 | long bplayback_goto_index( |
|---|
| 853 | bplayback_t p, |
|---|
| 854 | long index_offset, /* The index_offset to go to relative to whence. |
|---|
| 855 | If whence is SEEK_CUR or SEEK_END, the index_offset may be negative */ |
|---|
| 856 | int whence /* can be SEEK_SET or SEEK_CUR. SEEK_END is not supported yet */ |
|---|
| 857 | ); |
|---|
| 858 | |
|---|
| 859 | /* |
|---|
| 860 | Summary: |
|---|
| 861 | Goto a particular timestamp, relative to your current position or the beginning. |
|---|
| 862 | Return value: |
|---|
| 863 | Actual timestamp found |
|---|
| 864 | -1 on error |
|---|
| 865 | */ |
|---|
| 866 | long bplayback_goto_timestamp( |
|---|
| 867 | bplayback_t p, |
|---|
| 868 | long timestamp, /* The timestamp to go to relative to whence. |
|---|
| 869 | If whence is SEEK_CUR or SEEK_END, the index_offset may be negative */ |
|---|
| 870 | int whence /* can be SEEK_SET or SEEK_CUR. SEEK_END is not supported yet */ |
|---|
| 871 | ); |
|---|
| 872 | |
|---|
| 873 | /* |
|---|
| 874 | Summary: |
|---|
| 875 | Goto a particular mpeg offset, relative to your current position or the beginning. |
|---|
| 876 | Return value: |
|---|
| 877 | Actual mpeg offset of the frame found |
|---|
| 878 | -1 on error |
|---|
| 879 | */ |
|---|
| 880 | off_t bplayback_goto_mpeg_file_offset( |
|---|
| 881 | bplayback_t p, |
|---|
| 882 | off_t mpeg_file_offset, /* The impeg_file_offset to go to relative to whence. |
|---|
| 883 | If whence is SEEK_CUR or SEEK_END, the index_offset may be negative */ |
|---|
| 884 | int whence /* can be SEEK_SET or SEEK_CUR. SEEK_END is not supported yet */ |
|---|
| 885 | ); |
|---|
| 886 | |
|---|
| 887 | /* End of Playback API */ |
|---|
| 888 | |
|---|
| 889 | |
|---|
| 890 | /* Record API */ |
|---|
| 891 | |
|---|
| 892 | /* |
|---|
| 893 | Summary: |
|---|
| 894 | Open a record channel. |
|---|
| 895 | */ |
|---|
| 896 | brecord_t brecord_open(void); |
|---|
| 897 | |
|---|
| 898 | /* |
|---|
| 899 | Summary: |
|---|
| 900 | Open an IP record channel. |
|---|
| 901 | */ |
|---|
| 902 | brecord_t brecord_ip_open(void); |
|---|
| 903 | |
|---|
| 904 | /* |
|---|
| 905 | Summary: |
|---|
| 906 | Close a record channel. |
|---|
| 907 | Description: |
|---|
| 908 | Record should already have been stopped before calling close. |
|---|
| 909 | The brecord_t handle will be invalidated. You must call brecord_open |
|---|
| 910 | to record again. |
|---|
| 911 | */ |
|---|
| 912 | void brecord_close( |
|---|
| 913 | brecord_t record /* handle returned by brecord_open */ |
|---|
| 914 | ); |
|---|
| 915 | |
|---|
| 916 | /* |
|---|
| 917 | Summary: |
|---|
| 918 | Reason code returned in brecord_params.abnormal_stop callback. |
|---|
| 919 | */ |
|---|
| 920 | typedef enum brecord_error { |
|---|
| 921 | brecord_error_disk_full, /* No more data can be written because the disk is full. */ |
|---|
| 922 | brecord_error_max_file_size, /* No more data can be written because the file is |
|---|
| 923 | at a maximum size supported by the filesystem. */ |
|---|
| 924 | brecord_error_unknown /* No more data can be written because of a system |
|---|
| 925 | error. */ |
|---|
| 926 | } brecord_error; |
|---|
| 927 | |
|---|
| 928 | /* |
|---|
| 929 | Summary: |
|---|
| 930 | Parameters passed into brecord_start(). |
|---|
| 931 | Description: |
|---|
| 932 | This structure must be initialized by brecord_params_init(). |
|---|
| 933 | */ |
|---|
| 934 | typedef struct brecord_params { |
|---|
| 935 | bindex_format index_format; |
|---|
| 936 | bencryption_params encryption; |
|---|
| 937 | bool timestamp_enabled; /* If true, then a 4 byte timestamp is prepended to every |
|---|
| 938 | transport packet. bplayback_params.timestamp_enabled |
|---|
| 939 | must match. */ |
|---|
| 940 | void *callback_context; /* Context pointer which is returned in the callback functions. |
|---|
| 941 | This could be the brecord_t handle, or anything you'd like. */ |
|---|
| 942 | void (*error)(void *context, brecord_error errorcode); /* Called whenever the |
|---|
| 943 | record thread can no longer write data because of an error. |
|---|
| 944 | The thread will be exiting after this callback. */ |
|---|
| 945 | void (*overflow)(void *context, bool *stop_record); /* Called whenever a buffer |
|---|
| 946 | overflow is detected. Recorded data will be corrupt. |
|---|
| 947 | You can chose to modify the stop_record value to tell the |
|---|
| 948 | record thread to keep recording anyway, or to stop. If |
|---|
| 949 | it stops now, no corrupt data will be written to disk. */ |
|---|
| 950 | } brecord_params; |
|---|
| 951 | |
|---|
| 952 | /* |
|---|
| 953 | Summary: |
|---|
| 954 | Required initialization of brecord_params. |
|---|
| 955 | */ |
|---|
| 956 | void |
|---|
| 957 | brecord_params_init( |
|---|
| 958 | brecord_params *params, /* [out] */ |
|---|
| 959 | brecord_t record /* required for possible resource-dependent defaults */ |
|---|
| 960 | ); |
|---|
| 961 | |
|---|
| 962 | /* |
|---|
| 963 | Summary: |
|---|
| 964 | Open a record file to be passed to brecord_start(). |
|---|
| 965 | Description: |
|---|
| 966 | The brecord_file_t can be used for only one record at a time. |
|---|
| 967 | The files will be created if they don't already exist, and truncated if they do. |
|---|
| 968 | */ |
|---|
| 969 | brecord_file_t brecord_file_open( |
|---|
| 970 | const char *mpeg_file_name, /* mpeg file name to create */ |
|---|
| 971 | const char *index_file_name /* Index name to create. This can be NULL but only for |
|---|
| 972 | MPEG formats that don't produce any index data. */ |
|---|
| 973 | ); |
|---|
| 974 | |
|---|
| 975 | /* |
|---|
| 976 | Summary: |
|---|
| 977 | Open a record network file to be passed to brecord_start(). |
|---|
| 978 | Description: |
|---|
| 979 | The brecord_file_t can be used for only one record at a time. |
|---|
| 980 | The files will be created if they don't already exist, and truncated if they do. |
|---|
| 981 | You must pass in a params file in order to contact the network server where |
|---|
| 982 | the file for record is opened. |
|---|
| 983 | */ |
|---|
| 984 | brecord_file_t |
|---|
| 985 | brecord_file_open_network( |
|---|
| 986 | const char *mpeg_file_name, /* mpeg file name to create */ |
|---|
| 987 | const char *index_file_name, /* Index name to create. This can be NULL but only for |
|---|
| 988 | MPEG formats that don't produce any index data. */ |
|---|
| 989 | const bsocket_params * params, /* Params used to create a network record file */ |
|---|
| 990 | const bstream_mpeg * mpeg_info /* Stream Info that Needs to be sent to Remote Server*/ |
|---|
| 991 | ); |
|---|
| 992 | |
|---|
| 993 | /** |
|---|
| 994 | Close a file after record is stopped |
|---|
| 995 | **/ |
|---|
| 996 | void brecord_file_close( |
|---|
| 997 | brecord_file_t file |
|---|
| 998 | ); |
|---|
| 999 | |
|---|
| 1000 | /* |
|---|
| 1001 | Summary: |
|---|
| 1002 | Start recording a stream to a file. |
|---|
| 1003 | Description: |
|---|
| 1004 | You can only record one stream at a time for a given brecord_t handle. |
|---|
| 1005 | Dual record is done with two brecord_t handles. |
|---|
| 1006 | |
|---|
| 1007 | See brecpump_start for details on all-pass recording. |
|---|
| 1008 | */ |
|---|
| 1009 | bresult brecord_start( |
|---|
| 1010 | brecord_t record, /* handle returned by brecord_open */ |
|---|
| 1011 | brecpump_t recpump, /* record pump handle */ |
|---|
| 1012 | bstream_t stream, /* stream to record */ |
|---|
| 1013 | brecord_file_t file, /* destination for the data */ |
|---|
| 1014 | const brecord_params *params |
|---|
| 1015 | ); |
|---|
| 1016 | |
|---|
| 1017 | /** |
|---|
| 1018 | Summary: |
|---|
| 1019 | See brecpump_status for the structure definition. |
|---|
| 1020 | **/ |
|---|
| 1021 | typedef brecpump_status brecord_status; |
|---|
| 1022 | |
|---|
| 1023 | /* extend brecpump_status or copy it out ?? - TBD */ |
|---|
| 1024 | |
|---|
| 1025 | /* |
|---|
| 1026 | Summary: |
|---|
| 1027 | Get current status of the recording. |
|---|
| 1028 | */ |
|---|
| 1029 | void brecord_get_status( |
|---|
| 1030 | brecord_t record, /* handle returned by brecord_open */ |
|---|
| 1031 | brecord_status *status /* [out] */ |
|---|
| 1032 | ); |
|---|
| 1033 | |
|---|
| 1034 | /* |
|---|
| 1035 | Summary: |
|---|
| 1036 | Stop recording. |
|---|
| 1037 | Description: |
|---|
| 1038 | The brecord_t handle is still valid. You can either start another |
|---|
| 1039 | recording with brecord_start or close using brecord_close. |
|---|
| 1040 | */ |
|---|
| 1041 | bresult brecord_stop( |
|---|
| 1042 | brecord_t record /* handle returned by brecord_open */ |
|---|
| 1043 | ); |
|---|
| 1044 | |
|---|
| 1045 | /* End of Record API */ |
|---|
| 1046 | |
|---|
| 1047 | /* |
|---|
| 1048 | Summary: |
|---|
| 1049 | Opens an on the fly pvr playback . |
|---|
| 1050 | */ |
|---|
| 1051 | bplayback_t botfplay_open( |
|---|
| 1052 | bobject_t feeder_id /* id used to select a playback channel */ |
|---|
| 1053 | ); |
|---|
| 1054 | |
|---|
| 1055 | |
|---|
| 1056 | #define TS_PKT_SIZE 188 |
|---|
| 1057 | #define TS_PKTS_PER_UDP_PKT 7 |
|---|
| 1058 | #define UDP_PAYLOAD_SIZE TS_PKT_SIZE * TS_PKTS_PER_UDP_PKT |
|---|
| 1059 | #define RTP_PAYLOAD_SIZE UDP_PAYLOAD_SIZE |
|---|
| 1060 | #define IP_HALT_TASK_TIMEOUT_MSEC 1000 |
|---|
| 1061 | #define IP_RECV_TIMEOUT_USEC 250000 |
|---|
| 1062 | #define IP_RECV_BURST_USEC (IP_RECV_TIMEOUT_USEC/5) |
|---|
| 1063 | #define IP_PVR_PLAYSPEED_MAX_COUNT (128) |
|---|
| 1064 | |
|---|
| 1065 | /* |
|---|
| 1066 | Summary: |
|---|
| 1067 | This structure used to communicate initial parameters to the |
|---|
| 1068 | bplayback_socket_open function. |
|---|
| 1069 | Description: |
|---|
| 1070 | The field "ip_addr" is a dotted decimal IP Address represented as a string or a fully qualified domain name |
|---|
| 1071 | The field "port" is a UDP port number |
|---|
| 1072 | The field "protocol" is used to select the protocol employed (eg plain UDP or RTP, etc) |
|---|
| 1073 | The field "security" is used to select the security employed (eg none, SSL, DTCP-IP, ) |
|---|
| 1074 | The Field "fd" is an output parameter |
|---|
| 1075 | The Field "url" is used to pass a URL as a string |
|---|
| 1076 | */ |
|---|
| 1077 | typedef struct bplayback_socket_open_params { |
|---|
| 1078 | char ip_addr[64]; |
|---|
| 1079 | unsigned int port; |
|---|
| 1080 | bsettop_ip_protocol protocol; |
|---|
| 1081 | bsettop_ip_security security; |
|---|
| 1082 | int fd; |
|---|
| 1083 | char *url; |
|---|
| 1084 | /* program info */ |
|---|
| 1085 | bstream_mpeg psi; |
|---|
| 1086 | uint32_t first_pts; |
|---|
| 1087 | unsigned duration; /* In msec */ |
|---|
| 1088 | unsigned num_play_speed_entries; |
|---|
| 1089 | int http_frame_repeat; /* frame repeat count: computed & sent by the HTTP Streamer server */ |
|---|
| 1090 | int http_min_iframe_speed; /* Server only sends I Frames at this or higher speed */ |
|---|
| 1091 | int play_speed[IP_PVR_PLAYSPEED_MAX_COUNT]; |
|---|
| 1092 | } bplayback_socket_open_params; |
|---|
| 1093 | |
|---|
| 1094 | typedef enum bplayback_rtsp_ctrl_cmd_type { |
|---|
| 1095 | bplayback_rtsp_ctrl_cmd_type_play, |
|---|
| 1096 | bplayback_rtsp_ctrl_cmd_type_pause, |
|---|
| 1097 | bplayback_rtsp_ctrl_cmd_type_resume |
|---|
| 1098 | } bplayback_rtsp_ctrl_cmd_type; |
|---|
| 1099 | |
|---|
| 1100 | typedef struct bplayback_rtsp_ctrl_params { |
|---|
| 1101 | long start; |
|---|
| 1102 | long end; |
|---|
| 1103 | long scale; |
|---|
| 1104 | } bplayback_rtsp_ctrl_params; |
|---|
| 1105 | |
|---|
| 1106 | typedef struct bplayback_rtsp_ctrl_cmd { |
|---|
| 1107 | bplayback_rtsp_ctrl_cmd_type type; |
|---|
| 1108 | bplayback_rtsp_ctrl_params params; |
|---|
| 1109 | } bplayback_rtsp_ctrl_cmd; |
|---|
| 1110 | |
|---|
| 1111 | typedef struct bplayback_lm_callbacks { |
|---|
| 1112 | void (*lm_get_data)(void *context, void *buffer, unsigned int *buffer_size); |
|---|
| 1113 | void (*lm_session_open)(void **context, bplayback_socket_open_params *socket_open_params); |
|---|
| 1114 | void (*lm_session_start)(void *context, bplaypump_t pump); |
|---|
| 1115 | void (*lm_session_rtsp_ctrl)(void *context, bplayback_rtsp_ctrl_cmd *cmd); |
|---|
| 1116 | void (*lm_session_stop)(void *context); |
|---|
| 1117 | void (*lm_session_close)(void *context); |
|---|
| 1118 | } bplayback_lm_callbacks; |
|---|
| 1119 | |
|---|
| 1120 | typedef struct bplayback_socket_params { |
|---|
| 1121 | bplayback_socket_open_params open_params; |
|---|
| 1122 | bplayback_lm_callbacks lm_callbacks; |
|---|
| 1123 | } bplayback_socket_params; |
|---|
| 1124 | |
|---|
| 1125 | /* |
|---|
| 1126 | Summary: |
|---|
| 1127 | Required to initialize the bplayback_socket_params structure. |
|---|
| 1128 | */ |
|---|
| 1129 | void |
|---|
| 1130 | bplayback_socket_params_init( |
|---|
| 1131 | bplayback_socket_params *params, /* [out] */ |
|---|
| 1132 | bplayback_t playback |
|---|
| 1133 | ); |
|---|
| 1134 | |
|---|
| 1135 | /* |
|---|
| 1136 | Summary: |
|---|
| 1137 | Open a IP playback socket to pass to bplayback_start(). |
|---|
| 1138 | Description: |
|---|
| 1139 | The bplayback_socket_t can be used for only one IP playback at a time. |
|---|
| 1140 | */ |
|---|
| 1141 | bplayback_file_t bplayback_socket_open( |
|---|
| 1142 | bplayback_t playback, /* Handle returned by bplayback_open */ |
|---|
| 1143 | const bplayback_socket_params *params |
|---|
| 1144 | ); |
|---|
| 1145 | |
|---|
| 1146 | /* |
|---|
| 1147 | Summary: |
|---|
| 1148 | Close a IP playback socket. |
|---|
| 1149 | Description: |
|---|
| 1150 | Close a IP playback socket opened by bplayback_socket_open(). |
|---|
| 1151 | */ |
|---|
| 1152 | void bplayback_socket_close( |
|---|
| 1153 | bplayback_t playback /* Handle returned by bplayback_open */ |
|---|
| 1154 | ); |
|---|
| 1155 | |
|---|
| 1156 | |
|---|
| 1157 | /* |
|---|
| 1158 | Summary: |
|---|
| 1159 | Required to initialize the bsocket_params structure. |
|---|
| 1160 | */ |
|---|
| 1161 | void |
|---|
| 1162 | bsocket_params_init( |
|---|
| 1163 | bsocket_params *params /* [out] */ |
|---|
| 1164 | ); |
|---|
| 1165 | |
|---|
| 1166 | /* |
|---|
| 1167 | Summary: |
|---|
| 1168 | Open a IP record socket to pass to brecord_start(). |
|---|
| 1169 | Description: |
|---|
| 1170 | The record socket can be used for only one IP record at a time. |
|---|
| 1171 | */ |
|---|
| 1172 | bstream_t brecord_socket_open( |
|---|
| 1173 | brecord_t record, /* Handle returned by bplayback_open */ |
|---|
| 1174 | const bsocket_params *params |
|---|
| 1175 | ); |
|---|
| 1176 | |
|---|
| 1177 | /* |
|---|
| 1178 | Summary: |
|---|
| 1179 | Close a IP record socket. |
|---|
| 1180 | Description: |
|---|
| 1181 | Close a IP record socket opened by brecord_socket_open(). |
|---|
| 1182 | */ |
|---|
| 1183 | void brecord_t_socket_close( |
|---|
| 1184 | brecord_t record /* Handle returned by brecord_ip_open */ |
|---|
| 1185 | ); |
|---|
| 1186 | |
|---|
| 1187 | #ifdef __cplusplus |
|---|
| 1188 | } |
|---|
| 1189 | #endif |
|---|
| 1190 | |
|---|
| 1191 | |
|---|
| 1192 | #endif /* BSETTOP_PVR_H__ */ |
|---|
| 1193 | |
|---|