mirror of
https://github.com/alfg/mp4-rust.git
synced 2025-04-15 08:14:15 +00:00
.
This commit is contained in:
parent
666939ed64
commit
b4dbe3fe08
3 changed files with 15 additions and 14 deletions
|
@ -65,6 +65,7 @@ fn copy<P: AsRef<Path>>(src_filename: &P, dst_filename: &P) -> Result<()> {
|
|||
profile: track.audio_profile()?,
|
||||
freq_index: track.sample_freq_index()?,
|
||||
chan_conf: track.channel_config()?,
|
||||
samplesize: 16,
|
||||
data_reference_index: 1,
|
||||
sound_version: 0,
|
||||
esds_version: default_aac_config.esds_version,
|
||||
|
|
|
@ -34,12 +34,12 @@ impl Default for Mp4aBox {
|
|||
impl Mp4aBox {
|
||||
pub fn new(config: &AacConfig) -> Self {
|
||||
Self {
|
||||
data_reference_index: 1,
|
||||
sound_version: 0,
|
||||
data_reference_index: config.data_reference_index,
|
||||
sound_version: config.sound_version,
|
||||
channelcount: config.chan_conf as u16,
|
||||
samplesize: 16,
|
||||
samplesize: config.samplesize,
|
||||
samplerate: FixedPointU16::new(config.freq_index.freq() as u16),
|
||||
qt_bytes: None,
|
||||
qt_bytes: config.qt_bytes.clone(),
|
||||
esds: Some(EsdsBox::default()),
|
||||
}
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ impl ESDescriptor {
|
|||
let dec_config = DecoderConfigDescriptor::new(config);
|
||||
let sl_config = SLConfigDescriptor::new();
|
||||
Self {
|
||||
es_id: 1,
|
||||
es_id: config.es_id.unwrap_or(0),
|
||||
dec_config: dec_config,
|
||||
sl_config: sl_config,
|
||||
}
|
||||
|
@ -428,12 +428,12 @@ pub struct DecoderConfigDescriptor {
|
|||
impl DecoderConfigDescriptor {
|
||||
pub fn new(config: &AacConfig) -> Self {
|
||||
Self {
|
||||
object_type_indication: 0x40, // XXX AAC
|
||||
stream_type: 0x05, // XXX Audio
|
||||
up_stream: 0,
|
||||
buffer_size_db: 0,
|
||||
max_bitrate: config.bitrate, // XXX
|
||||
avg_bitrate: config.bitrate,
|
||||
object_type_indication: config.object_type_indication.unwrap_or(0x40), // XXX AAC
|
||||
stream_type: config.stream_type.unwrap_or(0x05), // XXX Audio
|
||||
up_stream: config.up_stream.unwrap_or(0),
|
||||
buffer_size_db: config.buffer_size_db.unwrap_or(0),
|
||||
max_bitrate: config.max_bitrate.unwrap_or(config.bitrate), // XXX
|
||||
avg_bitrate: config.max_bitrate.unwrap_or(config.bitrate),
|
||||
dec_specific: DecoderSpecificDescriptor::new(config),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -622,6 +622,7 @@ pub struct AacConfig {
|
|||
// New fields from Mp4aBox and child structs
|
||||
pub data_reference_index: u16,
|
||||
pub sound_version: u16,
|
||||
pub samplesize: u16,
|
||||
|
||||
// From EsdsBox
|
||||
pub esds_version: Option<u8>,
|
||||
|
@ -682,6 +683,7 @@ impl AacConfig {
|
|||
data_reference_index: mp4a.data_reference_index,
|
||||
sound_version: mp4a.sound_version,
|
||||
|
||||
samplesize: mp4a.samplesize,
|
||||
qt_bytes: mp4a.qt_bytes.clone(),
|
||||
|
||||
// Set remaining fields to None initially
|
||||
|
@ -727,9 +729,6 @@ impl AacConfig {
|
|||
config.buffer_size_db = Some(dec_config.buffer_size_db);
|
||||
config.max_bitrate = Some(dec_config.max_bitrate);
|
||||
config.avg_bitrate = Some(dec_config.avg_bitrate);
|
||||
|
||||
// Assuming decoder_specific has a getter for its binary data
|
||||
// config.decoder_specific_data = Some(dec_config.dec_specific.get_data().clone());
|
||||
}
|
||||
config
|
||||
}
|
||||
|
@ -743,6 +742,7 @@ impl Default for AacConfig {
|
|||
profile: AudioObjectType::AacLowComplexity,
|
||||
freq_index: SampleFreqIndex::Freq48000,
|
||||
chan_conf: ChannelConfig::Stereo,
|
||||
samplesize: 16,
|
||||
data_reference_index: 1,
|
||||
sound_version: 0,
|
||||
esds_version: Some(esds.version),
|
||||
|
|
Loading…
Reference in a new issue