close
Skip to content

Basic flac support#32

Merged
rillian merged 2 commits into
mozilla:masterfrom
rillian:flac-merge
Oct 3, 2016
Merged

Basic flac support#32
rillian merged 2 commits into
mozilla:masterfrom
rillian:flac-merge

Conversation

@rillian
Copy link
Copy Markdown
Contributor

@rillian rillian commented Oct 1, 2016

Basic support for the proposed FLAC encapsulation.

@rillian
Copy link
Copy Markdown
Contributor Author

rillian commented Oct 1, 2016

r? @kinetiknz

Copy link
Copy Markdown
Collaborator

@kinetiknz kinetiknz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few nits.

Comment thread mp4parse/src/lib.rs Outdated
let a = try!(src.read_u8()) as u32;
let b = try!(src.read_u8()) as u32;
let c = try!(src.read_u8()) as u32;
Ok( a << 16 | b << 8 | c)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space between Ok( and a

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Comment thread mp4parse/src/tests.rs Outdated
let mut track = super::Track::new(0);
let r = super::read_audio_desc(&mut stream, &mut track);
r.unwrap();
//assert!(r.is_ok());
Copy link
Copy Markdown
Collaborator

@kinetiknz kinetiknz Oct 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The assert!() was equivalent here, but .unwrap() gives a better error message.

Comment thread mp4parse_capi/src/lib.rs Outdated
(*info).codec_specific_config.length = v.len() as u32;
(*info).codec_specific_config.data = v.as_ptr();
}
AudioCodecSpecific::FLACSpecificBox(ref _flac) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FLACSpecificBox(_) might be clearer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Comment thread mp4parse/tests/public.rs Outdated
assert!(v.len() > 0);
"ES"
}
mp4::AudioCodecSpecific::FLACSpecificBox(_flac) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FLACSpecificBox(_) might be clearer

Comment thread mp4parse/src/lib.rs Outdated
// must be the METADATA_BLOCK_STREAMINFO
if blocks.len() < 1 {
return Err(Error::InvalidData("FLACSpecificBox missing metadata"));
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} and else if on the same line

Comment thread mp4parse/src/lib.rs Outdated
}
// The box must have at least one meta block, and the first block
// must be the METADATA_BLOCK_STREAMINFO
if blocks.len() < 1 {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocks.is_empty()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, much better, thanks.

This adds parsing and a new codec type.

Based on the draft spec attached to
https://bugzilla.mozilla.org/show_bug.cgi?id=1286097
Fix flac metadata block type mask.

Check flac metadata block lengths against parent box bounds.

Also validate STREAMINFO being present and the first block.

Add an example StreamInfo block from a real file
and pass it to verify the new validation code.

Use an enum instead of a u8 for FLAC Metadata Block types.
We only use one of them, so mark the remaining variants with
a leading underscore while they're unusued.
@rillian rillian merged commit b3e3ab1 into mozilla:master Oct 3, 2016
@rillian rillian deleted the flac-merge branch October 3, 2016 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants