| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2006, 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: $ |
|---|
| 11 | * $brcm_Revision: $ |
|---|
| 12 | * $brcm_Date: $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: $ |
|---|
| 19 | * |
|---|
| 20 | ***************************************************************************/ |
|---|
| 21 | |
|---|
| 22 | #ifndef BSETTOP_DECODE_H__ |
|---|
| 23 | #define BSETTOP_DECODE_H__ |
|---|
| 24 | |
|---|
| 25 | #include "bsettop_types.h" |
|---|
| 26 | #include "bsettop_stream.h" |
|---|
| 27 | |
|---|
| 28 | #define XVD_ST_RAP_NOT_DETECTED 0x100 |
|---|
| 29 | #define XVD_ST_UNSUPPORTED_FEATURE_DETECTED 0x200 |
|---|
| 30 | #define XVD_ST_IMAGE_SIZE_TOO_BIG 0x400 |
|---|
| 31 | |
|---|
| 32 | #ifdef __cplusplus |
|---|
| 33 | extern "C" |
|---|
| 34 | { |
|---|
| 35 | #endif |
|---|
| 36 | |
|---|
| 37 | /*=************************* |
|---|
| 38 | The decode interface is used to decode both digital and analog |
|---|
| 39 | streams. It controls both video and audio decode. |
|---|
| 40 | |
|---|
| 41 | The source for a decode is a stream (bstream_t). Streams can generated either from a tuner (btuner_t), |
|---|
| 42 | a playback engine (bplayback_t) or streamer (bstreamer_t). |
|---|
| 43 | The destination of a decode is a decode window (bdecode_window_t) which is connected to a |
|---|
| 44 | display (bdisplay_t). |
|---|
| 45 | |
|---|
| 46 | For PIP or dual output systems, there are two decoders. Otherwise there is only one |
|---|
| 47 | decoder. |
|---|
| 48 | ****************************/ |
|---|
| 49 | |
|---|
| 50 | /* |
|---|
| 51 | Summary: |
|---|
| 52 | Open a decode engine. |
|---|
| 53 | Description: |
|---|
| 54 | */ |
|---|
| 55 | bdecode_t bdecode_open( |
|---|
| 56 | bobject_t decode_id /* decode object id */ |
|---|
| 57 | ); |
|---|
| 58 | |
|---|
| 59 | /* |
|---|
| 60 | Summary: |
|---|
| 61 | Close a decode engine. |
|---|
| 62 | Description: |
|---|
| 63 | The decode should be stopped before closing. |
|---|
| 64 | After closing, the bdecode_t handle is invalid. |
|---|
| 65 | */ |
|---|
| 66 | void bdecode_close( |
|---|
| 67 | bdecode_t decode /* handle returned by bdecode_open */ |
|---|
| 68 | ); |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | /* |
|---|
| 72 | Summary: |
|---|
| 73 | Start decoding a stream. |
|---|
| 74 | */ |
|---|
| 75 | bresult bdecode_start( |
|---|
| 76 | bdecode_t decode, /* handle returned by bdecode_open */ |
|---|
| 77 | bstream_t source, /* source for the decode, either analog or digital */ |
|---|
| 78 | bdecode_window_t window /* window to render decode */ |
|---|
| 79 | ); |
|---|
| 80 | |
|---|
| 81 | /* |
|---|
| 82 | Summary: |
|---|
| 83 | Stop decoding a stream. |
|---|
| 84 | Description: |
|---|
| 85 | The stream remains valid after decode is stopped. Decode could be restarted |
|---|
| 86 | without retuning or restarting playback. |
|---|
| 87 | */ |
|---|
| 88 | void bdecode_stop( |
|---|
| 89 | bdecode_t decode /* handle returned by bdecode_open */ |
|---|
| 90 | ); |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | typedef struct { |
|---|
| 94 | unsigned int width; |
|---|
| 95 | unsigned int height; |
|---|
| 96 | unsigned int pitch; |
|---|
| 97 | unsigned char *buffer; |
|---|
| 98 | }bdecode_buffer; |
|---|
| 99 | |
|---|
| 100 | /* |
|---|
| 101 | Summary: |
|---|
| 102 | Decode status returned by bdecode_get_status |
|---|
| 103 | */ |
|---|
| 104 | typedef struct bdecode_status { |
|---|
| 105 | unsigned int source_width; /* width in pixels of the source video */ |
|---|
| 106 | unsigned int source_height; /* height in pixels of the source video */ |
|---|
| 107 | unsigned int display_width; /* width in pixels of the source video */ |
|---|
| 108 | unsigned int display_height; /* height in pixels of the source video */ |
|---|
| 109 | unsigned int video_fifo_depth; /* depth in bytes of the compressed video buffer (VBV) */ |
|---|
| 110 | unsigned int video_fifo_size; /* size in bytes of the compressed video buffer (VBV) */ |
|---|
| 111 | unsigned int video_pts; /* current PTS of the video decoder */ |
|---|
| 112 | unsigned int video_stc; /* current STC used by the video decoder */ |
|---|
| 113 | unsigned int video_pts_error; /* current pcr offset value held by decoder */ |
|---|
| 114 | unsigned video_aspect_ratio; /* value of aspect_ration_information field from decoded MPEG stream (see ISO/IEC 13818-2) */ |
|---|
| 115 | unsigned int video_format; |
|---|
| 116 | unsigned int video_framerate; |
|---|
| 117 | unsigned int first_pts_ticks; /* os ticks until first pts */ |
|---|
| 118 | unsigned int seq_ticks; /* os ticks until sequence header/format info */ |
|---|
| 119 | int hPanScan; /* horizontal PanScan */ |
|---|
| 120 | int vPanScan; /* vertical PanScan */ |
|---|
| 121 | unsigned int watchdog_cnt; |
|---|
| 122 | unsigned int pts_err_cnt; |
|---|
| 123 | unsigned int req_stc_cnt; |
|---|
| 124 | unsigned int first_pts_cnt; |
|---|
| 125 | unsigned int offset_cnt; |
|---|
| 126 | unsigned int decode_err_cnt; |
|---|
| 127 | unsigned int pic_info_cnt; |
|---|
| 128 | unsigned int decoder_drop_cnt; |
|---|
| 129 | unsigned int display_drop_cnt; |
|---|
| 130 | unsigned int pic_received; |
|---|
| 131 | unsigned int TSM_Mode; |
|---|
| 132 | unsigned int underflow_cnt; |
|---|
| 133 | unsigned int bitRate; |
|---|
| 134 | unsigned int profile; |
|---|
| 135 | unsigned int level; |
|---|
| 136 | unsigned short vPID; |
|---|
| 137 | unsigned short pcrPID; |
|---|
| 138 | bool bStreamProgressive; |
|---|
| 139 | bool bFrameProgressive; |
|---|
| 140 | bool bPCR_Lock; /* PCR Lock interrupt */ |
|---|
| 141 | bool bVideoDecoding; |
|---|
| 142 | unsigned int xvdch_status; |
|---|
| 143 | } bdecode_status; |
|---|
| 144 | |
|---|
| 145 | /* |
|---|
| 146 | Summary: |
|---|
| 147 | Get the status of the decoder and current source. |
|---|
| 148 | */ |
|---|
| 149 | bresult bdecode_get_status( |
|---|
| 150 | bdecode_t decode, /* handle returned by bdecode_open */ |
|---|
| 151 | bdecode_status *status /* [out] status to be populated */ |
|---|
| 152 | ); |
|---|
| 153 | |
|---|
| 154 | /* |
|---|
| 155 | Summary: |
|---|
| 156 | Decode config structure |
|---|
| 157 | */ |
|---|
| 158 | typedef struct bdecode_config { |
|---|
| 159 | void (*xds_callback)( int xds_class, /* the class (0 - current, used for vchip) */ |
|---|
| 160 | int xds_type, /* the xds type (5 - vchip) */ |
|---|
| 161 | unsigned char* data, /* the data buffer, containing data_len valid bytes */ |
|---|
| 162 | int data_len /* the number of valid bytes in data */ |
|---|
| 163 | ); |
|---|
| 164 | void (*cc_callback)(unsigned char* data,int data_len,bool banalog); |
|---|
| 165 | void (*xpt_callback)(void *data); |
|---|
| 166 | void *xpt_callback_data; |
|---|
| 167 | void *channel; /* opaque reference to the mvd channel to work around MVD pid filter configuation issues */ |
|---|
| 168 | unsigned int mute : 1; /* mute video when non-zero */ |
|---|
| 169 | unsigned int widescreen : 2; /* now 4 modes, full, letterbox, pillar and auto */ |
|---|
| 170 | unsigned int rmm_enabled : 1; /* reduced memory mode enabled when non-zero */ |
|---|
| 171 | unsigned int cc_enabled : 1; /* closed captioning output enabled when non -zero */ |
|---|
| 172 | unsigned int crc_enabled : 1; /* enable CRC capture - in debug build only */ |
|---|
| 173 | unsigned int channel_change : 2; /* 0 - mute on channel change, 1 - display last frame, 2 -display initial frame */ |
|---|
| 174 | unsigned int block_vbi; |
|---|
| 175 | unsigned int crc[2]; /* Luma,Chroma component CRC for last field */ |
|---|
| 176 | void *static_fields[2]; /* Static fields for testing feeder */ |
|---|
| 177 | void (*first_pts_callback)(void); |
|---|
| 178 | void (*seq_hdr_callback)(void); |
|---|
| 179 | }bdecode_config; |
|---|
| 180 | |
|---|
| 181 | /* |
|---|
| 182 | Summary: |
|---|
| 183 | General bdecode configuration function used to configure internal operation parameters. |
|---|
| 184 | */ |
|---|
| 185 | void bdecode_set_config( |
|---|
| 186 | bdecode_t decode, /* handle returned by bdecode_open */ |
|---|
| 187 | bdecode_config *p_cfg /* configuration structure reference */ |
|---|
| 188 | ); |
|---|
| 189 | |
|---|
| 190 | /* |
|---|
| 191 | Summary: |
|---|
| 192 | General bdecode configuration function used to get the internal operation parameters. |
|---|
| 193 | */ |
|---|
| 194 | void bdecode_get_config( |
|---|
| 195 | bdecode_t decode, /* handle returned by bdecode_open */ |
|---|
| 196 | bdecode_config *p_cfg /* [out] configuration to be populated */ |
|---|
| 197 | ); |
|---|
| 198 | |
|---|
| 199 | /** |
|---|
| 200 | Summary: |
|---|
| 201 | Supported video format. Returns NULL if stream_type (from PMT) not supported. |
|---|
| 202 | **/ |
|---|
| 203 | bsettop_av_stream_type_t *bdecode_supported_video(unsigned char stream_type); |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | #if SUPPORT_DST_PLATFORM |
|---|
| 207 | #include "bxvd.h" |
|---|
| 208 | |
|---|
| 209 | enum bdecode_callback_type{ |
|---|
| 210 | bdecode_callback_type_userdata = 10, |
|---|
| 211 | bdecode_callback_type_vec_isr, |
|---|
| 212 | bdecode_callback_type_seq_hdr_isr, |
|---|
| 213 | bdecode_callback_type_picture_isr, |
|---|
| 214 | bdecode_callback_type_video_err, |
|---|
| 215 | } ; |
|---|
| 216 | |
|---|
| 217 | //neverdai modify bdecode_callback_typeÃß°¡ |
|---|
| 218 | typedef void (*bdecode_callback_t)(enum bdecode_callback_type cb_type, void *param); |
|---|
| 219 | |
|---|
| 220 | /* |
|---|
| 221 | Summary: |
|---|
| 222 | Register decode callbacks |
|---|
| 223 | */ |
|---|
| 224 | bdecode_callback_t bdecode_register_callback( |
|---|
| 225 | enum bdecode_callback_type type, |
|---|
| 226 | bdecode_callback_t fn |
|---|
| 227 | ); |
|---|
| 228 | /* |
|---|
| 229 | void bdecode_debug(int arg); |
|---|
| 230 | void bdecode_force_update_picture_config(int count, int widescreenmode); |
|---|
| 231 | */ |
|---|
| 232 | BXVD_PictureParameterInfo *bdecode_get_stream_info(BXVD_PictureParameterInfo *status); |
|---|
| 233 | BAVC_USERDATA_info *bdecode_get_userdata_info(BAVC_USERDATA_info *status); |
|---|
| 234 | |
|---|
| 235 | #endif /* SUPPORT_DST_PLATFORM */ |
|---|
| 236 | |
|---|
| 237 | /* End of Decode API */ |
|---|
| 238 | |
|---|
| 239 | #ifdef __cplusplus |
|---|
| 240 | } |
|---|
| 241 | #endif |
|---|
| 242 | |
|---|
| 243 | |
|---|
| 244 | #endif /* BSETTOP_DECODE_H__ */ |
|---|