/*************************************************************************** * Copyright (c) 2003-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: bsettop_stream.h $ * $brcm_Revision: 4 $ * $brcm_Date: 8/10/05 3:17p $ * * Module Description: * * Revision History: * * $brcm_Log: /BSEAV/api/include/bsettop_stream.h $ ***************************************************************************/ #ifndef BSETTOP_STREAM_H__ #define BSETTOP_STREAM_H__ #include "bapp_types.h" #ifdef __cplusplus extern "C" { #endif /* Summary: Maximum number of video or audio programs which the bstream_mpeg data structure stores. stores. Description: If your application needs more, you'll need to override this value. */ #define BSETTOP_MAX_PROGRAMS 1 /* Summary: Maximum number of streams. */ #define BSETTOP_MAX_STREAMS 3 /* Summary: Beginning PID channel for video. */ #define B_VIDEO_PIDCH 0 /* Summary: PCR PID channel. */ #define B_PCR_PIDCH 6 /* Summary: DMA PID channel for video. */ #define B_DMA_PIDCH 7 /* Summary: PCR PID channel for audio. */ #define B_AUDIO_PIDCH 7 /* Summary: Default transport parser band from internal tuner/demodulator. */ #define DEF_PARSER_BAND 0 /* Summary: Macro to set playback parser band flag. i.e BSETTOP_PB_PARSER(DEF_PARSER_BAND). */ #define BSETTOP_PB_PARSER( x ) ( ( x ) | 0x8000 ) /* Summary: Invalid PID channel definition. */ #define B_INVALID_PIDCH ((unsigned int)-1) /* Summary: A stream is either a digital or analog program which can be decoded or recorded. Description: Streams are produced by one of the following: - tuning linein or rf (btuner_tune_rf or btuner_tune_linein) - tuning digital and selecting mpeg params (btuner_tune_qpsk/qam and bstream_set_mpeg) - starting playback (bplay_start) - direct transport input (bstream_set) */ typedef struct bstream *bstream_t; /* Summary: MPEG parameters for a single program with the same pcr pid which are passed to bstream_open and bplayback_start. Description: The reason for multiple video and audio pids is to support multiple elementary streams within the same program. All video and audio pids should use the same pcr pid. Multiple audio elementary streams are needed for multiple language support (i.e. English and Spansih). Multiple video elementary streams might be needed for multiple viewing angles of the same program. You should not use this structure to store mutliple programs for channel change. Each "channel" should have its own bstream_mpeg structure because each channel has its own pcr pid. For PES decode the pid value is used to represent the PES packet id. Typically this will be 0xE0 for video, 0xC0 for mpeg audio, and 0xBD for ac3 audio. For VOB decode, video and mpeg audio type streams are handled identically to a PES based decode. AC3 and DTS tracks ares slightly different as the upper 8 bits of the pid value represent the substream id that is to be decoded. For example: pid==0x00BD would correspond to AC3/DTS track 0, while 0x01BD would correspond to AC3/DTS track 1. */ typedef struct bstream_mpeg { struct { uint16_t pid; uint8_t format; } video[BSETTOP_MAX_PROGRAMS]; /* video stream pids */ struct { uint16_t pid; uint8_t format; } audio[BSETTOP_MAX_PROGRAMS]; /* audio stream pids */ uint16_t pcr_pid; } bstream_mpeg; /* Summary: Stream structure provides access to band, program PIDs and currently assigned PID channels. Description: */ /* Summary: Required to initialize int bstream_mpeg data structure. */ void bstream_mpeg_init( bstream_mpeg *mpeg /* [out] */ ); /** Summary: Dynamically create a digital stream using a band and mpeg parameters. Description: This is used for digital streams which are created from a tuned band or streamer band. The application supplies MPEG parameters which are obtained from scanning PSI information or stored separately. On some platforms, you can call bstream_open on the same band more than once. In this case, the transport block routes the data from one input band to multiple parser bands. You must call bstream_close to release resources. **/ bstream_t bstream_open( bband_t band, /* input band */ const bstream_mpeg *mpegparams /* MPEG pids to filter */ ); /* * Summary: * Digital stream status returned by bstream_get_mpeg_parameters. * **/ typedef struct bstream_status { bband_t band; uint32_t stc; uint32_t pcr; bstream_mpeg mpeg; unsigned long tsrate; /* in bits per second */ } bstream_status; /** * Summary: * Get status information from a digital stream. * Description: * This is useful for getting MPEG parameters from an encoded stream * where the bsettop_mpeg structure * is created internally. **/ bresult bstream_get_status( bstream_t stream, bstream_status *status /* [out]*/ ); /* * Summary: * Global transport configuration settings. * **/ typedef struct bstream_config { unsigned int cdb_size; /* CDB Size in bytes */ unsigned int itb_size; /* ITB Size in bytes */ } bstream_config; /** * Summary: * Get global transport configuraiton settings. **/ bresult bstream_get_config( bstream_config *config /* [out]*/ ); /** * Summary: * Set global transport configuraiton settings. **/ bresult bstream_set_config( bstream_config *config /* [in]*/ ); /** Summary: Close a stream. Description: This is required if you use bstream_open to obtain a stream. This is allowed but not required if you get an analog stream from btuner or any stream from bplayback or bplaypump. **/ void bstream_close( bstream_t stream /* Handle returned by bstream_open, btuner_tune_rf, btuner_tune_linein or bplayback_start. */ ); /** Summary: Callback function after XPT interrupt fires Description: This allows a function to be called after an interrupt fires. **/ void bstream_callback( void *data ); #ifdef __cplusplus } #endif #endif /* BSETTOP_STREAM_H__ */