| [2] | 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2002-2005, 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: tsindexer.h $ |
|---|
| 11 | * $brcm_Revision: Irvine_BSEAVSW_Devel/20 $ |
|---|
| 12 | * $brcm_Date: 3/18/05 9:38a $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: Software startcode index generator |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /SetTop/bcmplayer/tsindexer.h $ |
|---|
| 19 | * |
|---|
| 20 | * Irvine_BSEAVSW_Devel/20 3/18/05 9:38a erickson |
|---|
| 21 | * PR14451: added 6 word SCT support |
|---|
| 22 | * |
|---|
| 23 | * Irvine_BSEAVSW_Devel/19 3/14/05 5:00p erickson |
|---|
| 24 | * PR14451: add 6-word SCT support, extend alloc/reset api, add AVC start |
|---|
| 25 | * code support |
|---|
| 26 | * |
|---|
| 27 | * Irvine_BSEAVSW_Devel/18 4/13/04 4:33p erickson |
|---|
| 28 | * PR10292: added docjet comments |
|---|
| 29 | * |
|---|
| 30 | * Irvine_BSEAVSW_Devel/17 2/20/03 4:36p marcusk |
|---|
| 31 | * Added support for VOB (DVD program stream) indexing. |
|---|
| 32 | * |
|---|
| 33 | * Irvine_HDDemo_Devel\16 4/16/02 10:33a marcusk |
|---|
| 34 | * Updated to use unified interface with bcmindexer. |
|---|
| 35 | * |
|---|
| 36 | * Irvine_HDDemo_Devel\1 4/16/02 12:54p erickson |
|---|
| 37 | * Moved from SetTop/dvrtable |
|---|
| 38 | * Added reset |
|---|
| 39 | * Added version to allocate/reset |
|---|
| 40 | * |
|---|
| 41 | * |
|---|
| 42 | ***************************************************************************/ |
|---|
| 43 | #ifndef TSINDEXER_H |
|---|
| 44 | #define TSINDEXER_H |
|---|
| 45 | |
|---|
| 46 | #include "bcmsct_index.h" |
|---|
| 47 | |
|---|
| 48 | #ifdef __cplusplus |
|---|
| 49 | extern "C" { |
|---|
| 50 | #endif |
|---|
| 51 | |
|---|
| 52 | /** |
|---|
| 53 | Summary: |
|---|
| 54 | Callback function tsindexer needs to write new SCT's back to the calling app |
|---|
| 55 | **/ |
|---|
| 56 | typedef unsigned long (*INDEX_WRITE_CB)( const void *p_bfr, unsigned long numEntries, unsigned long entrySize, void *fp ); |
|---|
| 57 | |
|---|
| 58 | /** |
|---|
| 59 | Summary: |
|---|
| 60 | Structure on a 4 four SCT entry. |
|---|
| 61 | **/ |
|---|
| 62 | typedef BSCT_Entry sIndexEntry; |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | Summary: |
|---|
| 66 | Structure on a 6 word SCT entry. |
|---|
| 67 | **/ |
|---|
| 68 | typedef BSCT_SixWord_Entry sSixWordIndexEntry; |
|---|
| 69 | |
|---|
| 70 | /** |
|---|
| 71 | Summary: |
|---|
| 72 | Main tsindexer object. |
|---|
| 73 | **/ |
|---|
| 74 | typedef struct sTsIndexer sTsIndexer; |
|---|
| 75 | |
|---|
| 76 | /** |
|---|
| 77 | Summary: |
|---|
| 78 | Allocate new sTsIndexer. |
|---|
| 79 | |
|---|
| 80 | Return values: |
|---|
| 81 | NULL on error |
|---|
| 82 | New sTsIndexer object |
|---|
| 83 | **/ |
|---|
| 84 | sTsIndexer *tsindex_allocate( |
|---|
| 85 | INDEX_WRITE_CB cb, /* write callback. see tsindex_settings for details. */ |
|---|
| 86 | void *fp, /* file pointer. see tsindex_settings for details. */ |
|---|
| 87 | unsigned short pid, /* video pid. see tsindex_settings for details. */ |
|---|
| 88 | int version /* Compatibility version. see tsindex_settings for details. */ |
|---|
| 89 | ); |
|---|
| 90 | |
|---|
| 91 | /** |
|---|
| 92 | Summary: |
|---|
| 93 | Reset sTsIndexer to post-allocate state. |
|---|
| 94 | |
|---|
| 95 | Return values: |
|---|
| 96 | -1 if version is not supported |
|---|
| 97 | 0 on success |
|---|
| 98 | **/ |
|---|
| 99 | int tsindex_reset( |
|---|
| 100 | sTsIndexer *p_tsi, |
|---|
| 101 | INDEX_WRITE_CB cb, /* write callback. see tsindex_settings for details. */ |
|---|
| 102 | void *fp, /* file pointer. see tsindex_settings for details. */ |
|---|
| 103 | unsigned short pid, /* video pid. see tsindex_settings for details. */ |
|---|
| 104 | int version /* Compatibility version. see tsindex_settings for details. */ |
|---|
| 105 | ); |
|---|
| 106 | |
|---|
| 107 | /** |
|---|
| 108 | Summary: |
|---|
| 109 | Settings structure for initializing a tsindex object. |
|---|
| 110 | **/ |
|---|
| 111 | typedef struct tsindex_settings { |
|---|
| 112 | INDEX_WRITE_CB cb; /* write callback. fwrite() is valid. */ |
|---|
| 113 | void *fp; /* file pointer to pass to callback. If you used fwrite(), this |
|---|
| 114 | will be FILE* */ |
|---|
| 115 | unsigned short pid; /* video pid */ |
|---|
| 116 | int version; /* Compatibility version. If version == -1, latest version is used. |
|---|
| 117 | Major #'s for tsindexer and tsplayer should match. |
|---|
| 118 | |
|---|
| 119 | Current version supported: |
|---|
| 120 | 0101 |
|---|
| 121 | */ |
|---|
| 122 | int entry_size; /* number of words in SCT entry. Default is 4 and you |
|---|
| 123 | should use sIndexEntry to parse the generated data. |
|---|
| 124 | The other supported value is 6 and you should then |
|---|
| 125 | use sSixWordIndexEntry to parse the generated data. */ |
|---|
| 126 | unsigned short start_code_lo; |
|---|
| 127 | unsigned short start_code_hi; |
|---|
| 128 | int is_avc; /* This is an AVC stream, so don't interpret the |
|---|
| 129 | start codes. Just do raw capture. */ |
|---|
| 130 | } tsindex_settings; |
|---|
| 131 | |
|---|
| 132 | /** |
|---|
| 133 | Summary: |
|---|
| 134 | Initialize a settings struture to default values. |
|---|
| 135 | Description: |
|---|
| 136 | b, fp and pid cannot be defaulted. |
|---|
| 137 | **/ |
|---|
| 138 | void tsindex_settings_init( |
|---|
| 139 | tsindex_settings *settings |
|---|
| 140 | ); |
|---|
| 141 | |
|---|
| 142 | /** |
|---|
| 143 | Summary: |
|---|
| 144 | Allocate a tsindex object using the settings structure. |
|---|
| 145 | Description: |
|---|
| 146 | This is preferred to tsindex_allocate because it can be extended. The old |
|---|
| 147 | API is fixed. |
|---|
| 148 | **/ |
|---|
| 149 | sTsIndexer *tsindex_allocate_ex( |
|---|
| 150 | const tsindex_settings *settings |
|---|
| 151 | ); |
|---|
| 152 | |
|---|
| 153 | int tsindex_reset_ex( |
|---|
| 154 | sTsIndexer *p_tsi, |
|---|
| 155 | const tsindex_settings *settings |
|---|
| 156 | ); |
|---|
| 157 | |
|---|
| 158 | /** |
|---|
| 159 | Summary: |
|---|
| 160 | Free a sTsIndexer. |
|---|
| 161 | **/ |
|---|
| 162 | void tsindex_free( |
|---|
| 163 | sTsIndexer *p_tsi |
|---|
| 164 | ); |
|---|
| 165 | |
|---|
| 166 | /** |
|---|
| 167 | Summary: |
|---|
| 168 | Feed MPEG2 Transport into a sTsIndexer. |
|---|
| 169 | |
|---|
| 170 | Description: |
|---|
| 171 | It will build the startcode table and write it out |
|---|
| 172 | using the callback passed into tsindex_allocate(). |
|---|
| 173 | |
|---|
| 174 | Return values: |
|---|
| 175 | -1 on error |
|---|
| 176 | Number of packets processed |
|---|
| 177 | **/ |
|---|
| 178 | long tsindex_feed( sTsIndexer * const p_tsi, const unsigned char *p_bfr, long numBytes ); |
|---|
| 179 | |
|---|
| 180 | /** |
|---|
| 181 | Summary: |
|---|
| 182 | Set the PES id before calling tsindex_feedPes |
|---|
| 183 | **/ |
|---|
| 184 | void tsindex_setPesId( sTsIndexer *p_tsi, unsigned char pesStreamId ); |
|---|
| 185 | |
|---|
| 186 | /** |
|---|
| 187 | Summary: |
|---|
| 188 | Feed PES mpeg data. |
|---|
| 189 | **/ |
|---|
| 190 | long tsindex_feedPes( sTsIndexer * const p_tsi, const unsigned char *p_bfr, long numBytes ); |
|---|
| 191 | |
|---|
| 192 | /** |
|---|
| 193 | Summary: |
|---|
| 194 | Feed DVD VOB mpeg data. |
|---|
| 195 | **/ |
|---|
| 196 | long tsindex_feedVob( sTsIndexer * const p_tsi, const unsigned char *p_bfr, long numBytes ); |
|---|
| 197 | |
|---|
| 198 | #ifdef __cplusplus |
|---|
| 199 | } |
|---|
| 200 | #endif |
|---|
| 201 | |
|---|
| 202 | #endif |
|---|