1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright 2020 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

mod bindings;
mod event;
mod format;
mod session;
mod vea_instance;

pub use event::*;
pub use format::*;
pub use session::*;
pub use vea_instance::*;

/// libvda only exists on ChromeOS, so we cannot link against it in a regular environment, which
/// limits our build coverage. These stubs are built if the "chromeos" feature is not specified,
/// which allows build to complete successfully, although the video device will just badly crash if
/// it is ever used.
#[cfg(feature = "libvda-stub")]
mod native_stubs {
    use super::bindings::*;

    #[no_mangle]
    extern "C" fn initialize_encode(_type_: vea_impl_type_t) -> *mut ::std::os::raw::c_void {
        unimplemented!()
    }

    #[no_mangle]
    extern "C" fn deinitialize_encode(_impl_: *mut ::std::os::raw::c_void) {
        unimplemented!()
    }

    #[no_mangle]
    extern "C" fn get_vea_capabilities(
        _impl_: *mut ::std::os::raw::c_void,
    ) -> *const vea_capabilities_t {
        unimplemented!()
    }

    #[no_mangle]
    extern "C" fn init_encode_session(
        _impl_: *mut ::std::os::raw::c_void,
        _config: *mut vea_config_t,
    ) -> *mut vea_session_info_t {
        unimplemented!()
    }

    #[no_mangle]
    extern "C" fn close_encode_session(
        _impl_: *mut ::std::os::raw::c_void,
        _session_info: *mut vea_session_info_t,
    ) {
        unimplemented!()
    }

    #[no_mangle]
    extern "C" fn vea_encode(
        _ctx: *mut ::std::os::raw::c_void,
        _input_buffer_id: vea_input_buffer_id_t,
        _fd: ::std::os::raw::c_int,
        _num_planes: usize,
        _planes: *mut video_frame_plane_t,
        _timestamp: i64,
        _force_keyframe: u8,
    ) -> ::std::os::raw::c_int {
        unimplemented!()
    }

    #[no_mangle]
    extern "C" fn vea_use_output_buffer(
        _ctx: *mut ::std::os::raw::c_void,
        _output_buffer_id: vea_output_buffer_id_t,
        _fd: ::std::os::raw::c_int,
        _offset: u32,
        _size: u32,
    ) -> ::std::os::raw::c_int {
        unimplemented!()
    }

    #[no_mangle]
    extern "C" fn vea_request_encoding_params_change(
        _ctx: *mut ::std::os::raw::c_void,
        _bitrate: vea_bitrate_t,
        _framerate: u32,
    ) -> ::std::os::raw::c_int {
        unimplemented!()
    }

    #[no_mangle]
    extern "C" fn vea_flush(_ctx: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int {
        unimplemented!()
    }
}