mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
video: Add VideoEncoder/VideoDecoder::get_allocator()
This commit is contained in:
parent
2a442f6ec1
commit
7dfe7c09bd
5 changed files with 42 additions and 12 deletions
|
@ -50,6 +50,8 @@ manual = [
|
||||||
"Gst.Buffer",
|
"Gst.Buffer",
|
||||||
"Gst.BufferPool",
|
"Gst.BufferPool",
|
||||||
"Gst.BufferPoolAcquireParams",
|
"Gst.BufferPoolAcquireParams",
|
||||||
|
"Gst.Allocator",
|
||||||
|
"Gst.AllocationParams",
|
||||||
"Gst.ClockTimeDiff",
|
"Gst.ClockTimeDiff",
|
||||||
"Gst.FlowReturn",
|
"Gst.FlowReturn",
|
||||||
"Gst.TagList",
|
"Gst.TagList",
|
||||||
|
@ -149,6 +151,10 @@ status = "generate"
|
||||||
name = "negotiate"
|
name = "negotiate"
|
||||||
ignore = true
|
ignore = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "get_allocator"
|
||||||
|
ignore = true
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "GstVideo.VideoEncoder"
|
name = "GstVideo.VideoEncoder"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
@ -196,3 +202,7 @@ status = "generate"
|
||||||
[[object.function]]
|
[[object.function]]
|
||||||
name = "negotiate"
|
name = "negotiate"
|
||||||
ignore = true
|
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 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_buffer_pool(&self) -> Option<gst::BufferPool>;
|
||||||
|
|
||||||
fn get_estimate_rate(&self) -> i32;
|
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> {
|
fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(gst_video_sys::gst_video_decoder_get_buffer_pool(
|
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 {
|
pub trait VideoEncoderExt: 'static {
|
||||||
fn allocate_output_buffer(&self, size: usize) -> Option<gst::Buffer>;
|
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"))]
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
fn get_max_encode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff;
|
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"))]
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
fn get_max_encode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff {
|
fn get_max_encode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -11,6 +11,7 @@ use glib::object::IsA;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
use gst;
|
||||||
use gst_video_sys;
|
use gst_video_sys;
|
||||||
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use utils::HasStreamLock;
|
use utils::HasStreamLock;
|
||||||
use video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext};
|
use video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext};
|
||||||
|
@ -32,6 +33,8 @@ pub trait VideoDecoderExtManual: 'static {
|
||||||
fn get_frames(&self) -> Vec<VideoCodecFrame>;
|
fn get_frames(&self) -> Vec<VideoCodecFrame>;
|
||||||
fn get_oldest_frame(&self) -> Option<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 have_frame(&self) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
fn finish_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
|
fn finish_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
fn release_frame(&self, frame: VideoCodecFrame);
|
fn release_frame(&self, frame: VideoCodecFrame);
|
||||||
|
@ -84,6 +87,19 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
||||||
ret.into_result()
|
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> {
|
fn have_frame(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let ret: gst::FlowReturn = unsafe {
|
let ret: gst::FlowReturn = unsafe {
|
||||||
from_glib(gst_video_sys::gst_video_decoder_have_frame(
|
from_glib(gst_video_sys::gst_video_decoder_have_frame(
|
||||||
|
|
|
@ -12,6 +12,7 @@ use glib::object::IsA;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
use gst;
|
||||||
use gst_video_sys;
|
use gst_video_sys;
|
||||||
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use utils::HasStreamLock;
|
use utils::HasStreamLock;
|
||||||
use video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext};
|
use video_codec_state::{InNegotiation, Readable, VideoCodecState, VideoCodecStateContext};
|
||||||
|
@ -30,6 +31,8 @@ pub trait VideoEncoderExtManual: 'static {
|
||||||
fn get_frames(&self) -> Vec<VideoCodecFrame>;
|
fn get_frames(&self) -> Vec<VideoCodecFrame>;
|
||||||
fn get_oldest_frame(&self) -> Option<VideoCodecFrame>;
|
fn get_oldest_frame(&self) -> Option<VideoCodecFrame>;
|
||||||
|
|
||||||
|
fn get_allocator(&self) -> (gst::Allocator, gst::AllocationParams);
|
||||||
|
|
||||||
fn finish_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
|
fn finish_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime);
|
fn get_latency(&self) -> (gst::ClockTime, gst::ClockTime);
|
||||||
|
@ -65,6 +68,19 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
|
||||||
ret.into_result()
|
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: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
|
fn finish_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let ret: gst::FlowReturn = unsafe {
|
let ret: gst::FlowReturn = unsafe {
|
||||||
from_glib(gst_video_sys::gst_video_encoder_finish_frame(
|
from_glib(gst_video_sys::gst_video_encoder_finish_frame(
|
||||||
|
|
Loading…
Reference in a new issue