ffmpeg_rs/device/
input.rs1use std::ptr;
2
3use ffi::*;
4use format;
5use Format;
6
7pub struct AudioIter(*mut AVInputFormat);
8
9impl Iterator for AudioIter {
10 type Item = Format;
11
12 fn next(&mut self) -> Option<<Self as Iterator>::Item> {
13 unsafe {
14 let ptr = av_input_audio_device_next(self.0) as *mut AVInputFormat;
15
16 if ptr.is_null() && !self.0.is_null() {
17 None
18 } else {
19 self.0 = ptr;
20
21 Some(Format::Input(format::Input::wrap(ptr)))
22 }
23 }
24 }
25}
26
27pub fn audio() -> AudioIter {
28 AudioIter(ptr::null_mut())
29}
30
31pub struct VideoIter(*mut AVInputFormat);
32
33impl Iterator for VideoIter {
34 type Item = Format;
35
36 fn next(&mut self) -> Option<<Self as Iterator>::Item> {
37 unsafe {
38 let ptr = av_input_video_device_next(self.0) as *mut AVInputFormat;
39
40 if ptr.is_null() && !self.0.is_null() {
41 None
42 } else {
43 self.0 = ptr;
44
45 Some(Format::Input(format::Input::wrap(ptr)))
46 }
47 }
48 }
49}
50
51pub fn video() -> VideoIter {
52 VideoIter(ptr::null_mut())
53}