Skip to content

Commit 799334c

Browse files
committed
fix: av1, h264, h265, mp4 and opus boxes
1 parent b30d901 commit 799334c

File tree

6 files changed

+9
-63
lines changed

6 files changed

+9
-63
lines changed

crates/av1/src/boxes.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! <https://aomediacodec.github.io/av1-isobmff>
44
55
use isobmff::boxes::VisualSampleEntry;
6-
use isobmff::{BoxHeader, IsoBox, UnknownBox};
6+
use isobmff::{IsoBox, UnknownBox};
77

88
use crate::AV1CodecConfigurationRecord;
99

@@ -13,9 +13,6 @@ use crate::AV1CodecConfigurationRecord;
1313
#[derive(Debug, IsoBox)]
1414
#[iso_box(box_type = b"av01")]
1515
pub struct AV1SampleEntry<'a> {
16-
/// Header of the box
17-
#[iso_box(header)]
18-
pub header: BoxHeader,
1916
/// The visual sample entry fields that this box inherits.
2017
pub sample_entry: VisualSampleEntry,
2118
/// The AV1 codec configuration box contained in this box.
@@ -32,9 +29,6 @@ pub struct AV1SampleEntry<'a> {
3229
#[derive(Debug, IsoBox)]
3330
#[iso_box(box_type = b"av1C")]
3431
pub struct AV1CodecConfigurationBox<'a> {
35-
/// Header of the box.
36-
#[iso_box(header)]
37-
pub header: BoxHeader,
3832
/// The AV1 codec configuration record.
3933
pub av1_config: AV1CodecConfigurationRecord<'a>,
4034
}

crates/h264/src/boxes.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! ISO/IEC 14496-15 - 5.4
44
55
use isobmff::boxes::{MPEG4ExtensionDescriptorsBox, VisualSampleEntry};
6-
use isobmff::{BoxHeader, IsoBox, UnknownBox};
6+
use isobmff::{IsoBox, UnknownBox};
77

88
use crate::AVCDecoderConfigurationRecord;
99

@@ -13,9 +13,6 @@ use crate::AVCDecoderConfigurationRecord;
1313
#[derive(IsoBox, Debug)]
1414
#[iso_box(box_type = b"avcC")]
1515
pub struct AVCConfigurationBox<'a> {
16-
/// Header of the box.
17-
#[iso_box(header)]
18-
pub header: BoxHeader,
1916
/// The AVC decoder configuration record.
2017
pub avc_config: AVCDecoderConfigurationRecord<'a>,
2118
}
@@ -28,9 +25,6 @@ pub struct AVCConfigurationBox<'a> {
2825
#[derive(IsoBox, Debug)]
2926
#[iso_box(box_type = b"avc1")]
3027
pub struct AVCSampleEntry1<'a> {
31-
/// Header of the box.
32-
#[iso_box(header)]
33-
pub header: BoxHeader,
3428
/// The visual sample entry fields that this box inherits.
3529
pub visual_sample_entry: VisualSampleEntry,
3630
/// The AVC configuration box contained in this box.
@@ -50,9 +44,6 @@ pub struct AVCSampleEntry1<'a> {
5044
#[derive(IsoBox, Debug)]
5145
#[iso_box(box_type = b"avc2")]
5246
pub struct AVCSampleEntry2<'a> {
53-
/// Header of the box.
54-
#[iso_box(header)]
55-
pub header: BoxHeader,
5647
/// The visual sample entry fields that this box inherits.
5748
pub visual_sample_entry: VisualSampleEntry,
5849
/// The AVC configuration box contained in this box.
@@ -72,9 +63,6 @@ pub struct AVCSampleEntry2<'a> {
7263
#[derive(IsoBox, Debug)]
7364
#[iso_box(box_type = b"avc3")]
7465
pub struct AVCSampleEntry3<'a> {
75-
/// Header of the box.
76-
#[iso_box(header)]
77-
pub header: BoxHeader,
7866
/// The visual sample entry fields that this box inherits.
7967
pub visual_sample_entry: VisualSampleEntry,
8068
/// The AVC configuration box contained in this box.
@@ -94,9 +82,6 @@ pub struct AVCSampleEntry3<'a> {
9482
#[derive(IsoBox, Debug)]
9583
#[iso_box(box_type = b"avc4")]
9684
pub struct AVCSampleEntry4<'a> {
97-
/// Header of the box.
98-
#[iso_box(header)]
99-
pub header: BoxHeader,
10085
/// The visual sample entry fields that this box inherits.
10186
pub visual_sample_entry: VisualSampleEntry,
10287
/// The AVC configuration box contained in this box.
@@ -116,9 +101,6 @@ pub struct AVCSampleEntry4<'a> {
116101
#[derive(IsoBox, Debug)]
117102
#[iso_box(box_type = b"avcp")]
118103
pub struct AVCParameterSampleEntry<'a> {
119-
/// Header of the box.
120-
#[iso_box(header)]
121-
pub header: BoxHeader,
122104
/// The visual sample entry fields that this box inherits.
123105
pub visual_sample_entry: VisualSampleEntry,
124106
/// The AVC configuration box contained in this box.

crates/h265/src/boxes.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! ISO/IEC 14496-15 - 8.4
44
55
use isobmff::boxes::{MPEG4ExtensionDescriptorsBox, VisualSampleEntry};
6-
use isobmff::{BoxHeader, IsoBox, UnknownBox};
6+
use isobmff::{IsoBox, UnknownBox};
77

88
use crate::HEVCDecoderConfigurationRecord;
99

@@ -13,9 +13,6 @@ use crate::HEVCDecoderConfigurationRecord;
1313
#[derive(Debug, IsoBox)]
1414
#[iso_box(box_type = b"hvcC")]
1515
pub struct HEVCConfigurationBox<'a> {
16-
/// The box header.
17-
#[iso_box(header)]
18-
pub header: BoxHeader,
1916
/// The HEVC decoder configuration record contained in this box.
2017
pub hevc_config: HEVCDecoderConfigurationRecord<'a>,
2118
}
@@ -26,9 +23,6 @@ pub struct HEVCConfigurationBox<'a> {
2623
#[derive(Debug, IsoBox)]
2724
#[iso_box(box_type = b"hvc1")]
2825
pub struct HEVCSampleEntryHvc1<'a> {
29-
/// The box header.
30-
#[iso_box(header)]
31-
pub header: BoxHeader,
3226
/// The visual sample entry fields that this box inherits.
3327
pub sample_entry: VisualSampleEntry,
3428
/// The HEVC configuration box contained in this box.
@@ -48,9 +42,6 @@ pub struct HEVCSampleEntryHvc1<'a> {
4842
#[derive(Debug, IsoBox)]
4943
#[iso_box(box_type = b"hev1")]
5044
pub struct HEVCSampleEntryHev1<'a> {
51-
/// The box header.
52-
#[iso_box(header)]
53-
pub header: BoxHeader,
5445
/// The visual sample entry fields that this box inherits.
5546
pub sample_entry: VisualSampleEntry,
5647
/// The HEVC configuration box contained in this box.

crates/isobmff/src/boxes/other.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use crate::IsoBox;
1010
#[derive(IsoBox, Debug)]
1111
#[iso_box(box_type = b"m4ds", crate_path = crate)]
1212
pub struct MPEG4ExtensionDescriptorsBox<'a> {
13-
/// Header of the box.
1413
/// A descriptor that should be placed in the `ElementaryStreamDescriptor` when this
1514
/// stream is used in an MPEG-4 systems context. This does not include `SLConfigDescriptor` or
1615
/// `DecoderConfigDescriptor`, but includes the other descriptors in order to be placed after

crates/mp4/src/boxes.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! ISO/IEC 14496-14 - 6
44
55
use isobmff::boxes::{AudioSampleEntry, SampleEntry, VisualSampleEntry};
6-
use isobmff::{BoxHeader, FullBoxHeader, IsoBox};
6+
use isobmff::{FullBoxHeader, IsoBox};
77
use scuffle_bytes_util::BytesCow;
88

99
/// Object Descriptor Box
@@ -12,8 +12,7 @@ use scuffle_bytes_util::BytesCow;
1212
#[derive(Debug, IsoBox)]
1313
#[iso_box(box_type = b"iods")]
1414
pub struct ObjectDescriptorBox<'a> {
15-
/// Header of the box
16-
#[iso_box(header)]
15+
/// The full header of the box
1716
pub header: FullBoxHeader,
1817
/// The object descriptor contained in this box.
1918
///
@@ -29,9 +28,6 @@ pub struct ObjectDescriptorBox<'a> {
2928
#[derive(Debug, IsoBox)]
3029
#[iso_box(box_type = b"mp4v")]
3130
pub struct MP4VisualSampleEntry<'a> {
32-
/// Header of the box.
33-
#[iso_box(header)]
34-
pub header: BoxHeader,
3531
/// The visual sample entry fields that this box inherits.
3632
pub sample_entry: VisualSampleEntry,
3733
/// The ES Descriptor for this stream.
@@ -45,9 +41,6 @@ pub struct MP4VisualSampleEntry<'a> {
4541
#[derive(Debug, IsoBox)]
4642
#[iso_box(box_type = b"mp4a")]
4743
pub struct MP4AudioSampleEntry<'a> {
48-
/// Header of the box.
49-
#[iso_box(header)]
50-
pub header: BoxHeader,
5144
/// The audio sample entry fields that this box inherits.
5245
pub sample_entry: AudioSampleEntry,
5346
/// The ES Descriptor for this stream.
@@ -61,9 +54,6 @@ pub struct MP4AudioSampleEntry<'a> {
6154
#[derive(Debug, IsoBox)]
6255
#[iso_box(box_type = b"mp4s")]
6356
pub struct MpegSampleEntry<'a> {
64-
/// Header of the box.
65-
#[iso_box(header)]
66-
pub header: BoxHeader,
6757
/// The sample entry fields that this box inherits.
6858
pub sample_entry: SampleEntry,
6959
/// The ES Descriptor for this stream.
@@ -77,9 +67,6 @@ pub struct MpegSampleEntry<'a> {
7767
#[derive(Debug, IsoBox)]
7868
#[iso_box(box_type = b"m4ae")]
7969
pub struct MP4AudioEnhancementSampleEntry<'a> {
80-
/// Header of the box.
81-
#[iso_box(header)]
82-
pub header: BoxHeader,
8370
/// The audio sample entry fields that this box inherits.
8471
pub sample_entry: AudioSampleEntry,
8572
/// The ES Descriptor for this stream.
@@ -93,8 +80,7 @@ pub struct MP4AudioEnhancementSampleEntry<'a> {
9380
#[derive(Debug, IsoBox)]
9481
#[iso_box(box_type = b"esds")]
9582
pub struct ESDBox<'a> {
96-
/// Header of the box.
97-
#[iso_box(header)]
83+
/// The full header of the box
9884
pub header: FullBoxHeader,
9985
/// The ES Descriptor for this stream.
10086
///

crates/opus/src/boxes.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ use scuffle_bytes_util::zero_copy::{Deserialize, DeserializeSeed, Serialize};
1313
#[derive(Debug, IsoBox)]
1414
#[iso_box(box_type = b"Opus")]
1515
pub struct OpusSampleEntry<'a> {
16-
/// The header of the box.
17-
#[iso_box(header)]
18-
pub header: BoxHeader,
1916
/// The audio sample entry fields that this box inherits.
2017
pub sample_entry: AudioSampleEntry,
2118
/// Contains initializing information for the decoder.
@@ -32,9 +29,6 @@ pub struct OpusSampleEntry<'a> {
3229
#[derive(Debug, IsoBox)]
3330
#[iso_box(box_type = b"dOps", skip_impl(deserialize_seed, serialize))]
3431
pub struct OpusSpecificBox<'a> {
35-
/// The header of the box.
36-
#[iso_box(header)]
37-
pub header: BoxHeader,
3832
/// Shall be set to 0.
3933
pub version: u8,
4034
/// Shall be set to the same value as the *Output Channel Count* field in the
@@ -62,7 +56,7 @@ pub struct OpusSpecificBox<'a> {
6256
// That's why we have to implement the traits manually here.
6357

6458
impl<'a> DeserializeSeed<'a, BoxHeader> for OpusSpecificBox<'a> {
65-
fn deserialize_seed<R>(mut reader: R, seed: BoxHeader) -> std::io::Result<Self>
59+
fn deserialize_seed<R>(mut reader: R, _seed: BoxHeader) -> std::io::Result<Self>
6660
where
6761
R: scuffle_bytes_util::zero_copy::ZeroCopyReader<'a>,
6862
{
@@ -86,7 +80,6 @@ impl<'a> DeserializeSeed<'a, BoxHeader> for OpusSpecificBox<'a> {
8680
};
8781

8882
Ok(Self {
89-
header: seed,
9083
version,
9184
output_channel_count,
9285
pre_skip,
@@ -103,7 +96,8 @@ impl Serialize for OpusSpecificBox<'_> {
10396
where
10497
W: std::io::Write,
10598
{
106-
self.header.serialize(&mut writer)?;
99+
self.serialize_box_header(&mut writer)?;
100+
107101
self.version.serialize(&mut writer)?;
108102
self.output_channel_count.serialize(&mut writer)?;
109103
self.pre_skip.serialize(&mut writer)?;

0 commit comments

Comments
 (0)