-
Notifications
You must be signed in to change notification settings - Fork 37
Movie related functions
ISOErr MP4NewMovie( ISOMovie *outMovie,
u32 initialODID,
u8 OD_profileAndLevel,
u8 scene_profileAndLevel,
u8 audio_profileAndLevel,
u8 visual_profileAndLevel,
u8 graphics_profileAndLevel )
Creates a new empty Movie in memory. You may assign an initial object descriptor ID and profile and level indications that describe the presentation you are making. The profile and level definitions are detailed in the MPEG-4 Systems specification.
If you provide zero as the initialODID, then no object descriptor is created. Such files can be used as the target of an ES URL, or standalone. Similarly if you provide zero for all the profiles, then the IOD atom will contain an object descriptor, not an initial object descriptor; these files can also be useful on occasion. Do not attempt to add tracks to the object descriptor if you have asked that one not be created.
ISOErr MJ2NewMovie( ISOMovie *outMovie )
Creates a new empty Motion JPEG 2000 Movie in memory.
ISOErr NewMPEG21( MP4Movie *outMovie )
Creates a new empty MPEG-21 ‘movie’ in memory (actually an MPEG-21 file with a meta-atom but no movie atom). You will probably want to get the meta-atom reference ISOGetFileMeta
to add items etc. If you want a dual-function MP4/MPEG-21 file, create an MP4 file and then add a file-level meta atom to that, instead of using this call.
ISOErr New3GPPMovie( ISOMovie *outMovie, u16 release );
Creates a new empty 3GPP Movie in memory, and sets the brand to the indicated release (4, 5 or 6).
ISOErr ISONewMetaMovie( MP4Movie *outMovie,
u32 handlertype, u32 brand, u32 minorversion ); Like new MPEG21, but allows you to specify the meta handlertype, and the major brand and minor version of that brand.
ISOErr ISODisposeMovie( ISOMovie theMovie )
This function releases any resources owned by the Movie. You should not make any further reference to the Movie after calling this.
ISOErr ISOSetMovieBrand( ISOMovie theMovie,
u32 brand, u32 minorversion )
Sets the Movie’s major brand, and also inserts the major brand into the compatible brands list. This function is not normally needed; the brand is set by the appropriate movie-creation function.
ISOErr ISOSetMovieCompatibleBrand( ISOMovie theMovie,
u32 brand )
Adds a minor brand into the compatible brands list of the Movie. The following brands have defined constants in the headers, though of course you may use MP4_FOUR_CHAR_CODE
also.
JP2JPEG2000Brand /* brand for JPEG-2000 */
MJ2JPEG2000Brand /* brand for Motion JPEG-2000 */
ISOQuickTimeBrand /* brand for QuickTime */
ISOMpeg4V1Brand /* brand for MPEG-4 version 1 */
ISOMpeg4V2Brand /* brand for MPEG-4 version 2 */
ISOISOBrand /* conforming brand for all files */
ISOISO2Brand /* conforming brand for all files */
ISO3GP4Brand /* 3GPP Release 4 */
ISO3GP5Brand /* 3GPP Release 5 */
ISO3GP6Brand /* 3GPP Release 6 */
ISOMPEG21Brand /* MPEG-21 */
ISOErr ISOGetMovieBrand( ISOMovie theMovie,
u32* brand, u32* minorversion )
Returns the Movie’s major brand and minor version.
u32 ISOIsMovieCompatibleBrand ( ISOMovie theMovie, u32 brand )
If the brand is a compatible brand of the movie, this returns the compatible brand, otherwise it returns 0.
ISOErr ISOSetMovieTimeScale( ISOMovie theMovie, u32 timeScale )
Sets the Movie’s time scale.
ISOErr ISOGetMovieTimeScale( ISOMovie theMovie, u32* outTimeScale )
Use this to obtain the time scale of a Movie.
ISOErr ISOGetMovieTrack( ISOMovie theMovie,
u32 trackID,
ISOTrack* outTrack )
Use this to obtain a track given its track ID.
ISOErr ISOWriteMovieToFile( ISOMovie theMovie, const char *filename )
Writes the in-memory Movie to a file. The file given by filename is created, written, and closed.
ISOErr ISOOpenMovieFile( ISOMovie *theMovie,
const char *fileName,
int openMovieFlags )
Opens a movie file and creates a Movie in memory from this file. You may specify a pathname or a file: URL. The parameter openMovieFlags is ordinarily set to MP4OpenMovieNormal
, but if you set it to MP4OpenMovieDebug
a parse tree will be printed to standard output while the movie file is parsed.
ISOErr MP4NewMovieFromHandle(
MP4Movie *outMovie,
MP4Handle movieH,
u32 newMovieFlags )
Parses a movie ‘file’ in the handle and creates a Movie in memory from this file. The parameter openMovieFlags is ordinarily set to MP4OpenMovieNormal
, but if you set it to MP4OpenMovieDebug
a parse tree will be printed to standard output while the movie file is parsed.
ISOErr ISOPutMovieIntoHandle( ISOMovie theMovie, ISOHandle aHandle )
Places the movie and its media samples into a handle.
ISOErr MP4SetMovieInitialBIFSTrack( ISOMovie theMovie, ISOTrack theBIFSTrack )
Indicates that the given track is to be considered as the initial BIFS track. This information is placed into the Movie's initial object descriptor.
ISOErr MP4SetMovieInitialODTrack( ISOMovie theMovie, ISOTrack theODTrack )
Indicates that the given track is to be considered as the initial Object Descriptor stream track. This information is placed into the Movie's initial object descriptor.
ISOErr MP4SetMovieIODInlineProfileFlag( ISOMovie theMovie, u8 theFlag )
Allows you to set the value of includeInlineProfileLevelFlag
in the movie's initial object descriptor.
ISOErr MP4GetMovieInitialObjectDescriptor(
ISOMovie theMovie,
ISOHandle h )
Retrieves the initial object descriptor from a Movie and places it into a Handle.
ISOErr MP4GetMovieIODInlineProfileFlag (
ISOMovie theMovie,
u8* outFlag )
Queries the setting of includeInlineProfileLevelFlag
from the movie's initial object descriptor.
ISOErr MP4GetMovieProfilesAndLevels( ISOMovie theMovie,
u8 *outOD,
u8 *outScene,
u8 *outAudio,
u8 *outVisual,
u8 *outGraphics )
Use this to obtain the profiles and levels from a Movie's initial object descriptor. You may pass in null for parameters that don't care to read. This call will return an error if the movie does not contain an initial object descriptor.
ISOErr MJ2SetMovieMatrix( ISOMovie theMovie, u32 matrix[9] );
This sets the matrix of the overall movie; the default matrix is the unity matrix, if none has been set.
ISOErr MJ2GetMovieMatrix( ISOMovie theMovie, u32 outMatrix[9] );
This returns the overall transformation matrix for the movie.
ISOErr MJ2SetMoviePreferredRate( ISOMovie theMovie, u32 rate );
This sets the rate of the movie (the normal and default rate is 1.0). The rate is represented as a 16.16 fixed-point number.
ISOErr MJ2GetMoviePreferredRate( ISOMovie theMovie, u32 *outRate );
This returns the currently set movie preferred rate.
ISOErr MJ2SetMoviePreferredVolume( ISOMovie theMovie,
s16 volume );
This sets the normal volume of the movie. The normal, default, value is 1.0. The volume is expressed as an 8.8 fixed-point number.
ISOErr MJ2GetMoviePreferredVolume( ISOMovie theMovie, s16 *outVolume);
This returns the movie volume setting.
ISOErr ISOStartMovieFragment ( ISOMovie theMovie );
This starts a new movie fragment. Before calling this, you should create a normal movie, up to the point you would write it to the file, and you should set the track fragment defaults on the tracks to which you want to add samples. After calling this, you should only add samples, and write the file out. Each call to this function starts a new fragment. For example, in the above example, you might call this function after ISOEndMediaEdits
, and then insert some more samples into the track(s).
ISOErr ISOAddDelayToTrackFragmentDecodeTime (
ISOMovie theMovie, u32 delay );
Must be called right after ISOStartMovieFragment
. Setting the delay parameter to other than zero, a delay will be introduced, which will add a time offset to the track fragment decode time.
ISOErr ISOSetCompositonToDecodePropertiesForFragments(
ISOMovie theMovie,
u32 trackID,
s32 compositionToDTSShift,
s32 leastDecodeToDisplayDelta,
s32 greatestDecodeToDisplayDelta,
s32 compositionStartTime,
s32 compositionEndTime )
Must be called before the first ISOStartMovieFragment
. Sets the compositon to decode parameters for a specific track. They have to be calculated and added before calling the first ISOStartMovieFragment
and cannot be changed later.
ISOErr ISOGetMovieDuration(ISOMovie theMovie, u64* outDuration)
This calculates and returns the movie duration as recorded in the movie header, that is, the maximum track duration, expressed in units of the movie’s timescale.
ISOErr MP4AddAtomToMovie(
MP4Movie theMovie,
MP4GenericAtom the_atom );
Adds the given atom (see ISONewForeignAtom
and ISONewUUIDAtom
) to the movie.
How to use
API documentation single page
- Data Types
- Movie related functions
- Track related functions
- Media related functions
- MPEG sample auxiliary information functions
- MPEG sync-layer functions
- MPEG SLConfig functions
- General Sample Description functions
- AVC Sample Description functions
- MetaData Sample Description functions
- Meta data functions
- Track reader functions
- MPEG-4 IPMPX related functions
- ISMACrypt Support
- Utility functions