1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2025-04-15 08:14:15 +00:00
This commit is contained in:
damitha 2025-03-26 14:56:20 +11:00
parent b06846e132
commit 4807dc26e1
3 changed files with 59 additions and 21 deletions

View file

@ -53,24 +53,24 @@ fn copy<P: AsRef<Path>>(src_filename: &P, dst_filename: &P) -> Result<()> {
MediaType::H265 => MediaConfig::HevcConfig(HevcConfig {
width: Some(track.width()),
height: Some(track.height()),
configuration_version: None,
general_profile_space: None,
general_tier_flag: None,
general_profile_idc: None,
general_profile_compatibility_flags: None,
general_constraint_indicator_flag: None,
general_level_idc: None,
min_spatial_segmentation_idc: None,
parallelism_type: None,
chroma_format_idc: None,
bit_depth_luma_minus8: None,
bit_depth_chroma_minus8: None,
avg_frame_rate: None,
constant_frame_rate: None,
num_temporal_layers: None,
temporal_id_nested: None,
length_size_minus_one: None,
arrays: None,
configuration_version: Some(1),
general_profile_space: Some(0),
general_tier_flag: Some(false),
general_profile_idc: Some(1),
general_profile_compatibility_flags: Some(0),
general_constraint_indicator_flag: Some(0),
general_level_idc: Some(93),
min_spatial_segmentation_idc: Some(0),
parallelism_type: Some(0),
chroma_format_idc: Some(1),
bit_depth_luma_minus8: Some(0),
bit_depth_chroma_minus8: Some(0),
avg_frame_rate: Some(0),
constant_frame_rate: Some(0),
num_temporal_layers: Some(1),
temporal_id_nested: Some(false),
length_size_minus_one: Some(3),
arrays: Some(vec![]),
}),
MediaType::VP9 => MediaConfig::Vp9Config(Vp9Config {
width: track.width(),

View file

@ -37,7 +37,7 @@ impl Default for Hev1Box {
impl Hev1Box {
pub fn new(config: &HevcConfig) -> Self {
Hev1Box {
Self {
data_reference_index: 1,
width: config.width.unwrap_or(0),
height: config.height.unwrap_or(0),
@ -45,7 +45,26 @@ impl Hev1Box {
vertresolution: FixedPointU16::new(0x48),
frame_count: 1,
depth: 0x0018,
hvcc: HvcCBox::new(),
hvcc: HvcCBox {
configuration_version: config.configuration_version.unwrap_or(1),
general_profile_space: config.general_profile_space.unwrap_or(0),
general_tier_flag: config.general_tier_flag.unwrap_or(false),
general_profile_idc: config.general_profile_idc.unwrap_or(1),
general_profile_compatibility_flags: config.general_profile_compatibility_flags.unwrap_or(0),
general_constraint_indicator_flag: config.general_constraint_indicator_flag.unwrap_or(0),
general_level_idc: config.general_level_idc.unwrap_or(93),
min_spatial_segmentation_idc: config.min_spatial_segmentation_idc.unwrap_or(0),
parallelism_type: config.parallelism_type.unwrap_or(0),
chroma_format_idc: config.chroma_format_idc.unwrap_or(1),
bit_depth_luma_minus8: config.bit_depth_luma_minus8.unwrap_or(0),
bit_depth_chroma_minus8: config.bit_depth_chroma_minus8.unwrap_or(0),
avg_frame_rate: config.avg_frame_rate.unwrap_or(0),
constant_frame_rate: config.constant_frame_rate.unwrap_or(0),
num_temporal_layers: config.num_temporal_layers.unwrap_or(1),
temporal_id_nested: config.temporal_id_nested.unwrap_or(false),
length_size_minus_one: config.length_size_minus_one.unwrap_or(3),
arrays: config.arrays.clone().unwrap_or_default(),
},
}
}

View file

@ -45,7 +45,26 @@ impl Hvc1Box {
vertresolution: FixedPointU16::new(0x48),
frame_count: 1,
depth: 0x0018,
hvcc: HvcCBox::new(),
hvcc: HvcCBox {
configuration_version: config.configuration_version.unwrap_or(1),
general_profile_space: config.general_profile_space.unwrap_or(0),
general_tier_flag: config.general_tier_flag.unwrap_or(false),
general_profile_idc: config.general_profile_idc.unwrap_or(1),
general_profile_compatibility_flags: config.general_profile_compatibility_flags.unwrap_or(0),
general_constraint_indicator_flag: config.general_constraint_indicator_flag.unwrap_or(0),
general_level_idc: config.general_level_idc.unwrap_or(93),
min_spatial_segmentation_idc: config.min_spatial_segmentation_idc.unwrap_or(0),
parallelism_type: config.parallelism_type.unwrap_or(0),
chroma_format_idc: config.chroma_format_idc.unwrap_or(1),
bit_depth_luma_minus8: config.bit_depth_luma_minus8.unwrap_or(0),
bit_depth_chroma_minus8: config.bit_depth_chroma_minus8.unwrap_or(0),
avg_frame_rate: config.avg_frame_rate.unwrap_or(0),
constant_frame_rate: config.constant_frame_rate.unwrap_or(0),
num_temporal_layers: config.num_temporal_layers.unwrap_or(1),
temporal_id_nested: config.temporal_id_nested.unwrap_or(false),
length_size_minus_one: config.length_size_minus_one.unwrap_or(3),
arrays: config.arrays.clone().unwrap_or_default(),
},
}
}