This allows packetisers to get initial stream information and act on it
during parsing process or returning a new stream.
/// Trait for packetisers (objects that form full packets from raw stream data).
pub trait NAPacketiser {
+ /// Provides the reference stream from the demuxer to the packetiser.
+ ///
+ /// This may be useful in cases when packetiser cannot determine stream parameters by itself.
+ fn attach_stream(&mut self, stream: NAStreamRef);
/// Queues new raw stream data for parsing.
///
/// Returns false is the internal buffer grows too large.
}
impl NAPacketiser for FLACPacketiser {
+ fn attach_stream(&mut self, _stream: NAStreamRef) {}
fn add_data(&mut self, src: &[u8]) -> bool {
self.buf.extend_from_slice(src);
self.buf.len() < 4096
}
impl NAPacketiser for MPAPacketiser {
+ fn attach_stream(&mut self, _stream: NAStreamRef) {}
fn add_data(&mut self, src: &[u8]) -> bool {
self.buf.extend_from_slice(src);
self.buf.len() < 4096