forked from mirrors/gstreamer-rs
video: Check that the passed in video info is valid when creating a VideoFrame
This commit is contained in:
parent
6ed505401f
commit
4f5aceaa5a
1 changed files with 16 additions and 0 deletions
|
@ -224,6 +224,8 @@ impl VideoFrame<Readable> {
|
||||||
) -> Result<VideoFrame<Readable>, gst::Buffer> {
|
) -> Result<VideoFrame<Readable>, gst::Buffer> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_video_sys::gst_video_frame_map(
|
let res: bool = from_glib(gst_video_sys::gst_video_frame_map(
|
||||||
|
@ -255,6 +257,8 @@ impl VideoFrame<Readable> {
|
||||||
) -> Result<VideoFrame<Readable>, gst::Buffer> {
|
) -> Result<VideoFrame<Readable>, gst::Buffer> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id(
|
let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id(
|
||||||
|
@ -288,6 +292,8 @@ impl VideoFrame<Writable> {
|
||||||
) -> Result<VideoFrame<Writable>, gst::Buffer> {
|
) -> Result<VideoFrame<Writable>, gst::Buffer> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_video_sys::gst_video_frame_map(
|
let res: bool = from_glib(gst_video_sys::gst_video_frame_map(
|
||||||
|
@ -321,6 +327,8 @@ impl VideoFrame<Writable> {
|
||||||
) -> Result<VideoFrame<Writable>, gst::Buffer> {
|
) -> Result<VideoFrame<Writable>, gst::Buffer> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id(
|
let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id(
|
||||||
|
@ -572,6 +580,8 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
||||||
) -> Result<VideoFrameRef<&'a gst::BufferRef>, glib::BoolError> {
|
) -> Result<VideoFrameRef<&'a gst::BufferRef>, glib::BoolError> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_video_sys::gst_video_frame_map(
|
let res: bool = from_glib(gst_video_sys::gst_video_frame_map(
|
||||||
|
@ -602,6 +612,8 @@ impl<'a> VideoFrameRef<&'a gst::BufferRef> {
|
||||||
) -> Result<VideoFrameRef<&'a gst::BufferRef>, glib::BoolError> {
|
) -> Result<VideoFrameRef<&'a gst::BufferRef>, glib::BoolError> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id(
|
let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id(
|
||||||
|
@ -661,6 +673,8 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
||||||
) -> Result<VideoFrameRef<&'a mut gst::BufferRef>, glib::BoolError> {
|
) -> Result<VideoFrameRef<&'a mut gst::BufferRef>, glib::BoolError> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_video_sys::gst_video_frame_map(
|
let res: bool = from_glib(gst_video_sys::gst_video_frame_map(
|
||||||
|
@ -693,6 +707,8 @@ impl<'a> VideoFrameRef<&'a mut gst::BufferRef> {
|
||||||
) -> Result<VideoFrameRef<&'a mut gst::BufferRef>, glib::BoolError> {
|
) -> Result<VideoFrameRef<&'a mut gst::BufferRef>, glib::BoolError> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
|
assert!(info.is_valid());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut frame = mem::MaybeUninit::zeroed();
|
let mut frame = mem::MaybeUninit::zeroed();
|
||||||
let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id(
|
let res: bool = from_glib(gst_video_sys::gst_video_frame_map_id(
|
||||||
|
|
Loading…
Reference in a new issue