Skip to content

Commit

Permalink
Require 16-bit samples for media player (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam authored Sep 16, 2024
1 parent 24c8bc5 commit cc12187
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions esphome/components/media_player/media_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct MediaPlayerSupportedFormat {
uint32_t sample_rate;
uint32_t num_channels;
MediaPlayerFormatPurpose purpose;
uint32_t sample_bytes;
};

struct MediaFile {
Expand Down
6 changes: 4 additions & 2 deletions esphome/components/nabu/nabu_media_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,14 @@ media_player::MediaPlayerTraits NabuMediaPlayer::get_traits() {
media_player::MediaPlayerSupportedFormat{.format = "flac",
.sample_rate = 48000,
.num_channels = 2,
.purpose = media_player::MediaPlayerFormatPurpose::PURPOSE_DEFAULT});
.purpose = media_player::MediaPlayerFormatPurpose::PURPOSE_DEFAULT,
.sample_bytes = 2});
traits.get_supported_formats().push_back(media_player::MediaPlayerSupportedFormat{
.format = "flac",
.sample_rate = 48000,
.num_channels = 1,
.purpose = media_player::MediaPlayerFormatPurpose::PURPOSE_ANNOUNCEMENT});
.purpose = media_player::MediaPlayerFormatPurpose::PURPOSE_ANNOUNCEMENT,
.sample_bytes = 2});
return traits;
};

Expand Down

0 comments on commit cc12187

Please sign in to comment.