quicktime.std.movies.media
Class Media

java.lang.Object
  |
  +--quicktime.QTObject
        |
        +--quicktime.std.movies.media.Media
All Implemented Interfaces:
quicktime.jdirect.InterfaceLib, quicktime.jdirect.PrimitivesLib, quicktime.jdirect.QuickTimeLib, quicktime.jdirect.SharedLibrary, com.apple.jdirect.SharedLibrary
Direct Known Subclasses:
BaseMedia, FlashMedia, GenericMedia, MPEGMedia, MusicMedia, SoundMedia, SpriteMedia, StreamMedia, TextMedia, ThreeDMedia, TimeCodeMedia, TweenMedia, VideoMedia

public abstract class Media
extends QTObject
implements quicktime.jdirect.QuickTimeLib

The Media class implements the corresponding data structure of the Movie Toolbox. The data references of a track constitute the track's media. Each track has a single media data structure. Specifies the media for an operation. Your application obtains a media identifier from such Movie Toolbox functions as NewTrackMedia and GetTrackMedia (described on page 2-153 of Inside Macintosh: QuickTime and page 2-206 of Inside Macintosh: QuickTime, respectively).


Fields inherited from interface quicktime.jdirect.QuickTimeLib
JDirect_MacOSX, libraryInstance, name
 
Method Summary
 int addDataRef(DataRef dataReference)
          This method adds a data reference to a media.
 int addSample(QTHandleRef data, int dataOffset, int dataSize, int durationPerSample, SampleDescription sampleDesc, int numberOfSamples, int sampleFlags)
          This method adds sample data and a description to a media object.
 int addSampleReference(int dataOffset, int dataSize, int durationPerSample, SampleDescription sampleDesc, int numberOfSamples, int sampleFlags)
          This method allows your application to work with samples that have already been added to a movie data file.
 int addSampleReference(SampleDescription sampleDescription, int numOfSamples, SampleReferenceVector sampleRefs)
          Allows your application to add groups of sample references to a movie data file.
 void beginEdits()
          This method starts a media-editing session.
 void endEdits()
          This method ends a media-editing session.
static Media fromTrack(Track theTrack)
          Returns a Media class that corresponds to the media that contains a track's data.
 int getCreationTime()
          This method returns the creation date stored in the media.
 DataHandler getDataHandler(int index)
          This method allows you to determine a media's data handler.
 HandlerInfo getDataHandlerDescription(int index)
          This method allows your application to retrieve information about a media's data handler.
 DataRef getDataRef(int index)
          This method returns a copy of a specified data reference.
 int getDataRefCount()
          This method allows your application to determine the number of data references in a media.
 int getDataSize(int startTime, int duration)
          This method allows your application to determine the size, in bytes, of the sample data in a media segment.
 int getDuration()
          This method returns the duration of a media.
 MediaHandler getHandler()
          This method allows you to obtain a reference to a media handler component.
 HandlerInfo getHandlerDescription()
          This method allows your application to retrieve information about a media handler.
 AtomContainer getInputMap()
          This method returns you the input map of the media.
 int getLanguage()
          This method returns a media's language or region code.
 int getModificationTime()
          This method returns a media's modification date.
 TimeInfo getNextInterestingTime(int interestingTimeFlags, int time, float rate)
          This method searches for times of interest in a media.
 int getPlayHints()
          This method allows your application to get information from the Movie Toolbox that determines the current state of playback of a single media.
 int getPlayHints(int flags, int flagsMask)
          Deprecated. these arguments are not used in this call see getPlayHints()
 int getPreferredChunkSize()
          This method returns the preferred chunck size for the media.
 AtomContainer getPropertyAtom()
          Retrieves the properties from a media handler.
 int getQuality()
          This method returns a media's quality level value.
 MediaSample getSample(int maxSizeToGrow, int time, int maxNumberOfSamples)
          This method returns a sample from a movie data file.
 int getSampleCount()
          This method allows you to determine the number of samples in a media.
 SampleDescription getSampleDescription(int index)
          This method allows you to retrieve a sample description from a media.
 int getSampleDescriptionCount()
          This method returns the number of sample descriptions in a media.
 SampleInfo getSampleReference(int time, int maxNumberOfSamples)
          This method allows your application to obtain reference information about samples that are stored in a movie data file.
 SampleReferenceInfo getSampleReferences(int time, int maxNumberOfSamples)
          This method allows your application to obtain reference information about samples that are stored in a movie data file.
 int getShadowSync(int frameDiffSampleNum)
          This method returns the sample number of the shadow sync associated with a given frame difference sample number.
 int getSyncSampleCount()
          This method allows you to determine the number of samples in a media.
 int getTimeScale()
          This method allows your application to determine a media's time scale.
 Track getTrack()
          This method allows you to determine the track that uses a specified media.
static Media getTrackMedia(Track theTrack)
          Returns a Media class that corresponds to the media that contains a track's data.
 UserData getUserData()
          This method allows your application to obtain access to a media's user data list.
 void loadIntoRam(int time, int duration, int flags)
          This method loads a media's data into memory.
static Media newFromType(int mediaType, Track track, int timeScale, DataRef dataRef)
          Creates a media struct for the specified Track object.
 TimeInfo sampleNumToMediaTime(int logicalSampleNum)
          This method allows you to find the time at which a specified sample plays.
 void setDataHandler(int index, DataHandler dH)
          This method allows you to assign a data handler to a media.
 void setDataRef(int index, DataRef dataReference)
          This method changes the file that the specified media identifies as the location for its data storage.
 void setDataRefAttributes(int index, int dataRefAttributes)
          No QTDocumentation.
 void setDefaultDataRefIndex(int index)
          This method allows your application to determine the default index for a media.
 void setHandler(MediaHandler mH)
          This method allows you to assign a specific media handler to a track.
 void setInputMap(AtomContainer inputMap)
          This method allows you to set a new input map for a media.
 void setLanguage(int language)
          This method sets a media's language or region code.
 void setPlayHints(int flags, int flagsMask)
          This method allows your application to provide information to the Movie Toolbox that can influence playback of a single media.
 void setPreferredChunkSize(int maxChunkSize)
          This method allows your application to specify a preferred chunk size for the media.
 void setPropertyAtom(AtomContainer propertyAtom)
          No QT Documentation.
 void setQuality(int quality)
          This method sets a media's quality level value.
 void setSampleDescription(int index, SampleDescription descH)
          This method lets you change the contents of a particular sample description of a specified media.
 void setShadowSync(int frameDiffSampleNum, int syncSampleNum)
          This method creates an association between the indicated frame difference sample and a specified self-contained sample in a given media.
 void setTimeScale(int timeScale)
          This method allows your application to set a media's time scale.
 SampleTimeInfo timeToSampleNum(int time)
          This method allows you to find the sample that contains the data for a specified time.
 
Methods inherited from class quicktime.QTObject
disposeQTObject, equals, ID, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

newFromType

public static Media newFromType(int mediaType,
                                Track track,
                                int timeScale,
                                DataRef dataRef)
                         throws QTException
Creates a media struct for the specified Track object. The type of media object that is created is determined by the mediaType argument. If a media class is not found that corresponds with the specified media type then an instance of GenericMedia is returned.

QuickTime::NewTrackMedia()

Parameters:
mediaType - the type of media the track will or does contain
itsTrack - Specifies the Track object this media belongs to.
timeScale - Specifies the time scale of the new media.
dataRef - a DataRef object specifying the default data reference for this media. If there is no known dataRef then null can be passed in.

fromTrack

public static Media fromTrack(Track theTrack)
                       throws QTException
Returns a Media class that corresponds to the media that contains a track's data.

QuickTime::GetTrackMedia()

Parameters:
theTrack - specifies the track to get the media from
Returns:
a Media subclass

getTrackMedia

public static Media getTrackMedia(Track theTrack)
                           throws QTException
Returns a Media class that corresponds to the media that contains a track's data.

QuickTime::GetTrackMedia()

Parameters:
theTrack - specifies the track to get the media from
Returns:
a Media subclass

getSampleDescription

public SampleDescription getSampleDescription(int index)
                                       throws QTException
This method allows you to retrieve a sample description from a media.

QuickTime::GetMediaSampleDescription()

Parameters:
index - Specifies the index of the sample description to retrieve.
Returns:
a SampleDescription object for the specified index.

setSampleDescription

public final void setSampleDescription(int index,
                                       SampleDescription descH)
                                throws StdQTException
This method lets you change the contents of a particular sample description of a specified media.

QuickTime::SetMediaSampleDescription()

Parameters:
index - Specifies the index of the sample description to be changed.
descH - Specifies the handle to the sample description.

getDataHandler

public final DataHandler getDataHandler(int index)
                                 throws StdQTException
This method allows you to determine a media's data handler.

QuickTime::GetMediaDataHandler()

Parameters:
index - Identifies the data reference.

setDataHandler

public final void setDataHandler(int index,
                                 DataHandler dH)
                          throws StdQTException
This method allows you to assign a data handler to a media.

QuickTime::SetMediaDataHandler()

Parameters:
index - Identifies the data reference for this data handler.
dataHandler - Specifies the data handler for the media.

getHandler

public MediaHandler getHandler()
                        throws StdQTException
This method allows you to obtain a reference to a media handler component.

QuickTime::GetMediaHandler()

Returns:
a MediaHandler object for the media's media handler.

setHandler

public final void setHandler(MediaHandler mH)
                      throws StdQTException
This method allows you to assign a specific media handler to a track.

QuickTime::SetMediaHandler()

Parameters:
mH - Contains a reference to a media handler component.

getTrack

public final Track getTrack()
                     throws QTException
This method allows you to determine the track that uses a specified media.

QuickTime::GetMediaTrack()

Returns:
a Track object of the track that uses the media.

getCreationTime

public final int getCreationTime()
                          throws StdQTException
This method returns the creation date stored in the media.

QuickTime::GetMediaCreationTime()

Returns:
the creation date stored in the media.

getModificationTime

public final int getModificationTime()
                              throws StdQTException
This method returns a media's modification date.

QuickTime::GetMediaModificationTime()

Returns:
a media's modification date.

getTimeScale

public final int getTimeScale()
                       throws StdQTException
This method allows your application to determine a media's time scale.

QuickTime::GetMediaTimeScale()

Returns:
the media's time scale.

setTimeScale

public final void setTimeScale(int timeScale)
                        throws StdQTException
This method allows your application to set a media's time scale.

QuickTime::SetMediaTimeScale()

Parameters:
timeScale - Specifies the media's new time scale.

getDuration

public final int getDuration()
                      throws StdQTException
This method returns the duration of a media.

QuickTime::GetMediaDuration()

Returns:
the duration of a media.

getLanguage

public final int getLanguage()
                      throws StdQTException
This method returns a media's language or region code.

QuickTime::GetMediaLanguage()

Returns:
a media's language or region code.

setLanguage

public final void setLanguage(int language)
                       throws StdQTException
This method sets a media's language or region code.

QuickTime::SetMediaLanguage()

Parameters:
language - Specifies the media's language or region code.

getQuality

public final int getQuality()
                     throws StdQTException
This method returns a media's quality level value.

QuickTime::GetMediaQuality()

Returns:
a media's quality level value.

setQuality

public final void setQuality(int quality)
                      throws StdQTException
This method sets a media's quality level value.

QuickTime::SetMediaQuality()

Parameters:
quality - Specifies the media's quality value.

getHandlerDescription

public final HandlerInfo getHandlerDescription()
                                        throws StdQTException
This method allows your application to retrieve information about a media handler.

QuickTime::GetMediaHandlerDescription()

Returns:
a HandlerInfo object.

getUserData

public final UserData getUserData()
                           throws StdQTException
This method allows your application to obtain access to a media's user data list.

QuickTime::GetMediaUserData()

Returns:
a UserData object for the media's user data list.

getInputMap

public final AtomContainer getInputMap()
                                throws StdQTException
This method returns you the input map of the media.

QuickTime::GetMediaInputMap()

Returns:
an AtomContainer object for media's input map.

setInputMap

public final void setInputMap(AtomContainer inputMap)
                       throws StdQTException
This method allows you to set a new input map for a media.

QuickTime::SetMediaInputMap()

Parameters:
inputMap - Specifies the new input map.

beginEdits

public final void beginEdits()
                      throws StdQTException
This method starts a media-editing session.

QuickTime::BeginMediaEdits()


endEdits

public final void endEdits()
                    throws StdQTException
This method ends a media-editing session.

QuickTime::EndMediaEdits()


setDefaultDataRefIndex

public final void setDefaultDataRefIndex(int index)
                                  throws StdQTException
This method allows your application to determine the default index for a media.

QuickTime::SetMediaDefaultDataRefIndex()

Parameters:
index - Specifies the index of the data ref.

getDataHandlerDescription

public final HandlerInfo getDataHandlerDescription(int index)
                                            throws StdQTException
This method allows your application to retrieve information about a media's data handler.

QuickTime::GetMediaDataHandlerDescription()

Parameters:
index - Identifies the data reference.
Returns:
a HandlerInfo object.

getSampleDescriptionCount

public final int getSampleDescriptionCount()
                                    throws StdQTException
This method returns the number of sample descriptions in a media.

QuickTime::GetMediaSampleDescriptionCount()

Returns:
the number of sample descriptions in a media.

getSampleCount

public final int getSampleCount()
                         throws StdQTException
This method allows you to determine the number of samples in a media.

QuickTime::GetMediaSampleCount()

Returns:
an integer that specifies the number of samples in the specified media.

getSyncSampleCount

public final int getSyncSampleCount()
                             throws StdQTException
This method allows you to determine the number of samples in a media.

QuickTime::GetMediaSyncSampleCount()

Returns:
an integer that specifies the number of samples in the specified media.

sampleNumToMediaTime

public final TimeInfo sampleNumToMediaTime(int logicalSampleNum)
                                    throws StdQTException
This method allows you to find the time at which a specified sample plays.

QuickTime::SampleNumToMediaTime()

Parameters:
logicalSampleNum - Specifies the sample number.
Returns:
a TimeInfo object that contains the time and duration of the sample.

timeToSampleNum

public final SampleTimeInfo timeToSampleNum(int time)
                                     throws StdQTException
This method allows you to find the sample that contains the data for a specified time.

QuickTime::MediaTimeToSampleNum()

Parameters:
time - Specifies the time for which you are retrieving sample information.
Returns:
a SampleTimeInfo object that contains the sample time and sample duration for the specified sample.

addSample

public final int addSample(QTHandleRef data,
                           int dataOffset,
                           int dataSize,
                           int durationPerSample,
                           SampleDescription sampleDesc,
                           int numberOfSamples,
                           int sampleFlags)
                    throws StdQTException
This method adds sample data and a description to a media object.

QuickTime::AddMediaSample()

Parameters:
data - Specifies media sample's data handle.
dataOffset - an offset into the sample data.
dataSize - Specifies media sample's data size.
durationPerSample - Specifies media sample's duration.
sampleDesc - Specifies media sample's sample description.
numberOfSamples - Specifies the number of samples.
sampleFlags - Specifies flags for samples.
Returns:
the time where the sample was inserted.

getSample

public final MediaSample getSample(int maxSizeToGrow,
                                   int time,
                                   int maxNumberOfSamples)
                            throws QTException
This method returns a sample from a movie data file.

QuickTime::GetMediaSample()

Parameters:
maxSizeToGrow - Specifies the maximum number of bytes of sample data to be returned.
time - Specifies the starting time of the sample to be retrieved.
maxNumberOfSamples - Specifies the maximum number of samples to be returned.
Returns:
a MediaSample object specifying the media sample.

addSampleReference

public final int addSampleReference(int dataOffset,
                                    int dataSize,
                                    int durationPerSample,
                                    SampleDescription sampleDesc,
                                    int numberOfSamples,
                                    int sampleFlags)
                             throws StdQTException
This method allows your application to work with samples that have already been added to a movie data file.

QuickTime::AddMediaSampleReference()

Parameters:
dataOffset - an offset into the sample data.
dataSize - Specifies media sample's data size.
durationPerSample - Specifies media sample's duration.
sampleDesc - Specifies media sample's sample description.
numberOfSamples - Specifies the number of samples.
sampleFlags - Specifies flags for samples.
Returns:
the time where the reference was inserted

getSampleReference

public final SampleInfo getSampleReference(int time,
                                           int maxNumberOfSamples)
                                    throws QTException
This method allows your application to obtain reference information about samples that are stored in a movie data file.

QuickTime::GetMediaSampleReference()

Parameters:
time - Specifies the starting time of the sample reference to be retrieved.
maxNumberOfSamples - Specifies the maximum number of samples to be returned.
Returns:
a SampleInfo object.

addSampleReference

public final int addSampleReference(SampleDescription sampleDescription,
                                    int numOfSamples,
                                    SampleReferenceVector sampleRefs)
                             throws StdQTException
Allows your application to add groups of sample references to a movie data file.

QuickTime::AddMediaSampleReferences()

Parameters:
sampleDescription - describes characteristics about the sample references
numOfSamples - the number of references added
sampleRefs - the references add, there must be at least as many references in the vector as numOfSamples (there may be more).
Returns:
the time where the reference was inserted

getSampleReferences

public final SampleReferenceInfo getSampleReferences(int time,
                                                     int maxNumberOfSamples)
                                              throws QTException
This method allows your application to obtain reference information about samples that are stored in a movie data file.

QuickTime::GetMediaSampleReferences()

Parameters:
time - secifies the starting time of the sample reference to be retrieved.
maxNumberOfSamples - Specifies the maximum number of samples to be returned.
Returns:
a SampleReferenceInfo object.

setPreferredChunkSize

public final void setPreferredChunkSize(int maxChunkSize)
                                 throws StdQTException
This method allows your application to specify a preferred chunk size for the media.

QuickTime::SetMediaPreferredChunkSize()

Parameters:
maxChunkSize - Specifies the prefered maximum chunk size.

getPreferredChunkSize

public final int getPreferredChunkSize()
                                throws StdQTException
This method returns the preferred chunck size for the media.

QuickTime::GetMediaPreferredChunkSize()

Returns:
the preferred chunck size for the media.

setShadowSync

public final void setShadowSync(int frameDiffSampleNum,
                                int syncSampleNum)
                         throws StdQTException
This method creates an association between the indicated frame difference sample and a specified self-contained sample in a given media.

QuickTime::SetMediaShadowSync()

Parameters:
frameDiffSampleNum - Specifies a frame difference sample.
syncSampleNum - Specifies a shadow sync sample.

getShadowSync

public final int getShadowSync(int frameDiffSampleNum)
                        throws StdQTException
This method returns the sample number of the shadow sync associated with a given frame difference sample number.

QuickTime::GetMediaShadowSync()

Returns:
the sample number of the shadow sync.

getNextInterestingTime

public final TimeInfo getNextInterestingTime(int interestingTimeFlags,
                                             int time,
                                             float rate)
                                      throws StdQTException
This method searches for times of interest in a media.

QuickTime::GetMediaNextInterestingTime()

Parameters:
interestingTimeFlags - Specifies the search criteria.
time - Specifies a time value that establishes the starting point for the search.
rate - Contains the search direction.
Returns:
a TimeInfo object that specifies the first found interesting time.

getDataSize

public final int getDataSize(int startTime,
                             int duration)
                      throws StdQTException
This method allows your application to determine the size, in bytes, of the sample data in a media segment.

QuickTime::GetMediaDataSize()

Parameters:
startTime - Contains a time value specifying the starting point of the segment.
duration - Contains a time value that specifies the duration of the segment.
Returns:
the data size.

getDataRef

public final DataRef getDataRef(int index)
                         throws QTException
This method returns a copy of a specified data reference.

QuickTime::GetMediaDataRef()

Parameters:
index - Identifies the data reference.
Returns:
a copy of a specified data reference.

setDataRef

public final void setDataRef(int index,
                             DataRef dataReference)
                      throws StdQTException
This method changes the file that the specified media identifies as the location for its data storage.

QuickTime::SetMediaDataRef()

Parameters:
index - the index value at which to add the data.
dataRef - Specifies the data reference.

setDataRefAttributes

public final void setDataRefAttributes(int index,
                                       int dataRefAttributes)
                                throws StdQTException
No QTDocumentation.

QuickTime::SetMediaDataRefAttributes()


addDataRef

public final int addDataRef(DataRef dataReference)
                     throws StdQTException
This method adds a data reference to a media.

QuickTime::AddMediaDataRef()

Parameters:
dataReference - Specifies the data reference.
Returns:
the index value that is assigned to the new data reference.

getDataRefCount

public final int getDataRefCount()
                          throws StdQTException
This method allows your application to determine the number of data references in a media.

QuickTime::GetMediaDataRefCount()

Returns:
the number of data references in the media.

setPlayHints

public final void setPlayHints(int flags,
                               int flagsMask)
                        throws StdQTException
This method allows your application to provide information to the Movie Toolbox that can influence playback of a single media.

QuickTime::SetMediaPlayHints()

Parameters:
flags - Specifies the optimizations that can be used with this media.
flagsMask - Indicates which flags in the flags parameter are to be considered in this operation.

getPlayHints

public final int getPlayHints(int flags,
                              int flagsMask)
                       throws StdQTException
Deprecated. these arguments are not used in this call see getPlayHints()

This method allows your application to get information from the Movie Toolbox that determines the current state of playback of a single media.

QuickTime::GetMediaPlayHints()

Parameters:
flags - Specifies the optimizations that can be used with this media.
flagsMask - Indicates which flags in the flags parameter are to be considered in this operation.

getPlayHints

public final int getPlayHints()
                       throws StdQTException
This method allows your application to get information from the Movie Toolbox that determines the current state of playback of a single media.

QuickTime::GetMediaPlayHints()


setPropertyAtom

public final void setPropertyAtom(AtomContainer propertyAtom)
                           throws StdQTException
No QT Documentation.

QuickTime::SetMediaPropertyAtom()


getPropertyAtom

public final AtomContainer getPropertyAtom()
                                    throws StdQTException
Retrieves the properties from a media handler.

QuickTime::GetMediaPropertyAtom()

Returns:
Contains the property atoms for the track associated with the media handler.

loadIntoRam

public final void loadIntoRam(int time,
                              int duration,
                              int flags)
                       throws StdQTException
This method loads a media's data into memory.

QuickTime::LoadMediaIntoRam()

Parameters:
time - starting time of the media segment to load.
duration - duration of the media segment to load
flags - control the loading operation