| .. | .. |
|---|
| 151 | 151 | - Addition of encoding options when required (derived from OpenMAX IL) |
|---|
| 152 | 152 | - Addition of rateControlSupported (missing in OpenMAX AL) |
|---|
| 153 | 153 | |
|---|
| 154 | +State Machine |
|---|
| 155 | +============= |
|---|
| 156 | + |
|---|
| 157 | +The compressed audio stream state machine is described below :: |
|---|
| 158 | + |
|---|
| 159 | + +----------+ |
|---|
| 160 | + | | |
|---|
| 161 | + | OPEN | |
|---|
| 162 | + | | |
|---|
| 163 | + +----------+ |
|---|
| 164 | + | |
|---|
| 165 | + | |
|---|
| 166 | + | compr_set_params() |
|---|
| 167 | + | |
|---|
| 168 | + v |
|---|
| 169 | + compr_free() +----------+ |
|---|
| 170 | + +------------------------------------| | |
|---|
| 171 | + | | SETUP | |
|---|
| 172 | + | +-------------------------| |<-------------------------+ |
|---|
| 173 | + | | compr_write() +----------+ | |
|---|
| 174 | + | | ^ | |
|---|
| 175 | + | | | compr_drain_notify() | |
|---|
| 176 | + | | | or | |
|---|
| 177 | + | | | compr_stop() | |
|---|
| 178 | + | | | | |
|---|
| 179 | + | | +----------+ | |
|---|
| 180 | + | | | | | |
|---|
| 181 | + | | | DRAIN | | |
|---|
| 182 | + | | | | | |
|---|
| 183 | + | | +----------+ | |
|---|
| 184 | + | | ^ | |
|---|
| 185 | + | | | | |
|---|
| 186 | + | | | compr_drain() | |
|---|
| 187 | + | | | | |
|---|
| 188 | + | v | | |
|---|
| 189 | + | +----------+ +----------+ | |
|---|
| 190 | + | | | compr_start() | | compr_stop() | |
|---|
| 191 | + | | PREPARE |------------------->| RUNNING |--------------------------+ |
|---|
| 192 | + | | | | | | |
|---|
| 193 | + | +----------+ +----------+ | |
|---|
| 194 | + | | | ^ | |
|---|
| 195 | + | |compr_free() | | | |
|---|
| 196 | + | | compr_pause() | | compr_resume() | |
|---|
| 197 | + | | | | | |
|---|
| 198 | + | v v | | |
|---|
| 199 | + | +----------+ +----------+ | |
|---|
| 200 | + | | | | | compr_stop() | |
|---|
| 201 | + +--->| FREE | | PAUSE |---------------------------+ |
|---|
| 202 | + | | | | |
|---|
| 203 | + +----------+ +----------+ |
|---|
| 204 | + |
|---|
| 154 | 205 | |
|---|
| 155 | 206 | Gapless Playback |
|---|
| 156 | 207 | ================ |
|---|
| .. | .. |
|---|
| 183 | 234 | EOF is reached and now DSP can start skipping padding delay. Also next write |
|---|
| 184 | 235 | data would belong to next track |
|---|
| 185 | 236 | |
|---|
| 186 | | -- set_next_track_param |
|---|
| 187 | | -This routine is called to send to DSP codec specific data of subsequent track |
|---|
| 188 | | -in gapless before first write. |
|---|
| 189 | | - |
|---|
| 190 | | - |
|---|
| 191 | 237 | Sequence flow for gapless would be: |
|---|
| 192 | 238 | - Open |
|---|
| 193 | 239 | - Get caps / codec caps |
|---|
| .. | .. |
|---|
| 199 | 245 | - Indicate next track data by sending set_next_track |
|---|
| 200 | 246 | - Set metadata of the next track |
|---|
| 201 | 247 | - then call partial_drain to flush most of buffer in DSP |
|---|
| 202 | | -- set codec specific data of subsequent track |
|---|
| 203 | 248 | - Fill data of the next track |
|---|
| 204 | 249 | - DSP switches to second track |
|---|
| 205 | 250 | |
|---|
| 206 | 251 | (note: order for partial_drain and write for next track can be reversed as well) |
|---|
| 207 | 252 | |
|---|
| 253 | +Gapless Playback SM |
|---|
| 254 | +=================== |
|---|
| 255 | + |
|---|
| 256 | +For Gapless, we move from running state to partial drain and back, along |
|---|
| 257 | +with setting of meta_data and signalling for next track :: |
|---|
| 258 | + |
|---|
| 259 | + |
|---|
| 260 | + +----------+ |
|---|
| 261 | + compr_drain_notify() | | |
|---|
| 262 | + +------------------------>| RUNNING | |
|---|
| 263 | + | | | |
|---|
| 264 | + | +----------+ |
|---|
| 265 | + | | |
|---|
| 266 | + | | |
|---|
| 267 | + | | compr_next_track() |
|---|
| 268 | + | | |
|---|
| 269 | + | V |
|---|
| 270 | + | +----------+ |
|---|
| 271 | + | | | |
|---|
| 272 | + | |NEXT_TRACK| |
|---|
| 273 | + | | | |
|---|
| 274 | + | +----------+ |
|---|
| 275 | + | | |
|---|
| 276 | + | | |
|---|
| 277 | + | | compr_partial_drain() |
|---|
| 278 | + | | |
|---|
| 279 | + | V |
|---|
| 280 | + | +----------+ |
|---|
| 281 | + | | | |
|---|
| 282 | + +------------------------ | PARTIAL_ | |
|---|
| 283 | + | DRAIN | |
|---|
| 284 | + +----------+ |
|---|
| 208 | 285 | |
|---|
| 209 | 286 | Not supported |
|---|
| 210 | 287 | ============= |
|---|