| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2008, 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_encode.h $ |
|---|
| 11 | * $brcm_Revision: 4 $ |
|---|
| 12 | * $brcm_Date: 7/16/08 1:05p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/api/include/bsettop_encode.h $ |
|---|
| 19 | * |
|---|
| 20 | * 4 7/16/08 1:05p vsilyaev |
|---|
| 21 | * PR 43426: Added more setting for 7403 |
|---|
| 22 | * |
|---|
| 23 | * 3 6/25/08 12:01p jgarrett |
|---|
| 24 | * PR43426: PR43426 : Add 7043 Transcode support |
|---|
| 25 | * |
|---|
| 26 | * PR43426/1 6/24/08 6:24p shyam |
|---|
| 27 | * PR43426 : Add 7043 Transcode support |
|---|
| 28 | * |
|---|
| 29 | * 2 4/7/06 10:00a ahulse |
|---|
| 30 | * PR20504: Merge Vpp modifications into main branch |
|---|
| 31 | * |
|---|
| 32 | * Vpp_7042_Demo/3 4/5/06 3:44p ahulse |
|---|
| 33 | * PR20504: bencode_extended_settings_init now calls bencode_settings_init |
|---|
| 34 | * also, need to pass in bencode_t structure to accomadate this |
|---|
| 35 | * |
|---|
| 36 | * Vpp_7042_Demo/2 4/4/06 1:43p ahulse |
|---|
| 37 | * PR20504: Added bencode_vpp_off mode, pass in quality setting in |
|---|
| 38 | * extended_settings_init so they can be overridden |
|---|
| 39 | * |
|---|
| 40 | * Vpp_7042_Demo/1 3/29/06 5:52p ahulse |
|---|
| 41 | * PR20504: Enable support for changeing 7042's vpp settings when encoding |
|---|
| 42 | * analog |
|---|
| 43 | * |
|---|
| 44 | * 1 2/7/05 7:05p dlwin |
|---|
| 45 | * Merge down for release 2005_REFSW_MERGETOMAIN: |
|---|
| 46 | * |
|---|
| 47 | * Irvine_BSEAVSW_Devel/9 10/28/03 11:27a erickson |
|---|
| 48 | * settop api reworks after internal design view |
|---|
| 49 | * |
|---|
| 50 | * Irvine_BSEAVSW_Devel/8 10/22/03 11:22a erickson |
|---|
| 51 | * settop api pass-through type conversion |
|---|
| 52 | * |
|---|
| 53 | * Irvine_BSEAVSW_Devel/7 9/30/03 1:13a erickson |
|---|
| 54 | * updated docjet documentation |
|---|
| 55 | * |
|---|
| 56 | * Irvine_BSEAVSW_Devel/6 9/17/03 5:04p erickson |
|---|
| 57 | * updated documentation for DocJet |
|---|
| 58 | * |
|---|
| 59 | * Irvine_BSEAVSW_Devel/5 8/21/03 4:31p erickson |
|---|
| 60 | * added get for quality |
|---|
| 61 | * |
|---|
| 62 | * Irvine_BSEAVSW_Devel/4 8/12/03 6:50p vsilyaev |
|---|
| 63 | * Updated encoder settings and renamed bencode_get_settings to the |
|---|
| 64 | * bencode_get. |
|---|
| 65 | * |
|---|
| 66 | * Irvine_BSEAVSW_Devel/3 8/7/03 11:06a vsilyaev |
|---|
| 67 | * Reworked encoder API. |
|---|
| 68 | * |
|---|
| 69 | * Irvine_BSEAVSW_Devel/2 7/9/03 5:19p erickson |
|---|
| 70 | * rework for new bband_t model |
|---|
| 71 | * |
|---|
| 72 | * Irvine_BSEAVSW_Devel/1 7/7/03 9:50a vsilyaev |
|---|
| 73 | * Encoder API. |
|---|
| 74 | * |
|---|
| 75 | * |
|---|
| 76 | ***************************************************************************/ |
|---|
| 77 | #ifndef BSETTOP_ENCODE_H__ |
|---|
| 78 | #define BSETTOP_ENCODE_H__ |
|---|
| 79 | |
|---|
| 80 | #ifdef __cplusplus |
|---|
| 81 | extern "C" |
|---|
| 82 | { |
|---|
| 83 | #endif |
|---|
| 84 | |
|---|
| 85 | /*=*********************************** |
|---|
| 86 | Analog platforms require an MPEG encoder in order to |
|---|
| 87 | record PVR. |
|---|
| 88 | |
|---|
| 89 | The encoder API works by receiving an analog stream and returning |
|---|
| 90 | a digital stream. The analog stream is still valid and can be |
|---|
| 91 | decoded while the digital stream is either decoded or recorded. |
|---|
| 92 | **************************************/ |
|---|
| 93 | |
|---|
| 94 | /*************************************************************************** |
|---|
| 95 | Summary: |
|---|
| 96 | Defines for the video GOP structure. |
|---|
| 97 | ****************************************************************************/ |
|---|
| 98 | typedef enum bencode_gop_structure { |
|---|
| 99 | bencode_gop_structure_i, |
|---|
| 100 | bencode_gop_structure_ip, |
|---|
| 101 | bencode_gop_structure_ipb, |
|---|
| 102 | bencode_gop_structure_ipbb, |
|---|
| 103 | bencode_gop_structure_progressive_refresh |
|---|
| 104 | } bencode_gop_structure; |
|---|
| 105 | |
|---|
| 106 | /* |
|---|
| 107 | Summary: |
|---|
| 108 | Data structure used to initialize the encoder. |
|---|
| 109 | */ |
|---|
| 110 | typedef struct bencode_settings { |
|---|
| 111 | bvideo_codec video_format; /* format of digital video in the encoded stream */ |
|---|
| 112 | unsigned video_width; /* width in pixels of the encoded MPEG stream */ |
|---|
| 113 | unsigned video_height; /* height in pixels of the encoded MPEG stream */ |
|---|
| 114 | unsigned video_bitrate; /* bitrate (bits per second) of the encoded MPEG video stream */ |
|---|
| 115 | uint16_t video_pid; /* pid for the video program */ |
|---|
| 116 | bvideo_frame_rate framerate; /* framerate */ |
|---|
| 117 | bencode_gop_structure gop_structure; /* GOP structure */ |
|---|
| 118 | bool progressive ; /* Progressive or interlaced */ |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | baudio_format audio_type; /* format of the digital audio in the encoded stream */ |
|---|
| 122 | unsigned audio_bitrate; /* bitrate (bits per second) of the encoded audio stream */ |
|---|
| 123 | uint16_t audio_pid; /* pid for the audio program in the encoded stream */ |
|---|
| 124 | |
|---|
| 125 | unsigned transport_bitrate ; |
|---|
| 126 | unsigned vpp_settings; /* what to set the vpp to */ |
|---|
| 127 | } bencode_settings; |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | /** |
|---|
| 131 | Summary: |
|---|
| 132 | Open an MPEG encoder channel. |
|---|
| 133 | Description: |
|---|
| 134 | For a BCM7041, there are two encoder channels, so you can open two encoder objects. |
|---|
| 135 | For a BCM7040, there is one encoder channel, so you can only open one encoder object. |
|---|
| 136 | **/ |
|---|
| 137 | bencode_t bencode_open( |
|---|
| 138 | bobject_t id /* encode object id */ |
|---|
| 139 | ); |
|---|
| 140 | |
|---|
| 141 | /** |
|---|
| 142 | Summary: |
|---|
| 143 | Close an MPEG encoder channel. |
|---|
| 144 | **/ |
|---|
| 145 | void bencode_close( |
|---|
| 146 | bencode_t encode /* encode object */ |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | /* |
|---|
| 150 | Summary: |
|---|
| 151 | Enum used to set enhanced encoding quality settings. |
|---|
| 152 | Description: |
|---|
| 153 | This makes it easier to set the bencode_settings structure. |
|---|
| 154 | **/ |
|---|
| 155 | typedef enum bencode_vpp_mode { |
|---|
| 156 | bencode_vpp_none, /* Don't use extended settings */ |
|---|
| 157 | bencode_vpp_off, /* use extended settings, vpp is off */ |
|---|
| 158 | bencode_vpp_temporal_only, |
|---|
| 159 | bencode_vpp_spatial_only, |
|---|
| 160 | bencode_vpp_impulse_only, |
|---|
| 161 | bencode_vpp_medium, |
|---|
| 162 | bencode_vpp_default |
|---|
| 163 | } bencode_vpp_mode; |
|---|
| 164 | |
|---|
| 165 | /* |
|---|
| 166 | Summary: |
|---|
| 167 | Enum used to set default encoding quality settings. |
|---|
| 168 | Description: |
|---|
| 169 | This makes it easier to set the bencode_settings structure. |
|---|
| 170 | **/ |
|---|
| 171 | typedef enum bencode_quality { |
|---|
| 172 | bencode_quality_best, |
|---|
| 173 | bencode_quality_high, |
|---|
| 174 | bencode_quality_medium, |
|---|
| 175 | bencode_quality_basic |
|---|
| 176 | } bencode_quality; |
|---|
| 177 | |
|---|
| 178 | /** |
|---|
| 179 | Summary: |
|---|
| 180 | Initialize extended encoder settings - vpp video bitrate etc. Added to demonstrate |
|---|
| 181 | adjustable vpp settings of 7042 encoder. |
|---|
| 182 | **/ |
|---|
| 183 | void bencode_extended_settings_init( |
|---|
| 184 | bencode_settings *settings, /* [out] settings to be initialized */ |
|---|
| 185 | bencode_quality quality, /* quality level to use when chosing initial settings */ |
|---|
| 186 | bencode_t encode, /* required for possible resource-dependent defaults */ |
|---|
| 187 | bencode_vpp_mode vpp_mode /* vpp settings to set to*/ |
|---|
| 188 | ); |
|---|
| 189 | |
|---|
| 190 | |
|---|
| 191 | /** |
|---|
| 192 | Summary: |
|---|
| 193 | Initialize encoder settings for a particular quality level. |
|---|
| 194 | **/ |
|---|
| 195 | void bencode_settings_init( |
|---|
| 196 | bencode_settings *settings, /* [out] settings to be initialized */ |
|---|
| 197 | bencode_quality quality, /* quality level to use when chosing initial settings */ |
|---|
| 198 | bencode_t encode /* required for possible resource-dependent defaults */ |
|---|
| 199 | ); |
|---|
| 200 | |
|---|
| 201 | /** |
|---|
| 202 | Summary: |
|---|
| 203 | Start encoding an analog stream. |
|---|
| 204 | Description: |
|---|
| 205 | The analog stream remains valid before, during and after encoding. |
|---|
| 206 | Return values: |
|---|
| 207 | If successful, it returns a digital stream which can be decoded or recorded. |
|---|
| 208 | Otherwise it returns NULL. |
|---|
| 209 | **/ |
|---|
| 210 | bstream_t bencode_start( |
|---|
| 211 | bencode_t encode, /* encode object */ |
|---|
| 212 | bstream_t stream, /* analog stream to encode */ |
|---|
| 213 | const bencode_settings *settings /* settings for the encode */ |
|---|
| 214 | ); |
|---|
| 215 | |
|---|
| 216 | /** |
|---|
| 217 | Summary: |
|---|
| 218 | Stop encoding. |
|---|
| 219 | Description: |
|---|
| 220 | After bencode_stop, the digital stream is invalid. |
|---|
| 221 | The analog stream remains valid. |
|---|
| 222 | **/ |
|---|
| 223 | void bencode_stop( |
|---|
| 224 | bencode_t encode, /* encode object */ |
|---|
| 225 | bstream_t stream /* Digital stream returned by bencode_start which is |
|---|
| 226 | being stopped. */ |
|---|
| 227 | ); |
|---|
| 228 | |
|---|
| 229 | #ifdef __cplusplus |
|---|
| 230 | } |
|---|
| 231 | #endif |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | #endif /* BSETTOP_ENCODE_H__ */ |
|---|
| 235 | |
|---|