File tree Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,7 @@ use std::{
12
12
} ;
13
13
14
14
use anyhow:: anyhow;
15
- use linuxvideo:: {
16
- format:: { PixFormat , PixelFormat } ,
17
- Device ,
18
- } ;
15
+ use linuxvideo:: { format:: Format , BufType , Device } ;
19
16
20
17
fn main ( ) -> anyhow:: Result < ( ) > {
21
18
env_logger:: init ( ) ;
@@ -33,8 +30,10 @@ fn main() -> anyhow::Result<()> {
33
30
device. capabilities( ) ?. device_capabilities( )
34
31
) ;
35
32
36
- let mut capture =
37
- device. video_capture ( PixFormat :: new ( u32:: MAX , u32:: MAX , PixelFormat :: YUYV ) ) ?;
33
+ let Format :: VideoCapture ( fmt) = device. format ( BufType :: VIDEO_CAPTURE ) ? else {
34
+ unreachable ! ( )
35
+ } ;
36
+ let mut capture = device. video_capture ( fmt) ?;
38
37
println ! ( "negotiated format: {:?}" , capture. format( ) ) ;
39
38
let size = capture. format ( ) . size_image ( ) as usize ;
40
39
let mut buf = vec ! [ 0 ; size] ;
Original file line number Diff line number Diff line change @@ -12,10 +12,7 @@ use std::{
12
12
} ;
13
13
14
14
use anyhow:: anyhow;
15
- use linuxvideo:: {
16
- format:: { PixFormat , PixelFormat } ,
17
- Device ,
18
- } ;
15
+ use linuxvideo:: { format:: Format , BufType , Device } ;
19
16
20
17
fn main ( ) -> anyhow:: Result < ( ) > {
21
18
env_logger:: init ( ) ;
@@ -33,7 +30,10 @@ fn main() -> anyhow::Result<()> {
33
30
device. capabilities( ) ?. device_capabilities( )
34
31
) ;
35
32
36
- let capture = device. video_capture ( PixFormat :: new ( u32:: MAX , u32:: MAX , PixelFormat :: YUYV ) ) ?;
33
+ let Format :: VideoCapture ( fmt) = device. format ( BufType :: VIDEO_CAPTURE ) ? else {
34
+ unreachable ! ( )
35
+ } ;
36
+ let capture = device. video_capture ( fmt) ?;
37
37
println ! ( "negotiated format: {:?}" , capture. format( ) ) ;
38
38
39
39
let mut stream = capture. into_stream ( ) ?;
Original file line number Diff line number Diff line change @@ -175,10 +175,10 @@ impl Iterator for TextMenuIter<'_> {
175
175
type Item = io:: Result < TextMenuItem > ;
176
176
177
177
fn next ( & mut self ) -> Option < Self :: Item > {
178
- if self . next_index > self . max_index {
179
- None
180
- } else {
181
- loop {
178
+ loop {
179
+ if self . next_index > self . max_index {
180
+ return None ;
181
+ } else {
182
182
unsafe {
183
183
let mut raw = raw:: QueryMenu {
184
184
id : self . cid . 0 ,
You can’t perform that action at this time.
0 commit comments