Commit 2fd3c22f authored by Ralph Giles's avatar Ralph Giles Committed by Erik de Castro Lopo
Browse files

Flac-in-mp4 draft v0.0.2.



Draft updates in response to feedback from David Evans.
Signed-off-by: Erik de Castro Lopo's avatarErik de Castro Lopo <erikd@mega-nerd.com>
parent 52df9c61
Encapsulation of FLAC in ISO Base Media File Format
Version 0.0.1 (draft)
Version 0.0.2 (draft)
Table of Contents
1 Scope
2 Supproting Normative References
2 Supporting Normative References
3 Terms and Definitions
4 Design Rules of Encapsulation
4.1 File Type Indentification
4.1 File Type Identification
4.2 Overview of Track Structure
4.3 Definition of FLAC sample
4.3.1 Sample entry format
......@@ -75,10 +75,10 @@ Table of Contents
4 Design Rules of Encapsulation
4.1 File Type Indentification
4.1 File Type Identification
This specification does not define any brand to declare files
are conformant to this specification. Files conformant to
which conform to this specification. Files which conform to
this specification shall contain at least one brand which
supports the requirements and the requirements described in
this clause without contradiction in the compatible brands
......@@ -103,7 +103,7 @@ Table of Contents
using MP4AudioSampleEntry with objectTypeIndication
specified by the MPEG-4 Registration Authority
(http://www.mp4ra.org/). See section 'Sample entry
format' for the definition of the the sample entry.
format' for the definition of the sample entry.
+ The 'dfLa' box is added to the sample entry to convey
initializing information for the decoder.
......@@ -111,8 +111,9 @@ Table of Contents
See section 'FLAC Specific Box' for the definition of
the box contents.
+ A FLAC sample is exactly one FLAC packet. See section
'Sample format' for details of the packet contents.
+ A FLAC sample is exactly one FLAC frame as described
in the format specification[3]. See section
'Sample format' for details of the frame contents.
+ Every FLAC sample is a sync sample. No pre-roll or
lapping is required. See section 'Random Access' for
......@@ -144,6 +145,9 @@ Table of Contents
FLACSpecificBox();
}
The fields of the AudioSampleEntry portion shall be set as
follows:
+ channelcount:
The channelcount field shall be set equal to the
......@@ -179,6 +183,8 @@ Table of Contents
rate declared here and in the
METADATA_BLOCK_STREAMINFO header.
Finally, the FLACSpecificBox carries codec headers:
+ FLACSpecificBox
This box contains initializing information for the
......@@ -205,28 +211,16 @@ Table of Contents
unsigned int(1) LastMetadataBlockFlag;
unsigned int(7) BlockType;
unsigned int(24) Length;
unsigned int(8) MetadataBlockData[BlockLength];
unsigned int(8) BlockData[Length];
}
aligned(8) class FLACSpecificBox
(unsigned int32 MetadataBlocks) extends Box('dfLa'){
unsigned int(8) Version;
for(i=0; i <= MetadataBlocks; i++){
extends FullBox('dfLa', version=0, 0){
for (i=0; ; i++) { // to end of box
FLACMetadataBlock();
}
}
+ MetadataBlocks:
The number of FLAC[3] native metadata blocks to
follow. This value must be at least 1 as a native
METADATA_BLOCK_STREAMINFO structure is required to
decode FLAC audio data.
This value is not coded as the end of the
FLACMetadataBlock list can be intuited from the
LastMetadataBlockFlag (see below).
+ Version:
The Version field shall be set to 0.
......@@ -236,14 +230,23 @@ Table of Contents
of those values, the reader shall not read the fields
after this within the FLACSpecificBox.
The Version field is followed by a sequence of FLAC[3]
native-metadata block structures that fill the remainder
of the box length.
+ Flags:
The Flags field shall be set to 0.
After the FullBox header, the box contains a sequence of
FLAC[3] native-metadata block structures that fill the
remainder of the box.
Each FLACMetadataBlock structure consists of three fields
filling a total of four bytes that form a FLAC[3] native
METADATA_BLOCK_HEADER, followed by raw octet bytes that
comprise the FLAC[3] native METADATA_BLOCK_DATA.
+ LastMetadataBlockFlag:
The LastMetadataBlockFlag field maps semantically to
the FLAC[3] native MEATADATA_BLOCK_HEADER
the FLAC[3] native METADATA_BLOCK_HEADER
Last-metadata-block flag as defined in the FLAC[3]
file specification.
......@@ -272,25 +275,20 @@ Table of Contents
The length field specifies the number of bytes of
MetadataBlockData to follow.
+ MetadataBlockData
+ BlockData
The MetadataBlockData field maps semantically to the
FLAC[3] native MEATADATA_BLOCK_HEADER
METADATA_BLOCKDATA as defined in the FLAC[3] file
specification.
The BlockData field maps semantically to the FLAC[3]
native MEATADATA_BLOCK_HEADER METADATA_BLOCK_DATA as
defined in the FLAC[3] file specification.
The FLACMetadataBlock structure consists of three fields
filling a total of four bytes that form a FLAC[3] native
METADATA_BLOCK_HEADER, followed by raw octet bytes that
comprise the FLAC[3] native METADATA_BLOCK_DATA. Taken
together, the bytes of the FLACMetadataBlock form a
Taken together, the bytes of the FLACMetadataBlock form a
complete FLAC[3] native METADATA_BLOCK structure.
Note that a minimum of a single FLACMetadataBlock,
consisting of a FLAC[3] native METADATA_BLOCK_STREAMINFO
structure, is required. Should the FLACSpecificBox
contain more than a single FLACMetadataBlock structure,
the FLACMetadataBlock contianing the FLAC[3] native
the FLACMetadataBlock containing the FLAC[3] native
METADATA_BLOCK_STREAMINFO must occur first in the list.
Other containers that package FLAC audio streams, such as
......@@ -307,11 +305,11 @@ Table of Contents
4.3.3 Sample format
A FLAC sample is exactly one FLAC audio FRAME packet (as
defined in the FLAC[3] file specification) belonging to a
FLAC bitstreams. The FLAC sample data begins with a
complete FLAC FRAME_HEADER, followed by one FLAC SUBFRAME
per channel, any necessary bit padding, and ends with the
A FLAC sample is exactly one FLAC audio FRAME (as defined
in the FLAC[3] file specification) belonging to a FLAC
bitstreams. The FLAC sample data begins with a complete
FLAC FRAME_HEADER, followed by one FLAC SUBFRAME per
channel, any necessary bit padding, and ends with the
usual FLAC FRAME_FOOTER.
Note that the FLAC native FRAME_HEADER structure that
......@@ -319,7 +317,7 @@ Table of Contents
sample rate, and sample size. The values of these fields
must agree both with the values declared in the FLAC
METADATA_BLOCK_STREAMINFO structure as well as the
FLACDSampleEntry box.
FLACSampleEntry box.
4.3.4 Duration of a FLAC sample
......@@ -581,15 +579,16 @@ Table of Contents
samplerate = 48000.000000
[dfLa: FLAC Specific Box]
position = 484
size = 48
Version = 0
MetadataBlocks = 1
size = 50
version = 0
flags = 0x000000
[FLACMetaDataBlock]
LastMetadataBlockFlag = 1
BlockType = 0
Length = 34
MetadataBlockData[34];
BlockData[34];
[stts: Decoding Time to Sample Box]
position = 490
position = 492
size = 24
version = 0
flags = 0x000000
......@@ -598,7 +597,7 @@ Table of Contents
sample_count = 18
sample_delta = 1920
[stsc: Sample To Chunk Box]
position = 514
position = 516
size = 40
version = 0
flags = 0x000000
......@@ -612,7 +611,7 @@ Table of Contents
samples_per_chunk = 5
sample_description_index = 1
[stsz: Sample Size Box]
position = 554
position = 556
size = 92
version = 0
flags = 0x000000
......@@ -637,7 +636,7 @@ Table of Contents
entry_size[16] = 962
entry_size[17] = 848
[stco: Chunk Offset Box]
position = 646
position = 648
size = 24
version = 0
flags = 0x000000
......@@ -645,10 +644,10 @@ Table of Contents
chunk_offset[0] = 686
chunk_offset[1] = 12985
[free: Free Space Box]
position = 670
position = 672
size = 8
[mdat: Media Data Box]
position = 678
position = 680
size = 17001
5 Acknowledgements
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment