Skip to content

Movie related functions

Dimitri Podborski edited this page Sep 17, 2020 · 1 revision

MP4NewMovie

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.

MJ2NewMovie

ISOErr MJ2NewMovie( ISOMovie *outMovie )

Creates a new empty Motion JPEG 2000 Movie in memory.

NewMPEG21

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.

New3GPPMovie

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).

ISONewMetaMovie

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.

ISODisposeMovie

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.

ISOSetMovieBrand

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.

ISOSetMovieCompatibleBrand

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 */

ISOGetMovieBrand

ISOErr ISOGetMovieBrand( ISOMovie theMovie, 
            u32* brand, u32* minorversion )

Returns the Movie’s major brand and minor version.

ISOIsMovieCompatibleBrand

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.

ISOSetMovieTimeScale

ISOErr ISOSetMovieTimeScale( ISOMovie theMovie, u32 timeScale )

Sets the Movie’s time scale.

ISOGetMovieTimeScale

ISOErr ISOGetMovieTimeScale( ISOMovie theMovie, u32* outTimeScale )

Use this to obtain the time scale of a Movie.

ISOGetMovieTrack

ISOErr ISOGetMovieTrack( ISOMovie theMovie,
            u32 trackID,
            ISOTrack* outTrack )

Use this to obtain a track given its track ID.

ISOWriteMovieToFile

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.

ISOOpenMovieFile

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.

MP4NewMovieFromHandle

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.

ISOPutMovieIntoHandle

ISOErr ISOPutMovieIntoHandle( ISOMovie theMovie, ISOHandle aHandle )

Places the movie and its media samples into a handle.

MP4SetMovieInitialBIFSTrack

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.

MP4SetMovieInitialODTrack

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.

MP4SetMovieIODInlineProfileFlag

ISOErr MP4SetMovieIODInlineProfileFlag( ISOMovie theMovie, u8 theFlag )

Allows you to set the value of includeInlineProfileLevelFlag in the movie's initial object descriptor.

MP4GetMovieInitialObjectDescriptor

ISOErr MP4GetMovieInitialObjectDescriptor(
              ISOMovie theMovie,
              ISOHandle h )

Retrieves the initial object descriptor from a Movie and places it into a Handle.

MP4GetMovieIODInlineProfileFlag

ISOErr MP4GetMovieIODInlineProfileFlag (
              ISOMovie theMovie,
              u8* outFlag )

Queries the setting of includeInlineProfileLevelFlag from the movie's initial object descriptor.

MP4GetMovieProfilesAndLevels

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.

MJ2SetMovieMatrix

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.

MJ2GetMovieMatrix

ISOErr MJ2GetMovieMatrix( ISOMovie theMovie, u32 outMatrix[9] );

This returns the overall transformation matrix for the movie.

MJ2SetMoviePreferredRate

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.

MJ2GetMoviePreferredRate

ISOErr MJ2GetMoviePreferredRate( ISOMovie theMovie, u32 *outRate );

This returns the currently set movie preferred rate.

MJ2SetMoviePreferredVolume

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.

MJ2GetMoviePreferredVolume

ISOErr MJ2GetMoviePreferredVolume( ISOMovie theMovie, s16 *outVolume);

This returns the movie volume setting.

ISOStartMovieFragment

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).

ISOAddDelayToTrackFragmentDecodeTime

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.

ISOSetCompositonToDecodePropertiesForFragments

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.

ISOGetMovieDuration

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.

ISOAddAtomToMovie

ISOErr MP4AddAtomToMovie( 
          MP4Movie theMovie, 
          MP4GenericAtom the_atom );

Adds the given atom (see ISONewForeignAtom and ISONewUUIDAtom) to the movie.

Clone this wiki locally