| 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_transcode.h $ |
|---|
| 11 | * $brcm_Revision: 2 $ |
|---|
| 12 | * $brcm_Date: 7/23/08 3:19p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/api/include/bsettop_transcode.h $ |
|---|
| 19 | * |
|---|
| 20 | * 2 7/23/08 3:19p jgarrett |
|---|
| 21 | * PR43426: Fixing erroneous comment |
|---|
| 22 | * |
|---|
| 23 | * 1 6/25/08 12:01p jgarrett |
|---|
| 24 | * PR43426: PR43426 : Changes as per review comments |
|---|
| 25 | * PR43426 : Further modification for dynamic controls and debug |
|---|
| 26 | * PR43426 : Add transcode support to Settopapi |
|---|
| 27 | * |
|---|
| 28 | * PR43426/4 6/23/08 2:12p shyam |
|---|
| 29 | * PR43426 : Changes as per review comments |
|---|
| 30 | * |
|---|
| 31 | * PR43426/3 6/18/08 5:03p shyam |
|---|
| 32 | * PR43426 : Changes as per review comments |
|---|
| 33 | * |
|---|
| 34 | * PR43426/2 6/12/08 7:14p shyam |
|---|
| 35 | * PR43426 : Further modification for dynamic controls and debug |
|---|
| 36 | * |
|---|
| 37 | * PR43426/1 6/6/08 7:13p shyam |
|---|
| 38 | * PR43426 : Add transcode support to Settopapi |
|---|
| 39 | * |
|---|
| 40 | ***************************************************************************/ |
|---|
| 41 | #ifndef BSETTOP_TRANSCODE_H__ |
|---|
| 42 | #define BSETTOP_TRANSCODE_H__ |
|---|
| 43 | |
|---|
| 44 | #ifdef __cplusplus |
|---|
| 45 | extern "C" |
|---|
| 46 | { |
|---|
| 47 | #endif |
|---|
| 48 | |
|---|
| 49 | #define BTRANSCODE_MAX_VIDEO_PROGRAM 6 |
|---|
| 50 | #define BTRANSCODE_MAX_AUDIO_PROGRAM 6 |
|---|
| 51 | #define BTRANSCODE_MAX_DATA_PROGRAM 6 |
|---|
| 52 | |
|---|
| 53 | typedef struct btranscode_program { |
|---|
| 54 | |
|---|
| 55 | struct { |
|---|
| 56 | uint16_t pid; /* Pid 0 means unused slot */ |
|---|
| 57 | bvideo_codec format; |
|---|
| 58 | unsigned width; /* width in pixels of the encoded MPEG stream */ |
|---|
| 59 | unsigned height; /* height in pixels of the encoded MPEG stream */ |
|---|
| 60 | unsigned bitrate; /* bitrate (bits per second) of the encoded MPEG video stream */ |
|---|
| 61 | bvideo_frame_rate framerate; /* framerate */ |
|---|
| 62 | bencode_gop_structure gop_structure; /* GOP structure */ |
|---|
| 63 | bool progressive ; /* Progressive or interlaced */ |
|---|
| 64 | |
|---|
| 65 | } video[BTRANSCODE_MAX_VIDEO_PROGRAM]; /* video stream pids */ |
|---|
| 66 | struct { |
|---|
| 67 | uint16_t pid; |
|---|
| 68 | baudio_format format; /* format of the digital audio in the encoded stream */ |
|---|
| 69 | bool passthrough ; /* Enable Pass Through of incoming stream */ |
|---|
| 70 | unsigned samplerate; /* sample rate (samples per second) of the encoded audio stream */ |
|---|
| 71 | unsigned bitrate; /* bitrate (bits per second) of the encoded audio stream */ |
|---|
| 72 | |
|---|
| 73 | } audio[BTRANSCODE_MAX_AUDIO_PROGRAM]; /* audio stream pids */ |
|---|
| 74 | struct { |
|---|
| 75 | uint16_t pid; |
|---|
| 76 | } ancillary[BTRANSCODE_MAX_DATA_PROGRAM]; /* data channels */ |
|---|
| 77 | uint16_t pcr_pid; |
|---|
| 78 | } btranscode_program; |
|---|
| 79 | |
|---|
| 80 | /* |
|---|
| 81 | Summary: |
|---|
| 82 | Data structure used to initialize the transcoder. |
|---|
| 83 | */ |
|---|
| 84 | typedef struct btranscode_settings { |
|---|
| 85 | bool realtime ; /* Enables or disables realtime */ |
|---|
| 86 | btranscode_program program ; |
|---|
| 87 | bstream_mpeg_type stream_type; |
|---|
| 88 | unsigned transport_bitrate ; |
|---|
| 89 | } btranscode_settings; |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | /** |
|---|
| 93 | Summary: |
|---|
| 94 | The status data structure. |
|---|
| 95 | **/ |
|---|
| 96 | typedef struct btranscode_status { |
|---|
| 97 | bool is_locked ; /* True if encoder is locked */ |
|---|
| 98 | unsigned frame_count; /* Encoded frame count */ |
|---|
| 99 | } btranscode_status; |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | /* |
|---|
| 103 | Summary: |
|---|
| 104 | Open a transcode engine |
|---|
| 105 | Description: |
|---|
| 106 | */ |
|---|
| 107 | btranscode_t btranscode_open( |
|---|
| 108 | bobject_t transcode_id /* transcode object id */ |
|---|
| 109 | ); |
|---|
| 110 | |
|---|
| 111 | /** |
|---|
| 112 | Summary: |
|---|
| 113 | Initialize transcoder settings for a particular quality level. |
|---|
| 114 | **/ |
|---|
| 115 | void btranscode_settings_init( |
|---|
| 116 | btranscode_settings *settings, /* [out] settings to be initialized */ |
|---|
| 117 | bencode_quality quality, /* quality level to use when chosing initial settings */ |
|---|
| 118 | bencode_vpp_mode vpp_mode /* vpp settings to set to*/ |
|---|
| 119 | ); |
|---|
| 120 | |
|---|
| 121 | /* |
|---|
| 122 | Summary: |
|---|
| 123 | Close a transcode |
|---|
| 124 | */ |
|---|
| 125 | void btranscode_close( |
|---|
| 126 | btranscode_t transcode /* handle returned by btranscode_open */ |
|---|
| 127 | ); |
|---|
| 128 | |
|---|
| 129 | /* |
|---|
| 130 | Summary: |
|---|
| 131 | Start transcoding a stream. |
|---|
| 132 | */ |
|---|
| 133 | bstream_t btranscode_start( |
|---|
| 134 | btranscode_t transcode, /* handle returned by btranscode_open */ |
|---|
| 135 | bstream_t source, /* source for the transcode, either analog or digital */ |
|---|
| 136 | const btranscode_settings *settings /* settings to be initialized */ |
|---|
| 137 | ); |
|---|
| 138 | |
|---|
| 139 | /* |
|---|
| 140 | Summary: |
|---|
| 141 | Stop transcoding a stream. |
|---|
| 142 | Description: |
|---|
| 143 | The stream remains valid after transcode is stopped. |
|---|
| 144 | */ |
|---|
| 145 | void btranscode_stop( |
|---|
| 146 | btranscode_t transcode /* handle returned by btranscode_open */ |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | /* |
|---|
| 151 | Summary: |
|---|
| 152 | Pause a stream transcode. |
|---|
| 153 | */ |
|---|
| 154 | bresult btranscode_pause( |
|---|
| 155 | btranscode_t transcode /* handle returned by btranscode_open */ |
|---|
| 156 | ); |
|---|
| 157 | |
|---|
| 158 | |
|---|
| 159 | /* |
|---|
| 160 | Summary: |
|---|
| 161 | Resume a stream transcode. |
|---|
| 162 | */ |
|---|
| 163 | bresult btranscode_resume( |
|---|
| 164 | btranscode_t transcode /* handle returned by btranscode_open */ |
|---|
| 165 | ); |
|---|
| 166 | |
|---|
| 167 | |
|---|
| 168 | /* |
|---|
| 169 | Summary: |
|---|
| 170 | Get Settings for a stream transcode |
|---|
| 171 | Description: |
|---|
| 172 | Get aand Set settings will take care of dyanmic parameter changes |
|---|
| 173 | */ |
|---|
| 174 | void btranscode_get( |
|---|
| 175 | btranscode_t transcode, /* handle returned by btranscode_open */ |
|---|
| 176 | btranscode_settings *settings |
|---|
| 177 | ) ; |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | /* |
|---|
| 181 | Summary: |
|---|
| 182 | Set Settings for a stream transcode |
|---|
| 183 | Description: |
|---|
| 184 | Sets the transcoder settings |
|---|
| 185 | */ |
|---|
| 186 | bresult btranscode_set( |
|---|
| 187 | btranscode_t transcode, /* handle returned by btranscode_open */ |
|---|
| 188 | const btranscode_settings *settings |
|---|
| 189 | ) ; |
|---|
| 190 | |
|---|
| 191 | /* |
|---|
| 192 | Summary: |
|---|
| 193 | Get Settings for a stream transcode |
|---|
| 194 | Description: |
|---|
| 195 | Get aand Set settings will take care of dyanmic parameter changes |
|---|
| 196 | */ |
|---|
| 197 | bresult btranscode_get_status( |
|---|
| 198 | btranscode_t transcode, /* handle returned by btranscode_open */ |
|---|
| 199 | btranscode_status *status |
|---|
| 200 | ) ; |
|---|
| 201 | |
|---|
| 202 | #ifdef __cplusplus |
|---|
| 203 | } |
|---|
| 204 | #endif |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | #endif /* BSETTOP_TRANSCODE_H__ */ |
|---|
| 208 | |
|---|