|
TB2026-YDS Firmware
|
Playback transport: the orchestrator that turns the playlist into sound. More...
#include "esp_err.h"#include "playlist.h"#include "volume.h"#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | player_status_t |
| Snapshot of the transport for the UI. More... | |
Enumerations | |
| enum | player_state_t { PLAYER_STOPPED , PLAYER_PLAYING , PLAYER_PAUSED } |
| Transport state. More... | |
Functions | |
| esp_err_t | player_init (void) |
| Register the player with the pipeline's end-of-track callback. Call once at startup. | |
| esp_err_t | player_set_output (volume_output_t out) |
| Select the output and keep the volume routing consistent. | |
| void | player_poll (void) |
| Complete a deferred Bluetooth start once the speaker acknowledges the volume. | |
| esp_err_t | player_play (size_t index) |
Play the storage track at index (stops any current stream first). | |
| esp_err_t | player_start (void) |
| Start playback from the stopped state (e.g. first play after boot). | |
| esp_err_t | player_pause (void) |
| Pause the current playback (sink down, position kept). | |
| esp_err_t | player_resume (void) |
| Resume a paused playback. | |
| esp_err_t | player_stop (void) |
| Stop playback and power the output down. | |
| esp_err_t | player_next (void) |
| Skip to the next track (respecting the playlist's repeat/shuffle order). | |
| esp_err_t | player_prev (void) |
| Step to the previous track. Mirror of player_next. | |
| esp_err_t | player_get_state (player_status_t *out) |
| Read the current transport state and track. | |
| void | player_save_resume (void) |
| Persist the current track (path + position) so Now Playing re-selects it after boot. | |
Playback transport: the orchestrator that turns the playlist into sound.
The player sits above the pieces and wires them together: it asks the Playlist service what to play, hands the path to the Audio pipeline, picks the output sink and keeps the Volume service routing in step, and listens for end-of-track to advance automatically. It owns only the transport state (stopped / playing / paused) and the chosen output; "which track" stays the playlist's single source of truth, so the player carries no duplicate position. Dependency direction: ui -> player -> playlist -> storage; the player never touches the SD mount or a decoder/sink directly.
Threading: call the player_* API from one control task (the UI/maintenance task). The only exception is the internal end-of-track callback, which runs in the audio task and merely advances; do not call the API from interrupt context.