1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;
use gst_rtsp_server_sys;

/// Result codes from RTSP address pool functions.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum RTSPAddressPoolResult {
    /// no error
    Ok,
    /// invalid arguments were provided to a function
    Einval,
    /// the addres has already been reserved
    Ereserved,
    /// the address is not in the pool
    Erange,
    /// last error
    Elast,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for RTSPAddressPoolResult {
    type GlibType = gst_rtsp_server_sys::GstRTSPAddressPoolResult;

    fn to_glib(&self) -> gst_rtsp_server_sys::GstRTSPAddressPoolResult {
        match *self {
            RTSPAddressPoolResult::Ok => gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_OK,
            RTSPAddressPoolResult::Einval => gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_EINVAL,
            RTSPAddressPoolResult::Ereserved => {
                gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ERESERVED
            }
            RTSPAddressPoolResult::Erange => gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ERANGE,
            RTSPAddressPoolResult::Elast => gst_rtsp_server_sys::GST_RTSP_ADDRESS_POOL_ELAST,
            RTSPAddressPoolResult::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_rtsp_server_sys::GstRTSPAddressPoolResult> for RTSPAddressPoolResult {
    fn from_glib(value: gst_rtsp_server_sys::GstRTSPAddressPoolResult) -> Self {
        skip_assert_initialized!();
        match value {
            0 => RTSPAddressPoolResult::Ok,
            -1 => RTSPAddressPoolResult::Einval,
            -2 => RTSPAddressPoolResult::Ereserved,
            -3 => RTSPAddressPoolResult::Erange,
            -4 => RTSPAddressPoolResult::Elast,
            value => RTSPAddressPoolResult::__Unknown(value),
        }
    }
}

/// Possible return values for `RTSPSessionPoolExt::filter`.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum RTSPFilterResult {
    /// Remove session
    Remove,
    /// Keep session in the pool
    Keep,
    /// Ref session in the result list
    Ref,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for RTSPFilterResult {
    type GlibType = gst_rtsp_server_sys::GstRTSPFilterResult;

    fn to_glib(&self) -> gst_rtsp_server_sys::GstRTSPFilterResult {
        match *self {
            RTSPFilterResult::Remove => gst_rtsp_server_sys::GST_RTSP_FILTER_REMOVE,
            RTSPFilterResult::Keep => gst_rtsp_server_sys::GST_RTSP_FILTER_KEEP,
            RTSPFilterResult::Ref => gst_rtsp_server_sys::GST_RTSP_FILTER_REF,
            RTSPFilterResult::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_rtsp_server_sys::GstRTSPFilterResult> for RTSPFilterResult {
    fn from_glib(value: gst_rtsp_server_sys::GstRTSPFilterResult) -> Self {
        skip_assert_initialized!();
        match value {
            0 => RTSPFilterResult::Remove,
            1 => RTSPFilterResult::Keep,
            2 => RTSPFilterResult::Ref,
            value => RTSPFilterResult::__Unknown(value),
        }
    }
}

/// The state of the media pipeline.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum RTSPMediaStatus {
    /// media pipeline not prerolled
    Unprepared,
    /// media pipeline is busy doing a clean
    ///  shutdown.
    Unpreparing,
    /// media pipeline is prerolling
    Preparing,
    /// media pipeline is prerolled
    Prepared,
    /// media is suspended
    Suspended,
    /// media pipeline is in error
    Error,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for RTSPMediaStatus {
    type GlibType = gst_rtsp_server_sys::GstRTSPMediaStatus;

    fn to_glib(&self) -> gst_rtsp_server_sys::GstRTSPMediaStatus {
        match *self {
            RTSPMediaStatus::Unprepared => gst_rtsp_server_sys::GST_RTSP_MEDIA_STATUS_UNPREPARED,
            RTSPMediaStatus::Unpreparing => gst_rtsp_server_sys::GST_RTSP_MEDIA_STATUS_UNPREPARING,
            RTSPMediaStatus::Preparing => gst_rtsp_server_sys::GST_RTSP_MEDIA_STATUS_PREPARING,
            RTSPMediaStatus::Prepared => gst_rtsp_server_sys::GST_RTSP_MEDIA_STATUS_PREPARED,
            RTSPMediaStatus::Suspended => gst_rtsp_server_sys::GST_RTSP_MEDIA_STATUS_SUSPENDED,
            RTSPMediaStatus::Error => gst_rtsp_server_sys::GST_RTSP_MEDIA_STATUS_ERROR,
            RTSPMediaStatus::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_rtsp_server_sys::GstRTSPMediaStatus> for RTSPMediaStatus {
    fn from_glib(value: gst_rtsp_server_sys::GstRTSPMediaStatus) -> Self {
        skip_assert_initialized!();
        match value {
            0 => RTSPMediaStatus::Unprepared,
            1 => RTSPMediaStatus::Unpreparing,
            2 => RTSPMediaStatus::Preparing,
            3 => RTSPMediaStatus::Prepared,
            4 => RTSPMediaStatus::Suspended,
            5 => RTSPMediaStatus::Error,
            value => RTSPMediaStatus::__Unknown(value),
        }
    }
}

/// Whether the clock and possibly RTP/clock offset should be published according to RFC7273.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum RTSPPublishClockMode {
    /// Publish nothing
    None,
    /// Publish the clock but not the offset
    Clock,
    /// Publish the clock and offset
    ClockAndOffset,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for RTSPPublishClockMode {
    type GlibType = gst_rtsp_server_sys::GstRTSPPublishClockMode;

    fn to_glib(&self) -> gst_rtsp_server_sys::GstRTSPPublishClockMode {
        match *self {
            RTSPPublishClockMode::None => gst_rtsp_server_sys::GST_RTSP_PUBLISH_CLOCK_MODE_NONE,
            RTSPPublishClockMode::Clock => gst_rtsp_server_sys::GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK,
            RTSPPublishClockMode::ClockAndOffset => {
                gst_rtsp_server_sys::GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK_AND_OFFSET
            }
            RTSPPublishClockMode::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_rtsp_server_sys::GstRTSPPublishClockMode> for RTSPPublishClockMode {
    fn from_glib(value: gst_rtsp_server_sys::GstRTSPPublishClockMode) -> Self {
        skip_assert_initialized!();
        match value {
            0 => RTSPPublishClockMode::None,
            1 => RTSPPublishClockMode::Clock,
            2 => RTSPPublishClockMode::ClockAndOffset,
            value => RTSPPublishClockMode::__Unknown(value),
        }
    }
}

impl StaticType for RTSPPublishClockMode {
    fn static_type() -> Type {
        unsafe { from_glib(gst_rtsp_server_sys::gst_rtsp_publish_clock_mode_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for RTSPPublishClockMode {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for RTSPPublishClockMode {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for RTSPPublishClockMode {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// The suspend mode of the media pipeline. A media pipeline is suspended right
/// after creating the SDP and when the client performs a PAUSED request.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum RTSPSuspendMode {
    /// Media is not suspended
    None,
    /// Media is PAUSED in suspend
    Pause,
    /// The media is set to NULL when suspended
    Reset,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for RTSPSuspendMode {
    type GlibType = gst_rtsp_server_sys::GstRTSPSuspendMode;

    fn to_glib(&self) -> gst_rtsp_server_sys::GstRTSPSuspendMode {
        match *self {
            RTSPSuspendMode::None => gst_rtsp_server_sys::GST_RTSP_SUSPEND_MODE_NONE,
            RTSPSuspendMode::Pause => gst_rtsp_server_sys::GST_RTSP_SUSPEND_MODE_PAUSE,
            RTSPSuspendMode::Reset => gst_rtsp_server_sys::GST_RTSP_SUSPEND_MODE_RESET,
            RTSPSuspendMode::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_rtsp_server_sys::GstRTSPSuspendMode> for RTSPSuspendMode {
    fn from_glib(value: gst_rtsp_server_sys::GstRTSPSuspendMode) -> Self {
        skip_assert_initialized!();
        match value {
            0 => RTSPSuspendMode::None,
            1 => RTSPSuspendMode::Pause,
            2 => RTSPSuspendMode::Reset,
            value => RTSPSuspendMode::__Unknown(value),
        }
    }
}

impl StaticType for RTSPSuspendMode {
    fn static_type() -> Type {
        unsafe { from_glib(gst_rtsp_server_sys::gst_rtsp_suspend_mode_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for RTSPSuspendMode {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for RTSPSuspendMode {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for RTSPSuspendMode {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

/// Different thread types
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum RTSPThreadType {
    /// a thread to handle the client communication
    Client,
    /// a thread to handle media
    Media,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for RTSPThreadType {
    type GlibType = gst_rtsp_server_sys::GstRTSPThreadType;

    fn to_glib(&self) -> gst_rtsp_server_sys::GstRTSPThreadType {
        match *self {
            RTSPThreadType::Client => gst_rtsp_server_sys::GST_RTSP_THREAD_TYPE_CLIENT,
            RTSPThreadType::Media => gst_rtsp_server_sys::GST_RTSP_THREAD_TYPE_MEDIA,
            RTSPThreadType::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<gst_rtsp_server_sys::GstRTSPThreadType> for RTSPThreadType {
    fn from_glib(value: gst_rtsp_server_sys::GstRTSPThreadType) -> Self {
        skip_assert_initialized!();
        match value {
            0 => RTSPThreadType::Client,
            1 => RTSPThreadType::Media,
            value => RTSPThreadType::__Unknown(value),
        }
    }
}