ffmpeg_the_third/device/
mod.rs1pub mod extensions;
2pub mod input;
3pub mod output;
4
5use std::marker::PhantomData;
6
7use crate::ffi::*;
8use crate::utils;
9
10pub struct Info<'a> {
11 ptr: *mut AVDeviceInfo,
12
13 _marker: PhantomData<&'a ()>,
14}
15
16impl<'a> Info<'a> {
17 pub unsafe fn wrap(ptr: *mut AVDeviceInfo) -> Self {
18 Info {
19 ptr,
20 _marker: PhantomData,
21 }
22 }
23
24 pub unsafe fn as_ptr(&self) -> *const AVDeviceInfo {
25 self.ptr as *const _
26 }
27
28 pub unsafe fn as_mut_ptr(&mut self) -> *mut AVDeviceInfo {
29 self.ptr
30 }
31}
32
33impl<'a> Info<'a> {
34 pub fn name(&self) -> &str {
35 unsafe { utils::str_from_c_ptr((*self.as_ptr()).device_name) }
36 }
37
38 pub fn description(&self) -> &str {
39 unsafe { utils::str_from_c_ptr((*self.as_ptr()).device_description) }
40 }
41}
42
43pub fn register_all() {
44 unsafe {
45 avdevice_register_all();
46 }
47}
48
49pub fn version() -> u32 {
50 unsafe { avdevice_version() }
51}
52
53pub fn configuration() -> &'static str {
54 unsafe { utils::str_from_c_ptr(avdevice_configuration()) }
55}
56
57pub fn license() -> &'static str {
58 unsafe { utils::str_from_c_ptr(avdevice_license()) }
59}