pub(crate) struct AudioFrame {
pub(crate) data: Vec<u8>,
pub(crate) pts: u64,
pub(crate) pool: Option<Arc<BufferPool>>,
}Expand description
Zero-copy buffer-protocol result type handed to the Python callback.
Owns its Vec<u8> and exposes it read-only through the buffer protocol, so Python can
read the encoded frame without a copy. When the last Python reference is released and
the frame is dropped, a pooled buffer is recycled back to the capture thread (see the
Drop impl), keeping the steady-state emit path allocation-free.
Fields§
§data: Vec<u8>§pts: u64§pool: Option<Arc<BufferPool>>Set when the buffer came from a capture’s BufferPool; recycled to it on drop.
Implementations§
Source§impl AudioFrame
impl AudioFrame
pub(crate) fn __len__(&self) -> usize
pub(crate) fn pts(&self) -> u64
Sourcepub(crate) unsafe fn __getbuffer__(
slf: PyRefMut<'_, Self>,
view: *mut Py_buffer,
flags: c_int,
) -> PyResult<()>
pub(crate) unsafe fn __getbuffer__( slf: PyRefMut<'_, Self>, view: *mut Py_buffer, flags: c_int, ) -> PyResult<()>
Expose the owned bytes to Python’s buffer protocol without a copy.
PyBuffer_FillInfo INCREFs slf into view->obj, pinning the Vec alive until
every memoryview / slice over it is released. The view is readonly, so the
consumer cannot mutate the encoded frame.
pub(crate) unsafe fn __releasebuffer__(&self, _view: *mut Py_buffer)
Trait Implementations§
impl DerefToPyAny for AudioFrame
Source§impl Drop for AudioFrame
impl Drop for AudioFrame
impl ExtractPyClassWithClone for AudioFrame
Source§impl<'py> IntoPyObject<'py> for AudioFrame
impl<'py> IntoPyObject<'py> for AudioFrame
Source§type Target = AudioFrame
type Target = AudioFrame
Source§type Output = Bound<'py, <AudioFrame as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <AudioFrame as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for AudioFrame
impl PyClass for AudioFrame
Source§impl PyClassImpl for AudioFrame
impl PyClassImpl for AudioFrame
Source§const MODULE: Option<&str> = ::core::option::Option::None
const MODULE: Option<&str> = ::core::option::Option::None
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = c"Zero-copy buffer-protocol result type handed to the Python callback.\n\nOwns its `Vec<u8>` and exposes it read-only through the buffer protocol, so Python can\nread the encoded frame without a copy. When the last Python reference is released and\nthe frame is dropped, a pooled buffer is recycled back to the capture thread (see the\n`Drop` impl), keeping the steady-state emit path allocation-free.\x00"
const RAW_DOC: &'static CStr = c"Zero-copy buffer-protocol result type handed to the Python callback.\n\nOwns its `Vec<u8>` and exposes it read-only through the buffer protocol, so Python can\nread the encoded frame without a copy. When the last Python reference is released and\nthe frame is dropped, a pooled buffer is recycled back to the capture thread (see the\n`Drop` impl), keeping the steady-state emit path allocation-free.\x00"
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<AudioFrame as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<AudioFrame>
type Layout = <<AudioFrame as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<AudioFrame>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyMethods<AudioFrame> for PyClassImplCollector<AudioFrame>
impl PyMethods<AudioFrame> for PyClassImplCollector<AudioFrame>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for AudioFrame
impl PyTypeInfo for AudioFrame
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.Auto Trait Implementations§
impl Freeze for AudioFrame
impl RefUnwindSafe for AudioFrame
impl Send for AudioFrame
impl Sync for AudioFrame
impl Unpin for AudioFrame
impl UnsafeUnpin for AudioFrame
impl UnwindSafe for AudioFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read more§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more