Skip to content

Commit 194a96a

Browse files
committed
small readme updates
1 parent cac6d2c commit 194a96a

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,31 @@
11
Direct, unobscured and self contained FFmpeg (sys) bindings.
22

3+
```rust
4+
let input_path_cstr = std::ffi::CString::new("path/to/source.mp4").unwrap("to c str");
5+
6+
// Open an e.g. MP4 file
7+
avformat_open_input(
8+
&mut ifmt_ctx,
9+
input_path_cstr.as_ptr(),
10+
std::ptr::null_mut(),
11+
std::ptr::null_mut(),
12+
);
13+
avformat_find_stream_info(ifmt_ctx, std::ptr::null_mut());
14+
15+
// Print info about the loaded file
16+
av_dump_format(
17+
ifmt_ctx,
18+
0,
19+
input_path_cstr.as_ptr(),
20+
0,
21+
);
22+
```
23+
24+
325
```rust
426
let ifmt_ctx: AVFormatContext = *ifmt_ctx;
527

6-
// Extract video/audio/etc. streams from an e.g. MP4 file
28+
// Extract video/audio/etc. streams from our mp4 file
729
let streams: &[AVStream] = std::slice::from_raw_parts(
830
*ifmt_ctx.streams,
931
ifmt_ctx.nb_streams as usize

0 commit comments

Comments
 (0)