Improve conversion code for enum variants

This commit is contained in:
Guillaume Gomez 2021-05-23 13:15:27 +02:00
parent 7e892b507f
commit dcd0695567

View file

@ -565,45 +565,45 @@ impl FromGlib<ffi::GstMessageType> for MessageType {
unsafe fn from_glib(value: ffi::GstMessageType) -> Self {
skip_assert_initialized!();
match value {
0 => MessageType::Unknown,
1 => MessageType::Eos,
2 => MessageType::Error,
4 => MessageType::Warning,
8 => MessageType::Info,
16 => MessageType::Tag,
32 => MessageType::Buffering,
64 => MessageType::StateChanged,
128 => MessageType::StateDirty,
256 => MessageType::StepDone,
512 => MessageType::ClockProvide,
1024 => MessageType::ClockLost,
2048 => MessageType::NewClock,
4096 => MessageType::StructureChange,
8192 => MessageType::StreamStatus,
16384 => MessageType::Application,
32768 => MessageType::Element,
65536 => MessageType::SegmentStart,
131072 => MessageType::SegmentDone,
262144 => MessageType::DurationChanged,
524288 => MessageType::Latency,
1048576 => MessageType::AsyncStart,
2097152 => MessageType::AsyncDone,
4194304 => MessageType::RequestState,
8388608 => MessageType::StepStart,
16777216 => MessageType::Qos,
33554432 => MessageType::Progress,
67108864 => MessageType::Toc,
134217728 => MessageType::ResetTime,
268435456 => MessageType::StreamStart,
536870912 => MessageType::NeedContext,
1073741824 => MessageType::HaveContext,
2147483648 => MessageType::Extended,
2147483649 => MessageType::DeviceAdded,
2147483650 => MessageType::DeviceRemoved,
2147483651 => MessageType::PropertyNotify,
2147483652 => MessageType::StreamCollection,
2147483653 => MessageType::StreamsSelected,
2147483654 => MessageType::Redirect,
ffi::GST_MESSAGE_UNKNOWN => MessageType::Unknown,
ffi::GST_MESSAGE_EOS => MessageType::Eos,
ffi::GST_MESSAGE_ERROR => MessageType::Error,
ffi::GST_MESSAGE_WARNING => MessageType::Warning,
ffi::GST_MESSAGE_INFO => MessageType::Info,
ffi::GST_MESSAGE_TAG => MessageType::Tag,
ffi::GST_MESSAGE_BUFFERING => MessageType::Buffering,
ffi::GST_MESSAGE_STATE_CHANGED => MessageType::StateChanged,
ffi::GST_MESSAGE_STATE_DIRTY => MessageType::StateDirty,
ffi::GST_MESSAGE_STEP_DONE => MessageType::StepDone,
ffi::GST_MESSAGE_CLOCK_PROVIDE => MessageType::ClockProvide,
ffi::GST_MESSAGE_CLOCK_LOST => MessageType::ClockLost,
ffi::GST_MESSAGE_NEW_CLOCK => MessageType::NewClock,
ffi::GST_MESSAGE_STRUCTURE_CHANGE => MessageType::StructureChange,
ffi::GST_MESSAGE_STREAM_STATUS => MessageType::StreamStatus,
ffi::GST_MESSAGE_APPLICATION => MessageType::Application,
ffi::GST_MESSAGE_ELEMENT => MessageType::Element,
ffi::GST_MESSAGE_SEGMENT_START => MessageType::SegmentStart,
ffi::GST_MESSAGE_SEGMENT_DONE => MessageType::SegmentDone,
ffi::GST_MESSAGE_DURATION_CHANGED => MessageType::DurationChanged,
ffi::GST_MESSAGE_LATENCY => MessageType::Latency,
ffi::GST_MESSAGE_ASYNC_START => MessageType::AsyncStart,
ffi::GST_MESSAGE_ASYNC_DONE => MessageType::AsyncDone,
ffi::GST_MESSAGE_REQUEST_STATE => MessageType::RequestState,
ffi::GST_MESSAGE_STEP_START => MessageType::StepStart,
ffi::GST_MESSAGE_QOS => MessageType::Qos,
ffi::GST_MESSAGE_PROGRESS => MessageType::Progress,
ffi::GST_MESSAGE_TOC => MessageType::Toc,
ffi::GST_MESSAGE_RESET_TIME => MessageType::ResetTime,
ffi::GST_MESSAGE_STREAM_START => MessageType::StreamStart,
ffi::GST_MESSAGE_NEED_CONTEXT => MessageType::NeedContext,
ffi::GST_MESSAGE_HAVE_CONTEXT => MessageType::HaveContext,
ffi::GST_MESSAGE_EXTENDED => MessageType::Extended,
ffi::GST_MESSAGE_DEVICE_ADDED => MessageType::DeviceAdded,
ffi::GST_MESSAGE_DEVICE_REMOVED => MessageType::DeviceRemoved,
ffi::GST_MESSAGE_PROPERTY_NOTIFY => MessageType::PropertyNotify,
ffi::GST_MESSAGE_STREAM_COLLECTION => MessageType::StreamCollection,
ffi::GST_MESSAGE_STREAMS_SELECTED => MessageType::StreamsSelected,
ffi::GST_MESSAGE_REDIRECT => MessageType::Redirect,
value => MessageType::__Unknown(value as i32),
}
}