change nalu handling, allow different handling for flv and mpegts

This commit is contained in:
Muaz Ahmad 2023-10-10 16:01:00 +05:00
parent 4bcf6c797d
commit 3a46d0559d
2 changed files with 4 additions and 4 deletions

View file

@ -4,7 +4,7 @@ use std::io::Read;
use crate::util; use crate::util;
use crate::demux::input; use crate::demux::input;
use crate::demux::nalu; use crate::demux::nalu_flv as nalu;
enum FLVTagType { enum FLVTagType {
Metadata, Metadata,
@ -87,11 +87,11 @@ impl input::FileReader for FLVReader {
return match packet_type { return match packet_type {
FLVTagType::Audio => Ok(util::NALUPacket { FLVTagType::Audio => Ok(util::NALUPacket {
packet_type: util::NALUPacketType::Audio, packet_type: util::NALUPacketType::Audio,
packet_data: nalu::prepend_a_flv(data, &metadata), packet_data: nalu::prepend_a(data, &metadata),
}), }),
FLVTagType::Video => Ok(util::NALUPacket { FLVTagType::Video => Ok(util::NALUPacket {
packet_type: util::NALUPacketType::Video, packet_type: util::NALUPacketType::Video,
packet_data: nalu::prepend_v_flv(data, &metadata), packet_data: nalu::prepend_v(data, &metadata),
}), }),
_ => Err(Box::new(util::DemuxerError::FLVUnexpectedTag)) _ => Err(Box::new(util::DemuxerError::FLVUnexpectedTag))
}; };

View file

@ -1,6 +1,6 @@
mod input; mod input;
mod flv; mod flv;
mod nalu; mod nalu_flv;
use std::sync::mpsc; use std::sync::mpsc;
use std::error::Error; use std::error::Error;