X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Fframe.rs;h=26e8640aa5dc236ee7ba605cf2126e91c333a957;hb=c8db9313866c4d7bcf34e45e486d2f909daa16d9;hp=5b090bb942841e6006beceec1a94591c07b9389b;hpb=b3785cd74e6f2ac6bdb1bda21c4c66ab807a73c0;p=nihav.git diff --git a/nihav-core/src/frame.rs b/nihav-core/src/frame.rs index 5b090bb..26e8640 100644 --- a/nihav-core/src/frame.rs +++ b/nihav-core/src/frame.rs @@ -233,6 +233,8 @@ impl NAAudioBuffer { pub fn get_chmap(&self) -> &NAChannelMap { &self.chmap } /// Returns an immutable reference to the data. pub fn get_data(&self) -> &Vec { self.data.as_ref() } + /// Returns reference to the data. + pub fn get_data_ref(&self) -> NABufferRef> { self.data.clone() } /// Returns a mutable reference to the data. pub fn get_data_mut(&mut self) -> Option<&mut Vec> { self.data.as_mut() } /// Clones current `NAAudioBuffer` into a new one. @@ -857,21 +859,6 @@ pub const DUMMY_CODEC_INFO: NACodecInfo = NACodecInfo { properties: NACodecTypeInfo::None, extradata: None }; -/// A list of accepted option values. -#[derive(Debug,Clone)] -pub enum NAValue { - /// Empty value. - None, - /// Integer value. - Int(i32), - /// Long integer value. - Long(i64), - /// String value. - String(String), - /// Binary data value. - Data(Arc>), -} - /// A list of recognized frame types. #[derive(Debug,Clone,Copy,PartialEq)] #[allow(dead_code)] @@ -1200,6 +1187,10 @@ impl NAPacket { // vec.resize(size, 0); NAPacket { stream: str, ts, keyframe: kf, buffer: NABufferRef::new(vec), side_data: Vec::new() } } + /// Constructs a new `NAPacket` instance reusing a buffer reference. + pub fn new_from_refbuf(str: NAStreamRef, ts: NATimeInfo, kf: bool, buffer: NABufferRef>) -> Self { + NAPacket { stream: str, ts, keyframe: kf, buffer, side_data: Vec::new() } + } /// Returns information about the stream packet belongs to. pub fn get_stream(&self) -> NAStreamRef { self.stream.clone() } /// Returns packet timestamp.