fix packet timestamps

This commit is contained in:
2024-03-25 19:19:31 +00:00
parent 9a086d80c1
commit 2a82e2c00b
15 changed files with 520 additions and 469 deletions

View File

@ -1,4 +1,5 @@
use std::ffi::CStr;
use std::ptr;
use anyhow::Error;
use ffmpeg_sys_next::{av_buffer_allocz, av_make_error_string, AVBufferRef, memcpy};
@ -53,9 +54,12 @@ pub fn video_variant_id_ref(var: &VideoVariant) -> *mut AVBufferRef {
}
}
pub fn id_ref_to_uuid(buf: *mut AVBufferRef) -> Uuid {
pub fn id_ref_to_uuid(buf: *mut AVBufferRef) -> Result<Uuid, Error> {
unsafe {
if buf == ptr::null_mut() {
return Err(Error::msg("Buffer was null"));
}
let binding = Bytes::from(*((*buf).data as *const [u8; 16]));
Uuid::from_bytes_ref(&binding).clone()
Ok(Uuid::from_bytes_ref(&binding).clone())
}
}