#![allow(unused_imports)]
use crate::dm::conformance::{Clause, Condition, Conform, Conformance};
use crate::dm::meta::{EventPriority, Reporting};
use crate::dm::spec::{Attribute, Cluster, Command, Event, Feature};
use crate::dm::{Access, AccessQualities, AttributeQualities, Privilege};
use crate::error::Result;
use crate::im::{AttributeId, ClusterId, CommandId, EventId};
use crate::tlv::{
ContainerKind, Element, FromTlv, Nullable, Tag, TlvList, TlvReader, TlvWriter, ToTlv, Value,
};
pub const ID: ClusterId = 0x0506;
pub const REVISION: u16 = 2;
pub const PICS: &str = "MEDIAPLAYBACK";
pub mod feature {
pub const ADVANCED_SEEK: u32 = 1 << 0;
pub const VARIABLE_SPEED: u32 = 1 << 1;
pub const TEXT_TRACKS: u32 = 1 << 2;
pub const AUDIO_TRACKS: u32 = 1 << 3;
pub const AUDIO_ADVANCE: u32 = 1 << 4;
}
pub const FEATURES: &[Feature] = &[
Feature {
bit: 0,
code: "AS",
name: "AdvancedSeek",
conform: Conform::OPTIONAL,
},
Feature {
bit: 1,
code: "VS",
name: "VariableSpeed",
conform: Conform::OPTIONAL,
},
Feature {
bit: 2,
code: "TT",
name: "TextTracks",
conform: Conform::OPTIONAL,
},
Feature {
bit: 3,
code: "AT",
name: "AudioTracks",
conform: Conform::OPTIONAL,
},
Feature {
bit: 4,
code: "AA",
name: "AudioAdvance",
conform: Conform::OPTIONAL,
},
];
pub mod attribute {
use crate::im::AttributeId;
pub const CURRENT_STATE: AttributeId = 0x00;
pub const START_TIME: AttributeId = 0x01;
pub const DURATION: AttributeId = 0x02;
pub const SAMPLED_POSITION: AttributeId = 0x03;
pub const PLAYBACK_SPEED: AttributeId = 0x04;
pub const SEEK_RANGE_END: AttributeId = 0x05;
pub const SEEK_RANGE_START: AttributeId = 0x06;
pub const ACTIVE_AUDIO_TRACK: AttributeId = 0x07;
pub const AVAILABLE_AUDIO_TRACKS: AttributeId = 0x08;
pub const ACTIVE_TEXT_TRACK: AttributeId = 0x09;
pub const AVAILABLE_TEXT_TRACKS: AttributeId = 0x0A;
}
pub mod command {
use crate::im::CommandId;
pub const PLAY: CommandId = 0x00;
pub const PAUSE: CommandId = 0x01;
pub const STOP: CommandId = 0x02;
pub const START_OVER: CommandId = 0x03;
pub const PREVIOUS: CommandId = 0x04;
pub const NEXT: CommandId = 0x05;
pub const REWIND: CommandId = 0x06;
pub const FAST_FORWARD: CommandId = 0x07;
pub const SKIP_FORWARD: CommandId = 0x08;
pub const SKIP_BACKWARD: CommandId = 0x09;
pub const PLAYBACK_RESPONSE: CommandId = 0x0A;
pub const SEEK: CommandId = 0x0B;
pub const ACTIVATE_AUDIO_TRACK: CommandId = 0x0C;
pub const ACTIVATE_TEXT_TRACK: CommandId = 0x0D;
pub const DEACTIVATE_TEXT_TRACK: CommandId = 0x0E;
}
pub mod event {
use crate::im::EventId;
pub const STATE_CHANGED: EventId = 0x00;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum CharacteristicEnum {
ForcedSubtitles = 0,
DescribesVideo = 1,
EasyToRead = 2,
FrameBased = 3,
MainProgram = 4,
OriginalContent = 5,
VoiceOverTranslation = 6,
Caption = 7,
Subtitle = 8,
Alternate = 9,
Supplementary = 10,
Commentary = 11,
DubbedTranslation = 12,
Description = 13,
Metadata = 14,
EnhancedAudioIntelligibility = 15,
Emergency = 16,
Karaoke = 17,
}
impl CharacteristicEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::ForcedSubtitles),
1 => Some(Self::DescribesVideo),
2 => Some(Self::EasyToRead),
3 => Some(Self::FrameBased),
4 => Some(Self::MainProgram),
5 => Some(Self::OriginalContent),
6 => Some(Self::VoiceOverTranslation),
7 => Some(Self::Caption),
8 => Some(Self::Subtitle),
9 => Some(Self::Alternate),
10 => Some(Self::Supplementary),
11 => Some(Self::Commentary),
12 => Some(Self::DubbedTranslation),
13 => Some(Self::Description),
14 => Some(Self::Metadata),
15 => Some(Self::EnhancedAudioIntelligibility),
16 => Some(Self::Emergency),
17 => Some(Self::Karaoke),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for CharacteristicEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for CharacteristicEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum PlaybackStateEnum {
Playing = 0,
Paused = 1,
NotPlaying = 2,
Buffering = 3,
}
impl PlaybackStateEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Playing),
1 => Some(Self::Paused),
2 => Some(Self::NotPlaying),
3 => Some(Self::Buffering),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for PlaybackStateEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for PlaybackStateEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum StatusEnum {
Success = 0,
InvalidStateForCommand = 1,
NotAllowed = 2,
NotActive = 3,
SpeedOutOfRange = 4,
SeekOutOfRange = 5,
}
impl StatusEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Success),
1 => Some(Self::InvalidStateForCommand),
2 => Some(Self::NotAllowed),
3 => Some(Self::NotActive),
4 => Some(Self::SpeedOutOfRange),
5 => Some(Self::SeekOutOfRange),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for StatusEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for StatusEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct PlaybackPositionStruct {
pub updated_at: u64,
pub position: Nullable<u64>,
}
impl ToTlv for PlaybackPositionStruct {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.updated_at.to_tlv(w, Tag::Context(0))?;
self.position.to_tlv(w, Tag::Context(1))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for PlaybackPositionStruct {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut updated_at = None;
let mut position = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => updated_at = Some(<u64>::from_tlv(reader, &field)?),
Some(1) => position = Some(<Nullable<u64>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
updated_at: updated_at.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
position: position.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct TrackAttributesStruct<'a> {
pub language_code: &'a str,
pub characteristics: Option<Nullable<TlvList<'a, CharacteristicEnum>>>,
pub display_name: Option<Nullable<&'a str>>,
}
impl<'a> ToTlv for TrackAttributesStruct<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.language_code.to_tlv(w, Tag::Context(0))?;
if let Some(value) = &self.characteristics {
value.to_tlv(w, Tag::Context(1))?;
}
if let Some(value) = &self.display_name {
value.to_tlv(w, Tag::Context(2))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for TrackAttributesStruct<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut language_code = None;
let mut characteristics = None;
let mut display_name = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => language_code = Some(<&'a str>::from_tlv(reader, &field)?),
Some(1) => {
characteristics = Some(<Nullable<TlvList<'a, CharacteristicEnum>>>::from_tlv(
reader, &field,
)?)
}
Some(2) => display_name = Some(<Nullable<&'a str>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
language_code: language_code.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
characteristics,
display_name,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct TrackStruct<'a> {
pub id: &'a str,
pub track_attributes: TrackAttributesStruct<'a>,
}
impl<'a> ToTlv for TrackStruct<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.id.to_tlv(w, Tag::Context(0))?;
self.track_attributes.to_tlv(w, Tag::Context(1))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for TrackStruct<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut id = None;
let mut track_attributes = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => id = Some(<&'a str>::from_tlv(reader, &field)?),
Some(1) => {
track_attributes = Some(<TrackAttributesStruct<'a>>::from_tlv(reader, &field)?)
}
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
id: id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
track_attributes: track_attributes
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct RewindFields {
pub audio_advance_unmuted: Option<bool>,
}
impl ToTlv for RewindFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
if let Some(value) = &self.audio_advance_unmuted {
value.to_tlv(w, Tag::Context(0))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for RewindFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut audio_advance_unmuted = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => audio_advance_unmuted = Some(<bool>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
audio_advance_unmuted,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct FastForwardFields {
pub audio_advance_unmuted: Option<bool>,
}
impl ToTlv for FastForwardFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
if let Some(value) = &self.audio_advance_unmuted {
value.to_tlv(w, Tag::Context(0))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for FastForwardFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut audio_advance_unmuted = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => audio_advance_unmuted = Some(<bool>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
audio_advance_unmuted,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SkipForwardFields {
pub delta_position_milliseconds: u64,
}
impl ToTlv for SkipForwardFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.delta_position_milliseconds
.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SkipForwardFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut delta_position_milliseconds = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => delta_position_milliseconds = Some(<u64>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
delta_position_milliseconds: delta_position_milliseconds
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SkipBackwardFields {
pub delta_position_milliseconds: u64,
}
impl ToTlv for SkipBackwardFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.delta_position_milliseconds
.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SkipBackwardFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut delta_position_milliseconds = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => delta_position_milliseconds = Some(<u64>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
delta_position_milliseconds: delta_position_milliseconds
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct PlaybackResponseFields<'a> {
pub status: StatusEnum,
pub data: Option<&'a str>,
}
impl<'a> ToTlv for PlaybackResponseFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.status.to_tlv(w, Tag::Context(0))?;
if let Some(value) = &self.data {
value.to_tlv(w, Tag::Context(1))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for PlaybackResponseFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut status = None;
let mut data = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => status = Some(<StatusEnum>::from_tlv(reader, &field)?),
Some(1) => data = Some(<&'a str>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
status: status.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
data,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SeekFields {
pub position: u64,
}
impl ToTlv for SeekFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.position.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SeekFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut position = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => position = Some(<u64>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
position: position.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ActivateAudioTrackFields<'a> {
pub track_id: &'a str,
pub audio_output_index: Option<Nullable<u8>>,
}
impl<'a> ToTlv for ActivateAudioTrackFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.track_id.to_tlv(w, Tag::Context(0))?;
if let Some(value) = &self.audio_output_index {
value.to_tlv(w, Tag::Context(1))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for ActivateAudioTrackFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut track_id = None;
let mut audio_output_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => track_id = Some(<&'a str>::from_tlv(reader, &field)?),
Some(1) => audio_output_index = Some(<Nullable<u8>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
track_id: track_id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
audio_output_index,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ActivateTextTrackFields<'a> {
pub track_id: &'a str,
}
impl<'a> ToTlv for ActivateTextTrackFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.track_id.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for ActivateTextTrackFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut track_id = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => track_id = Some(<&'a str>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
track_id: track_id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
pub const ATTRIBUTES: &[Attribute] = &[
Attribute {
id: 0x0000,
name: "CurrentState",
kind: "PlaybackStateEnum",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::MANDATORY,
},
Attribute {
id: 0x0001,
name: "StartTime",
kind: "epoch-us",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0002,
name: "Duration",
kind: "uint64",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0003,
name: "SampledPosition",
kind: "PlaybackPositionStruct",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0004,
name: "PlaybackSpeed",
kind: "single",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0005,
name: "SeekRangeEnd",
kind: "uint64",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0006,
name: "SeekRangeStart",
kind: "uint64",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0007,
name: "ActiveAudioTrack",
kind: "TrackStruct",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(3),
}],
},
},
Attribute {
id: 0x0008,
name: "AvailableAudioTracks",
kind: "list[TrackStruct]",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(3),
}],
},
},
Attribute {
id: 0x0009,
name: "ActiveTextTrack",
kind: "TrackStruct",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(2),
}],
},
},
Attribute {
id: 0x000A,
name: "AvailableTextTracks",
kind: "list[TrackStruct]",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(2),
}],
},
},
];
pub const COMMANDS: &[Command] = &[
Command {
id: 0x00,
name: "Play",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform::MANDATORY,
},
Command {
id: 0x01,
name: "Pause",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform::MANDATORY,
},
Command {
id: 0x02,
name: "Stop",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform::MANDATORY,
},
Command {
id: 0x03,
name: "StartOver",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform::OPTIONAL,
},
Command {
id: 0x04,
name: "Previous",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform::OPTIONAL,
},
Command {
id: 0x05,
name: "Next",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform::OPTIONAL,
},
Command {
id: 0x06,
name: "Rewind",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(1),
}],
},
},
Command {
id: 0x07,
name: "FastForward",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(1),
}],
},
},
Command {
id: 0x08,
name: "SkipForward",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform::OPTIONAL,
},
Command {
id: 0x09,
name: "SkipBackward",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform::OPTIONAL,
},
Command {
id: 0x0A,
name: "PlaybackResponse",
to_server: false,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform::MANDATORY,
},
Command {
id: 0x0B,
name: "Seek",
to_server: true,
response: Some(0x0A),
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Command {
id: 0x0C,
name: "ActivateAudioTrack",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(3),
}],
},
},
Command {
id: 0x0D,
name: "ActivateTextTrack",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(2),
}],
},
},
Command {
id: 0x0E,
name: "DeactivateTextTrack",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(2),
}],
},
},
];
pub const EVENTS: &[Event] = &[Event {
id: 0x00,
name: "StateChanged",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform::OPTIONAL,
}];
pub const CLUSTER: Cluster = Cluster {
id: ID,
name: "Media Playback",
revision: REVISION,
pics: "MEDIAPLAYBACK",
derived_from: None,
features: FEATURES,
attributes: ATTRIBUTES,
commands: COMMANDS,
events: EVENTS,
};