util/frame: add iniline attributes
This commit is contained in:
parent
25c403fa07
commit
5c4ac30f20
@ -35,38 +35,46 @@ unsafe impl Send for Frame { }
|
|||||||
unsafe impl Sync for Frame { }
|
unsafe impl Sync for Frame { }
|
||||||
|
|
||||||
impl Frame {
|
impl Frame {
|
||||||
|
#[inline(always)]
|
||||||
pub unsafe fn wrap(ptr: *mut AVFrame) -> Self {
|
pub unsafe fn wrap(ptr: *mut AVFrame) -> Self {
|
||||||
Frame { ptr: ptr, _own: false }
|
Frame { ptr: ptr, _own: false }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub unsafe fn empty() -> Self {
|
pub unsafe fn empty() -> Self {
|
||||||
Frame { ptr: av_frame_alloc(), _own: true }
|
Frame { ptr: av_frame_alloc(), _own: true }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub unsafe fn as_ptr(&self) -> *const AVFrame {
|
pub unsafe fn as_ptr(&self) -> *const AVFrame {
|
||||||
self.ptr as *const _
|
self.ptr as *const _
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub unsafe fn as_mut_ptr(&mut self) -> *mut AVFrame {
|
pub unsafe fn as_mut_ptr(&mut self) -> *mut AVFrame {
|
||||||
self.ptr
|
self.ptr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub unsafe fn is_empty(&self) -> bool {
|
pub unsafe fn is_empty(&self) -> bool {
|
||||||
(*self.as_ptr()).data[0].is_null()
|
(*self.as_ptr()).data[0].is_null()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Frame {
|
impl Frame {
|
||||||
|
#[inline]
|
||||||
pub fn is_key(&self) -> bool {
|
pub fn is_key(&self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.as_ptr()).key_frame == 1
|
(*self.as_ptr()).key_frame == 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn is_corrupt(&self) -> bool {
|
pub fn is_corrupt(&self) -> bool {
|
||||||
self.flags().contains(flag::CORRUPT)
|
self.flags().contains(flag::CORRUPT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn packet(&self) -> Packet {
|
pub fn packet(&self) -> Packet {
|
||||||
unsafe {
|
unsafe {
|
||||||
Packet {
|
Packet {
|
||||||
@ -80,6 +88,7 @@ impl Frame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn pts(&self) -> Option<i64> {
|
pub fn pts(&self) -> Option<i64> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match (*self.as_ptr()).pts {
|
match (*self.as_ptr()).pts {
|
||||||
@ -148,6 +157,7 @@ impl Frame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn new_side_data(&mut self, kind: side_data::Type, size: usize) -> Option<SideData> {
|
pub fn new_side_data(&mut self, kind: side_data::Type, size: usize) -> Option<SideData> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = av_frame_new_side_data(self.as_mut_ptr(), kind.into(), size as c_int);
|
let ptr = av_frame_new_side_data(self.as_mut_ptr(), kind.into(), size as c_int);
|
||||||
@ -161,6 +171,7 @@ impl Frame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn remove_side_data(&mut self, kind: side_data::Type) {
|
pub fn remove_side_data(&mut self, kind: side_data::Type) {
|
||||||
unsafe {
|
unsafe {
|
||||||
av_frame_remove_side_data(self.as_mut_ptr(), kind.into());
|
av_frame_remove_side_data(self.as_mut_ptr(), kind.into());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user