Add sample_bytes to media player supported format (#7451)

This commit is contained in:
Michael Hansen 2024-09-15 18:46:54 -05:00 committed by GitHub
parent f652cd3851
commit 857d79dc71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 0 deletions

View file

@ -1118,6 +1118,7 @@ message MediaPlayerSupportedFormat {
uint32 sample_rate = 2; uint32 sample_rate = 2;
uint32 num_channels = 3; uint32 num_channels = 3;
MediaPlayerFormatPurpose purpose = 4; MediaPlayerFormatPurpose purpose = 4;
uint32 sample_bytes = 5;
} }
message ListEntitiesMediaPlayerResponse { message ListEntitiesMediaPlayerResponse {
option (id) = 63; option (id) = 63;

View file

@ -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.sample_rate = supported_format.sample_rate;
media_format.num_channels = supported_format.num_channels; media_format.num_channels = supported_format.num_channels;
media_format.purpose = static_cast<enums::MediaPlayerFormatPurpose>(supported_format.purpose); 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); msg.supported_formats.push_back(media_format);
} }

View file

@ -5149,6 +5149,10 @@ bool MediaPlayerSupportedFormat::decode_varint(uint32_t field_id, ProtoVarInt va
this->purpose = value.as_enum<enums::MediaPlayerFormatPurpose>(); this->purpose = value.as_enum<enums::MediaPlayerFormatPurpose>();
return true; return true;
} }
case 5: {
this->sample_bytes = value.as_uint32();
return true;
}
default: default:
return false; return false;
} }
@ -5168,6 +5172,7 @@ void MediaPlayerSupportedFormat::encode(ProtoWriteBuffer buffer) const {
buffer.encode_uint32(2, this->sample_rate); buffer.encode_uint32(2, this->sample_rate);
buffer.encode_uint32(3, this->num_channels); buffer.encode_uint32(3, this->num_channels);
buffer.encode_enum<enums::MediaPlayerFormatPurpose>(4, this->purpose); buffer.encode_enum<enums::MediaPlayerFormatPurpose>(4, this->purpose);
buffer.encode_uint32(5, this->sample_bytes);
} }
#ifdef HAS_PROTO_MESSAGE_DUMP #ifdef HAS_PROTO_MESSAGE_DUMP
void MediaPlayerSupportedFormat::dump_to(std::string &out) const { 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(" purpose: ");
out.append(proto_enum_to_string<enums::MediaPlayerFormatPurpose>(this->purpose)); out.append(proto_enum_to_string<enums::MediaPlayerFormatPurpose>(this->purpose));
out.append("\n"); out.append("\n");
out.append(" sample_bytes: ");
sprintf(buffer, "%" PRIu32, this->sample_bytes);
out.append(buffer);
out.append("\n");
out.append("}"); out.append("}");
} }
#endif #endif

View file

@ -1277,6 +1277,7 @@ class MediaPlayerSupportedFormat : public ProtoMessage {
uint32_t sample_rate{0}; uint32_t sample_rate{0};
uint32_t num_channels{0}; uint32_t num_channels{0};
enums::MediaPlayerFormatPurpose purpose{}; enums::MediaPlayerFormatPurpose purpose{};
uint32_t sample_bytes{0};
void encode(ProtoWriteBuffer buffer) const override; void encode(ProtoWriteBuffer buffer) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP #ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override; void dump_to(std::string &out) const override;

View file

@ -37,6 +37,7 @@ struct MediaPlayerSupportedFormat {
uint32_t sample_rate; uint32_t sample_rate;
uint32_t num_channels; uint32_t num_channels;
MediaPlayerFormatPurpose purpose; MediaPlayerFormatPurpose purpose;
uint32_t sample_bytes;
}; };
class MediaPlayer; class MediaPlayer;