/*************************************************************************** * Copyright (c) 2002-2005, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: tsindexer.h $ * $brcm_Revision: Irvine_BSEAVSW_Devel/20 $ * $brcm_Date: 3/18/05 9:38a $ * * Module Description: Software startcode index generator * * Revision History: * * $brcm_Log: /SetTop/bcmplayer/tsindexer.h $ * * Irvine_BSEAVSW_Devel/20 3/18/05 9:38a erickson * PR14451: added 6 word SCT support * * Irvine_BSEAVSW_Devel/19 3/14/05 5:00p erickson * PR14451: add 6-word SCT support, extend alloc/reset api, add AVC start * code support * * Irvine_BSEAVSW_Devel/18 4/13/04 4:33p erickson * PR10292: added docjet comments * * Irvine_BSEAVSW_Devel/17 2/20/03 4:36p marcusk * Added support for VOB (DVD program stream) indexing. * * Irvine_HDDemo_Devel\16 4/16/02 10:33a marcusk * Updated to use unified interface with bcmindexer. * * Irvine_HDDemo_Devel\1 4/16/02 12:54p erickson * Moved from SetTop/dvrtable * Added reset * Added version to allocate/reset * * ***************************************************************************/ #ifndef TSINDEXER_H #define TSINDEXER_H #include "bcmsct_index.h" #ifdef __cplusplus extern "C" { #endif /** Summary: Callback function tsindexer needs to write new SCT's back to the calling app **/ typedef unsigned long (*INDEX_WRITE_CB)( const void *p_bfr, unsigned long numEntries, unsigned long entrySize, void *fp ); /** Summary: Structure on a 4 four SCT entry. **/ typedef BSCT_Entry sIndexEntry; /** Summary: Structure on a 6 word SCT entry. **/ typedef BSCT_SixWord_Entry sSixWordIndexEntry; /** Summary: Main tsindexer object. **/ typedef struct sTsIndexer sTsIndexer; /** Summary: Allocate new sTsIndexer. Return values: NULL on error New sTsIndexer object **/ sTsIndexer *tsindex_allocate( INDEX_WRITE_CB cb, /* write callback. see tsindex_settings for details. */ void *fp, /* file pointer. see tsindex_settings for details. */ unsigned short pid, /* video pid. see tsindex_settings for details. */ int version /* Compatibility version. see tsindex_settings for details. */ ); /** Summary: Reset sTsIndexer to post-allocate state. Return values: -1 if version is not supported 0 on success **/ int tsindex_reset( sTsIndexer *p_tsi, INDEX_WRITE_CB cb, /* write callback. see tsindex_settings for details. */ void *fp, /* file pointer. see tsindex_settings for details. */ unsigned short pid, /* video pid. see tsindex_settings for details. */ int version /* Compatibility version. see tsindex_settings for details. */ ); /** Summary: Settings structure for initializing a tsindex object. **/ typedef struct tsindex_settings { INDEX_WRITE_CB cb; /* write callback. fwrite() is valid. */ void *fp; /* file pointer to pass to callback. If you used fwrite(), this will be FILE* */ unsigned short pid; /* video pid */ int version; /* Compatibility version. If version == -1, latest version is used. Major #'s for tsindexer and tsplayer should match. Current version supported: 0101 */ int entry_size; /* number of words in SCT entry. Default is 4 and you should use sIndexEntry to parse the generated data. The other supported value is 6 and you should then use sSixWordIndexEntry to parse the generated data. */ unsigned short start_code_lo; unsigned short start_code_hi; int is_avc; /* This is an AVC stream, so don't interpret the start codes. Just do raw capture. */ } tsindex_settings; /** Summary: Initialize a settings struture to default values. Description: b, fp and pid cannot be defaulted. **/ void tsindex_settings_init( tsindex_settings *settings ); /** Summary: Allocate a tsindex object using the settings structure. Description: This is preferred to tsindex_allocate because it can be extended. The old API is fixed. **/ sTsIndexer *tsindex_allocate_ex( const tsindex_settings *settings ); int tsindex_reset_ex( sTsIndexer *p_tsi, const tsindex_settings *settings ); /** Summary: Free a sTsIndexer. **/ void tsindex_free( sTsIndexer *p_tsi ); /** Summary: Feed MPEG2 Transport into a sTsIndexer. Description: It will build the startcode table and write it out using the callback passed into tsindex_allocate(). Return values: -1 on error Number of packets processed **/ long tsindex_feed( sTsIndexer * const p_tsi, const unsigned char *p_bfr, long numBytes ); /** Summary: Set the PES id before calling tsindex_feedPes **/ void tsindex_setPesId( sTsIndexer *p_tsi, unsigned char pesStreamId ); /** Summary: Feed PES mpeg data. **/ long tsindex_feedPes( sTsIndexer * const p_tsi, const unsigned char *p_bfr, long numBytes ); /** Summary: Feed DVD VOB mpeg data. **/ long tsindex_feedVob( sTsIndexer * const p_tsi, const unsigned char *p_bfr, long numBytes ); #ifdef __cplusplus } #endif #endif