X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Fframe.rs;h=26e8640aa5dc236ee7ba605cf2126e91c333a957;hb=c8db9313866c4d7bcf34e45e486d2f909daa16d9;hp=badc7f8c0a542a3a64b60e860cd5490b72404344;hpb=cceb524cf46b4a768c703fdbae5abe1dae11a92c;p=nihav.git diff --git a/nihav-core/src/frame.rs b/nihav-core/src/frame.rs index badc7f8..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,47 +859,6 @@ pub const DUMMY_CODEC_INFO: NACodecInfo = NACodecInfo { properties: NACodecTypeInfo::None, extradata: None }; -/// Option definition. -#[derive(Debug)] -pub struct NAOptionDefinition { - /// Option name. - pub name: &'static str, - /// Option meaning. - pub description: &'static str, - /// Minimal value for the option (if applicable). - pub min_value: Option, - /// Maximum value for the option (if applicable). - pub max_value: Option, -} - -/// Option. -#[derive(Clone,Debug,PartialEq)] -pub struct NAOption { - /// Option name. - pub name: String, - /// Option value. - pub value: NAValue, -} - -/// A list of accepted option values. -#[derive(Debug,Clone,PartialEq)] -pub enum NAValue { - /// Empty value. - None, - /// Boolean value. - Bool(bool), - /// Integer value. - Int(i32), - /// Long integer value. - Long(i64), - /// Floating point value. - Float(f32), - /// String value. - String(String), - /// Binary data value. - Data(Arc>), -} - /// A list of recognized frame types. #[derive(Debug,Clone,Copy,PartialEq)] #[allow(dead_code)] @@ -1226,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.