mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 00:18:11 +01:00
Add sample_bytes to media player supported format (#7451)
This commit is contained in:
parent
f652cd3851
commit
857d79dc71
5 changed files with 14 additions and 0 deletions
|
@ -1118,6 +1118,7 @@ message MediaPlayerSupportedFormat {
|
|||
uint32 sample_rate = 2;
|
||||
uint32 num_channels = 3;
|
||||
MediaPlayerFormatPurpose purpose = 4;
|
||||
uint32 sample_bytes = 5;
|
||||
}
|
||||
message ListEntitiesMediaPlayerResponse {
|
||||
option (id) = 63;
|
||||
|
|
|
@ -1032,6 +1032,7 @@ bool APIConnection::send_media_player_info(media_player::MediaPlayer *media_play
|
|||
media_format.sample_rate = supported_format.sample_rate;
|
||||
media_format.num_channels = supported_format.num_channels;
|
||||
media_format.purpose = static_cast<enums::MediaPlayerFormatPurpose>(supported_format.purpose);
|
||||
media_format.sample_bytes = supported_format.sample_bytes;
|
||||
msg.supported_formats.push_back(media_format);
|
||||
}
|
||||
|
||||
|
|
|
@ -5149,6 +5149,10 @@ bool MediaPlayerSupportedFormat::decode_varint(uint32_t field_id, ProtoVarInt va
|
|||
this->purpose = value.as_enum<enums::MediaPlayerFormatPurpose>();
|
||||
return true;
|
||||
}
|
||||
case 5: {
|
||||
this->sample_bytes = value.as_uint32();
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -5168,6 +5172,7 @@ void MediaPlayerSupportedFormat::encode(ProtoWriteBuffer buffer) const {
|
|||
buffer.encode_uint32(2, this->sample_rate);
|
||||
buffer.encode_uint32(3, this->num_channels);
|
||||
buffer.encode_enum<enums::MediaPlayerFormatPurpose>(4, this->purpose);
|
||||
buffer.encode_uint32(5, this->sample_bytes);
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void MediaPlayerSupportedFormat::dump_to(std::string &out) const {
|
||||
|
@ -5190,6 +5195,11 @@ void MediaPlayerSupportedFormat::dump_to(std::string &out) const {
|
|||
out.append(" purpose: ");
|
||||
out.append(proto_enum_to_string<enums::MediaPlayerFormatPurpose>(this->purpose));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" sample_bytes: ");
|
||||
sprintf(buffer, "%" PRIu32, this->sample_bytes);
|
||||
out.append(buffer);
|
||||
out.append("\n");
|
||||
out.append("}");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1277,6 +1277,7 @@ class MediaPlayerSupportedFormat : public ProtoMessage {
|
|||
uint32_t sample_rate{0};
|
||||
uint32_t num_channels{0};
|
||||
enums::MediaPlayerFormatPurpose purpose{};
|
||||
uint32_t sample_bytes{0};
|
||||
void encode(ProtoWriteBuffer buffer) const override;
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
void dump_to(std::string &out) const override;
|
||||
|
|
|
@ -37,6 +37,7 @@ struct MediaPlayerSupportedFormat {
|
|||
uint32_t sample_rate;
|
||||
uint32_t num_channels;
|
||||
MediaPlayerFormatPurpose purpose;
|
||||
uint32_t sample_bytes;
|
||||
};
|
||||
|
||||
class MediaPlayer;
|
||||
|
|
Loading…
Reference in a new issue