org.red5.io.mp4
public class MP4Atom extends Object
MP4Atom
object represents the smallest information block
of the MP4 file. It could contain other atoms as children.
01/29/2008 - Added support for avc1 atom (video sample)
02/05/2008 - Added stss - sync sample atom and stts - time to sample atom
10/2008 - Added pasp - pixel aspect ratio atom
10/2010 - Added ctts atom
11/2011 - Added wide, frma, chan, and terminator handlingModifier and Type | Class and Description |
---|---|
static class |
MP4Atom.CompositionTimeSampleRecord |
static class |
MP4Atom.Record |
static class |
MP4Atom.TimeSampleRecord |
Modifier and Type | Field and Description |
---|---|
protected int |
avcLevel |
protected int |
avcProfile |
protected int |
balance |
protected List<MP4Atom> |
children
The children of this atom.
|
protected Vector<Long> |
chunks
The decoding time to sample table.
|
protected Vector<MP4Atom.CompositionTimeSampleRecord> |
comptimeToSamplesRecords |
protected Date |
creationTime |
protected long |
duration |
protected int |
entryCount |
protected MP4Descriptor |
esd_descriptor |
protected int |
fieldSize |
protected int |
flags |
protected int |
graphicsMode |
protected int |
handlerType |
protected int |
height |
protected Date |
modificationTime |
protected int |
opColorBlue |
protected int |
opColorGreen |
protected int |
opColorRed |
protected int |
qt_trackHeight |
protected int |
qt_trackWidth |
protected long |
readed
The amount of bytes that are read from the mpeg stream.
|
protected Vector<MP4Atom.Record> |
records
The decoding time to sample table.
|
protected int |
sampleCount |
protected Vector<Integer> |
samples
The decoding time to sample table.
|
protected int |
sampleSize |
protected long |
size
The size of the atom.
|
protected Vector<Integer> |
syncSamples |
protected int |
timeScale |
protected Vector<MP4Atom.TimeSampleRecord> |
timeToSamplesRecords |
protected long |
trackId |
protected int |
type
The type of the atom.
|
protected String |
uuid
The user's extended type of the atom.
|
protected int |
version |
protected int |
width |
Constructor and Description |
---|
MP4Atom(long size,
int type,
String uuid,
long readed) |
Modifier and Type | Method and Description |
---|---|
long |
create_audio_sample_entry_atom(MP4DataStream bitstream)
Loads AudioSampleEntry atom from the input bitstream.
|
long |
create_avc_config_atom(MP4DataStream bitstream)
Loads AVCC atom from the input bitstream.
|
long |
create_chan_atom(MP4DataStream bitstream)
Loads Audio Channel Layout atom from the input bitstream.
|
long |
create_chunk_large_offset_atom(MP4DataStream bitstream)
Loads ChunkLargeOffset atom from the input bitstream.
|
long |
create_chunk_offset_atom(MP4DataStream bitstream)
Loads ChunkOffset atom from the input bitstream.
|
long |
create_compact_sample_size_atom(MP4DataStream stream)
Loads CompactSampleSize atom from the input stream.
|
long |
create_composite_atom(MP4DataStream bitstream)
Loads the composite atom from the input bitstream.
|
long |
create_composition_time_to_sample_atom(MP4DataStream bitstream)
Loads composition time to sample atom from the input bitstream.
|
long |
create_esd_atom(MP4DataStream bitstream)
Loads M4ESDAtom atom from the input bitstream.
|
long |
create_full_atom(MP4DataStream bitstream)
Loads the version of the full atom from the input bitstream.
|
long |
create_handler_atom(MP4DataStream bitstream)
Loads Handler atom from the input bitstream.
|
long |
create_media_header_atom(MP4DataStream bitstream)
Loads MediaHeader atom from the input bitstream.
|
long |
create_meta_atom(MP4DataStream bitstream)
Creates a meta data atom.
|
long |
create_movie_header_atom(MP4DataStream bitstream)
Loads MovieHeader atom from the input bitstream.
|
long |
create_pasp_atom(MP4DataStream bitstream)
Creates the PASP atom or Pixel Aspect Ratio.
|
long |
create_sample_description_atom(MP4DataStream bitstream)
Loads SampleDescription atom from the input bitstream.
|
long |
create_sample_size_atom(MP4DataStream bitstream)
Loads MP4SampleSizeAtom atom from the input bitstream.
|
long |
create_sample_to_chunk_atom(MP4DataStream bitstream)
Loads MP4SampleToChunkAtom atom from the input bitstream.
|
long |
create_sound_media_header_atom(MP4DataStream bitstream)
Loads MP4SoundMediaHeaderAtom atom from the input bitstream.
|
long |
create_sync_sample_atom(MP4DataStream bitstream)
Loads MP4SyncSampleAtom atom from the input bitstream.
|
long |
create_time_to_sample_atom(MP4DataStream bitstream)
Loads MP4TimeToSampleAtom atom from the input bitstream.
|
long |
create_track_header_atom(MP4DataStream bitstream)
Loads MP4TrackHeaderAtom atom from the input bitstream.
|
long |
create_udta_atom(MP4DataStream bitstream)
Creates a user data atom.
|
long |
create_video_media_header_atom(MP4DataStream bitstream)
Loads MP4VideoMediaHeaderAtom atom from the input bitstream.
|
long |
create_video_sample_entry_atom(MP4DataStream bitstream)
Loads MP4VideoSampleEntryAtom atom from the input bitstream.
|
long |
create_visual_sample_entry_atom(MP4DataStream bitstream)
Loads MP4VisualSampleEntryAtom atom from the input bitstream.
|
static MP4Atom |
createAtom(MP4DataStream bitstream)
Constructs an
Atom object from the data in the bitstream. |
static Date |
createDate(long movieTime)
Converts the time in seconds since midnight 1 Jan 1904 to the
Date . |
int |
getAvcLevel() |
int |
getAvcProfile() |
int |
getChannelCount() |
List<MP4Atom> |
getChildren()
Gets children from this atom.
|
Vector<Long> |
getChunks() |
Vector<MP4Atom.CompositionTimeSampleRecord> |
getCompositionTimeToSamplesRecords() |
long |
getDuration() |
MP4Descriptor |
getEsd_descriptor()
Returns the ESD descriptor.
|
int |
getHandlerType()
Gets the handler type.
|
int |
getHeight() |
Vector<MP4Atom.Record> |
getRecords() |
Vector<Integer> |
getSamples() |
int |
getSampleSize() |
long |
getSize()
Gets the size of this atom.
|
Vector<Integer> |
getSyncSamples() |
int |
getTimeScale() |
Vector<MP4Atom.TimeSampleRecord> |
getTimeToSamplesRecords() |
int |
getType()
Returns the type of this atom.
|
byte[] |
getVideoConfigBytes() |
int |
getWidth() |
static String |
intToType(int type)
Convert the atom integer to a string.
|
MP4Atom |
lookup(long type,
int number)
Lookups for a child atom with the specified
type , skips the number
children with the same type before finding a result. |
String |
toString()
Returns the name of this atom.
|
static int |
typeToInt(String type)
Convert the atom identifer to an integer.
|
protected long size
protected int type
protected String uuid
protected long readed
protected int version
protected int flags
protected int entryCount
protected int handlerType
protected Date creationTime
protected Date modificationTime
protected int timeScale
protected long duration
protected int sampleSize
protected int sampleCount
protected int fieldSize
protected Vector<MP4Atom.Record> records
protected Vector<MP4Atom.TimeSampleRecord> timeToSamplesRecords
protected Vector<MP4Atom.CompositionTimeSampleRecord> comptimeToSamplesRecords
protected int balance
protected long trackId
protected int qt_trackWidth
protected int qt_trackHeight
protected int graphicsMode
protected int opColorRed
protected int opColorGreen
protected int opColorBlue
protected int width
protected int height
protected int avcLevel
protected int avcProfile
protected MP4Descriptor esd_descriptor
public MP4Atom(long size, int type, String uuid, long readed)
public static final MP4Atom createAtom(MP4DataStream bitstream) throws IOException
Atom
object from the data in the bitstream.bitstream
- the input bitstreamIOException
public long create_full_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_composite_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public MP4Atom lookup(long type, int number)
type
, skips the number
children with the same type before finding a result.type
- the type of the atom.number
- the number of atoms to skippublic int getChannelCount()
public long create_udta_atom(MP4DataStream bitstream) throws IOException
bitstream
- IOException
public long create_meta_atom(MP4DataStream bitstream) throws IOException
bitstream
- IOException
public long create_audio_sample_entry_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_chunk_large_offset_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_chunk_offset_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_handler_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public int getHandlerType()
public long create_media_header_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long getDuration()
public int getTimeScale()
public long create_movie_header_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_sample_description_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_sample_size_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public int getSampleSize()
public long create_compact_sample_size_atom(MP4DataStream stream) throws IOException
stream
- the input streamIOException
public Vector<MP4Atom.Record> getRecords()
public long create_sample_to_chunk_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_sync_sample_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public Vector<MP4Atom.TimeSampleRecord> getTimeToSamplesRecords()
public long create_time_to_sample_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_sound_media_header_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_track_header_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_video_media_header_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_visual_sample_entry_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_video_sample_entry_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public int getHeight()
public int getWidth()
public int getAvcLevel()
public int getAvcProfile()
public byte[] getVideoConfigBytes()
public long create_avc_config_atom(MP4DataStream bitstream) throws IOException
8+ bytes ISO/IEC 14496-10 or 3GPP AVC decode config box = long unsigned offset + long ASCII text string 'avcC' -> 1 byte version = 8-bit hex version (current = 1) -> 1 byte H.264 profile = 8-bit unsigned stream profile -> 1 byte H.264 compatible profiles = 8-bit hex flags -> 1 byte H.264 level = 8-bit unsigned stream level -> 1 1/2 nibble reserved = 6-bit unsigned value set to 63 -> 1/2 nibble NAL length = 2-bit length byte size type - 1 byte = 0 ; 2 bytes = 1 ; 4 bytes = 3 -> 1 byte number of SPS = 8-bit unsigned total -> 2+ bytes SPS length = short unsigned length -> + SPS NAL unit = hexdump -> 1 byte number of PPS = 8-bit unsigned total -> 2+ bytes PPS length = short unsigned length -> + PPS NAL unit = hexdump
bitstream
- the input bitstreamIOException
public long create_pasp_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_chan_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public long create_esd_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public MP4Descriptor getEsd_descriptor()
public long create_composition_time_to_sample_atom(MP4DataStream bitstream) throws IOException
bitstream
- the input bitstreamIOException
public Vector<MP4Atom.CompositionTimeSampleRecord> getCompositionTimeToSamplesRecords()
public static final Date createDate(long movieTime)
Date
.movieTime
- the time in milliseconds since midnight 1 Jan 1904.Date
object.public static int typeToInt(String type)
type
- public static String intToType(int type)
type
- public List<MP4Atom> getChildren()
public long getSize()
public int getType()
Copyright © 2006-2012 The Red5 Project