opusic_c/multistream/
encoder.rs

1use crate::{sys, mem, ErrorCode, Application, SampleRate, Bandwidth, Bitrate, Signal, InbandFec, FrameDuration};
2use super::Config;
3
4use mem::alloc::vec::Vec;
5
6///OPUS multistream encoder
7///
8pub struct Encoder {
9    inner: mem::Unique<sys::OpusMSEncoder>,
10    channels: u8,
11}
12
13impl Encoder {
14    ///Creates new encoder instance
15    ///
16    ///## Notes
17    ///
18    ///### Mapping
19    ///
20    ///`config.mapping` table defines which decoded channel i should be used for each input/output (I/O) channel j.
21    ///
22    ///Let `i` = `mapping[j]` be the index for I/O channel `j`.
23    ///
24    ///If `i` < `2*coupled_streams`, then I/O channel `j` is encoded as the left channel of stream `(i/2)` if `i` is even,
25    ///or as the right channel of stream `(i/2)` if `i` is odd.
26    ///
27    ///Otherwise, I/O channel `j` is encoded as mono in stream `(i - coupled_streams)`,
28    ///unless it has the special value **255**,
29    ///in which case it is omitted from the encoding entirely (the decoder will reproduce it as silence).
30    ///
31    ///Each value `i` must either be the special value **255** or be less than `streams + coupled_streams`.
32    pub fn new<const CH: usize>(config: Config<CH>, rate: SampleRate, app: Application) -> Result<Self, ErrorCode> {
33        let size = unsafe {
34            sys::opus_multistream_encoder_get_size(config.streams as _, config.coupled_streams as _)
35        };
36
37        if size == 0 {
38            return Err(ErrorCode::Internal);
39        }
40
41        let mut encoder = match mem::Unique::new(size as _) {
42            Some(inner) => Encoder {
43                inner,
44                channels: CH as _,
45            },
46            None => return Err(ErrorCode::AllocFail)
47        };
48
49        let result = unsafe {
50            sys::opus_multistream_encoder_init(encoder.inner.as_mut(), rate as _, CH as _, config.streams as _, config.coupled_streams as _, config.mapping.as_ptr() as _, app as _)
51        };
52
53        map_sys_error!(result => encoder)
54    }
55
56    #[inline]
57    ///Resets state to initial state
58    pub fn reset(&mut self) -> Result<(), ErrorCode> {
59        let result = unsafe {
60            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_RESET_STATE)
61        };
62
63        map_sys_error!(result => ())
64    }
65
66    ///Encodes an Opus frame, returning number of bytes written.
67    ///
68    ///If more than 1 channel is configured, then input must be interleaved.
69    ///
70    ///Input size must correspond to sampling rate.
71    ///For example, at 48 kHz allowed frame sizes are 120, 240, 480, 960, 1920, and 2880.
72    ///Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes.
73    pub fn encode_to(&mut self, input: &[u16], output: &mut [mem::MaybeUninit<u8>]) -> Result<usize, ErrorCode> {
74        let result = unsafe {
75            sys::opus_multistream_encode(self.inner.as_mut(),
76                                         input.as_ptr() as _, (input.len() / (self.channels as usize)) as _,
77                                         output.as_mut_ptr() as _, output.len() as _)
78        };
79
80        map_sys_error!(result => result as _)
81    }
82
83    #[inline(always)]
84    ///Encodes an Opus frame, returning number of bytes written.
85    ///
86    ///Refer to `encode_to` for details
87    pub fn encode_to_slice(&mut self, input: &[u16], output: &mut [u8]) -> Result<usize, ErrorCode> {
88        self.encode_to(input, unsafe { mem::transmute(output) })
89    }
90
91    #[inline(always)]
92    ///Encodes an Opus frame, returning number of bytes written.
93    ///
94    ///Vector will be written into spare capacity, modifying its length on success.
95    ///
96    ///It is user responsibility to reserve correct amount of space
97    ///
98    ///Refer to `encode_to` for details
99    pub fn encode_to_vec(&mut self, input: &[u16], output: &mut Vec<u8>) -> Result<usize, ErrorCode> {
100        let initial_len = output.len();
101        let result = self.encode_to(input, output.spare_capacity_mut())?;
102        unsafe {
103            output.set_len(initial_len + result);
104        }
105        Ok(result)
106    }
107
108    ///Encodes an Opus frame, returning number of bytes written.
109    ///
110    ///If more than 1 channel is configured, then input must be interleaved.
111    ///
112    ///Input size must correspond to sampling rate.
113    ///For example, at 48 kHz allowed frame sizes are 120, 240, 480, 960, 1920, and 2880.
114    ///Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes.
115    ///
116    ///## Note
117    ///
118    ///When using float API, input with a normal range of +/-1.0 should be preferred.
119    ///Samples with a range beyond +/-1.0 are supported
120    ///but will be clipped by decoders using the integer API and should only be used
121    ///if it is known that the far end supports extended dynamic range
122    pub fn encode_float_to(&mut self, input: &[f32], output: &mut [mem::MaybeUninit<u8>]) -> Result<usize, ErrorCode> {
123        let result = unsafe {
124            sys::opus_multistream_encode_float(self.inner.as_mut(),
125                                               input.as_ptr(), (input.len() / (self.channels as usize)) as _,
126                                               output.as_mut_ptr() as _, output.len() as _)
127        };
128
129        map_sys_error!(result => result as _)
130    }
131
132    #[inline(always)]
133    ///Encodes an Opus frame, returning number of bytes written.
134    ///
135    ///Refer to `encode_to` for details
136    pub fn encode_float_to_slice(&mut self, input: &[f32], output: &mut [u8]) -> Result<usize, ErrorCode> {
137        self.encode_float_to(input, unsafe { mem::transmute(output) })
138    }
139
140    #[inline(always)]
141    ///Encodes an Opus frame, returning number of bytes written.
142    ///
143    ///Vector will be written into spare capacity, modifying its length on success.
144    ///
145    ///It is user responsibility to reserve correct amount of space
146    ///
147    ///Refer to `encode_to` for details
148    pub fn encode_float_to_vec(&mut self, input: &[f32], output: &mut Vec<u8>) -> Result<usize, ErrorCode> {
149        let initial_len = output.len();
150        let result = self.encode_float_to(input, output.spare_capacity_mut())?;
151        unsafe {
152            output.set_len(initial_len + result);
153        }
154        Ok(result)
155    }
156
157    #[inline]
158    ///Gets the total samples of delay added by the entire codec.
159    ///
160    ///From the perspective of a decoding application the real data begins this many samples late.
161    pub fn get_look_ahead(&mut self) -> Result<u32, ErrorCode> {
162        let mut value: i32 = 0;
163        let result = unsafe {
164            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_LOOKAHEAD_REQUEST, &mut value)
165        };
166
167        map_sys_error!(result => match value.is_negative() {
168            false => value as _,
169            true => return Err(ErrorCode::unknown())
170        })
171    }
172
173    #[inline]
174    ///Gets the encoder's bitrate configuration.
175    pub fn get_bitrate(&mut self) -> Result<Bitrate, ErrorCode> {
176        let mut value: i32 = 0;
177        let result = unsafe {
178            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_BITRATE_REQUEST, &mut value)
179        };
180
181        map_sys_error!(result => value.into())
182    }
183
184    #[inline]
185    ///Configures the encoder's bitrate
186    pub fn set_bitrate(&mut self, value: Bitrate) -> Result<(), ErrorCode> {
187        let value: i32 = value.into();
188        let result = unsafe {
189            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_BITRATE_REQUEST, value)
190        };
191
192        map_sys_error!(result => ())
193    }
194
195    #[inline]
196    ///Determine if variable bitrate (VBR) is enabled in the encoder.
197    pub fn get_vbr(&mut self) -> Result<bool, ErrorCode> {
198        let mut value: i32 = 0;
199        let result = unsafe {
200            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_VBR_REQUEST, &mut value)
201        };
202
203        map_sys_error!(result => value == 1)
204    }
205
206    #[inline]
207    ///Enables or disables variable bitrate (VBR) in the encoder.
208    ///
209    ///The configured bitrate may not be met exactly because frames must be an integer number of bytes in length.
210    pub fn set_vbr(&mut self, value: bool) -> Result<(), ErrorCode> {
211        let value: i32 = match value {
212            true => 1,
213            false => 0
214        };
215        let result = unsafe {
216            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_VBR_REQUEST, value)
217        };
218
219        map_sys_error!(result => ())
220    }
221
222    #[inline]
223    ///Determine if constrained VBR is enabled in the encoder.
224    pub fn get_vbr_constraint(&mut self) -> Result<bool, ErrorCode> {
225        let mut value: i32 = 0;
226        let result = unsafe {
227            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_VBR_CONSTRAINT_REQUEST, &mut value)
228        };
229
230        map_sys_error!(result => value == 1)
231    }
232
233    #[inline]
234    ///Enables or disables constrained VBR in the encoder.
235    ///
236    ///This setting is ignored when the encoder is in CBR mode.
237    ///
238    ///## Note
239    ///
240    ///Only the MDCT mode of Opus currently heeds the constraint. Speech mode ignores it
241    ///completely, hybrid mode may fail to obey it if the LPC layer uses more bitrate than the
242    ///constraint would have permitted.
243    pub fn set_vbr_constraint(&mut self, value: bool) -> Result<(), ErrorCode> {
244        let value: i32 = match value {
245            true => 1,
246            false => 0
247        };
248        let result = unsafe {
249            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_VBR_CONSTRAINT_REQUEST, value)
250        };
251
252        map_sys_error!(result => ())
253    }
254
255    #[inline]
256    ///Gets the encoder's complexity configuration.
257    pub fn get_complexity(&mut self) -> Result<u8, ErrorCode> {
258        let mut value: i32 = 0;
259        let result = unsafe {
260            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_COMPLEXITY_REQUEST, &mut value)
261        };
262
263        map_sys_error!(result => value as _)
264    }
265
266    #[inline]
267    ///Configures the encoder's computational complexity.
268    ///
269    ///The supported range is 0-10 inclusive with 10 representing the highest complexity.
270    pub fn set_complexity(&mut self, value: u8) -> Result<(), ErrorCode> {
271        let result = unsafe {
272            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_COMPLEXITY_REQUEST, value as i32)
273        };
274
275        map_sys_error!(result => ())
276    }
277
278    #[inline]
279    ///Gets the encoder's configured signal type.
280    pub fn get_signal(&mut self) -> Result<Signal, ErrorCode> {
281        let mut value: i32 = 0;
282        let result = unsafe {
283            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_SIGNAL_REQUEST, &mut value)
284        };
285
286        map_sys_error!(result => value.into())
287    }
288
289    #[inline]
290    ///Configures the type of signal being encoded.
291    ///
292    ///This is a hint which helps the encoder's mode selection.
293    pub fn set_signal(&mut self, value: Signal) -> Result<(), ErrorCode> {
294        let result = unsafe {
295            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_SIGNAL_REQUEST, value as i32)
296        };
297
298        map_sys_error!(result => ())
299    }
300
301    #[inline]
302    ///Gets the encoder's configured application.
303    pub fn get_application(&mut self) -> Result<Application, ErrorCode> {
304        let mut value: i32 = 0;
305        let result = unsafe {
306            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_APPLICATION_REQUEST, &mut value)
307        };
308
309        map_sys_error!(result => match Application::from_sys(value) {
310            Some(value) => value,
311            None => return Err(ErrorCode::unknown())
312        })
313    }
314
315    #[inline]
316    ///Configures the encoder's intended application.
317    ///
318    ///The initial value is a mandatory argument to encoder constructor.
319    pub fn set_application(&mut self, value: Application) -> Result<(), ErrorCode> {
320        let result = unsafe {
321            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_APPLICATION_REQUEST, value as i32)
322        };
323
324        map_sys_error!(result => ())
325    }
326
327    #[inline]
328    ///Gets the encoder's configured bandpass
329    pub fn get_bandwidth(&mut self) -> Result<Bandwidth, ErrorCode> {
330        let mut value: i32 = 0;
331        let result = unsafe {
332            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_BANDWIDTH_REQUEST, &mut value)
333        };
334
335        map_sys_error!(result => value.into())
336    }
337
338    #[inline]
339    ///Sets the encoder's bandpass to a specific value.
340    ///
341    ///This prevents the encoder from automatically selecting the bandpass based on the available
342    ///bitrate. If an application knows the bandpass of the input audio it is providing, it should
343    ///normally use `set_max_bandwidth` instead, which still gives the encoder the freedom to
344    ///reduce the bandpass when the bitrate becomes too low, for better overall quality.
345    pub fn set_bandwidth(&mut self, value: Bandwidth) -> Result<(), ErrorCode> {
346        let result = unsafe {
347            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_BANDWIDTH_REQUEST, value as i32)
348        };
349
350        map_sys_error!(result => ())
351    }
352
353    #[inline]
354    ///Configures the maximum bandpass that the encoder will select automatically.
355    ///
356    ///Applications should normally use this instead of `set_bandwidth` (leaving that set to the
357    ///default, `Bandwidth::Auto`). This allows the application to set an upper bound based on the type of
358    ///input it is providing, but still gives the encoder the freedom to reduce the bandpass when
359    ///the bitrate becomes too low, for better overall quality.
360    pub fn set_max_bandwidth(&mut self, value: Bandwidth) -> Result<(), ErrorCode> {
361        let result = unsafe {
362            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_MAX_BANDWIDTH_REQUEST, value as i32)
363        };
364
365        map_sys_error!(result => ())
366    }
367
368    #[inline]
369    ///Gets encoder's configured use of inband forward error correction.
370    pub fn get_inband_fec(&mut self) -> Result<InbandFec, ErrorCode> {
371        let mut value: i32 = 0;
372        let result = unsafe {
373            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_INBAND_FEC_REQUEST, &mut value)
374        };
375
376        map_sys_error!(result => match value {
377            0 => InbandFec::Off,
378            1 => InbandFec::Mode1,
379            2 => InbandFec::Mode2,
380            _ => return Err(ErrorCode::unknown()),
381        })
382    }
383
384    #[inline]
385    ///Configures the encoder's use of inband forward error correction (FEC).
386    ///
387    ///## Note
388    ///
389    ///This is only applicable to the LPC layer
390    pub fn set_inband_fec(&mut self, value: InbandFec) -> Result<(), ErrorCode> {
391        let result = unsafe {
392            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_INBAND_FEC_REQUEST, value as i32)
393        };
394
395        map_sys_error!(result => ())
396    }
397
398    #[inline]
399    ///Gets the encoder's configured packet loss percentage.
400    pub fn get_packet_loss(&mut self) -> Result<u8, ErrorCode> {
401        let mut value: i32 = 0;
402        let result = unsafe {
403            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_PACKET_LOSS_PERC_REQUEST, &mut value)
404        };
405
406        map_sys_error!(result => value as _)
407    }
408
409    #[inline]
410    ///Configures the encoder's expected packet loss percentage (Allowed values are 0..=100).
411    ///
412    ///Higher values trigger progressively more loss resistant behavior in the encoder at the
413    ///expense of quality at a given bitrate in the absence of packet loss, but greater quality
414    ///under loss.
415    pub fn set_packet_loss(&mut self, value: u8) -> Result<(), ErrorCode> {
416        let result = unsafe {
417            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_PACKET_LOSS_PERC_REQUEST, value as i32)
418        };
419
420        map_sys_error!(result => ())
421    }
422
423    #[inline]
424    ///Gets the encoder's configured prediction status.
425    pub fn get_prediction_disabled(&mut self) -> Result<bool, ErrorCode> {
426        let mut value: i32 = 0;
427        let result = unsafe {
428            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_PREDICTION_DISABLED_REQUEST, &mut value)
429        };
430
431        map_sys_error!(result => value == 1)
432    }
433
434    #[inline]
435    ///If set to `true`, disables almost all use of prediction, making frames almost completely independent.
436    ///
437    ///This reduces quality.
438    pub fn set_prediction_disabled(&mut self, value: bool) -> Result<(), ErrorCode> {
439        let value: i32 = match value {
440            true => 1,
441            false => 0,
442        };
443
444        let result = unsafe {
445            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_PREDICTION_DISABLED_REQUEST, value)
446        };
447
448        map_sys_error!(result => ())
449    }
450
451    #[inline]
452    ///Gets the encoder's configured signal depth.
453    pub fn get_lsb_depth(&mut self) -> Result<u8, ErrorCode> {
454        let mut value: i32 = 0;
455        let result = unsafe {
456            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_LSB_DEPTH_REQUEST, &mut value)
457        };
458
459        map_sys_error!(result => value as _)
460    }
461
462    #[inline]
463    ///Configures the depth of signal being encoded (Defaults to 24) in range 8 to 24.
464    ///
465    ///This is a hint which helps the encoder identify silence and near-silence. It represents the
466    ///number of significant bits of linear intensity below which the signal contains ignorable
467    ///quantization or other noise.
468    ///
469    ///For example, 14 would be an appropriate setting for G.711 u-law input.
470    ///16 would be appropriate for 16-bit linear pcm input with `encode_float`.
471    ///
472    ///When using `encode` instead of `encode_float`, or when libopus is compiled for
473    ///fixed-point, the encoder uses the minimum of the value set here and the value 16.
474    pub fn set_lsb_depth(&mut self, value: u8) -> Result<(), ErrorCode> {
475        let result = unsafe {
476            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_LSB_DEPTH_REQUEST, value as i32)
477        };
478
479        map_sys_error!(result => ())
480    }
481
482    #[inline]
483    ///Gets the encoder's configured use of variable duration frames.
484    pub fn get_frame_duration(&mut self) -> Result<FrameDuration, ErrorCode> {
485        let mut value: i32 = 0;
486        let result = unsafe {
487            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_EXPERT_FRAME_DURATION_REQUEST, &mut value)
488        };
489
490        map_sys_error!(result => match value {
491            sys::OPUS_FRAMESIZE_ARG => FrameDuration::SizeArg,
492            sys::OPUS_FRAMESIZE_2_5_MS => FrameDuration::Size2_5,
493            sys::OPUS_FRAMESIZE_5_MS => FrameDuration::Size5,
494            sys::OPUS_FRAMESIZE_10_MS => FrameDuration::Size10,
495            sys::OPUS_FRAMESIZE_20_MS => FrameDuration::Size20,
496            sys::OPUS_FRAMESIZE_40_MS => FrameDuration::Size40,
497            sys::OPUS_FRAMESIZE_60_MS => FrameDuration::Size60,
498            sys::OPUS_FRAMESIZE_80_MS => FrameDuration::Size80,
499            sys::OPUS_FRAMESIZE_100_MS => FrameDuration::Size100,
500            sys::OPUS_FRAMESIZE_120_MS => FrameDuration::Size120,
501            _ => return Err(ErrorCode::unknown()),
502        })
503    }
504
505    #[inline]
506    ///Configures the encoder's use of variable duration frames.
507    ///
508    ///When variable duration is enabled, the encoder is free to use a shorter frame size than the
509    ///one requested in the `encode` call. It is then the user's responsibility to verify how
510    ///much audio was encoded by checking the ToC byte of the encoded packet. The part of the audio
511    ///that was not encoded needs to be resent to the encoder for the next call. Do not use this
512    ///option unless you really know what you are doing.
513    pub fn set_frame_duration(&mut self, value: FrameDuration) -> Result<(), ErrorCode> {
514        let result = unsafe {
515            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_EXPERT_FRAME_DURATION_REQUEST, value as i32)
516        };
517
518        map_sys_error!(result => ())
519    }
520
521    #[inline]
522    ///Gets configured sample rate of this instance
523    pub fn get_sample_rate(&mut self) -> Result<SampleRate, ErrorCode> {
524        let mut value: i32 = 0;
525        let result = unsafe {
526            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_SAMPLE_RATE_REQUEST, &mut value)
527        };
528
529        map_sys_error!(result => match value {
530            8000 => SampleRate::Hz8000,
531            12000 => SampleRate::Hz12000,
532            16000 => SampleRate::Hz16000,
533            24000 => SampleRate::Hz24000,
534            48000 => SampleRate::Hz48000,
535            _ => return Err(ErrorCode::unknown())
536        })
537    }
538
539    #[inline]
540    ///Access encoder's DTX value
541    pub fn get_dtx(&mut self) -> Result<bool, ErrorCode> {
542        let mut value: i32 = 0;
543        let result = unsafe {
544            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_DTX_REQUEST, &mut value)
545        };
546
547        map_sys_error!(result => value == 1)
548    }
549
550    #[inline]
551    ///Configures the encoder's use of discontinuous transmission (DTX).
552    ///
553    ///This is only applicable to the LPC layer
554    pub fn set_dtx(&mut self, value: bool) -> Result<(), ErrorCode> {
555        let value: i32 = match value {
556            true => 1,
557            false => 0,
558        };
559
560        let result = unsafe {
561            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_DTX_REQUEST, value)
562        };
563
564        map_sys_error!(result => ())
565    }
566
567    #[inline]
568    ///Gets the encoder's configured phase inversion status.
569    pub fn get_phase_inversion_disabled(&mut self) -> Result<bool, ErrorCode> {
570        let mut value: i32 = 0;
571        let result = unsafe {
572            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_GET_PHASE_INVERSION_DISABLED_REQUEST, &mut value)
573        };
574
575        map_sys_error!(result => value == 1)
576    }
577
578    #[inline]
579    ///Configures phase inversion.
580    ///
581    ///If set to `true`, disables the use of phase inversion for intensity stereo, improving the quality
582    ///of mono downmixes, but slightly reducing normal stereo quality.
583    pub fn set_phase_inversion_disabled(&mut self, value: bool) -> Result<(), ErrorCode> {
584        let value: i32 = match value {
585            true => 1,
586            false => 0,
587        };
588
589        let result = unsafe {
590            sys::opus_multistream_encoder_ctl(self.inner.as_mut(), sys::OPUS_SET_PHASE_INVERSION_DISABLED_REQUEST, value)
591        };
592
593        map_sys_error!(result => ())
594    }
595}
596
597unsafe impl Send for Encoder {}