Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
rav1e
Commits
4c9e6c14
Commit
4c9e6c14
authored
Oct 10, 2018
by
Luca Barbato
Committed by
Luca Barbato
Jun 25, 2019
Browse files
crav1e: wip: Update to the new API and test the documentation capabilities
parent
4ecc088b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/capi.rs
View file @
4c9e6c14
//! # C API for rav1e
//!
//! [rav1e](https://github.com/xiph/rav1e/) is an [AV1](https://aomediacodec.github.io/av1-spec/)
//! encoder written in [Rust](https://rust-lang.org)
//!
//! This is the C-compatible API to it
extern
crate
rav1e
;
use
std
::
slice
;
...
...
@@ -7,6 +14,10 @@ use std::ffi::CStr;
use
std
::
os
::
raw
::
c_char
;
use
std
::
os
::
raw
::
c_int
;
/// Raw video Frame
///
/// It can be allocated throught rav1e_frame_new(), populated using rav1e_frame_fill_plane()
/// and freed using rav1e_frame_drop().
pub
struct
RaFrame
(
Arc
<
rav1e
::
Frame
>
);
pub
struct
RaConfig
{
...
...
@@ -25,7 +36,7 @@ type RaFrameType = rav1e::FrameType;
pub
struct
RaPacket
{
pub
data
:
*
const
u8
,
pub
len
:
usize
,
pub
number
:
u
size
,
pub
number
:
u
64
,
pub
frame_type
:
RaFrameType
,
}
...
...
@@ -154,6 +165,18 @@ pub unsafe extern fn rav1e_packet_drop(pkt: *mut RaPacket) {
let
_
=
Box
::
from_raw
(
pkt
);
}
#[no_mangle]
pub
unsafe
extern
fn
rav1e_container_sequence_header
(
ctx
:
*
mut
RaContext
,
len
:
*
mut
usize
)
->
*
mut
u8
{
let
buf
=
(
*
ctx
)
.ctx
.container_sequence_header
();
*
len
=
buf
.len
();
Box
::
into_raw
(
buf
.into_boxed_slice
())
as
*
mut
u8
}
pub
unsafe
extern
fn
rav1e_container_sequence_header_drop
(
sequence
:
*
mut
u8
)
{
let
_
=
Box
::
from_raw
(
sequence
);
}
#[no_mangle]
pub
unsafe
extern
"C"
fn
rav1e_frame_fill_plane
(
frame
:
*
mut
RaFrame
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment