mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-23 00:26:31 +00:00
video: Add VideoEncoder/VideoDecoder::get_allocator()
This commit is contained in:
parent
de7a9dee1e
commit
2d5b6de590
5 changed files with 42 additions and 12 deletions
|
@ -50,6 +50,8 @@ manual = [
|
|||
"Gst.Buffer",
|
||||
"Gst.BufferPool",
|
||||
"Gst.BufferPoolAcquireParams",
|
||||
"Gst.Allocator",
|
||||
"Gst.AllocationParams",
|
||||
"Gst.ClockTimeDiff",
|
||||
"Gst.FlowReturn",
|
||||
"Gst.TagList",
|
||||
|
@ -149,6 +151,10 @@ status = "generate"
|
|||
name = "negotiate"
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "get_allocator"
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVideo.VideoEncoder"
|
||||
status = "generate"
|
||||
|
@ -196,3 +202,7 @@ status = "generate"
|
|||
[[object.function]]
|
||||
name = "negotiate"
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "get_allocator"
|
||||
ignore = true
|
||||
|
|
|
@ -26,8 +26,6 @@ pub trait VideoDecoderExt: 'static {
|
|||
|
||||
fn allocate_output_buffer(&self) -> Option<gst::Buffer>;
|
||||
|
||||
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);
|
||||
|
||||
fn get_buffer_pool(&self) -> Option<gst::BufferPool>;
|
||||
|
||||
fn get_estimate_rate(&self) -> i32;
|
||||
|
@ -78,10 +76,6 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) {
|
||||
// unsafe { TODO: call gst_video_sys:gst_video_decoder_get_allocator() }
|
||||
//}
|
||||
|
||||
fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
|
||||
unsafe {
|
||||
from_glib_full(gst_video_sys::gst_video_decoder_get_buffer_pool(
|
||||
|
|
|
@ -34,8 +34,6 @@ pub const NONE_VIDEO_ENCODER: Option<&VideoEncoder> = None;
|
|||
pub trait VideoEncoderExt: 'static {
|
||||
fn allocate_output_buffer(&self, size: usize) -> Option<gst::Buffer>;
|
||||
|
||||
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);
|
||||
|
||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||
fn get_max_encode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff;
|
||||
|
||||
|
@ -77,10 +75,6 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) {
|
||||
// unsafe { TODO: call gst_video_sys:gst_video_encoder_get_allocator() }
|
||||
//}
|
||||
|
||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||
fn get_max_encode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff {
|
||||
unsafe {
|
||||
|
|
|
@ -11,6 +11,7 @@ use glib::object::IsA;
|
|||
use glib::translate::*;
|
||||
use gst;
|
||||
use gst_video_sys;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use utils::HasStreamLock;
|
||||
use video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext};
|
||||
|
@ -32,6 +33,8 @@ pub trait VideoDecoderExtManual: 'static {
|
|||
fn get_frames(&self) -> Vec<VideoCodecFrame>;
|
||||
fn get_oldest_frame(&self) -> Option<VideoCodecFrame>;
|
||||
|
||||
fn get_allocator(&self) -> (gst::Allocator, gst::AllocationParams);
|
||||
|
||||
fn have_frame(&self) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
fn finish_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
fn release_frame(&self, frame: VideoCodecFrame);
|
||||
|
@ -84,6 +87,19 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
|||
ret.into_result()
|
||||
}
|
||||
|
||||
fn get_allocator(&self) -> (gst::Allocator, gst::AllocationParams) {
|
||||
unsafe {
|
||||
let mut allocator = ptr::null_mut();
|
||||
let mut params = mem::zeroed();
|
||||
gst_video_sys::gst_video_decoder_get_allocator(
|
||||
self.as_ref().to_glib_none().0,
|
||||
&mut allocator,
|
||||
&mut params,
|
||||
);
|
||||
(from_glib_full(allocator), params.into())
|
||||
}
|
||||
}
|
||||
|
||||
fn have_frame(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||
let ret: gst::FlowReturn = unsafe {
|
||||
from_glib(gst_video_sys::gst_video_decoder_have_frame(
|
||||
|
|
|
@ -12,6 +12,7 @@ use glib::object::IsA;
|
|||
use glib::translate::*;
|
||||
use gst;
|
||||
use gst_video_sys;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use utils::HasStreamLock;
|
||||
use video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext};
|
||||
|
@ -30,6 +31,8 @@ pub trait VideoEncoderExtManual: 'static {
|
|||
fn get_frames(&self) -> Vec<VideoCodecFrame>;
|
||||
fn get_oldest_frame(&self) -> Option<VideoCodecFrame>;
|
||||
|
||||
fn get_allocator(&self) -> (gst::Allocator, gst::AllocationParams);
|
||||
|
||||
fn finish_frame(
|
||||
&self,
|
||||
frame: Option<VideoCodecFrame>,
|
||||
|
@ -68,6 +71,19 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
|
|||
ret.into_result()
|
||||
}
|
||||
|
||||
fn get_allocator(&self) -> (gst::Allocator, gst::AllocationParams) {
|
||||
unsafe {
|
||||
let mut allocator = ptr::null_mut();
|
||||
let mut params = mem::zeroed();
|
||||
gst_video_sys::gst_video_encoder_get_allocator(
|
||||
self.as_ref().to_glib_none().0,
|
||||
&mut allocator,
|
||||
&mut params,
|
||||
);
|
||||
(from_glib_full(allocator), params.into())
|
||||
}
|
||||
}
|
||||
|
||||
fn finish_frame(
|
||||
&self,
|
||||
frame: Option<VideoCodecFrame>,
|
||||
|
|
Loading…
Reference in a new issue