Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions

View File

@ -0,0 +1,128 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
* and was contributed by Ximpo Group Ltd.
*
* Portions created by Ximpo Group Ltd. are
* Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
*
* Contributor(s):
* Ximpo Group Ltd. mp4v2@ximpo.com
*/
#include "mp4common.h"
#define _3GP_MAJOR_BRAND "3gp5"
#define _3GP_MINOR_VERSION 0x0001
void MP4File::Make3GPCompliant(const MP4_FILENAME_CHAR* fileName, char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount, bool deleteIodsAtom)
{
char brand[5] = "3gp5";
char* _3gpSupportedBrands[1] = { (char*)&brand };
if (majorBrand) {
if (!supportedBrands || !supportedBrandsCount) {
throw new MP4Error("Invalid parameters", "MP4File::Make3GPCompliant");
}
}
MakeFtypAtom(
majorBrand ? majorBrand : (char*)brand,
majorBrand ? minorVersion : _3GP_MINOR_VERSION,
majorBrand ? supportedBrands : (char**)_3gpSupportedBrands,
majorBrand ? supportedBrandsCount : 1);
if (deleteIodsAtom) {
// Delete the iods atom, if it exists....
MP4Atom* iodsAtom = m_pRootAtom->FindAtomMP4("moov.iods");
if (iodsAtom) {
MP4Atom* moovAtom = m_pRootAtom->FindAtomMP4("moov");
ASSERT(moovAtom);
moovAtom->DeleteChildAtom(iodsAtom);
}
}
}
void MP4File::MakeFtypAtom(char* majorBrand, u_int32_t minorVersion, char** supportedBrands, u_int32_t supportedBrandsCount)
{
bool rewriteNeeded = false;
u_int32_t currentSupportedBrandsCount;
u_int32_t i;
MP4Atom* ftypAtom = m_pRootAtom->FindAtomMP4("ftyp");
if (ftypAtom == NULL) {
ftypAtom = InsertChildAtom(m_pRootAtom, "ftyp", 0);
}
if (majorBrand == NULL)
return;
MP4StringProperty* pMajorBrandProperty;
if (!ftypAtom->FindProperty(
"ftyp.majorBrand",
(MP4Property**)&pMajorBrandProperty))
return;
pMajorBrandProperty->SetValue(majorBrand);
MP4Integer32Property* pMinorVersionProperty;
if (!ftypAtom->FindProperty(
"ftype.minorVersion",
(MP4Property**)&pMinorVersionProperty))
return;
pMinorVersionProperty->SetValue(minorVersion);
MP4Integer32Property* pCompatibleBrandsCountProperty;
if (!ftypAtom->FindProperty(
"ftyp.compatibleBrandsCount",
(MP4Property**)&pCompatibleBrandsCountProperty)) return;
currentSupportedBrandsCount = pCompatibleBrandsCountProperty->GetValue();
MP4TableProperty* pCompatibleBrandsProperty;
if (!ftypAtom->FindProperty(
"ftyp.compatibleBrands",
(MP4Property**)&pCompatibleBrandsProperty)) return;
MP4StringProperty* pBrandProperty = (MP4StringProperty*)
pCompatibleBrandsProperty->GetProperty(0);
ASSERT(pBrandProperty);
for (i = 0 ; i < ((currentSupportedBrandsCount > supportedBrandsCount) ? supportedBrandsCount : currentSupportedBrandsCount) ; i++) {
pBrandProperty->SetValue(supportedBrands[i], i);
}
if (i < supportedBrandsCount) {
for ( ; i < supportedBrandsCount ; i++) {
pBrandProperty->AddValue(supportedBrands[i]);
}
}
if (currentSupportedBrandsCount != supportedBrandsCount) {
rewriteNeeded = true;
pBrandProperty->SetCount(supportedBrandsCount);
pCompatibleBrandsCountProperty->SetReadOnly(false);
pCompatibleBrandsCountProperty->SetValue(supportedBrandsCount);
pCompatibleBrandsCountProperty->SetReadOnly(true);
}
}

View File

@ -0,0 +1,179 @@
#include "mp4common.h"
size_t utf16len(const uint16_t *str)
{
size_t size=0;
while (*str++) size++;
return size;
}
void utf16swap(uint16_t *str)
{
while (*str)
{
*str = htons(*str);
str++;
}
}
bool MP4File::Get3GPMetadataString(const char *atom, uint16_t **value)
{
char atomstring[60];
snprintf(atomstring, 60, "moov.udta.%s.metadata", atom);
const uint8_t *str = (const uint8_t *)this->GetStringProperty(atomstring);
if (str)
{
bool reverse=false;
bool utf16=false;
if ((str[0] == 0xFE && str[1] == 0xFF))
{
reverse=true;
utf16=true;
}
if ((str[0] == 0xFF && str[1] == 0xFE))
{
utf16=true;
}
if (utf16)
{
uint16_t *utf16 = (uint16_t *)str;
size_t len = utf16len(utf16);
*value = (uint16_t *)malloc(len*sizeof(uint16_t));
if (!*value)
return false;
memcpy(*value, utf16+1, len*sizeof(uint16_t));
if (reverse)
utf16swap(*value);
}
else
{
int len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)str, -1, 0, 0);
*value = (uint16_t *)malloc(len * sizeof(uint16_t));
if (*value == NULL)
{
return false;
}
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)str, -1, (LPWSTR)*value, len);
}
return true;
}
return false;
}
bool MP4File::Set3GPMetadataString(const char *atom, const uint16_t *value)
{
char atomstring[60];
MP4Atom *pMetaAtom;
MP4StringProperty *pMetadataProperty = NULL;
MP4Integer16Property *unknown = NULL;
snprintf(atomstring, 60, "moov.udta.%s", atom);
pMetaAtom = m_pRootAtom->FindAtomMP4(atomstring);
if (!pMetaAtom)
{
(void)AddDescendantAtoms("moov", atomstring+5);
//if (!CreateMetadataAtom(atom))
//return false;
pMetaAtom = m_pRootAtom->FindAtomMP4(atomstring);
if (pMetaAtom == NULL) return false;
}
snprintf(atomstring, 60, "%s.language", atom);
ASSERT(pMetaAtom->FindProperty(atomstring,
(MP4Property**)&unknown));
ASSERT(unknown);
unknown->SetValue(0x15C7);
snprintf(atomstring, 60, "%s.metadata", atom);
ASSERT(pMetaAtom->FindProperty(atomstring,
(MP4Property**)&pMetadataProperty));
ASSERT(pMetadataProperty);
pMetadataProperty->SetUnicode(true);
size_t lenWithBOM = utf16len(value) + 1;
uint16_t *newVal = (uint16_t *)malloc((lenWithBOM+1) * sizeof(uint16_t));
newVal[0]=0xFEFF;
memcpy(newVal+1, value, lenWithBOM*sizeof(uint16_t));
pMetadataProperty->SetValue((char *)newVal, 0);
free(newVal);
return true;
}
bool MP4File::Get3GPMetadataInteger(const char *atom, uint64_t *value)
{
char atomstring[60];
snprintf(atomstring, 60, "moov.udta.%s.metadata", atom);
MP4Property* pProperty;
u_int32_t index;
FindIntegerProperty(atomstring, &pProperty, &index);
if (pProperty)
{
*value = ((MP4IntegerProperty*)pProperty)->GetValue(index);
return true;
}
return false;
}
bool MP4File::Set3GPMetadataInteger(const char *atom, uint64_t value)
{
char atomstring[60] = {0};
MP4Atom *pMetaAtom;
MP4IntegerProperty *pMetadataProperty = NULL;
snprintf(atomstring, 60, "moov.udta.%s", atom);
pMetaAtom = m_pRootAtom->FindAtomMP4(atomstring);
if (!pMetaAtom)
{
(void)AddDescendantAtoms("moov", atomstring+5);
//if (!CreateMetadataAtom(atom))
//return false;
pMetaAtom = m_pRootAtom->FindAtomMP4(atomstring);
if (pMetaAtom == NULL) return false;
}
snprintf(atomstring, 60, "%s.metadata", atom);
ASSERT(pMetaAtom->FindProperty(atomstring,
(MP4Property**)&pMetadataProperty));
ASSERT(pMetadataProperty);
pMetadataProperty->SetValue(value, 0);
return true;
}
bool MP4File::Delete3GPMetadataAtom(const char* name)
{
MP4Atom *pMetaAtom = NULL;
char s[256];
snprintf(s, 256, "moov.udta.%s", name);
pMetaAtom = m_pRootAtom->FindAtomMP4(s);
/* if it exists, delete it */
if (pMetaAtom)
{
MP4Atom *pParent = pMetaAtom->GetParentAtom();
pParent->DeleteChildAtom(pMetaAtom);
delete pMetaAtom;
return true;
}
return false;
}

View File

@ -0,0 +1,124 @@
Changes in xxxx
---------------
Change to MP4Create and MP4Modify to allow flags to be set for 64 bit
to allow Quicktime compatibility
Change to MP4CloneTrack and MP4CopyTrack for when you copy a hint
track - you must now specify the track ID in the new file for the
reference track.
Changes in 0.9.9
---------------------------
Added support for ISMA's Ismacrypt specification:
MP4GetTrackEsdsObjectTypeId replaces MP4GetTrackAudioType
and MP4GetTrackVideoType.
MP4EncAndCloneTrack is used instead of MP4CloneTrack to encrypt a track
while cloning it.
MP4EncAndCopyTrack is used instead of MP4CopyTrack to encrypt a track
while copying it.
MP4AddEncAudioTrack adds an encrypted audio track.
MP4AddEncVideoTrack adds an encrypted video track.
Changes in 0.9.8
---------------------------
MP4WriteSample - changed "uint8_t * data" to "const uint8_t *data"
Changes from 0.9.6
---------------------------
Modified
MP4SetHintTrackRtpPayload
payload parameter to get a dynamic payload is MP4_SET_DYNAMIC_PAYLOAD
(value 0xff) instead of 0.
Changes from 0.9.5 to 0.9.6
---------------------------
Modified
MP4GetHintTrackRtpPayload
MP4SetHintTrackRtpPayload
get/set the encoding params (a=rtpmap <payloadname>/<timescale>[/<encoding params>])
Changes from 0.9.4 to 0.9.5
---------------------------
Added
MP4GetTrackAudioMpeg4Type()
Returns MPEG-4 Audio type (e.g. AAC, CELP, HXVC, MIDI, etc.)
MP4ReadSampleFromTime()
Variant of MP4ReadSample() that uses time instead of sample id
(basically MP4GetSampleIdFromTime() + MP4ReadSample())
MP4Info()
MP4FileInfo()
Returns summary info on tracks in file (from util/mp4info.cpp)
The following functions add support for mp4 authoring/editting:
MP4CloneTrack()
Make a copy of a specified track, without media samples
MP4CopyTrack()
Make a copy of a specified track, with or without media samples
MP4CopySample()
Make a copy of a specified media sample
MP4AddTrackEdit()
Add a track edit list element
MP4DeleteTrackEdit()
Delete a track edit list element
MP4GetTrackNumberOfEdits()
Return the number of track edit list elements
MP4GetTrackEditTotalDuration()
Return the total duration of the track edit list
MP4GetTrackEditStart()
Return the edit start time for the edit list element
MP4GetTrackEditMediaStart()
Return the media start time for the edit list element
MP4SetTrackEditMediaStart()
Set the media start time for the edit list element
MP4GetTrackEditDuration()
Return the edit list element duration
MP4SetTrackEditDuration()
Set the edit list element duration
MP4GetTrackEditDwell()
Return the edit list element dwell parameter, see man page
MP4SetTrackEditDwell()
Set the edit list element dwell parameter, see man page
MP4ReadSampleFromEditTime()
Apply the edit list timeline to reading a sample
MP4GetSampleIdFromEditTime()
Return the sample id for a specified time on the edit list timeline
Modified
MP4GetSampleIdFromTime()
Semantic change - now returns sample id corresponding
to specified time, not the sample id with the smallest positive
start time difference from the specified time.
Changes from 0.9.3 to 0.9.4
---------------------------
Added
MP4GetTrackVideoFrameRate()
Returns video frame rate (average rate if video is variable rate).
MP4GetTrackBitRate()
Returns track average bit rate in bits-per-second.
Changes from 0.9.2 to 0.9.3
---------------------------
Modified
MP4Optimize()
Second argument, newFileName, can now be NULL in which case
a temporary file is created for the results of the optimization.
Upon success, the existing file specified with the first argument
is overwritten with the optimized file.
MP4GetNumberOfTracks()
MP4FindTrackId()
Both have a new optional argument, subType, with default value 0.
The subType can be specified for audio and video tracks to
match only a specific encoding type. See man page for more details.
Added
MP4GetTrackVideoWidth()
Returns video width in pixels. See man page for caveat.
MP4GetTrackVideoHeight()
Returns video height in pixels. See man page for caveat.

View File

@ -0,0 +1,223 @@
January 7, 2002
MP4V2 LIBRARY INTERNALS
=======================
This document provides an overview of the internals of the mp4v2 library
to aid those who wish to modify and extend it. Before reading this document,
I recommend familiarizing yourself with the MP4 (or Quicktime) file format
standard and the mp4v2 library API. The API is described in a set of man pages
in mpeg4ip/doc/mp4v2, or if you prefer by looking at mp4.h.
All the library code is written in C++, however the library API follows uses
C calling conventions hence is linkable by both C and C++ programs. The
library has been compiled and used on Linux, BSD, Windows, and Mac OS X.
Other than libc, the library has no external dependencies, and hence can
be used independently of the mpeg4ip package if desired. The library is
used for both real-time recording and playback in mpeg4ip, and its runtime
performance is up to those tasks. On the IA32 architecture compiled with gcc,
the stripped library is approximately 600 KB code and initialized data.
It is useful to think of the mp4v2 library as consisting of four layers:
infrastructure, file format, generic tracks, and type specific track helpers.
A description of each layer follows, from the fundamental to the optional.
Infrastructure
==============
The infrastructure layer provides basic file I/O, memory allocation,
error handling, string utilities, and protected arrays. The source files
for this layer are mp4file_io, mp4util, and mp4array.
Note that the array classes uses preprocessor macros instead of C++
templates. The rationale for this is to increase portability given the
sometimes incomplete support by some compilers for templates.
File Format
===========
The file format layer provides the translation from the on-disk MP4 file
format to in-memory C++ structures and back to disk. It is intended
to exactly match the MP4 specification in syntax and semantics. It
represents the majority of the code.
There are three key structures at the file format layer: atoms, properties,
and descriptors.
Atoms are the primary containers within an mp4 file. They can contain
any combination of properties, other atoms, or descriptors.
The mp4atom files contain the base class for all the atoms, and provide
generic functions that cover most cases. Most atoms are covered in
atom_standard.cpp. Atoms that have a special read, generation or
write needs are contained in their subclass contained in file atom_<name>.cpp,
where <name> is the four letter name of the atom defined in the MP4
specification.
Atoms that only specifies the properties of the atom or the possible child
atoms in the case of a container atom are located in atom_standard.cpp.
In more specialized cases the atom specific file provides routines to
initialize, read, or write the atom.
Properties are the atomic pieces of information. The basic types of
properties are integers, floats, strings, and byte arrays. For integers
and floats there are subclasses that represent the different storage sizes,
e.g. 8, 16, 24, 32, and 64 bit integers. For strings, there is 1 property
class with a number of options regarding exact storage details, e.g. null
terminated, fixed length, counted.
For implementation reasons, there are also two special properties, table
and descriptor, that are actually containers for groups of properties.
I.e by making these containers provide a property interface much code can
be written in a generic fashion.
The mp4property files contain all the property related classes.
Descriptors are containers that derive from the MPEG conventions and use
different encoding rules than the atoms derived from the QuickTime file
format. This means more use of bitfields and conditional existence with
an emphasis on bit efficiency at the cost of encoding/decoding complexity.
Descriptors can contain other descriptors and/or properties.
The mp4descriptor files contain the generic base class for descriptors.
Also the mp4property files have a descriptor wrapper class that allows a
descriptor to behave as if it were a property. The specific descriptors
are implemented as subclasses of the base class descriptor in manner similar
to that of atoms. The descriptors, ocidescriptors, and qosqualifiers files
contain these implementations.
Each atom/property/descriptor has a name closely related to that in the
MP4 specification. The difference being that the mp4v2 library doesn't
use '-' or '_' in property names and capitalizes the first letter of each
word, e.g. "thisIsAPropertyName". A complete name specifies the complete
container path. The names follow the C/C++ syntax for elements and array
indices.
Examples are:
"moov.mvhd.duration"
"moov.trak[2].tkhd.duration"
"moov.trak[3].minf.mdia.stbl.stsz[101].sampleSize"
Note "*" can be used as a wildcard for an atom name (only). This is most
useful when dealing with the stsd atom which contains child atoms with
various names, but shared property names.
Note that internally when performance matters the code looks up a property
by name once, and then stores the returned pointer to the property class.
To add an atom, first you should see if an existing atom exists that
can be used. If not, you need to decide if special read/write or
generate properties need to be established; for example a property in the atom
changes other properties (adds, or subtracts). If there are no
special cases, add the atom properties to atom_standard.cpp. If there
are special properties, add a new file, add a new class to atoms.h, and
add the class to MP4Atom::CreateAtom in mp4atom.cpp.
Generic Tracks
==============
The two entities at this level are the mp4 file as a whole and the tracks
which are contained with it. The mp4file and mp4track files contain the
implementation.
The critical work done by this layer is to map the collection of atoms,
properties, and descriptors that represent a media track into a useful,
and consistent set of operations. For example, reading or writing a media
sample of a track is a relatively simple operation from the library API
perspective. However there are numerous pieces of information in the mp4
file that need to be properly used and updated to do this. This layer
handles all those details.
Given familiarity with the mp4 spec, the code should be straight-forward.
What may not be immediately obvious are the functions to handle chunks of
media samples. These exist to allow optimization of the mp4 file layout by
reordering the chunks on disk to interleave the media sample chunks of
multiple tracks in time order. (See MP4Optimize API doc).
Type Specific Track Helpers
===========================
This specialized code goes beyond the meta-information about tracks in
the mp4 file to understanding and manipulating the information in the
track samples. There are currently two helpers in the library:
the MPEG-4 Systems Helper, and the RTP Hint Track Helper.
The MPEG-4 Systems Helper is currently limited to creating the OD, BIFS,
and SDP information about a minimal audio/video scene consistent with
the Internet Streaming Media Alliance (ISMA) specifications. We will be
evaluating how best to generalize the library's helper functions for
MPEG-4 Systems without overburdening the implementation. The code for
this helper is found in the isma and odcommands files.
The RTP Hint Track Helper is more extensive in its support. The hint
tracks contain the track packetization information needed to build
RTP packets for streaming. The library can construct RTP packets based
on the hint track making RTP based servers significantly easier to write.
All code related to rtp hint tracks is in the rtphint files. It would also
be useful to look at test/mp4broadcaster and mpeg4ip/server/mp4creator for
examples of how this part of the library API can be used.
Library API
===========
The library API is defined and implemented in the mp4 files. The API uses
C linkage conventions, and the mp4.h file adapts itself according to whether
C or C++ is the compilation mode.
All API calls are implemented in mp4.cpp and basically pass thru's to the
MP4File member functions. This ensures that the library has internal access
to the same functions as available via the API. All the calls in mp4.cpp use
C++ try/catch blocks to protect against any runtime errors in the library.
Upon error the library will print a diagnostic message if the verbostiy level
has MP4_DETAILS_ERROR set, and return a distinguished error value, typically
0 or -1.
The test and util subdirectories contain useful examples of how to
use the library. Also the mp4creator and mp4live programs within
mpeg4ip demonstrate more complete usage of the library API.
Debugging
=========
Since mp4 files are fairly complicated, extensive debugging support is
built into the library. Multi-level diagnostic messages are available
under the control of a verbosity bitmask described in the API.
Also the library provides the MP4Dump() call which provides an ASCII
version of the mp4 file meta-information. The mp4dump utilitity is a
wrapper executable around this function.
The mp4extract program is also provided in the utilities directory
which is useful for extracting a track from an mp4file and putting the
media data back into it's own file. It can also extract each sample of
a track into its own file it that is desired.
When all else fails, mp4 files are amenable to debugging by direct
examination. Since the atom names are four letter ASCII codes finding
reference points in a hex dump is feasible. On UNIX, the od command
is your friend: "od -t x1z -A x [-j 0xXXXXXX] foo.mp4" will print
a hex and ASCII dump, with hex addresses, starting optionally from
a specified offset. The library diagnostic messages can provide
information on where the library is reading or writing.
General caveats
===============
The coding convention is to use the C++ throw operator whenever an
unrecoverable error occurs. This throw is caught at the API layer
in mp4.cpp and translated into an error value.
Be careful about indices. Internally, we follow the C/C++ convention
to use zero-based indices. However the MP4 spec uses one-based indices
for things like samples and hence the library API uses this convention.

View File

@ -0,0 +1,97 @@
SUBDIRS = . test util
INCLUDES = -I$(top_srcdir)/include
AM_CXXFLAGS = @BILLS_CPPWARNINGS@
lib_LTLIBRARIES = libmp4v2.la
include_HEADERS = mp4.h
libmp4v2_la_SOURCES = \
3gp.cpp \
atom_amr.cpp \
atom_avc1.cpp \
atom_avcC.cpp \
atom_d263.cpp \
atom_damr.cpp \
atom_dref.cpp \
atom_elst.cpp \
atom_enca.cpp \
atom_encv.cpp \
atom_free.cpp \
atom_ftyp.cpp \
atom_gmin.cpp \
atom_hdlr.cpp \
atom_hinf.cpp \
atom_hnti.cpp \
atom_href.cpp \
atom_mdat.cpp \
atom_mdhd.cpp \
atom_meta.cpp \
atom_mp4s.cpp \
atom_mp4v.cpp \
atom_mvhd.cpp \
atom_ohdr.cpp \
atom_root.cpp \
atom_rtp.cpp \
atom_s263.cpp \
atom_sdp.cpp \
atoms.h \
atom_smi.cpp \
atom_sound.cpp \
atom_standard.cpp \
atom_stbl.cpp \
atom_stdp.cpp \
atom_stsc.cpp \
atom_stsd.cpp \
atom_stsz.cpp \
atom_stz2.cpp \
atom_text.cpp \
atom_tfhd.cpp \
atom_tkhd.cpp \
atom_treftype.cpp \
atom_trun.cpp \
atom_udta.cpp \
atom_url.cpp \
atom_urn.cpp \
atom_video.cpp \
atom_vmhd.cpp \
descriptors.cpp \
descriptors.h \
isma.cpp \
mp4array.h \
mp4atom.cpp \
mp4atom.h \
mp4common.h \
mp4container.cpp \
mp4container.h \
mp4.cpp \
mp4descriptor.cpp \
mp4descriptor.h \
mp4file.cpp \
mp4file.h \
mp4file_io.cpp \
mp4info.cpp \
mp4meta.cpp \
mp4property.cpp \
mp4property.h \
mp4track.cpp \
mp4track.h \
mp4util.cpp \
mp4util.h \
ocidescriptors.cpp \
ocidescriptors.h \
odcommands.cpp \
odcommands.h \
qosqualifiers.cpp \
qosqualifiers.h \
rtphint.cpp \
rtphint.h \
virtual_io.cpp \
virtual_io.h
EXTRA_DIST = API_CHANGES \
INTERNALS \
libmp4v260.dsp \
TODO

View File

@ -0,0 +1,833 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = lib/mp4v2
DIST_COMMON = README $(include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in TODO
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/mpeg4ip_config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libmp4v2_la_LIBADD =
am_libmp4v2_la_OBJECTS = 3gp.lo atom_amr.lo atom_avc1.lo atom_avcC.lo \
atom_d263.lo atom_damr.lo atom_dref.lo atom_elst.lo \
atom_enca.lo atom_encv.lo atom_free.lo atom_ftyp.lo \
atom_hdlr.lo atom_hinf.lo atom_hnti.lo atom_href.lo \
atom_mdat.lo atom_mdhd.lo atom_meta.lo atom_mp4s.lo \
atom_mp4v.lo atom_mvhd.lo atom_ohdr.lo atom_root.lo \
atom_rtp.lo atom_s263.lo atom_sdp.lo atom_smi.lo atom_sound.lo \
atom_standard.lo atom_stbl.lo atom_stdp.lo atom_stsc.lo \
atom_stsd.lo atom_stsz.lo atom_tfhd.lo atom_tkhd.lo \
atom_treftype.lo atom_trun.lo atom_udta.lo atom_url.lo \
atom_urn.lo atom_video.lo atom_vmhd.lo descriptors.lo isma.lo \
mp4atom.lo mp4container.lo mp4.lo mp4descriptor.lo mp4file.lo \
mp4file_io.lo mp4info.lo mp4meta.lo mp4property.lo mp4track.lo \
mp4util.lo ocidescriptors.lo odcommands.lo qosqualifiers.lo \
rtphint.lo
libmp4v2_la_OBJECTS = $(am_libmp4v2_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libmp4v2_la_SOURCES)
DIST_SOURCES = $(libmp4v2_la_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-exec-recursive install-info-recursive \
install-recursive installcheck-recursive installdirs-recursive \
pdf-recursive ps-recursive uninstall-info-recursive \
uninstall-recursive
includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
ALIGN_FUNCS = @ALIGN_FUNCS@
ALIGN_JUMPS = @ALIGN_JUMPS@
ALIGN_LOOPS = @ALIGN_LOOPS@
ALSA_CFLAGS = @ALSA_CFLAGS@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
ASFLAGS = @ASFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BILLS_CPPWARNINGS = @BILLS_CPPWARNINGS@
BILLS_CWARNINGS = @BILLS_CWARNINGS@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FAAC_LIB = @FAAC_LIB@
FFLAGS = @FFLAGS@
FFMPEG_INC = @FFMPEG_INC@
FFMPEG_LIB = @FFMPEG_LIB@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
GLIB_LIBS = @GLIB_LIBS@
GLIB_MKENUMS = @GLIB_MKENUMS@
GOBJECT_QUERY = @GOBJECT_QUERY@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
HAVE_A52DEC_LIB_FALSE = @HAVE_A52DEC_LIB_FALSE@
HAVE_A52DEC_LIB_TRUE = @HAVE_A52DEC_LIB_TRUE@
HAVE_ALIGN_FUNCS_FALSE = @HAVE_ALIGN_FUNCS_FALSE@
HAVE_ALIGN_FUNCS_TRUE = @HAVE_ALIGN_FUNCS_TRUE@
HAVE_ALIGN_JUMPS_FALSE = @HAVE_ALIGN_JUMPS_FALSE@
HAVE_ALIGN_JUMPS_TRUE = @HAVE_ALIGN_JUMPS_TRUE@
HAVE_ALIGN_LOOPS_FALSE = @HAVE_ALIGN_LOOPS_FALSE@
HAVE_ALIGN_LOOPS_TRUE = @HAVE_ALIGN_LOOPS_TRUE@
HAVE_FFMPEG_FALSE = @HAVE_FFMPEG_FALSE@
HAVE_FFMPEG_TRUE = @HAVE_FFMPEG_TRUE@
HAVE_ID3_TAG_FALSE = @HAVE_ID3_TAG_FALSE@
HAVE_ID3_TAG_TRUE = @HAVE_ID3_TAG_TRUE@
HAVE_LIBMAD_FALSE = @HAVE_LIBMAD_FALSE@
HAVE_LIBMAD_TRUE = @HAVE_LIBMAD_TRUE@
HAVE_LIBMPEG2_FALSE = @HAVE_LIBMPEG2_FALSE@
HAVE_LIBMPEG2_TRUE = @HAVE_LIBMPEG2_TRUE@
HAVE_MAC_OSX_FALSE = @HAVE_MAC_OSX_FALSE@
HAVE_MAC_OSX_TRUE = @HAVE_MAC_OSX_TRUE@
HAVE_X264_FALSE = @HAVE_X264_FALSE@
HAVE_X264_TRUE = @HAVE_X264_TRUE@
HAVE_XVID_1_0_FALSE = @HAVE_XVID_1_0_FALSE@
HAVE_XVID_1_0_TRUE = @HAVE_XVID_1_0_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LAME_LIB = @LAME_LIB@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_C_TAG = @LIBTOOL_C_TAG@
LIBVORBIS_LIB = @LIBVORBIS_LIB@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MP4LIVE_FALSE = @MP4LIVE_FALSE@
MP4LIVE_TRUE = @MP4LIVE_TRUE@
NASM = @NASM@
NASMFLAGS = @NASMFLAGS@
NO_GLIB_GTK_FALSE = @NO_GLIB_GTK_FALSE@
NO_GLIB_GTK_TRUE = @NO_GLIB_GTK_TRUE@
NO_XVID_FALSE = @NO_XVID_FALSE@
NO_XVID_TRUE = @NO_XVID_TRUE@
OBJC = @OBJC@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PLAYER_FALSE = @PLAYER_FALSE@
PLAYER_PLUGIN_DIR = @PLAYER_PLUGIN_DIR@
PLAYER_TRUE = @PLAYER_TRUE@
RANLIB = @RANLIB@
SDL_LIBS = @SDL_LIBS@
SDL_LIB_LIBS = @SDL_LIB_LIBS@
SERVER_FALSE = @SERVER_FALSE@
SERVER_TRUE = @SERVER_TRUE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SRTPLIB = @SRTPLIB@
STRIP = @STRIP@
SUN_LIBS = @SUN_LIBS@
USENASM = @USENASM@
USE_MMX_FALSE = @USE_MMX_FALSE@
USE_MMX_TRUE = @USE_MMX_TRUE@
USE_PPC_FALSE = @USE_PPC_FALSE@
USE_PPC_TRUE = @USE_PPC_TRUE@
VERSION = @VERSION@
X264_LIB = @X264_LIB@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
SUBDIRS = . test util
INCLUDES = -I$(top_srcdir)/include
AM_CXXFLAGS = @BILLS_CPPWARNINGS@
lib_LTLIBRARIES = libmp4v2.la
include_HEADERS = mp4.h
libmp4v2_la_SOURCES = \
3gp.cpp \
atom_amr.cpp \
atom_avc1.cpp \
atom_avcC.cpp \
atom_d263.cpp \
atom_damr.cpp \
atom_dref.cpp \
atom_elst.cpp \
atom_enca.cpp \
atom_encv.cpp \
atom_free.cpp \
atom_ftyp.cpp \
atom_hdlr.cpp \
atom_hinf.cpp \
atom_hnti.cpp \
atom_href.cpp \
atom_mdat.cpp \
atom_mdhd.cpp \
atom_meta.cpp \
atom_mp4s.cpp \
atom_mp4v.cpp \
atom_mvhd.cpp \
atom_ohdr.cpp \
atom_root.cpp \
atom_rtp.cpp \
atom_s263.cpp \
atom_sdp.cpp \
atoms.h \
atom_smi.cpp \
atom_sound.cpp \
atom_standard.cpp \
atom_stbl.cpp \
atom_stdp.cpp \
atom_stsc.cpp \
atom_stsd.cpp \
atom_stsz.cpp \
atom_tfhd.cpp \
atom_tkhd.cpp \
atom_treftype.cpp \
atom_trun.cpp \
atom_udta.cpp \
atom_url.cpp \
atom_urn.cpp \
atom_video.cpp \
atom_vmhd.cpp \
descriptors.cpp \
descriptors.h \
isma.cpp \
mp4array.h \
mp4atom.cpp \
mp4atom.h \
mp4common.h \
mp4container.cpp \
mp4container.h \
mp4.cpp \
mp4descriptor.cpp \
mp4descriptor.h \
mp4file.cpp \
mp4file.h \
mp4file_io.cpp \
mp4info.cpp \
mp4meta.cpp \
mp4property.cpp \
mp4property.h \
mp4track.cpp \
mp4track.h \
mp4util.cpp \
mp4util.h \
ocidescriptors.cpp \
ocidescriptors.h \
odcommands.cpp \
odcommands.h \
qosqualifiers.cpp \
qosqualifiers.h \
rtphint.cpp \
rtphint.h
EXTRA_DIST = API_CHANGES \
INTERNALS \
libmp4v260.dsp \
TODO
all: all-recursive
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/mp4v2/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign lib/mp4v2/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libmp4v2.la: $(libmp4v2_la_OBJECTS) $(libmp4v2_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libmp4v2_la_LDFLAGS) $(libmp4v2_la_OBJECTS) $(libmp4v2_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/3gp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_amr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_avc1.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_avcC.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_d263.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_damr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_dref.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_elst.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_enca.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_encv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_free.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_ftyp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hdlr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hinf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hnti.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_href.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mdat.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mdhd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_meta.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mp4s.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mp4v.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mvhd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_ohdr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_root.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_rtp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_s263.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_sdp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_smi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_sound.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_standard.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stbl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stdp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsz.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tfhd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tkhd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_treftype.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_trun.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_udta.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_url.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_urn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_video.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_vmhd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/descriptors.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isma.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4atom.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4container.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4descriptor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4file.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4file_io.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4info.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4meta.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4property.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4track.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4util.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocidescriptors.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/odcommands.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qosqualifiers.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtphint.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
$(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
rm -f "$(DESTDIR)$(includedir)/$$f"; \
done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(mkdir_p) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-includeHEADERS
install-exec-am: install-libLTLIBRARIES
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
clean clean-generic clean-libLTLIBRARIES clean-libtool \
clean-recursive ctags ctags-recursive distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-recursive distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-exec install-exec-am \
install-includeHEADERS install-info install-info-am \
install-libLTLIBRARIES install-man install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am \
uninstall-includeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,28 @@
July 18, 2002
MP4V2 Library
=============
This library provides functions to read, create, and modify mp4 files.
The detailed documentation of the library is available as a set of man pages
in mpeg4ip/doc/mp4v2. The MP4.3 man page gives an overview of the library.
Alternately mp4.h in this directory specifies the complete API.
The file INTERNALS provides an overview of what is happening behind the API.
Note that although we using C++ object oriented features internally, that's
all hidden behind a flat C style API (with C linkage conventions).
The test and util subdirectories contain some simple programs that use
this library.
Once make install is run, to use this library, you should:
To use this library in your application, it should be sufficient to:
1) add the installed library to your final link:
e.g. gcc ... -o foo foo.cpp -lmp4v2
2) include mp4.h into your code,
e.g. #include <mp4.h>

View File

@ -0,0 +1,61 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4AlacAtom::MP4AlacAtom()
: MP4Atom("alac")
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddReserved("reserved2", 16); /* 2 */
AddProperty( /* 3 */
new MP4Integer16Property("timeScale"));
AddReserved("reserved3", 2); /* 4 */
AddProperty(
new MP4BytesProperty("alacInfo", 36)); /* 5 */
//ExpectChildAtom("alac", Required, OnlyOne);
}
void MP4AlacAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
// property reserved2 has non-zero fixed values
static u_int8_t reserved2[16] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00,
};
m_pProperties[2]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[2])->
SetValue(reserved2, sizeof(reserved2));
m_pProperties[2]->SetReadOnly(true);
}

View File

@ -0,0 +1,65 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
* and was contributed by Ximpo Group Ltd.
*
* Portions created by Ximpo Group Ltd. are
* Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
*
* Contributor(s):
* Ximpo Group Ltd. mp4v2@ximpo.com
*/
#include "mp4common.h"
MP4AmrAtom::MP4AmrAtom(const char *type)
: MP4Atom(type)
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddReserved("reserved2", 16); /* 2 */
AddProperty( /* 3 */
new MP4Integer16Property("timeScale"));
AddReserved("reserved3", 2); /* 4 */
ExpectChildAtom("damr", Required, OnlyOne);
}
void MP4AmrAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
// property reserved2 has non-zero fixed values
static u_int8_t reserved2[16] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00,
};
m_pProperties[2]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[2])->
SetValue(reserved2, sizeof(reserved2));
m_pProperties[2]->SetReadOnly(true);
}

View File

@ -0,0 +1,81 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved.
*
* Contributor(s):
* Bill May wmay@cisco.com
*/
#include "mp4common.h"
MP4Avc1Atom::MP4Avc1Atom()
: MP4Atom("avc1")
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddReserved("reserved2", 16); /* 2 */
AddProperty( /* 3 */
new MP4Integer16Property("width"));
AddProperty( /* 4 */
new MP4Integer16Property("height"));
AddReserved("reserved3", 14); /* 5 */
MP4StringProperty* pProp =
new MP4StringProperty("compressorName");
pProp->SetFixedLength(32);
pProp->SetValue("AVC Coding");
AddProperty(pProp); /* 6 */
AddReserved("reserved4", 4); /* 7 */
ExpectChildAtom("avcC", Required, OnlyOne);
ExpectChildAtom("btrt", Optional, OnlyOne);
// for now ExpectChildAtom("m4ds", Optional, OnlyOne);
}
void MP4Avc1Atom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
// property reserved3 has non-zero fixed values
static u_int8_t reserved3[14] = {
0x00, 0x48, 0x00, 0x00,
0x00, 0x48, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01,
};
m_pProperties[5]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[5])->
SetValue(reserved3, sizeof(reserved3));
m_pProperties[5]->SetReadOnly(true);
// property reserved4 has non-zero fixed values
static u_int8_t reserved4[4] = {
0x00, 0x18, 0xFF, 0xFF,
};
m_pProperties[7]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[7])->
SetValue(reserved4, sizeof(reserved4));
m_pProperties[7]->SetReadOnly(true);
}

View File

@ -0,0 +1,261 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved.
*
* Contributor(s):
* Bill May wmay@cisco.com
*/
#include "mp4common.h"
/*
* SizeTableProperty is a special version of the MP4TableProperty -
* the BytesProperty will need to set the value before it can read
* from the file
*/
class SizeTableProperty : public MP4TableProperty
{
public:
SizeTableProperty(char *name, MP4IntegerProperty *pCountProperty) :
MP4TableProperty(name, pCountProperty) {};
protected:
void ReadEntry(MP4File *pFile, u_int32_t index) {
// Each table has a size, followed by the length field
// first, read the length
m_pProperties[0]->Read(pFile, index);
MP4IntegerProperty *pIntProp = (MP4IntegerProperty *)m_pProperties[0];
// set the size in the bytes property
MP4BytesProperty *pBytesProp = (MP4BytesProperty *)m_pProperties[1];
pBytesProp->SetValueSize(pIntProp->GetValue(index), index);
// And read the bytes
m_pProperties[1]->Read(pFile, index);
};
};
MP4AvcCAtom::MP4AvcCAtom()
: MP4Atom("avcC")
{
MP4BitfieldProperty *pCount;
MP4TableProperty *pTable;
AddProperty( new MP4Integer8Property("configurationVersion")); /* 0 */
AddProperty( new MP4Integer8Property("AVCProfileIndication")); /* 1 */
AddProperty( new MP4Integer8Property("profile_compatibility")); /* 2 */
AddProperty( new MP4Integer8Property("AVCLevelIndication")); /* 3 */
AddProperty( new MP4BitfieldProperty("reserved", 6)); /* 4 */
AddProperty( new MP4BitfieldProperty("lengthSizeMinusOne", 2)); /* 5 */
AddProperty( new MP4BitfieldProperty("reserved1", 3)); /* 6 */
pCount = new MP4BitfieldProperty("numOfSequenceParameterSets", 5);
AddProperty(pCount); /* 7 */
pTable = new SizeTableProperty("sequenceEntries", pCount);
AddProperty(pTable); /* 8 */
pTable->AddProperty(new MP4Integer16Property("sequenceParameterSetLength"));
pTable->AddProperty(new MP4BytesProperty("sequenceParameterSetNALUnit"));
MP4Integer8Property *pCount2 = new MP4Integer8Property("numOfPictureParameterSets");
AddProperty(pCount2); /* 9 */
pTable = new SizeTableProperty("pictureEntries", pCount2);
AddProperty(pTable); /* 10 */
pTable->AddProperty(new MP4Integer16Property("pictureParameterSetLength"));
pTable->AddProperty(new MP4BytesProperty("pictureParameterSetNALUnit"));
}
void MP4AvcCAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer8Property*)m_pProperties[0])->SetValue(1);
m_pProperties[4]->SetReadOnly(false);
((MP4BitfieldProperty*)m_pProperties[4])->SetValue(0x3f);
m_pProperties[4]->SetReadOnly(true);
m_pProperties[6]->SetReadOnly(false);
((MP4BitfieldProperty*)m_pProperties[6])->SetValue(0x7);
m_pProperties[6]->SetReadOnly(true);
#if 0
// property reserved4 has non-zero fixed values
static u_int8_t reserved4[4] = {
0x00, 0x18, 0xFF, 0xFF,
};
m_pProperties[7]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[7])->
SetValue(reserved4, sizeof(reserved4));
m_pProperties[7]->SetReadOnly(true);
#endif
}
//
// Clone - clone my properties to destination atom
//
// this method simplifies duplicating avcC atom properties from
// source to destination file using a single API rather than
// having to copy each property. This API encapsulates the object
// so the application layer need not concern with each property
// thereby isolating any future changes to atom properties.
//
// ----------------------------------------
// property description
// ----------------------------------------
//
// 0 configurationVersion
// 1 AVCProfileIndication
// 2 profile_compatibility
// 3 AVCLevelIndication
// 4 reserved
// 5 lengthSizeMinusOne
// 6 reserved
// 7 number of SPS
// 8 SPS entries
// 9 number of PPS
// 10 PPS entries
//
//
void MP4AvcCAtom::Clone(MP4AvcCAtom *dstAtom)
{
MP4Property *dstProperty;
MP4TableProperty *pTable;
u_int16_t i16;
u_int64_t i32;
u_int64_t i64;
u_int8_t *tmp;
// source pointer Property I16
MP4Integer16Property *spPI16;
// source pointer Property Bytes
MP4BytesProperty *spPB;
// dest pointer Property I16
MP4Integer16Property *dpPI16;
// dest pointer Property Bytes
MP4BytesProperty *dpPB;
// start with defaults and reserved fields
dstAtom->Generate();
// 0, 4, 6 are now generated from defaults
// leaving 1, 2, 3, 5, 7, 8, 9, 10 to export
dstProperty=dstAtom->GetProperty(1);
((MP4Integer8Property *)dstProperty)->SetValue(
((MP4Integer8Property *)m_pProperties[1])->GetValue());
dstProperty=dstAtom->GetProperty(2);
((MP4Integer8Property *)dstProperty)->SetValue(
((MP4Integer8Property *)m_pProperties[2])->GetValue());
dstProperty=dstAtom->GetProperty(3);
((MP4Integer8Property *)dstProperty)->SetValue(
((MP4Integer8Property *)m_pProperties[3])->GetValue());
dstProperty=dstAtom->GetProperty(5);
((MP4BitfieldProperty *)dstProperty)->SetValue(
((MP4BitfieldProperty *)m_pProperties[5])->GetValue());
//
// 7 and 8 are related SPS (one set of sequence parameters)
//
// first the count bitfield
//
dstProperty=dstAtom->GetProperty(7);
dstProperty->SetReadOnly(false);
((MP4BitfieldProperty *)dstProperty)->SetValue(
((MP4BitfieldProperty *)m_pProperties[7])->GetValue());
dstProperty->SetReadOnly(true);
// next export SPS Length and NAL bytes */
// first source pointers
pTable = (MP4TableProperty *) m_pProperties[8];
spPI16 = (MP4Integer16Property *)pTable->GetProperty(0);
spPB = (MP4BytesProperty *)pTable->GetProperty(1);
// now dest pointers
dstProperty=dstAtom->GetProperty(8);
pTable = (MP4TableProperty *) dstProperty;
dpPI16 = (MP4Integer16Property *)pTable->GetProperty(0);
dpPB = (MP4BytesProperty *)pTable->GetProperty(1);
// sps length
i16 = spPI16->GetValue();
i64 = i16;
// FIXME - this leaves m_maxNumElements =2
// but src atom m_maxNumElements is 1
dpPI16->InsertValue(i64, 0);
// export byte array
i32 = i16;
// copy bytes to local buffer
tmp = (u_int8_t *)MP4Malloc(i32);
ASSERT(tmp != NULL);
spPB->CopyValue(tmp, 0);
// set element count
dpPB->SetCount(1);
// copy bytes
dpPB->SetValue(tmp, i32, 0);
MP4Free((void *)tmp);
//
// 9 and 10 are related PPS (one set of picture parameters)
//
// first the integer8 count
//
dstProperty=dstAtom->GetProperty(9);
dstProperty->SetReadOnly(false);
((MP4Integer8Property *)dstProperty)->SetValue(
((MP4Integer8Property *)m_pProperties[9])->GetValue());
dstProperty->SetReadOnly(true);
// next export PPS Length and NAL bytes */
// first source pointers
pTable = (MP4TableProperty *) m_pProperties[10];
spPI16 = (MP4Integer16Property *)pTable->GetProperty(0);
spPB = (MP4BytesProperty *)pTable->GetProperty(1);
// now dest pointers
dstProperty=dstAtom->GetProperty(10);
pTable = (MP4TableProperty *) dstProperty;
dpPI16 = (MP4Integer16Property *)pTable->GetProperty(0);
dpPB = (MP4BytesProperty *)pTable->GetProperty(1);
// pps length
i16 = spPI16->GetValue();
i64 = i16;
dpPI16->InsertValue(i64, 0);
// export byte array
i32 = i16;
// copy bytes to local buffer
tmp = (u_int8_t *)MP4Malloc(i32);
ASSERT(tmp != NULL);
spPB->CopyValue(tmp, 0);
// set element count
dpPB->SetCount(1);
// copy bytes
dpPB->SetValue(tmp, i32, 0);
MP4Free((void *)tmp);
}

View File

@ -0,0 +1,41 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
* and was contributed by Ximpo Group Ltd.
*
* Portions created by Ximpo Group Ltd. are
* Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
*
* Contributor(s):
* Ximpo Group Ltd. mp4v2@ximpo.com
*/
#include "mp4common.h"
MP4BitrAtom::MP4BitrAtom()
: MP4Atom("bitr")
{
AddProperty( /* 0 */
new MP4Integer32Property("avgBitrate"));
AddProperty( /* 1 */
new MP4Integer32Property("maxBitrate"));
}

View File

@ -0,0 +1,30 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved.
*
* Contributor(s):
* Bill May wmay@cisco.com
*/
#include "mp4common.h"
MP4BtrtAtom::MP4BtrtAtom()
: MP4Atom("btrt")
{
AddProperty( new MP4Integer32Property("bufferSizeDB")); /* 0 */
AddProperty( new MP4Integer32Property("avgBitrate")); /* 1 */
AddProperty( new MP4Integer32Property("maxBitrate")); /* 2 */
}

View File

@ -0,0 +1,59 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributed to MPEG4IP
* by Ullrich Pollaehne <pollaehne at users.sourceforge.net>
*
* Nero chapter atom
*/
#include "mp4common.h"
// MP4ChplAtom is for Nero chapter list atom which is a child of udta
MP4ChplAtom::MP4ChplAtom () : MP4Atom("chpl")
{
// it is not completely clear if version, flags, reserved and chaptercount
// have the right sizes but
// one thing is clear: chaptercount is not only 8-bit it is at least 16-bit
// add the version
AddVersionAndFlags();
// add reserved bytes
AddReserved("reserved", 1);
// define the chaptercount
MP4Integer32Property * counter = new MP4Integer32Property("chaptercount");
AddProperty(counter);
// define the chapterlist
MP4TableProperty * list = new MP4TableProperty("chapters", counter);
// the start time as 100 nanoseconds units
list->AddProperty(new MP4Integer64Property("starttime"));
// the chapter name as UTF-8
list->AddProperty(new MP4StringProperty("name", true));
// add the chapterslist
AddProperty(list);
}
void MP4ChplAtom::Generate ()
{
SetVersion(1);
}

View File

@ -0,0 +1,38 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4Co64Atom::MP4Co64Atom()
: MP4Atom("co64")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(
new MP4Integer64Property("chunkOffset"));
}

View File

@ -0,0 +1,32 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4CprtAtom::MP4CprtAtom()
: MP4Atom("cprt")
{
AddVersionAndFlags();
AddProperty(
new MP4Integer16Property("language"));
AddProperty(
new MP4StringProperty("notice"));
}

View File

@ -0,0 +1,40 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4CttsAtom::MP4CttsAtom()
: MP4Atom("ctts")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(
new MP4Integer32Property("sampleCount"));
pTable->AddProperty(
new MP4Integer32Property("sampleOffset"));
}

View File

@ -0,0 +1,88 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
* and was contributed by Ximpo Group Ltd.
*
* Portions created by Ximpo Group Ltd. are
* Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
*
* Contributor(s):
* Ximpo Group Ltd. mp4v2@ximpo.com
*/
#include "mp4common.h"
#define H263_VENDOR 0x6d346970
MP4D263Atom::MP4D263Atom()
: MP4Atom("d263")
{
AddProperty( /* 0 */
new MP4Integer32Property("vendor"));
AddProperty( /* 1 */
new MP4Integer8Property("decoderVersion"));
AddProperty( /* 2 */
new MP4Integer8Property("h263Level"));
AddProperty( /* 3 */
new MP4Integer8Property("h263Profile"));
ExpectChildAtom("bitr", Optional, OnlyOne);
}
void MP4D263Atom::Generate()
{
MP4Atom::Generate();
((MP4Integer32Property*)m_pProperties[0])->SetValue(H263_VENDOR);
((MP4Integer8Property*)m_pProperties[1])->SetValue(1);
}
void MP4D263Atom::Write()
{
// Check whether we have valid values in the bitr atom
// (if it exists, of course)
MP4Atom* bitrAtom = FindAtomMP4("d263.bitr");
if (bitrAtom) {
u_int32_t avgBitrate;
u_int32_t maxBitrate;
MP4Integer32Property* pProp;
bitrAtom->FindProperty("bitr.avgBitrate",
(MP4Property**)&pProp,
NULL);
ASSERT(pProp);
avgBitrate = pProp->GetValue();
bitrAtom->FindProperty("bitr.maxBitrate",
(MP4Property**)&pProp,
NULL);
ASSERT(pProp);
maxBitrate = pProp->GetValue();
if(!maxBitrate && !avgBitrate) {
DeleteChildAtom(bitrAtom);
}
}
MP4Atom::Write();
}

View File

@ -0,0 +1,59 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
* and was contributed by Ximpo Group Ltd.
*
* Portions created by Ximpo Group Ltd. are
* Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
*
* Contributor(s):
* Ximpo Group Ltd. mp4v2@ximpo.com
*/
#include "mp4common.h"
#define AMR_VENDOR 0x6d346970
MP4DamrAtom::MP4DamrAtom()
: MP4Atom("damr")
{
AddProperty( /* 0 */
new MP4Integer32Property("vendor"));
AddProperty( /* 1 */
new MP4Integer8Property("decoderVersion"));
AddProperty( /* 2 */
new MP4Integer16Property("modeSet"));
AddProperty( /* 3 */
new MP4Integer8Property("modeChangePeriod"));
AddProperty( /* 4 */
new MP4Integer8Property("framesPerSample"));
}
void MP4DamrAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer32Property*)m_pProperties[0])->SetValue(AMR_VENDOR);
((MP4Integer8Property*)m_pProperties[1])->SetValue(1);
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4DimmAtom::MP4DimmAtom()
: MP4Atom("dimm")
{
AddProperty( // bytes of immediate data
new MP4Integer64Property("bytes"));
}

View File

@ -0,0 +1,28 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4DinfAtom::MP4DinfAtom()
: MP4Atom("dinf")
{
ExpectChildAtom("dref", Required, OnlyOne);
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4DmaxAtom::MP4DmaxAtom()
: MP4Atom("dmax")
{
AddProperty( // max packet duration
new MP4Integer32Property("milliSecs"));
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4DmedAtom::MP4DmedAtom()
: MP4Atom("dmed")
{
AddProperty( // bytes sent from media data
new MP4Integer64Property("bytes"));
}

View File

@ -0,0 +1,56 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4DrefAtom::MP4DrefAtom()
: MP4Atom("dref")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
pCount->SetReadOnly();
AddProperty(pCount);
ExpectChildAtom("url ", Optional, Many);
ExpectChildAtom("urn ", Optional, Many);
ExpectChildAtom("alis", Optional, Many);
}
void MP4DrefAtom::Read()
{
/* do the usual read */
MP4Atom::Read();
// check that number of children == entryCount
MP4Integer32Property* pCount =
(MP4Integer32Property*)m_pProperties[2];
if (m_pChildAtoms.Size() != pCount->GetValue()) {
//VERBOSE_READ(GetVerbosity(), MP4Printf("Warning: dref inconsistency with number of entries"));
/* fix it */
pCount->SetReadOnly(false);
pCount->SetValue(m_pChildAtoms.Size());
pCount->SetReadOnly(true);
}
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4DrepAtom::MP4DrepAtom()
: MP4Atom("drep")
{
AddProperty( // bytes of repeated data
new MP4Integer64Property("bytes"));
}

View File

@ -0,0 +1,28 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4EdtsAtom::MP4EdtsAtom()
: MP4Atom("edts")
{
ExpectChildAtom("elst", Required, OnlyOne);
}

View File

@ -0,0 +1,80 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4ElstAtom::MP4ElstAtom()
: MP4Atom("elst")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
}
void MP4ElstAtom::AddProperties(u_int8_t version)
{
MP4TableProperty* pTable = (MP4TableProperty*)m_pProperties[3];
if (version == 1) {
pTable->AddProperty(
new MP4Integer64Property("segmentDuration"));
pTable->AddProperty(
new MP4Integer64Property("mediaTime"));
} else {
pTable->AddProperty(
new MP4Integer32Property("segmentDuration"));
pTable->AddProperty(
new MP4Integer32Property("mediaTime"));
}
pTable->AddProperty(
new MP4Integer16Property("mediaRate"));
pTable->AddProperty(
new MP4Integer16Property("reserved"));
}
void MP4ElstAtom::Generate()
{
SetVersion(0);
AddProperties(GetVersion());
MP4Atom::Generate();
}
void MP4ElstAtom::Read()
{
/* read atom version */
ReadProperties(0, 1);
/* need to create the properties based on the atom version */
AddProperties(GetVersion());
/* now we can read the remaining properties */
ReadProperties(1);
Skip(); // to end of atom
}

View File

@ -0,0 +1,61 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
* Alix Marchandise-Franquet alix@cisco.com
*/
#include "mp4common.h"
MP4EncaAtom::MP4EncaAtom()
: MP4Atom("enca")
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddReserved("reserved2", 16); /* 2 */
AddProperty( /* 3 */
new MP4Integer16Property("timeScale"));
AddReserved("reserved3", 2); /* 4 */
ExpectChildAtom("esds", Required, OnlyOne);
ExpectChildAtom("sinf", Required, OnlyOne);
}
void MP4EncaAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
// property reserved2 has non-zero fixed values
static u_int8_t reserved2[16] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00,
};
m_pProperties[2]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[2])->
SetValue(reserved2, sizeof(reserved2));
m_pProperties[2]->SetReadOnly(true);
}

View File

@ -0,0 +1,81 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
* Alix Marchandise-Franquet alix@cisco.com
*/
#include "mp4common.h"
MP4EncvAtom::MP4EncvAtom()
: MP4Atom("encv")
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddReserved("reserved2", 16); /* 2 */
AddProperty( /* 3 */
new MP4Integer16Property("width"));
AddProperty( /* 4 */
new MP4Integer16Property("height"));
AddReserved("reserved3", 14); /* 5 */
MP4StringProperty* pProp =
new MP4StringProperty("compressorName");
pProp->SetFixedLength(32);
pProp->SetValue("");
AddProperty(pProp); /* 6 */
AddReserved("reserved4", 4); /* 7 */
ExpectChildAtom("esds", Required, OnlyOne);
ExpectChildAtom("sinf", Required, OnlyOne);
ExpectChildAtom("avcC", Optional, OnlyOne);
}
void MP4EncvAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
// property reserved3 has non-zero fixed values
static u_int8_t reserved3[14] = {
0x00, 0x48, 0x00, 0x00,
0x00, 0x48, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01,
};
m_pProperties[5]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[5])->
SetValue(reserved3, sizeof(reserved3));
m_pProperties[5]->SetReadOnly(true);
// property reserved4 has non-zero fixed values
static u_int8_t reserved4[4] = {
0x00, 0x18, 0xFF, 0xFF,
};
m_pProperties[7]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[7])->
SetValue(reserved4, sizeof(reserved4));
m_pProperties[7]->SetReadOnly(true);
}

View File

@ -0,0 +1,31 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4EsdsAtom::MP4EsdsAtom()
: MP4Atom("esds")
{
AddVersionAndFlags();
AddProperty(
new MP4DescriptorProperty(NULL,
MP4ESDescrTag, 0, Required, OnlyOne));
}

View File

@ -0,0 +1,49 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4FreeAtom::MP4FreeAtom()
: MP4Atom("free")
{
}
void MP4FreeAtom::Read()
{
Skip();
}
void MP4FreeAtom::Write()
{
ASSERT(m_pFile);
bool use64 = (GetSize() > (0xFFFFFFFF - 8));
BeginWrite(use64);
#if 1
for (uint64_t ix = 0; ix < GetSize(); ix++) {
m_pFile->WriteUInt8(0);
}
#else
m_pFile->SetPosition(m_pFile->GetPosition() + GetSize());
#endif
FinishWrite(use64);
}

View File

@ -0,0 +1,32 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Alix Marchandise-Franquet alix@cisco.com
*
* Add the OriginalFormatBox for ISMACrypt
* contains the original format of the data (i.e. decrypted format)
*/
#include "mp4common.h"
MP4FrmaAtom::MP4FrmaAtom()
: MP4Atom("frma")
{
AddProperty( /* 0 */
new MP4Integer32Property("data-format"));
}

View File

@ -0,0 +1,71 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4FtypAtom::MP4FtypAtom()
: MP4Atom("ftyp")
{
MP4StringProperty* pProp = new MP4StringProperty("majorBrand");
pProp->SetFixedLength(4);
AddProperty(pProp); /* 0 */
AddProperty( /* 1 */
new MP4Integer32Property("minorVersion"));
MP4Integer32Property* pCount =
new MP4Integer32Property("compatibleBrandsCount");
pCount->SetImplicit();
AddProperty(pCount); /* 2 */
MP4TableProperty* pTable =
new MP4TableProperty("compatibleBrands", pCount);
AddProperty(pTable); /* 3 */
pProp = new MP4StringProperty("brand");
pProp->SetFixedLength(4);
pTable->AddProperty(pProp);
}
void MP4FtypAtom::Generate()
{
MP4Atom::Generate();
((MP4StringProperty*)m_pProperties[0])->SetValue("mp42");
MP4StringProperty* pBrandProperty = (MP4StringProperty*)
((MP4TableProperty*)m_pProperties[3])->GetProperty(0);
ASSERT(pBrandProperty);
pBrandProperty->AddValue("mp42");
pBrandProperty->AddValue("isom");
((MP4Integer32Property*)m_pProperties[2])->IncrementValue();
((MP4Integer32Property*)m_pProperties[2])->IncrementValue();
}
void MP4FtypAtom::Read()
{
// table entry count computed from atom size
((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(false);
((MP4Integer32Property*)m_pProperties[2])->SetValue((m_size - 8) / 4);
((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(true);
MP4Atom::Read();
}

View File

@ -0,0 +1,49 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* Contributer has declined to give copyright information, and gives
* it freely to the world.
*
* Contributor(s):
*/
#include "mp4common.h"
MP4GminAtom::MP4GminAtom()
: MP4Atom("gmin")
{
AddVersionAndFlags(); /* 0, 1 */
AddProperty(new MP4Integer16Property("graphicsMode")); /* 2 */
AddProperty(new MP4Integer16Property("opColorRed")); /* 3 */
AddProperty(new MP4Integer16Property("opColorGreen")); /* 4 */
AddProperty(new MP4Integer16Property("opColorBlue")); /* 5 */
AddProperty(new MP4Integer16Property("balance")); /* 6 */
AddReserved("reserved", 2); /* 7 */
}
void MP4GminAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[2])->SetValue(0x0040);
((MP4Integer16Property*)m_pProperties[3])->SetValue(0x8000);
((MP4Integer16Property*)m_pProperties[4])->SetValue(0x8000);
((MP4Integer16Property*)m_pProperties[5])->SetValue(0x8000);
((MP4Integer16Property*)m_pProperties[6])->SetValue(0x0000);
}

View File

@ -0,0 +1,66 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4HdlrAtom::MP4HdlrAtom()
: MP4Atom("hdlr")
{
AddVersionAndFlags(); /* 0, 1 */
AddReserved("reserved1", 4); /* 2 */
MP4StringProperty* pProp = new MP4StringProperty("handlerType");
pProp->SetFixedLength(4);
AddProperty(pProp); /* 3 */
AddReserved("reserved2", 12); /* 4 */
AddProperty( /* 5 */
new MP4StringProperty("name"));
}
// There is a spec incompatiblity between QT and MP4
// QT says name field is a counted string
// MP4 says name field is a null terminated string
// Here we attempt to make all things work
void MP4HdlrAtom::Read()
{
// read all the properties but the "name" field
ReadProperties(0, 5);
uint64_t pos = m_pFile->GetPosition();
uint64_t end = GetEnd();
if (pos == end) return;
// take a peek at the next byte
u_int8_t strLength;
m_pFile->PeekBytes(&strLength, 1);
// if the value matches the remaining atom length
if (pos + strLength + 1 == end) {
// read a counted string
MP4StringProperty* pNameProp =
(MP4StringProperty*)m_pProperties[5];
pNameProp->SetCountedFormat(true);
ReadProperties(5);
pNameProp->SetCountedFormat(false);
} else {
// read a null terminated string
ReadProperties(5);
}
Skip(); // to end of atom
}

View File

@ -0,0 +1,57 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4HinfAtom::MP4HinfAtom()
: MP4Atom("hinf")
{
ExpectChildAtom("trpy", Optional, OnlyOne);
ExpectChildAtom("nump", Optional, OnlyOne);
ExpectChildAtom("tpyl", Optional, OnlyOne);
ExpectChildAtom("maxr", Optional, Many);
ExpectChildAtom("dmed", Optional, OnlyOne);
ExpectChildAtom("dimm", Optional, OnlyOne);
ExpectChildAtom("drep", Optional, OnlyOne);
ExpectChildAtom("tmin", Optional, OnlyOne);
ExpectChildAtom("tmax", Optional, OnlyOne);
ExpectChildAtom("pmax", Optional, OnlyOne);
ExpectChildAtom("dmax", Optional, OnlyOne);
ExpectChildAtom("payt", Optional, OnlyOne);
}
void MP4HinfAtom::Generate()
{
// hinf is special in that although all it's child atoms
// are optional (on read), if we generate it for writing
// we really want all the children
for (u_int32_t i = 0; i < m_pChildAtomInfos.Size(); i++) {
MP4Atom* pChildAtom =
CreateAtom(m_pChildAtomInfos[i]->m_name);
AddChildAtom(pChildAtom);
// and ask it to self generate
pChildAtom->Generate();
}
}

View File

@ -0,0 +1,39 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4HmhdAtom::MP4HmhdAtom()
: MP4Atom("hmhd")
{
AddVersionAndFlags();
AddProperty(
new MP4Integer16Property("maxPduSize"));
AddProperty(
new MP4Integer16Property("avgPduSize"));
AddProperty(
new MP4Integer32Property("maxBitRate"));
AddProperty(
new MP4Integer32Property("avgBitRate"));
AddProperty(
new MP4Integer32Property("slidingAvgBitRate"));
}

View File

@ -0,0 +1,40 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4HntiAtom::MP4HntiAtom()
: MP4Atom("hnti")
{
}
void MP4HntiAtom::Read()
{
MP4Atom* grandParent = m_pParentAtom->GetParentAtom();
ASSERT(grandParent);
if (ATOMID(grandParent->GetType()) == ATOMID("trak")) {
ExpectChildAtom("sdp ", Optional, OnlyOne);
} else {
ExpectChildAtom("rtp ", Optional, OnlyOne);
}
MP4Atom::Read();
}

View File

@ -0,0 +1,40 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2005. All Rights Reserved.
*
* Contributor(s):
* Bill May wmay@cisco.com
*/
#include "mp4common.h"
MP4HrefAtom::MP4HrefAtom()
: MP4Atom("href")
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
ExpectChildAtom("burl", Optional, OnlyOne);
}
void MP4HrefAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
}

View File

@ -0,0 +1,34 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Alix Marchandise-Franquet alix@cisco.com
*
* ISMAKMSBox for ISMACrypt
* Do we care about the string length? Do we need to handle the null-term
* issue like in the hdlr atom?
*/
#include "mp4common.h"
MP4IKMSAtom::MP4IKMSAtom()
: MP4Atom("iKMS")
{
AddVersionAndFlags(); /* 0, 1 */
MP4StringProperty* pProp = new MP4StringProperty("kms_URI");
AddProperty(pProp); /* 2 */
}

View File

@ -0,0 +1,38 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Alix Marchandise-Franquet alix@cisco.com
*
* ISMASampleFormatBox for ISMACrypt
*/
#include "mp4common.h"
MP4ISFMAtom::MP4ISFMAtom()
: MP4Atom("iSFM")
{
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4BitfieldProperty("selective-encryption", 1));
AddProperty( /* 3 */
new MP4BitfieldProperty("reserved", 7));
AddProperty( /* 4 */
new MP4Integer8Property("key-indicator-length"));
AddProperty( /* 5 */
new MP4Integer8Property("IV-length"));
}

View File

@ -0,0 +1,31 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4IodsAtom::MP4IodsAtom()
: MP4Atom("iods")
{
AddVersionAndFlags();
AddProperty(
new MP4DescriptorProperty(NULL,
MP4FileIODescrTag, MP4FileODescrTag, Required, OnlyOne));
}

View File

@ -0,0 +1,31 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MaxrAtom::MP4MaxrAtom()
: MP4Atom("maxr")
{
AddProperty(
new MP4Integer32Property("granularity"));
AddProperty(
new MP4Integer32Property("bytes"));
}

View File

@ -0,0 +1,38 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MdatAtom::MP4MdatAtom()
: MP4Atom("mdat")
{
}
void MP4MdatAtom::Read()
{
Skip();
}
void MP4MdatAtom::Write()
{
// should never get here
ASSERT(false);
}

View File

@ -0,0 +1,91 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MdhdAtom::MP4MdhdAtom()
: MP4Atom("mdhd")
{
AddVersionAndFlags();
}
void MP4MdhdAtom::AddProperties(u_int8_t version)
{
if (version == 1) {
AddProperty(
new MP4Integer64Property("creationTime"));
AddProperty(
new MP4Integer64Property("modificationTime"));
} else {
AddProperty(
new MP4Integer32Property("creationTime"));
AddProperty(
new MP4Integer32Property("modificationTime"));
}
AddProperty(
new MP4Integer32Property("timeScale"));
if (version == 1) {
AddProperty(
new MP4Integer64Property("duration"));
} else {
AddProperty(
new MP4Integer32Property("duration"));
}
AddProperty(
new MP4Integer16Property("language"));
AddReserved("reserved", 2);
}
void MP4MdhdAtom::Generate()
{
u_int8_t version = m_pFile->Use64Bits(GetType()) ? 1 : 0;
SetVersion(version);
AddProperties(version);
MP4Atom::Generate();
// set creation and modification times
MP4Timestamp now = MP4GetAbsTimestamp();
if (version == 1) {
((MP4Integer64Property*)m_pProperties[2])->SetValue(now);
((MP4Integer64Property*)m_pProperties[3])->SetValue(now);
} else {
((MP4Integer32Property*)m_pProperties[2])->SetValue(now);
((MP4Integer32Property*)m_pProperties[3])->SetValue(now);
}
}
void MP4MdhdAtom::Read()
{
/* read atom version */
ReadProperties(0, 1);
/* need to create the properties based on the atom version */
AddProperties(GetVersion());
/* now we can read the remaining properties */
ReadProperties(1);
Skip(); // to end of atom
}

View File

@ -0,0 +1,30 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MdiaAtom::MP4MdiaAtom()
: MP4Atom("mdia")
{
ExpectChildAtom("mdhd", Required, OnlyOne);
ExpectChildAtom("hdlr", Required, OnlyOne);
ExpectChildAtom("minf", Required, OnlyOne);
}

View File

@ -0,0 +1,117 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* M. Bakker mbakker at nero.com
*
* Apple iTunes META data
*/
#include "mp4common.h"
MP4Meta1Atom::MP4Meta1Atom(const char *name)
: MP4Atom(name)
{
AddVersionAndFlags(); /* 0, 1 */
AddProperty(new MP4BytesProperty("metadata")); /* 2 */
}
void MP4Meta1Atom::Read()
{
// calculate size of the metadata from the atom size
((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 4);
MP4Atom::Read();
}
MP4DataAtom::MP4DataAtom()
: MP4Atom("data")
{
AddVersionAndFlags(); /* 0, 1 */
AddReserved("reserved2", 4); /* 2 */
AddProperty(
new MP4BytesProperty("metadata")); /* 3 */
}
void MP4DataAtom::Read()
{
// calculate size of the metadata from the atom size
((MP4BytesProperty*)m_pProperties[3])->SetValueSize(m_size - 8);
MP4Atom::Read();
}
// MP4Meta2Atom is for \251nam and \251cmt flags, which appear differently
// in .mov and in itunes file. In .movs, they appear under udata, in
// itunes, they appear under ilst.
MP4Meta2Atom::MP4Meta2Atom (const char *name) : MP4Atom(name)
{
}
void MP4Meta2Atom::Read ()
{
MP4Atom *parent = GetParentAtom();
if (ATOMID(parent->GetType()) == ATOMID("udta")) {
// add data property
AddReserved("reserved2", 4); /* 0 */
AddProperty(
new MP4BytesProperty("metadata")); /* 1 */
((MP4BytesProperty*)m_pProperties[1])->SetValueSize(m_size - 4);
} else {
ExpectChildAtom("data", Required, OnlyOne);
}
MP4Atom::Read();
}
MP4Meta3Atom::MP4Meta3Atom (const char *name) : MP4Atom(name)
{
// add data property
AddReserved("reserved2", 4); /* 0 */
AddProperty(new MP4Integer16Property("language"));
MP4StringProperty *strProp = new MP4StringProperty("metadata");
strProp->SetUnicode(true);
AddProperty(strProp); /* 3 */
}
void MP4Meta3Atom::Read ()
{
MP4Atom::Read();
}
MP4Meta4Atom::MP4Meta4Atom (const char *name) : MP4Atom(name)
{
// add data property
AddReserved("reserved2", 4); /* 0 */
AddProperty(new MP4Integer16Property("metadata")); /* 1 */
}
void MP4Meta4Atom::Read ()
{
MP4Atom::Read();
}

View File

@ -0,0 +1,31 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MfhdAtom::MP4MfhdAtom()
: MP4Atom("mfhd")
{
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4Integer32Property("sequenceNumber"));
}

View File

@ -0,0 +1,33 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MinfAtom::MP4MinfAtom()
: MP4Atom("minf")
{
ExpectChildAtom("vmhd", Optional, OnlyOne);
ExpectChildAtom("smhd", Optional, OnlyOne);
ExpectChildAtom("hmhd", Optional, OnlyOne);
ExpectChildAtom("nmhd", Optional, OnlyOne);
ExpectChildAtom("dinf", Required, OnlyOne);
ExpectChildAtom("stbl", Required, OnlyOne);
}

View File

@ -0,0 +1,30 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MoofAtom::MP4MoofAtom()
: MP4Atom("moof")
{
ExpectChildAtom("mfhd", Required, OnlyOne);
ExpectChildAtom("traf", Optional, Many);
}

View File

@ -0,0 +1,33 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MoovAtom::MP4MoovAtom()
: MP4Atom("moov")
{
ExpectChildAtom("mvhd", Required, OnlyOne);
ExpectChildAtom("iods", Required, OnlyOne);
ExpectChildAtom("trak", Required, Many);
ExpectChildAtom("udta", Optional, Many);
ExpectChildAtom("mvex", Optional, OnlyOne);
}

View File

@ -0,0 +1,59 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4Mp4aAtom::MP4Mp4aAtom()
: MP4Atom("mp4a")
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddReserved("reserved2", 16); /* 2 */
AddProperty( /* 3 */
new MP4Integer16Property("timeScale"));
AddReserved("reserved3", 2); /* 4 */
ExpectChildAtom("esds", Required, OnlyOne);
}
void MP4Mp4aAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
// property reserved2 has non-zero fixed values
static u_int8_t reserved2[16] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00,
};
m_pProperties[2]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[2])->
SetValue(reserved2, sizeof(reserved2));
m_pProperties[2]->SetReadOnly(true);
}

View File

@ -0,0 +1,40 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4Mp4sAtom::MP4Mp4sAtom()
: MP4Atom("mp4s")
{
AddReserved("reserved1", 6);
AddProperty(
new MP4Integer16Property("dataReferenceIndex"));
ExpectChildAtom("esds", Required, OnlyOne);
}
void MP4Mp4sAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
}

View File

@ -0,0 +1,79 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4Mp4vAtom::MP4Mp4vAtom()
: MP4Atom("mp4v")
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddReserved("reserved2", 16); /* 2 */
AddProperty( /* 3 */
new MP4Integer16Property("width"));
AddProperty( /* 4 */
new MP4Integer16Property("height"));
AddReserved("reserved3", 14); /* 5 */
MP4StringProperty* pProp =
new MP4StringProperty("compressorName");
pProp->SetFixedLength(32);
pProp->SetValue("");
AddProperty(pProp); /* 6 */
AddReserved("reserved4", 4); /* 7 */
ExpectChildAtom("esds", Required, OnlyOne);
}
void MP4Mp4vAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
// property reserved3 has non-zero fixed values
static u_int8_t reserved3[14] = {
0x00, 0x48, 0x00, 0x00,
0x00, 0x48, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01,
};
m_pProperties[5]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[5])->
SetValue(reserved3, sizeof(reserved3));
m_pProperties[5]->SetReadOnly(true);
// property reserved4 has non-zero fixed values
static u_int8_t reserved4[4] = {
0x00, 0x18, 0xFF, 0xFF,
};
m_pProperties[7]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[7])->
SetValue(reserved4, sizeof(reserved4));
m_pProperties[7]->SetReadOnly(true);
}

View File

@ -0,0 +1,28 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MvexAtom::MP4MvexAtom()
: MP4Atom("mvex")
{
ExpectChildAtom("trex", Required, Many);
}

View File

@ -0,0 +1,136 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4MvhdAtom::MP4MvhdAtom()
: MP4Atom("mvhd")
{
AddVersionAndFlags();
}
void MP4MvhdAtom::AddProperties(u_int8_t version)
{
if (version == 1) {
AddProperty( /* 2 */
new MP4Integer64Property("creationTime"));
AddProperty( /* 3 */
new MP4Integer64Property("modificationTime"));
} else {
AddProperty( /* 2 */
new MP4Integer32Property("creationTime"));
AddProperty( /* 3 */
new MP4Integer32Property("modificationTime"));
}
AddProperty( /* 4 */
new MP4Integer32Property("timeScale"));
if (version == 1) {
AddProperty( /* 5 */
new MP4Integer64Property("duration"));
} else {
AddProperty( /* 5 */
new MP4Integer32Property("duration"));
}
MP4Float32Property* pProp;
pProp = new MP4Float32Property("rate");
pProp->SetFixed32Format();
AddProperty(pProp); /* 6 */
pProp = new MP4Float32Property("volume");
pProp->SetFixed16Format();
AddProperty(pProp); /* 7 */
AddReserved("reserved1", 70); /* 8 */
AddProperty( /* 9 */
new MP4Integer32Property("nextTrackId"));
}
void MP4MvhdAtom::Generate()
{
u_int8_t version = m_pFile->Use64Bits(GetType()) ? 1 : 0;
SetVersion(version);
AddProperties(version);
MP4Atom::Generate();
// set creation and modification times
MP4Timestamp now = MP4GetAbsTimestamp();
if (version == 1) {
((MP4Integer64Property*)m_pProperties[2])->SetValue(now);
((MP4Integer64Property*)m_pProperties[3])->SetValue(now);
} else {
((MP4Integer32Property*)m_pProperties[2])->SetValue(now);
((MP4Integer32Property*)m_pProperties[3])->SetValue(now);
}
((MP4Integer32Property*)m_pProperties[4])->SetValue(1000);
((MP4Float32Property*)m_pProperties[6])->SetValue(1.0);
((MP4Float32Property*)m_pProperties[7])->SetValue(1.0);
// property reserved has non-zero fixed values
static u_int8_t reserved[70] = {
0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
m_pProperties[8]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[8])->
SetValue(reserved, sizeof(reserved));
m_pProperties[8]->SetReadOnly(true);
// set next track id
((MP4Integer32Property*)m_pProperties[9])->SetValue(1);
}
void MP4MvhdAtom::Read()
{
/* read atom version */
ReadProperties(0, 1);
/* need to create the properties based on the atom version */
AddProperties(GetVersion());
/* now we can read the remaining properties */
ReadProperties(1);
Skip(); // to end of atom
}

View File

@ -0,0 +1,28 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4NmhdAtom::MP4NmhdAtom()
: MP4Atom("nmhd")
{
AddVersionAndFlags();
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4NumpAtom::MP4NumpAtom()
: MP4Atom("nump")
{
AddProperty( // packets sent
new MP4Integer64Property("packets"));
}

View File

@ -0,0 +1,92 @@
/** \file atom_ohdr.cpp
\author Danijel Kopcinovic (danijel.kopcinovic@adnecto.net)
*/
#include "mp4common.h"
/*! \brief Patch class for read/write operations when string is 0-length.
We want to use string property, but mpeg4ip doesn't support ohdr way of
encoding of string (in ohdr atom we first have 3 lengths of 3 strings and
then their string values, and it cannot be simulated with any of the
current mpeg4ip string property parameters), so we have to write our own
Read() and Write() routines.
*/
class OhdrMP4StringProperty: public MP4StringProperty {
public:
/*! \brief Constructor.
\param name name of the property.
\param useCountedFormat counted format flag.
\param useUnicode unicode flag.
*/
OhdrMP4StringProperty(char* name, bool useCountedFormat = false,
bool useUnicode = false): MP4StringProperty(name, useCountedFormat,
useUnicode) {
}
/*! \brief Read property from file.
\param pFile input, file handle.
\param index input, index to read.
*/
void Read(MP4File* pFile, u_int32_t index = 0) {
MP4Free(m_values[index]);
m_values[index] = (char*)MP4Calloc(m_fixedLength + 1);
(void)pFile->ReadBytes((u_int8_t*)m_values[index], m_fixedLength);
}
/*! \brief Write property to file.
\param pFile input, file handle.
\param index input, index to write.
*/
void Write(MP4File* pFile, u_int32_t index = 0) {
pFile->WriteBytes((u_int8_t*)m_values[index], m_fixedLength);
}
};
/*! \brief OMA DRM headers atom.
Contained in OMA DRM key management atom. It must contain content identifier.
*/
/*! \brief Constructor.
*/
MP4OhdrAtom::MP4OhdrAtom(): MP4Atom("ohdr") {
AddVersionAndFlags();
AddProperty(new MP4Integer8Property("EncryptionMethod"));
AddProperty(new MP4Integer8Property("EncryptionPadding"));
AddProperty(new MP4Integer64Property("PlaintextLength"));
AddProperty(new MP4Integer16Property("ContentIDLength"));
AddProperty(new MP4Integer16Property("RightsIssuerURLLength"));
AddProperty(new MP4Integer16Property("TextualHeadersLength"));
AddProperty(new OhdrMP4StringProperty("ContentID"));
AddProperty(new OhdrMP4StringProperty("RightsIssuerURL"));
AddProperty(new MP4BytesProperty("TextualHeaders"));
}
MP4OhdrAtom::~MP4OhdrAtom() {
}
/*! \brief Read atom.
*/
void MP4OhdrAtom::Read() {
ReadProperties(0, 8);
MP4Property* lProperty;
MP4Property* property;
lProperty = GetProperty(5);
property = GetProperty(8);
((OhdrMP4StringProperty*)property)->SetFixedLength(
((MP4Integer16Property*)lProperty)->GetValue());
lProperty = GetProperty(6);
property = GetProperty(9);
((OhdrMP4StringProperty*)property)->SetFixedLength(
((MP4Integer16Property*)lProperty)->GetValue());
lProperty = GetProperty(7);
property = GetProperty(10);
((MP4BytesProperty*)property)->SetFixedSize(
((MP4Integer16Property*)lProperty)->GetValue());
ReadProperties(8, 3);
}

View File

@ -0,0 +1,31 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4PaytAtom::MP4PaytAtom()
: MP4Atom("payt")
{
AddProperty(
new MP4Integer32Property("payloadNumber"));
AddProperty(
new MP4StringProperty("rtpMap", Counted));
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4PmaxAtom::MP4PmaxAtom()
: MP4Atom("pmax")
{
AddProperty( // max packet size
new MP4Integer32Property("bytes"));
}

View File

@ -0,0 +1,124 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4RootAtom::MP4RootAtom()
: MP4Atom(NULL)
{
ExpectChildAtom("moov", Required, OnlyOne);
ExpectChildAtom("ftyp", Optional, OnlyOne);
ExpectChildAtom("mdat", Optional, Many);
ExpectChildAtom("free", Optional, Many);
ExpectChildAtom("skip", Optional, Many);
ExpectChildAtom("udta", Optional, Many);
ExpectChildAtom("moof", Optional, Many);
}
void MP4RootAtom::BeginWrite(bool use64)
{
// only call under MP4Create() control
WriteAtomType("ftyp", OnlyOne);
m_pChildAtoms[GetLastMdatIndex()]->BeginWrite(m_pFile->Use64Bits("mdat"));
}
void MP4RootAtom::Write()
{
// no-op
}
void MP4RootAtom::FinishWrite(bool use64)
{
// finish writing last mdat atom
u_int32_t mdatIndex = GetLastMdatIndex();
m_pChildAtoms[mdatIndex]->FinishWrite(m_pFile->Use64Bits("mdat"));
// write all atoms after last mdat
u_int32_t size = m_pChildAtoms.Size();
for (u_int32_t i = mdatIndex + 1; i < size; i++) {
m_pChildAtoms[i]->Write();
}
}
void MP4RootAtom::BeginOptimalWrite()
{
WriteAtomType("ftyp", OnlyOne);
WriteAtomType("moov", OnlyOne);
WriteAtomType("udta", Many);
m_pChildAtoms[GetLastMdatIndex()]->BeginWrite(m_pFile->Use64Bits("mdat"));
}
void MP4RootAtom::FinishOptimalWrite()
{
// finish writing mdat
m_pChildAtoms[GetLastMdatIndex()]->FinishWrite(m_pFile->Use64Bits("mdat"));
// find moov atom
u_int32_t size = m_pChildAtoms.Size();
MP4Atom* pMoovAtom = NULL;
u_int32_t i;
for (i = 0; i < size; i++) {
if (!strcmp("moov", m_pChildAtoms[i]->GetType())) {
pMoovAtom = m_pChildAtoms[i];
break;
}
}
ASSERT(i < size);
ASSERT(pMoovAtom != NULL);
// rewrite moov so that updated chunkOffsets are written to disk
m_pFile->SetPosition(pMoovAtom->GetStart());
u_int64_t oldSize = pMoovAtom->GetSize();
pMoovAtom->Write();
// sanity check
u_int64_t newSize = pMoovAtom->GetSize();
ASSERT(oldSize == newSize);
}
u_int32_t MP4RootAtom::GetLastMdatIndex()
{
for (int32_t i = m_pChildAtoms.Size() - 1; i >= 0; i--) {
if (!strcmp("mdat", m_pChildAtoms[i]->GetType())) {
return i;
}
}
ASSERT(false);
return (u_int32_t)-1;
}
void MP4RootAtom::WriteAtomType(const char* type, bool onlyOne)
{
u_int32_t size = m_pChildAtoms.Size();
for (u_int32_t i = 0; i < size; i++) {
if (!strcmp(type, m_pChildAtoms[i]->GetType())) {
m_pChildAtoms[i]->Write();
if (onlyOne) {
break;
}
}
}
}

View File

@ -0,0 +1,148 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4RtpAtom::MP4RtpAtom()
: MP4Atom("rtp ")
{
// The atom type "rtp " is used in two complete unrelated ways
// i.e. it's real two atoms with the same name
// To handle that we need to postpone property creation until
// we know who our parent atom is (stsd or hnti) which gives us
// the context info we need to know who we are
}
void MP4RtpAtom::AddPropertiesStsdType()
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddProperty( /* 2 */
new MP4Integer16Property("hintTrackVersion"));
AddProperty( /* 3 */
new MP4Integer16Property("highestCompatibleVersion"));
AddProperty( /* 4 */
new MP4Integer32Property("maxPacketSize"));
ExpectChildAtom("tims", Required, OnlyOne);
ExpectChildAtom("tsro", Optional, OnlyOne);
ExpectChildAtom("snro", Optional, OnlyOne);
}
void MP4RtpAtom::AddPropertiesHntiType()
{
MP4StringProperty* pProp =
new MP4StringProperty("descriptionFormat");
pProp->SetFixedLength(4);
AddProperty(pProp); /* 0 */
AddProperty( /* 1 */
new MP4StringProperty("sdpText"));
}
void MP4RtpAtom::Generate()
{
if (!strcmp(m_pParentAtom->GetType(), "stsd")) {
AddPropertiesStsdType();
GenerateStsdType();
} else if (!strcmp(m_pParentAtom->GetType(), "hnti")) {
AddPropertiesHntiType();
GenerateHntiType();
} else {
VERBOSE_WARNING(m_pFile->GetVerbosity(),
printf("Warning: rtp atom in unexpected context, can not generate"));
}
}
void MP4RtpAtom::GenerateStsdType()
{
// generate children
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
((MP4Integer16Property*)m_pProperties[2])->SetValue(1);
((MP4Integer16Property*)m_pProperties[3])->SetValue(1);
}
void MP4RtpAtom::GenerateHntiType()
{
MP4Atom::Generate();
((MP4StringProperty*)m_pProperties[0])->SetValue("sdp ");
}
void MP4RtpAtom::Read()
{
if (!strcmp(m_pParentAtom->GetType(), "stsd")) {
AddPropertiesStsdType();
ReadStsdType();
} else if (!strcmp(m_pParentAtom->GetType(), "hnti")) {
AddPropertiesHntiType();
ReadHntiType();
} else {
VERBOSE_READ(m_pFile->GetVerbosity(),
printf("rtp atom in unexpected context, can not read"));
}
Skip(); // to end of atom
}
void MP4RtpAtom::ReadStsdType()
{
MP4Atom::Read();
}
void MP4RtpAtom::ReadHntiType()
{
ReadProperties(0, 1);
// read sdp string, length is implicit in size of atom
u_int64_t size = GetEnd() - m_pFile->GetPosition();
char* data = (char*)MP4Malloc(size + 1);
ASSERT(data != NULL);
m_pFile->ReadBytes((u_int8_t*)data, size);
data[size] = '\0';
((MP4StringProperty*)m_pProperties[1])->SetValue(data);
MP4Free(data);
}
void MP4RtpAtom::Write()
{
if (!strcmp(m_pParentAtom->GetType(), "hnti")) {
WriteHntiType();
} else {
MP4Atom::Write();
}
}
void MP4RtpAtom::WriteHntiType()
{
// since length of string is implicit in size of atom
// we need to handle this specially, and not write the terminating \0
MP4StringProperty* pSdp = (MP4StringProperty*)m_pProperties[1];
pSdp->SetFixedLength((u_int32_t)strlen(pSdp->GetValue()));
MP4Atom::Write();
pSdp->SetFixedLength(0);
}

View File

@ -0,0 +1,78 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
* and was contributed by Ximpo Group Ltd.
*
* Portions created by Ximpo Group Ltd. are
* Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
*
* Contributor(s):
* Ximpo Group Ltd. mp4v2@ximpo.com
*/
#include "mp4common.h"
MP4S263Atom::MP4S263Atom()
: MP4Atom("s263")
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddReserved("reserved2", 16); /* 2 */
AddProperty( /* 3 */
new MP4Integer16Property("width"));
AddProperty( /* 4 */
new MP4Integer16Property("height"));
AddReserved("reserved3", 50); /* 5 */
ExpectChildAtom("d263", Required, OnlyOne);
}
void MP4S263Atom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
// property reserved2 has non-zero fixed values
static u_int8_t reserved3[50] = {
0x00, 0x48, 0x00, 0x00,
0x00, 0x48, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x24,
0xFF, 0xFF
};
m_pProperties[5]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[5])->
SetValue(reserved3, sizeof(reserved3));
m_pProperties[5]->SetReadOnly(true);
}

View File

@ -0,0 +1,33 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Alix Marchandise-Franquet alix@cisco.com
*
* SchemeInformationBox for ISMACrypt
*/
#include "mp4common.h"
MP4SchiAtom::MP4SchiAtom()
: MP4Atom("schi")
{
// not sure if this is child atoms or table of boxes
// get clarification on spec 9.1.2.5
ExpectChildAtom("iKMS", Required, OnlyOne);
ExpectChildAtom("iSFM", Required, OnlyOne);
}

View File

@ -0,0 +1,35 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Alix Marchandise-Franquet alix@cisco.com
*
* Add the SchemeTypeBox for ISMACrypt
*/
#include "mp4common.h"
MP4SchmAtom::MP4SchmAtom()
: MP4Atom("schm")
{
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4Integer32Property("scheme_type"));
AddProperty( /* 3 */
new MP4Integer32Property("scheme_version"));
// browser URI if flags set, TODO
}

View File

@ -0,0 +1,54 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4SdpAtom::MP4SdpAtom() : MP4Atom("sdp ")
{
AddProperty(
new MP4StringProperty("sdpText"));
}
void MP4SdpAtom::Read()
{
// read sdp string, length is implicit in size of atom
u_int64_t size = GetEnd() - m_pFile->GetPosition();
char* data = (char*)MP4Malloc(size + 1);
ASSERT(data != NULL);
m_pFile->ReadBytes((u_int8_t*)data, size);
data[size] = '\0';
((MP4StringProperty*)m_pProperties[0])->SetValue(data);
MP4Free(data);
}
void MP4SdpAtom::Write()
{
// since length of string is implicit in size of atom
// we need to handle this specially, and not write the terminating \0
MP4StringProperty* pSdp = (MP4StringProperty*)m_pProperties[0];
const char* sdpText = pSdp->GetValue();
if (sdpText) {
pSdp->SetFixedLength((u_int32_t)strlen(sdpText));
}
MP4Atom::Write();
pSdp->SetFixedLength(0);
}

View File

@ -0,0 +1,33 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
* Alix Marchandise-Franquet alix@cisco.com
*
* Add the ProtectionInfoBox for ISMACrypt
*/
#include "mp4common.h"
MP4SinfAtom::MP4SinfAtom()
: MP4Atom("sinf")
{
ExpectChildAtom("frma", Required, OnlyOne);
ExpectChildAtom("schm", Required, OnlyOne);
ExpectChildAtom("schi", Required, OnlyOne);
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4SmhdAtom::MP4SmhdAtom()
: MP4Atom("smhd")
{
AddVersionAndFlags();
AddReserved("reserved", 4);
}

View File

@ -0,0 +1,41 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved.
*
* Contributor(s):
* Bill May wmay@cisco.com
*
* Apple iTunes META data
*/
#include "mp4common.h"
MP4SmiAtom::MP4SmiAtom()
: MP4Atom("meta")
{
AddProperty( new MP4BytesProperty("metadata"));
}
void MP4SmiAtom::Read()
{
// calculate size of the metadata from the atom size
((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size);
MP4Atom::Read();
}

View File

@ -0,0 +1,30 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4SnroAtom::MP4SnroAtom()
: MP4Atom("snro")
{
AddProperty(
new MP4Integer32Property("offset"));
}

View File

@ -0,0 +1,125 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved.
*
* Contributor(s):
* Bill May wmay@cisco.com
*/
#include "mp4common.h"
MP4SoundAtom::MP4SoundAtom(const char *atomid)
: MP4Atom(atomid)
{
AddReserved("reserved1", 6); /* 0 */
AddProperty( /* 1 */
new MP4Integer16Property("dataReferenceIndex"));
AddProperty( /* 2 */
new MP4Integer16Property("soundVersion"));
AddReserved( "reserved2", 6); /* 3 */
AddProperty( /* 4 */
new MP4Integer16Property("channels"));
AddProperty( /* 5 */
new MP4Integer16Property("sampleSize"));
AddProperty( /* 6 */
new MP4Integer16Property("packetSize"));
AddProperty( /* 7 */
new MP4Integer32Property("timeScale"));
if (ATOMID(atomid) == ATOMID("mp4a")) {
AddReserved("reserved3", 2); /* 8 */
ExpectChildAtom("esds", Required, OnlyOne);
ExpectChildAtom("wave", Optional, OnlyOne);
} else if (ATOMID(atomid) == ATOMID("alac")) {
AddReserved("reserved3", 2); /* 8 */
ExpectChildAtom("alac", Optional, Optional);
//AddProperty( new MP4BytesProperty("alacInfo", 36));
}
}
void MP4SoundAtom::AddProperties (uint8_t version)
{
if (version > 0) {
AddProperty( /* 8 */
new MP4Integer32Property("samplesPerPacket"));
AddProperty( /* 9 */
new MP4Integer32Property("bytesPerPacket"));
AddProperty( /* 10 */
new MP4Integer32Property("bytesPerFrame"));
AddProperty( /* 11 */
new MP4Integer32Property("bytesPerSample"));
}
if (version == 2) {
AddReserved("reserved4", 20);
}
}
void MP4SoundAtom::Generate()
{
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
// property reserved2 has non-zero fixed values
((MP4Integer16Property*)m_pProperties[2])->SetValue(0);
static const u_int8_t reserved2[6] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
};
m_pProperties[3]->SetReadOnly(false);
((MP4BytesProperty*)m_pProperties[3])->
SetValue(reserved2, sizeof(reserved2));
m_pProperties[3]->SetReadOnly(true);
((MP4Integer16Property*)m_pProperties[4])->SetValue(2);
((MP4Integer16Property*)m_pProperties[5])->SetValue(0x0010);
((MP4Integer16Property*)m_pProperties[6])->SetValue(0);
}
void MP4SoundAtom::Read()
{
MP4Atom *parent = GetParentAtom();
if (ATOMID(parent->GetType()) != ATOMID("stsd")) {
// Quicktime has an interesting thing - they'll put an mp4a atom
// which is blank inside a wave atom, which is inside an mp4a atom
// we have a mp4a inside an wave inside an mp4a - delete all properties
m_pProperties.Delete(8);
m_pProperties.Delete(7);
m_pProperties.Delete(6);
m_pProperties.Delete(5);
m_pProperties.Delete(4);
m_pProperties.Delete(3);
m_pProperties.Delete(2);
m_pProperties.Delete(1);
m_pProperties.Delete(0);
if (ATOMID(GetType()) == ATOMID("alac")) {
AddProperty(new MP4BytesProperty("decoderConfig", m_size));
ReadProperties();
}
if (m_pChildAtomInfos.Size() > 0) {
ReadChildAtoms();
}
} else {
ReadProperties(0, 3); // read first 3 properties
AddProperties(((MP4IntegerProperty *)m_pProperties[2])->GetValue());
ReadProperties(3); // continue
if (m_pChildAtomInfos.Size() > 0) {
ReadChildAtoms();
}
}
Skip();
}

View File

@ -0,0 +1,466 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2004. All Rights Reserved.
*
* Contributor(s):
* Bill May (from others work).
*/
#include "mp4common.h"
#include "atoms.h"
static const char name[5]={'\xA9','n', 'a', 'm', '\0'};
static const char art[5]={'\xA9','A', 'R', 'T', '\0'};
static const char wrt[5]={'\xA9','w', 'r', 't', '\0'};
static const char alb[5]={'\xA9','a', 'l', 'b', '\0'};
static const char day[5]={'\xA9','d', 'a', 'y', '\0'};
static const char too[5]={'\xA9','t', 'o', 'o', '\0'};
static const char cmt[5]={'\xA9','c', 'm', 't', '\0'};
static const char gen[5]={'\xA9','g', 'e', 'n', '\0'};
static const char grp[5]={'\xA9','g', 'r', 'p', '\0'};
MP4StandardAtom::MP4StandardAtom (const char *type) : MP4Atom(type)
{
/*
* This is a big if else loop. Make sure that you don't break it
* when adding new atoms, or you will set the unknown type flag
*
* Try to keep it in alphabetical order - it should only be called
* 1 time per atom, so it's not that urgent.
*/
if (ATOMID(type) == ATOMID("aART") ||
ATOMID(type) == ATOMID("akID") ||
ATOMID(type) == ATOMID("apID") ||
ATOMID(type) == ATOMID("atID")) {
ExpectChildAtom("data", Required, OnlyOne);
/*
* b???
*/
} else if (ATOMID(type) == ATOMID("bitr")) {
AddProperty( /* 0 */
new MP4Integer32Property("avgBitrate"));
AddProperty( /* 1 */
new MP4Integer32Property("maxBitrate"));
} else if (ATOMID(type) == ATOMID("btrt")) {
AddProperty( new MP4Integer32Property("bufferSizeDB")); /* 0 */
AddProperty( new MP4Integer32Property("avgBitrate")); /* 1 */
AddProperty( new MP4Integer32Property("maxBitrate")); /* 2 */
} else if (ATOMID(type) == ATOMID("burl")) {
AddProperty( new MP4StringProperty("base_url"));
/*
* c???
*/
} else if (ATOMID(type) == ATOMID("co64")) {
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(
new MP4Integer64Property("chunkOffset"));
} else if (ATOMID(type) == ATOMID("cpil")) {
ExpectChildAtom("data", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("covr")) { /* Apple iTunes */
ExpectChildAtom("data", Required, Many);
} else if (ATOMID(type) == ATOMID("cprt") ||
ATOMID(type) == ATOMID("cnID")) {
#if 0
AddVersionAndFlags();
AddProperty(
new MP4Integer16Property("language"));
AddProperty(
new MP4StringProperty("notice"));
#else
ExpectChildAtom("data", Required, OnlyOne);
#endif
} else if (ATOMID(type) == ATOMID("ctts")) {
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(new MP4Integer32Property("sampleCount"));
pTable->AddProperty(new MP4Integer32Property("sampleOffset"));
/*
* d???
*/
} else if (ATOMID(type) == ATOMID("dinf")) {
ExpectChildAtom("dref", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("dimm")) {
AddProperty( // bytes of immediate data
new MP4Integer64Property("bytes"));
} else if (ATOMID(type) == ATOMID("disk")) { /* Apple iTunes */
ExpectChildAtom("data", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("dmax")) {
AddProperty( // max packet duration
new MP4Integer32Property("milliSecs"));
} else if (ATOMID(type) == ATOMID("dmed")) {
AddProperty( // bytes sent from media data
new MP4Integer64Property("bytes"));
} else if (ATOMID(type) == ATOMID("drep")) {
AddProperty( // bytes of repeated data
new MP4Integer64Property("bytes"));
/*
* e???
*/
} else if (ATOMID(type) == ATOMID("edts")) {
ExpectChildAtom("elst", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("esds")) {
AddVersionAndFlags();
AddProperty(
new MP4DescriptorProperty(NULL, MP4ESDescrTag, 0,
Required, OnlyOne));
/*
* f???
*/
} else if (ATOMID(type) == ATOMID("frma")) {
AddProperty( /* 0 */
new MP4Integer32Property("data-format"));
/*
* g???
*/
} else if (ATOMID(type) == ATOMID("gmhd")) {
ExpectChildAtom("gmin", Required, OnlyOne);
ExpectChildAtom("tmcd", Optional, OnlyOne);
ExpectChildAtom("text", Optional, OnlyOne);
} else if (ATOMID(type) == ATOMID("gnre") ||
ATOMID(type) == ATOMID("geID")) { // Apple iTunes
ExpectChildAtom("data", Optional, OnlyOne);
/*
* h???
*/
} else if (ATOMID(type) == ATOMID("hmhd")) {
AddVersionAndFlags();
AddProperty(new MP4Integer16Property("maxPduSize"));
AddProperty(new MP4Integer16Property("avgPduSize"));
AddProperty(new MP4Integer32Property("maxBitRate"));
AddProperty(new MP4Integer32Property("avgBitRate"));
AddProperty(new MP4Integer32Property("slidingAvgBitRate"));
/*
* i???
*/
} else if (ATOMID(type) == ATOMID("iKMS")) {
AddVersionAndFlags(); /* 0, 1 */
MP4StringProperty* pProp = new MP4StringProperty("kms_URI");
AddProperty(pProp); /* 2 */
} else if (ATOMID(type) == ATOMID("iSFM")) {
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4BitfieldProperty("selective-encryption", 1));
AddProperty( /* 3 */
new MP4BitfieldProperty("reserved", 7));
AddProperty( /* 4 */
new MP4Integer8Property("key-indicator-length"));
AddProperty( /* 5 */
new MP4Integer8Property("IV-length"));
} else if (ATOMID(type) == ATOMID("ilst")) {
ExpectChildAtom("\251nam", Optional, OnlyOne); /* name */
ExpectChildAtom("\251ART", Optional, OnlyOne); /* artist */
ExpectChildAtom("\251wrt", Optional, OnlyOne); /* writer */
ExpectChildAtom("\251alb", Optional, OnlyOne); /* album */
ExpectChildAtom("\251day", Optional, OnlyOne); /* date */
ExpectChildAtom("\251too", Optional, OnlyOne); /* tool */
ExpectChildAtom("\251cmt", Optional, OnlyOne); /* comment */
ExpectChildAtom("\251gen", Optional, OnlyOne); /* custom genre */
ExpectChildAtom("trkn", Optional, OnlyOne); /* tracknumber */
ExpectChildAtom("disk", Optional, OnlyOne); /* disknumber */
ExpectChildAtom("gnre", Optional, OnlyOne); /* genre (ID3v1 index + 1) */
ExpectChildAtom("cpil", Optional, OnlyOne); /* compilation */
ExpectChildAtom("tmpo", Optional, OnlyOne); /* BPM */
ExpectChildAtom("covr", Optional, OnlyOne); /* cover art */
ExpectChildAtom("aART", Optional, OnlyOne); /* album artist */
ExpectChildAtom("----", Optional, Many); /* ---- free form */
ExpectChildAtom("pgap", Optional, OnlyOne); /* part of gapless album */
ExpectChildAtom("rate", Optional, OnlyOne); /* rating 0-100 */
} else if (ATOMID(type) == ATOMID("imif")) {
AddVersionAndFlags();
AddProperty(new MP4DescriptorProperty("ipmp_desc", MP4IPMPDescrTag,
MP4IPMPDescrTag, Required, Many));
} else if (ATOMID(type) == ATOMID("iods")) {
AddVersionAndFlags();
AddProperty(
new MP4DescriptorProperty(NULL, MP4FileIODescrTag,
MP4FileODescrTag,
Required, OnlyOne));
/*
* m???
*/
} else if (ATOMID(type) == ATOMID("maxr")) {
AddProperty(new MP4Integer32Property("granularity"));
AddProperty(new MP4Integer32Property("bytes"));
} else if (ATOMID(type) == ATOMID("mdia")) {
ExpectChildAtom("mdhd", Required, OnlyOne);
ExpectChildAtom("hdlr", Required, OnlyOne);
ExpectChildAtom("minf", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("meta")) { // iTunes
AddVersionAndFlags(); /* 0, 1 */
ExpectChildAtom("hdlr", Required, OnlyOne);
ExpectChildAtom("ilst", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("mfhd")) {
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4Integer32Property("sequenceNumber"));
} else if (ATOMID(type) == ATOMID("minf")) {
ExpectChildAtom("vmhd", Optional, OnlyOne);
ExpectChildAtom("smhd", Optional, OnlyOne);
ExpectChildAtom("hmhd", Optional, OnlyOne);
ExpectChildAtom("nmhd", Optional, OnlyOne);
ExpectChildAtom("gmhd", Optional, OnlyOne);
ExpectChildAtom("dinf", Required, OnlyOne);
ExpectChildAtom("stbl", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("moof")) {
ExpectChildAtom("mfhd", Required, OnlyOne);
ExpectChildAtom("traf", Optional, Many);
} else if (ATOMID(type) == ATOMID("moov")) {
ExpectChildAtom("mvhd", Required, OnlyOne);
ExpectChildAtom("iods", Optional, OnlyOne);
ExpectChildAtom("trak", Required, Many);
ExpectChildAtom("udta", Optional, Many);
ExpectChildAtom("mvex", Optional, OnlyOne);
} else if (ATOMID(type) == ATOMID("mvex")) {
ExpectChildAtom("trex", Required, Many);
/*
* n???
*/
} else if (ATOMID(type) == ATOMID("nmhd")) {
AddVersionAndFlags();
} else if (ATOMID(type) == ATOMID("nump")) {
AddProperty( // packets sent
new MP4Integer64Property("packets"));
/*
* o???
*/
} else if (ATOMID(type) == ATOMID("odkm")) {
AddVersionAndFlags();
ExpectChildAtom("ohdr", Required, OnlyOne);
/*
* p???
*/
} else if (ATOMID(type) == ATOMID("payt")) {
AddProperty(new MP4Integer32Property("payloadNumber"));
AddProperty(new MP4StringProperty("rtpMap", Counted));
} else if (ATOMID(type) == ATOMID("pinf")) {
ExpectChildAtom("frma", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("pmax")) {
AddProperty( // max packet size
new MP4Integer32Property("bytes"));
} else if (ATOMID(type) == ATOMID("pgap") ||
ATOMID(type) == ATOMID("plID") ||
ATOMID(type) == ATOMID("purd") ||
ATOMID(type) == ATOMID("rtng")) {
ExpectChildAtom("data", Required, OnlyOne);
/*
* s???
*/
} else if (ATOMID(type) == ATOMID("schi")) {
// not sure if this is child atoms or table of boxes
// get clarification on spec 9.1.2.5
ExpectChildAtom("odkm", Optional, OnlyOne);
ExpectChildAtom("iKMS", Optional, OnlyOne);
ExpectChildAtom("iSFM", Optional, OnlyOne);
} else if (ATOMID(type) == ATOMID("schm")) {
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4Integer32Property("scheme_type"));
AddProperty( /* 3 */
new MP4Integer32Property("scheme_version"));
// browser URI if flags set, TODO
} else if (ATOMID(type) == ATOMID("sinf")) {
ExpectChildAtom("frma", Required, OnlyOne);
ExpectChildAtom("imif", Optional, OnlyOne);
ExpectChildAtom("schm", Optional, OnlyOne);
ExpectChildAtom("schi", Optional, OnlyOne);
} else if (ATOMID(type) == ATOMID("smhd")) {
AddVersionAndFlags();
AddReserved("reserved", 4);
} else if (ATOMID(type) == ATOMID("snro")) {
AddProperty(new MP4Integer32Property("offset"));
} else if (ATOMID(type) == ATOMID("stco")) {
AddVersionAndFlags();
MP4Integer32Property* pCount = new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(new MP4Integer32Property("chunkOffset"));
} else if (ATOMID(type) == ATOMID("stsh")) {
AddVersionAndFlags();
MP4Integer32Property* pCount = new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(new MP4Integer32Property("shadowedSampleNumber"));
pTable->AddProperty(new MP4Integer32Property("syncSampleNumber"));
} else if (ATOMID(type) == ATOMID("stss")) {
AddVersionAndFlags();
MP4Integer32Property* pCount = new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(new MP4Integer32Property("sampleNumber"));
} else if (ATOMID(type) == ATOMID("stts")) {
AddVersionAndFlags();
MP4Integer32Property* pCount = new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(new MP4Integer32Property("sampleCount"));
pTable->AddProperty(new MP4Integer32Property("sampleDelta"));
} else if (ATOMID(type) == ATOMID("sfID") ||
ATOMID(type) == ATOMID("stik")) {
ExpectChildAtom("data", Required, OnlyOne);
/*
* t???
*/
} else if (ATOMID(type) == ATOMID("tims")) {
AddProperty(
new MP4Integer32Property("timeScale"));
} else if (ATOMID(type) == ATOMID("tmin")) {
AddProperty( // min relative xmit time
new MP4Integer32Property("milliSecs"));
} else if (ATOMID(type) == ATOMID("tmax")) {
AddProperty( // max relative xmit time
new MP4Integer32Property("milliSecs"));
} else if (ATOMID(type) == ATOMID("tmpo")) { // iTunes
ExpectChildAtom("data", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("traf")) {
ExpectChildAtom("tfhd", Required, OnlyOne);
ExpectChildAtom("trun", Optional, Many);
} else if (ATOMID(type) == ATOMID("trak")) {
ExpectChildAtom("tkhd", Required, OnlyOne);
ExpectChildAtom("tref", Optional, OnlyOne);
ExpectChildAtom("edts", Optional, OnlyOne);
ExpectChildAtom("mdia", Required, OnlyOne);
ExpectChildAtom("udta", Optional, Many);
} else if (ATOMID(type) == ATOMID("tref")) {
ExpectChildAtom("chap", Optional, OnlyOne);
ExpectChildAtom("dpnd", Optional, OnlyOne);
ExpectChildAtom("hint", Optional, OnlyOne);
ExpectChildAtom("ipir", Optional, OnlyOne);
ExpectChildAtom("mpod", Optional, OnlyOne);
ExpectChildAtom("sync", Optional, OnlyOne);
} else if (ATOMID(type) == ATOMID("trex")) {
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4Integer32Property("trackId"));
AddProperty( /* 3 */
new MP4Integer32Property("defaultSampleDesriptionIndex"));
AddProperty( /* 4 */
new MP4Integer32Property("defaultSampleDuration"));
AddProperty( /* 5 */
new MP4Integer32Property("defaultSampleSize"));
AddProperty( /* 6 */
new MP4Integer32Property("defaultSampleFlags"));
} else if (ATOMID(type) == ATOMID("rate")) {
ExpectChildAtom("data", Optional, OnlyOne);
} else if (ATOMID(type) == ATOMID("trkn")) { // iTunes
ExpectChildAtom("data", Required, OnlyOne);
} else if (ATOMID(type) == ATOMID("trpy") ||
ATOMID(type) == ATOMID("tpyl")) {
AddProperty( // bytes sent including RTP headers
new MP4Integer64Property("bytes"));
} else if (ATOMID(type) == ATOMID("tsro")) {
AddProperty(
new MP4Integer32Property("offset"));
} else if (ATOMID(type) == ATOMID("wave")) {
ExpectChildAtom("esds", Required, OnlyOne);
/*
* copyright???
*/
} else if (ATOMID(type) == ATOMID(art) ||
ATOMID(type) == ATOMID(wrt) ||
ATOMID(type) == ATOMID(alb) ||
ATOMID(type) == ATOMID(day) ||
ATOMID(type) == ATOMID(too) ||
ATOMID(type) == ATOMID(gen) ||
ATOMID(type) == ATOMID(grp)) { /* Apple iTunes */
ExpectChildAtom("data", Required, OnlyOne);
/*
* ----
*/
} else if (ATOMID(type) == ATOMID("----")) { /* Apple iTunes */
ExpectChildAtom("mean", Required, OnlyOne);
ExpectChildAtom("name", Required, OnlyOne);
ExpectChildAtom("data", Required, OnlyOne);
} else {
/*
* default - unknown type
*/
SetUnknownType(true);
}
}

View File

@ -0,0 +1,58 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4StblAtom::MP4StblAtom()
: MP4Atom("stbl")
{
ExpectChildAtom("stsd", Required, OnlyOne);
ExpectChildAtom("stts", Required, OnlyOne);
ExpectChildAtom("ctts", Optional, OnlyOne);
ExpectChildAtom("stsz", Required, OnlyOne);
ExpectChildAtom("stz2", Optional, OnlyOne);
ExpectChildAtom("stsc", Required, OnlyOne);
ExpectChildAtom("stco", Optional, OnlyOne);
ExpectChildAtom("co64", Optional, OnlyOne);
ExpectChildAtom("stss", Optional, OnlyOne);
ExpectChildAtom("stsh", Optional, OnlyOne);
ExpectChildAtom("stdp", Optional, OnlyOne);
}
void MP4StblAtom::Generate()
{
// as usual
MP4Atom::Generate();
// but we also need one of the chunk offset atoms
MP4Atom* pChunkOffsetAtom;
if (m_pFile->Use64Bits(GetType())) {
pChunkOffsetAtom = CreateAtom("co64");
} else {
pChunkOffsetAtom = CreateAtom("stco");
}
AddChildAtom(pChunkOffsetAtom);
// and ask it to self generate
pChunkOffsetAtom->Generate();
}

View File

@ -0,0 +1,38 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4StcoAtom::MP4StcoAtom()
: MP4Atom("stco")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(
new MP4Integer32Property("chunkOffset"));
}

View File

@ -0,0 +1,49 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4StdpAtom::MP4StdpAtom()
: MP4Atom("stdp")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
pCount->SetImplicit();
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(
new MP4Integer16Property("priority"));
}
void MP4StdpAtom::Read()
{
// table entry count computed from atom size
((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(false);
((MP4Integer32Property*)m_pProperties[2])->SetValue((m_size - 4) / 2);
((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(true);
MP4Atom::Read();
}

View File

@ -0,0 +1,78 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4StscAtom::MP4StscAtom()
: MP4Atom("stsc")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(
new MP4Integer32Property("firstChunk"));
pTable->AddProperty(
new MP4Integer32Property("samplesPerChunk"));
pTable->AddProperty(
new MP4Integer32Property("sampleDescriptionIndex"));
// As an optimization we add an implicit property to this table,
// "firstSample" that corresponds to the first sample of the firstChunk
MP4Integer32Property* pSample =
new MP4Integer32Property("firstSample");
pSample->SetImplicit();
pTable->AddProperty(pSample);
}
void MP4StscAtom::Read()
{
// Read as usual
MP4Atom::Read();
// Compute the firstSample values for later use
u_int32_t count =
((MP4Integer32Property*)m_pProperties[2])->GetValue();
MP4Integer32Property* pFirstChunk = (MP4Integer32Property*)
((MP4TableProperty*)m_pProperties[3])->GetProperty(0);
MP4Integer32Property* pSamplesPerChunk = (MP4Integer32Property*)
((MP4TableProperty*)m_pProperties[3])->GetProperty(1);
MP4Integer32Property* pFirstSample = (MP4Integer32Property*)
((MP4TableProperty*)m_pProperties[3])->GetProperty(3);
MP4SampleId sampleId = 1;
for (u_int32_t i = 0; i < count; i++) {
pFirstSample->SetValue(sampleId, i);
if (i < count - 1) {
sampleId +=
(pFirstChunk->GetValue(i+1) - pFirstChunk->GetValue(i))
* pSamplesPerChunk->GetValue(i);
}
}
}

View File

@ -0,0 +1,74 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001 - 2004. All Rights Reserved.
*
* 3GPP features implementation is based on 3GPP's TS26.234-v5.60,
* and was contributed by Ximpo Group Ltd.
*
* Portions created by Ximpo Group Ltd. are
* Copyright (C) Ximpo Group Ltd. 2003, 2004. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
* Alix Marchandise-Franquet alix@cisco.com
* Ximpo Group Ltd. mp4v2@ximpo.com
*/
#include "mp4common.h"
MP4StsdAtom::MP4StsdAtom()
: MP4Atom("stsd")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
pCount->SetReadOnly();
AddProperty(pCount);
ExpectChildAtom("mp4a", Optional, Many);
ExpectChildAtom("enca", Optional, Many);
ExpectChildAtom("mp4s", Optional, Many);
ExpectChildAtom("mp4v", Optional, Many);
ExpectChildAtom("encv", Optional, Many);
ExpectChildAtom("rtp ", Optional, Many);
ExpectChildAtom("samr", Optional, Many); // For AMR-NB
ExpectChildAtom("sawb", Optional, Many); // For AMR-WB
ExpectChildAtom("s263", Optional, Many); // For H.263
ExpectChildAtom("avc1", Optional, Many);
ExpectChildAtom("alac", Optional, Many);
ExpectChildAtom("text", Optional, Many);
}
void MP4StsdAtom::Read()
{
/* do the usual read */
MP4Atom::Read();
// check that number of children == entryCount
MP4Integer32Property* pCount =
(MP4Integer32Property*)m_pProperties[2];
if (m_pChildAtoms.Size() != pCount->GetValue()) {
VERBOSE_READ(GetVerbosity(),
printf("Warning: stsd inconsistency with number of entries"));
/* fix it */
pCount->SetReadOnly(false);
pCount->SetValue(m_pChildAtoms.Size());
pCount->SetReadOnly(true);
}
}

View File

@ -0,0 +1,40 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4StshAtom::MP4StshAtom()
: MP4Atom("stsh")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(
new MP4Integer32Property("shadowedSampleNumber"));
pTable->AddProperty(
new MP4Integer32Property("syncSampleNumber"));
}

View File

@ -0,0 +1,38 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4StssAtom::MP4StssAtom()
: MP4Atom("stss")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(
new MP4Integer32Property("sampleNumber"));
}

View File

@ -0,0 +1,69 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4StszAtom::MP4StszAtom()
: MP4Atom("stsz")
{
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4Integer32Property("sampleSize"));
MP4Integer32Property* pCount =
new MP4Integer32Property("sampleCount");
AddProperty(pCount); /* 3 */
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable); /* 4 */
pTable->AddProperty( /* 4/0 */
new MP4Integer32Property("entrySize"));
}
void MP4StszAtom::Read()
{
ReadProperties(0, 4);
u_int32_t sampleSize =
((MP4Integer32Property*)m_pProperties[2])->GetValue();
// only attempt to read entries table if sampleSize is zero
// i.e sample size is not constant
m_pProperties[4]->SetImplicit(sampleSize != 0);
ReadProperties(4);
Skip(); // to end of atom
}
void MP4StszAtom::Write()
{
u_int32_t sampleSize =
((MP4Integer32Property*)m_pProperties[2])->GetValue();
// only attempt to write entries table if sampleSize is zero
// i.e sample size is not constant
m_pProperties[4]->SetImplicit(sampleSize != 0);
MP4Atom::Write();
}

View File

@ -0,0 +1,40 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4SttsAtom::MP4SttsAtom()
: MP4Atom("stts")
{
AddVersionAndFlags();
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
AddProperty(pCount);
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable);
pTable->AddProperty(
new MP4Integer32Property("sampleCount"));
pTable->AddProperty(
new MP4Integer32Property("sampleDelta"));
}

View File

@ -0,0 +1,95 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
/*
* This is used for the 4 bit sample size below. We need the sampleCount
* to be correct for the number of samples, but the table size needs to
* be correct to read and write it.
*/
class MP4HalfSizeTableProperty : public MP4TableProperty
{
public:
MP4HalfSizeTableProperty(char *name, MP4IntegerProperty *pCountProperty) :
MP4TableProperty(name, pCountProperty) {};
// The count is half the actual size
u_int32_t GetCount() {
return (m_pCountProperty->GetValue() + 1)/ 2;
};
void SetCount(u_int32_t count) {
m_pCountProperty->SetValue(count * 2);
};
};
MP4Stz2Atom::MP4Stz2Atom()
: MP4Atom("stz2")
{
AddVersionAndFlags(); /* 0, 1 */
AddReserved("reserved", 3); /* 2 */
AddProperty( /* 3 */
new MP4Integer8Property("fieldSize"));
MP4Integer32Property* pCount =
new MP4Integer32Property("sampleCount");
AddProperty(pCount); /* 4 */
}
void MP4Stz2Atom::Read()
{
ReadProperties(0, 4);
uint8_t fieldSize =
((MP4Integer8Property *)m_pProperties[3])->GetValue();
// uint32_t sampleCount = 0;
MP4Integer32Property* pCount =
(MP4Integer32Property *)m_pProperties[4];
MP4TableProperty *pTable;
if (fieldSize != 4) {
pTable = new MP4TableProperty("entries", pCount);
} else {
// 4 bit field size uses a special table.
pTable = new MP4HalfSizeTableProperty("entries", pCount);
}
AddProperty(pTable);
if (fieldSize == 16) {
pTable->AddProperty( /* 5/0 */
new MP4Integer16Property("entrySize"));
} else {
pTable->AddProperty( /* 5/0 */
new MP4Integer8Property("entrySize"));
}
ReadProperties(4);
Skip(); // to end of atom
}

View File

@ -0,0 +1,128 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* Contributer has declined to give copyright information, and gives
* it freely to the world.
*/
#include "mp4common.h"
MP4TextAtom::MP4TextAtom()
: MP4Atom("text")
{
// The atom type "text" is used in two complete unrelated ways
// i.e. it's real two atoms with the same name
// To handle that we need to postpone property creation until
// we know who our parent atom is (stsd or gmhd) which gives us
// the context info we need to know who we are
}
void MP4TextAtom::AddPropertiesStsdType()
{
AddReserved("reserved1", 6); /* 0 */
AddProperty(new MP4Integer16Property("dataReferenceIndex"));/* 1 */
AddProperty(new MP4Integer32Property("displayFlags")); /* 2 */
AddProperty(new MP4Integer32Property("textJustification")); /* 3 */
AddProperty(new MP4Integer16Property("bgColorRed")); /* 4 */
AddProperty(new MP4Integer16Property("bgColorGreen")); /* 5 */
AddProperty(new MP4Integer16Property("bgColorBlue")); /* 6 */
AddProperty(new MP4Integer16Property("defTextBoxTop")); /* 7 */
AddProperty(new MP4Integer16Property("defTextBoxLeft")); /* 8 */
AddProperty(new MP4Integer16Property("defTextBoxBottom")); /* 9 */
AddProperty(new MP4Integer16Property("defTextBoxRight")); /* 10 */
AddReserved("reserved2", 8); /* 11 */
AddProperty(new MP4Integer16Property("fontNumber")); /* 12 */
AddProperty(new MP4Integer16Property("fontFace")); /* 13 */
AddReserved("reserved3", 1); /* 14 */
AddReserved("reserved4", 2); /* 15 */
AddProperty(new MP4Integer16Property("foreColorRed")); /* 16 */
AddProperty(new MP4Integer16Property("foreColorGreen")); /* 17 */
AddProperty(new MP4Integer16Property("foreColorBlue")); /* 18 */
}
void MP4TextAtom::AddPropertiesGmhdType()
{
AddProperty(new MP4BytesProperty("textData", 36)); /* 0 */
}
void MP4TextAtom::Generate()
{
if (!strcmp(m_pParentAtom->GetType(), "stsd")) {
AddPropertiesStsdType();
GenerateStsdType();
} else if (!strcmp(m_pParentAtom->GetType(), "gmhd")) {
AddPropertiesGmhdType();
GenerateGmhdType();
} else {
VERBOSE_WARNING(m_pFile->GetVerbosity(),
printf("Warning: text atom in unexpected context, can not generate"));
}
}
void MP4TextAtom::GenerateStsdType()
{
// generate children
MP4Atom::Generate();
((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
((MP4Integer32Property*)m_pProperties[2])->SetValue(1);
((MP4Integer32Property*)m_pProperties[3])->SetValue(1);
}
void MP4TextAtom::GenerateGmhdType()
{
MP4Atom::Generate();
// property 0 has non-zero fixed values
static u_int8_t textData[36] = {
0x00, 0x01,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x01,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x40, 0x00,
0x00, 0x00,
};
((MP4BytesProperty*)m_pProperties[0])->SetValue(textData, sizeof(textData));
}

View File

@ -0,0 +1,69 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TfhdAtom::MP4TfhdAtom()
: MP4Atom("tfhd")
{
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4Integer32Property("trackId"));
}
void MP4TfhdAtom::AddProperties(u_int32_t flags)
{
if (flags & 0x01) {
// note this property is signed 64!
AddProperty(
new MP4Integer64Property("baseDataOffset"));
}
if (flags & 0x02) {
AddProperty(
new MP4Integer32Property("sampleDescriptionIndex"));
}
if (flags & 0x08) {
AddProperty(
new MP4Integer32Property("defaultSampleDuration"));
}
if (flags & 0x10) {
AddProperty(
new MP4Integer32Property("defaultSampleSize"));
}
if (flags & 0x20) {
AddProperty(
new MP4Integer32Property("defaultSampleFlags"));
}
}
void MP4TfhdAtom::Read()
{
/* read atom version, flags, and trackId */
ReadProperties(0, 3);
/* need to create the properties based on the atom flags */
AddProperties(GetFlags());
/* now we can read the remaining properties */
ReadProperties(3);
Skip(); // to end of atom
}

View File

@ -0,0 +1,30 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TimsAtom::MP4TimsAtom()
: MP4Atom("tims")
{
AddProperty(
new MP4Integer32Property("timeScale"));
}

View File

@ -0,0 +1,130 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TkhdAtom::MP4TkhdAtom()
: MP4Atom("tkhd")
{
AddVersionAndFlags();
}
void MP4TkhdAtom::AddProperties(u_int8_t version)
{
if (version == 1) {
AddProperty( /* 2 */
new MP4Integer64Property("creationTime"));
AddProperty( /* 3 */
new MP4Integer64Property("modificationTime"));
} else { // version == 0
AddProperty( /* 2 */
new MP4Integer32Property("creationTime"));
AddProperty( /* 3 */
new MP4Integer32Property("modificationTime"));
}
AddProperty( /* 4 */
new MP4Integer32Property("trackId"));
AddReserved("reserved1", 4); /* 5 */
if (version == 1) {
AddProperty( /* 6 */
new MP4Integer64Property("duration"));
} else {
AddProperty( /* 6 */
new MP4Integer32Property("duration"));
}
AddReserved("reserved2", 12); /* 7 */
MP4Float32Property* pProp;
pProp = new MP4Float32Property("volume");
pProp->SetFixed16Format();
AddProperty(pProp); /* 8 */
AddReserved("reserved3", 2); /* 9 */
AddProperty(new MP4BytesProperty("matrix", 36)); /* 10 */
pProp = new MP4Float32Property("width");
pProp->SetFixed32Format();
AddProperty(pProp); /* 11 */
pProp = new MP4Float32Property("height");
pProp->SetFixed32Format();
AddProperty(pProp); /* 12 */
}
void MP4TkhdAtom::Generate()
{
u_int8_t version = m_pFile->Use64Bits(GetType()) ? 1 : 0;
SetVersion(version);
AddProperties(version);
MP4Atom::Generate();
// set creation and modification times
MP4Timestamp now = MP4GetAbsTimestamp();
if (version == 1) {
((MP4Integer64Property*)m_pProperties[2])->SetValue(now);
((MP4Integer64Property*)m_pProperties[3])->SetValue(now);
} else {
((MP4Integer32Property*)m_pProperties[2])->SetValue(now);
((MP4Integer32Property*)m_pProperties[3])->SetValue(now);
}
// property "matrix" has non-zero fixed values
// this default identity matrix indicates no transformation, i.e.
// 1, 0, 0
// 0, 1, 0
// 0, 0, 1
// see http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap4/chapter_5_section_4.html
static u_int8_t matrix[36] = {
0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00,
};
((MP4BytesProperty*)m_pProperties[10])->
SetValue(matrix, sizeof(matrix));
}
void MP4TkhdAtom::Read()
{
/* read atom version */
ReadProperties(0, 1);
/* need to create the properties based on the atom version */
AddProperties(GetVersion());
/* now we can read the remaining properties */
ReadProperties(1);
Skip(); // to end of atom
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TmaxAtom::MP4TmaxAtom()
: MP4Atom("tmax")
{
AddProperty( // max relative xmit time
new MP4Integer32Property("milliSecs"));
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TminAtom::MP4TminAtom()
: MP4Atom("tmin")
{
AddProperty( // min relative xmit time
new MP4Integer32Property("milliSecs"));
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TpylAtom::MP4TpylAtom()
: MP4Atom("tpyl")
{
AddProperty( // bytes sent of RTP payload data
new MP4Integer64Property("bytes"));
}

View File

@ -0,0 +1,30 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TrafAtom::MP4TrafAtom()
: MP4Atom("traf")
{
ExpectChildAtom("tfhd", Required, OnlyOne);
ExpectChildAtom("trun", Optional, Many);
}

View File

@ -0,0 +1,32 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TrakAtom::MP4TrakAtom()
: MP4Atom("trak")
{
ExpectChildAtom("tkhd", Required, OnlyOne);
ExpectChildAtom("tref", Optional, OnlyOne);
ExpectChildAtom("edts", Optional, OnlyOne);
ExpectChildAtom("mdia", Required, OnlyOne);
ExpectChildAtom("udta", Optional, Many);
}

View File

@ -0,0 +1,32 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TrefAtom::MP4TrefAtom()
: MP4Atom("tref")
{
ExpectChildAtom("dpnd", Optional, OnlyOne);
ExpectChildAtom("hint", Optional, OnlyOne);
ExpectChildAtom("ipir", Optional, OnlyOne);
ExpectChildAtom("mpod", Optional, OnlyOne);
ExpectChildAtom("sync", Optional, OnlyOne);
}

View File

@ -0,0 +1,47 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TrefTypeAtom::MP4TrefTypeAtom(const char* type)
: MP4Atom(type)
{
MP4Integer32Property* pCount =
new MP4Integer32Property("entryCount");
pCount->SetImplicit();
AddProperty(pCount); /* 0 */
MP4TableProperty* pTable = new MP4TableProperty("entries", pCount);
AddProperty(pTable); /* 1 */
pTable->AddProperty( /* 1, 0 */
new MP4Integer32Property("trackId"));
}
void MP4TrefTypeAtom::Read()
{
// table entry count computed from atom size
((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(false);
((MP4Integer32Property*)m_pProperties[0])->SetValue(m_size / 4);
((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(true);
MP4Atom::Read();
}

View File

@ -0,0 +1,39 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TrexAtom::MP4TrexAtom()
: MP4Atom("trex")
{
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4Integer32Property("trackId"));
AddProperty( /* 3 */
new MP4Integer32Property("defaultSampleDesriptionIndex"));
AddProperty( /* 4 */
new MP4Integer32Property("defaultSampleDuration"));
AddProperty( /* 5 */
new MP4Integer32Property("defaultSampleSize"));
AddProperty( /* 6 */
new MP4Integer32Property("defaultSampleFlags"));
}

View File

@ -0,0 +1,29 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TrpyAtom::MP4TrpyAtom()
: MP4Atom("trpy")
{
AddProperty( // bytes sent including RTP headers
new MP4Integer64Property("bytes"));
}

View File

@ -0,0 +1,79 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TrunAtom::MP4TrunAtom()
: MP4Atom("trun")
{
AddVersionAndFlags(); /* 0, 1 */
AddProperty( /* 2 */
new MP4Integer32Property("sampleCount"));
}
void MP4TrunAtom::AddProperties(u_int32_t flags)
{
if (flags & 0x01) {
// Note this is a signed 32 value
AddProperty(
new MP4Integer32Property("dataOffset"));
}
if (flags & 0x04) {
AddProperty(
new MP4Integer32Property("firstSampleFlags"));
}
MP4TableProperty* pTable =
new MP4TableProperty("samples",
(MP4Integer32Property *)m_pProperties[2]);
AddProperty(pTable);
if (flags & 0x100) {
pTable->AddProperty(
new MP4Integer32Property("sampleDuration"));
}
if (flags & 0x200) {
pTable->AddProperty(
new MP4Integer32Property("sampleSize"));
}
if (flags & 0x400) {
pTable->AddProperty(
new MP4Integer32Property("sampleFlags"));
}
if (flags & 0x800) {
pTable->AddProperty(
new MP4Integer32Property("sampleCompositionTimeOffset"));
}
}
void MP4TrunAtom::Read()
{
/* read atom version, flags, and sampleCount */
ReadProperties(0, 3);
/* need to create the properties based on the atom flags */
AddProperties(GetFlags());
/* now we can read the remaining properties */
ReadProperties(3);
Skip(); // to end of atom
}

View File

@ -0,0 +1,30 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4TsroAtom::MP4TsroAtom()
: MP4Atom("tsro")
{
AddProperty(
new MP4Integer32Property("offset"));
}

View File

@ -0,0 +1,50 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4UdtaAtom::MP4UdtaAtom()
: MP4Atom("udta")
{
ExpectChildAtom("chpl", Optional, OnlyOne);
ExpectChildAtom("cprt", Optional, Many);
ExpectChildAtom("hnti", Optional, OnlyOne);
ExpectChildAtom("meta", Optional, OnlyOne);
ExpectChildAtom("\251cpy", Optional, OnlyOne);
ExpectChildAtom("\251des", Optional, OnlyOne);
ExpectChildAtom("\251nam", Optional, OnlyOne);
ExpectChildAtom("\251cmt", Optional, OnlyOne);
ExpectChildAtom("\251prd", Optional, OnlyOne);
/*
ExpectChildAtom("titl", Optional, OnlyOne);
ExpectChildAtom("gnre", Optional, OnlyOne);
ExpectChildAtom("perf", Optional, OnlyOne);
ExpectChildAtom("albm", Optional, OnlyOne);*/
}
void MP4UdtaAtom::Read()
{
if (ATOMID(m_pParentAtom->GetType()) == ATOMID("trak")) {
ExpectChildAtom("hinf", Optional, OnlyOne);
}
MP4Atom::Read();
}

View File

@ -0,0 +1,63 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is MPEG4IP.
*
* The Initial Developer of the Original Code is Cisco Systems Inc.
* Portions created by Cisco Systems Inc. are
* Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
*
* Contributor(s):
* Dave Mackie dmackie@cisco.com
*/
#include "mp4common.h"
MP4UrlAtom::MP4UrlAtom(const char *type)
: MP4Atom(type)
{
AddVersionAndFlags();
AddProperty(new MP4StringProperty("location"));
}
void MP4UrlAtom::Read()
{
// read the version and flags properties
ReadProperties(0, 2);
// check if self-contained flag is set
if (!(GetFlags() & 1)) {
// if not then read url location
ReadProperties(2);
}
Skip(); // to end of atom
}
void MP4UrlAtom::Write()
{
MP4StringProperty* pLocationProp =
(MP4StringProperty*)m_pProperties[2];
// if no url location has been set
// then set self-contained flag
// and don't attempt to write anything
if (pLocationProp->GetValue() == NULL) {
SetFlags(GetFlags() | 1);
pLocationProp->SetImplicit(true);
} else {
SetFlags(GetFlags() & 0xFFFFFE);
pLocationProp->SetImplicit(false);
}
// write atom as usual
MP4Atom::Write();
}

Some files were not shown because too many files have changed in this diff Show More