Package com.avpkit.core
Class SimpleMediaFile
- java.lang.Object
-
- com.avpkit.core.SimpleMediaFile
-
- All Implemented Interfaces:
ISimpleMediaFile
public class SimpleMediaFile extends java.lang.Object implements ISimpleMediaFile
An implementation ofISimpleMediaFile. Provides a generic bag of attributes about a SimpleMediaFile.
-
-
Constructor Summary
Constructors Constructor Description SimpleMediaFile()Create a newSimpleMediaFile.SimpleMediaFile(ISimpleMediaFile src)Create a newSimpleMediaFilefrom an existingSimpleMediaFile.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAudioBitRate()Get the audio bit rateintgetAudioChannels()Get the number of audio channelsICodec.IDgetAudioCodec()Get the audio codec set on this configuration object.IAudioSamples.FormatgetAudioSampleFormat()Get the audio sample format.intgetAudioSampleRate()Get the audio sample rate.IRationalgetAudioTimeBase()Get the time base used when encoding or decoding audio.IContainerFormatgetContainerFormat()Get the container format, if known, for this container.ITimeValuegetDuration()Get the duration that we'll assume for the stream we're representing.java.lang.StringgetURL()Return the URL for this stream.intgetVideoBitRate()Get the video bit rateICodec.IDgetVideoCodec()Get the video codec that packets are encoded with.IRationalgetVideoFrameRate()Get the Video Frame RateintgetVideoGlobalQuality()Get the VideoGlobalQuality setting.intgetVideoHeight()Get the video height of video frames broadcastedintgetVideoNumPicturesInGroupOfPictures()Get the GOPS.IPixelFormat.TypegetVideoPixelFormat()Return the pixel format to useIRationalgetVideoTimeBase()Get the timebase that packets should be encoded with.intgetVideoWidth()Get the video width of video frames broadcastedbooleanhasAudio()Tells whether or not the output stream should have audiobooleanhasVideo()Tells whether or not the output stream should have videobooleanisAudioBitRateKnown()is the audio bit rate known?booleanisAudioChannelsKnown()are the # of audio channels known?booleanisAudioSampleRateKnown()is the audio sample rate known?booleanisVideoBitRateKnown()is the video bit rate known?booleanisVideoGlobalQualityKnown()is the global quality setting known?booleanisVideoHeightKnown()is the video height known?booleanisVideoNumPicturesInGroupOfPicturesKnown()is the MPEG number of pictures in a group of pictures known?booleanisVideoPixelFormatKnown()is the video pixel format known?booleanisVideoWidthKnown()is the video width known?voidsetAudioBitRate(int bitRate)Set the audio bitratevoidsetAudioBitRateKnown(boolean audioBitRateKnown)set if the audio bit rate is known.voidsetAudioChannels(int numChannels)Set the number of audio channels.voidsetAudioChannelsKnown(boolean audioChannelsKnown)set if the audio channels are knownvoidsetAudioCodec(ICodec.ID audioCodec)Set the audio codec to use.voidsetAudioSampleFormat(IAudioSamples.Format aFormat)Set the audio sample format you want to use in this file.voidsetAudioSampleRate(int sampleRate)Set the audio sample ratevoidsetAudioSampleRateKnown(boolean audioSampleRateKnown)set if the audio sample rate is known.voidsetAudioTimeBase(IRational aTimeBase)Set the time base to use when encoding or decoding audiovoidsetContainerFormat(IContainerFormat aFormat)Sets the container format for this streamvoidsetDuration(ITimeValue duration)Set the duration that we'll assume for the stream we're representing.voidsetHasAudio(boolean hasAudio)Set whether you want the output stream to have audiovoidsetHasVideo(boolean hasVideo)Set whether you want the output stream to have videovoidsetURL(java.lang.String uRL)Set the URL that this stream contains info for.voidsetVideoBitRate(int bitRate)Set the timebase that we encode video for.voidsetVideoBitRateKnown(boolean videoBitRateKnown)set if the video bit rate is known.voidsetVideoCodec(ICodec.ID videoCodec)Set the video codec that packets are encoded with.voidsetVideoFrameRate(IRational frameRate)Set the Video Frame Rate as a rational.voidsetVideoGlobalQuality(int quality)Set the default quality quality setting for video.voidsetVideoGlobalQualityKnown(boolean videoGlobalQualityKnown)set if the global quality setting is known.voidsetVideoHeight(int height)Set the height of the video frames in broadcasted packetsvoidsetVideoHeightKnown(boolean videoHeightKnown)set if the video height is known.voidsetVideoNumPicturesInGroupOfPictures(int gops)Set the MPEG2 Num Pictures In Group Of Pictures (GOPS) settingsvoidsetVideoNumPicturesInGroupOfPicturesKnown(boolean videoGOPSKnown)set if the MPEG number of pictures in a group of pictures is known?voidsetVideoPixelFormat(IPixelFormat.Type pixelFormat)Sets the pixel format to usevoidsetVideoPixelFormatKnown(boolean videoPixelFormatKnown)set if the video pixel format is known.voidsetVideoTimeBase(IRational timeBase)Set the TimeBase that video packets are encoded with.voidsetVideoWidth(int width)Set the width of the video frames in broadcasted packetsvoidsetVideoWidthKnown(boolean videoWidthKnown)set if the video width is known.
-
-
-
Constructor Detail
-
SimpleMediaFile
public SimpleMediaFile()
Create a newSimpleMediaFile.
-
SimpleMediaFile
public SimpleMediaFile(ISimpleMediaFile src)
Create a newSimpleMediaFilefrom an existingSimpleMediaFile. All values are shallow copied.- Parameters:
src- The value to copy.- Throws:
java.lang.IllegalArgumentException- if src is null
-
-
Method Detail
-
getAudioBitRate
public int getAudioBitRate()
Get the audio bit rate- Specified by:
getAudioBitRatein interfaceISimpleMediaFile- Returns:
- bit rate, in Hz.
-
getAudioChannels
public int getAudioChannels()
Get the number of audio channels- Specified by:
getAudioChannelsin interfaceISimpleMediaFile- Returns:
- number of audio channels
-
getAudioSampleRate
public int getAudioSampleRate()
Get the audio sample rate.- Specified by:
getAudioSampleRatein interfaceISimpleMediaFile- Returns:
- sample rate, in Hz.
-
setAudioBitRate
public void setAudioBitRate(int bitRate)
Set the audio bitrate- Specified by:
setAudioBitRatein interfaceISimpleMediaFile- Parameters:
bitRate- bitrate to use
-
setAudioChannels
public void setAudioChannels(int numChannels)
Set the number of audio channels.- Specified by:
setAudioChannelsin interfaceISimpleMediaFile- Parameters:
numChannels- Number of channels; only 1 or 2 supported
-
setAudioSampleRate
public void setAudioSampleRate(int sampleRate)
Set the audio sample rate- Specified by:
setAudioSampleRatein interfaceISimpleMediaFile- Parameters:
sampleRate- Audio sample rate in Hz (e.g. 22050)
-
getAudioCodec
public ICodec.ID getAudioCodec()
Get the audio codec set on this configuration object.- Specified by:
getAudioCodecin interfaceISimpleMediaFile- Returns:
- The audiocodec. if null, a user may guess the codec from other information.
-
setAudioCodec
public void setAudioCodec(ICodec.ID audioCodec)
Set the audio codec to use.- Specified by:
setAudioCodecin interfaceISimpleMediaFile- Parameters:
audioCodec- The audio codec to use; if null, a user may guess the codec from other information.
-
getVideoCodec
public ICodec.ID getVideoCodec()
Get the video codec that packets are encoded with.- Specified by:
getVideoCodecin interfaceISimpleMediaFile- Returns:
- the video codec
-
getVideoHeight
public int getVideoHeight()
Get the video height of video frames broadcasted- Specified by:
getVideoHeightin interfaceISimpleMediaFile- Returns:
- height in pixels
-
getVideoWidth
public int getVideoWidth()
Get the video width of video frames broadcasted- Specified by:
getVideoWidthin interfaceISimpleMediaFile- Returns:
- width in pixels
-
getVideoBitRate
public int getVideoBitRate()
Get the video bit rate- Specified by:
getVideoBitRatein interfaceISimpleMediaFile- Returns:
- video bit rate
-
setVideoCodec
public void setVideoCodec(ICodec.ID videoCodec)
Set the video codec that packets are encoded with.- Specified by:
setVideoCodecin interfaceISimpleMediaFile- Parameters:
videoCodec- video codec that packets are encoded with.
-
setVideoHeight
public void setVideoHeight(int height)
Set the height of the video frames in broadcasted packets- Specified by:
setVideoHeightin interfaceISimpleMediaFile- Parameters:
height- height in pixels
-
setVideoWidth
public void setVideoWidth(int width)
Set the width of the video frames in broadcasted packets- Specified by:
setVideoWidthin interfaceISimpleMediaFile- Parameters:
width- width in pixels
-
getVideoTimeBase
public IRational getVideoTimeBase()
Get the timebase that packets should be encoded with.- Specified by:
getVideoTimeBasein interfaceISimpleMediaFile- Returns:
- The timebase or null if unknown.
-
setVideoTimeBase
public void setVideoTimeBase(IRational timeBase)
Set the TimeBase that video packets are encoded with.- Specified by:
setVideoTimeBasein interfaceISimpleMediaFile- Parameters:
timeBase- The timebase to use with this configuration, or null if unknowbn.
-
setVideoBitRate
public void setVideoBitRate(int bitRate)
Set the timebase that we encode video for.- Specified by:
setVideoBitRatein interfaceISimpleMediaFile- Parameters:
bitRate- The bitrate to use for encoding video
-
getVideoPixelFormat
public IPixelFormat.Type getVideoPixelFormat()
Return the pixel format to use- Specified by:
getVideoPixelFormatin interfaceISimpleMediaFile- Returns:
- The pixel format.
-
setVideoPixelFormat
public void setVideoPixelFormat(IPixelFormat.Type pixelFormat)
Sets the pixel format to use- Specified by:
setVideoPixelFormatin interfaceISimpleMediaFile- Parameters:
pixelFormat- Pixel format
-
getVideoFrameRate
public IRational getVideoFrameRate()
Get the Video Frame Rate- Specified by:
getVideoFrameRatein interfaceISimpleMediaFile- Returns:
- The video frame rate, or null if unknown
- See Also:
ISimpleMediaFile.setVideoFrameRate(IRational)
-
getVideoGlobalQuality
public int getVideoGlobalQuality()
Get the VideoGlobalQuality setting.- Specified by:
getVideoGlobalQualityin interfaceISimpleMediaFile- Returns:
- The global quality for video
- See Also:
ISimpleMediaFile.setVideoGlobalQuality(int)
-
getVideoNumPicturesInGroupOfPictures
public int getVideoNumPicturesInGroupOfPictures()
Get the GOPS.- Specified by:
getVideoNumPicturesInGroupOfPicturesin interfaceISimpleMediaFile- Returns:
- The GOPS
- See Also:
ISimpleMediaFile.setVideoNumPicturesInGroupOfPictures(int)
-
setVideoFrameRate
public void setVideoFrameRate(IRational frameRate)
Set the Video Frame Rate as a rational.- Specified by:
setVideoFrameRatein interfaceISimpleMediaFile- Parameters:
frameRate- The frame rate (e.g. 15/1), or null if unknown.
-
setVideoGlobalQuality
public void setVideoGlobalQuality(int quality)
Set the default quality quality setting for video. 0 is highest quality. > 0 is decreasing quality.- Specified by:
setVideoGlobalQualityin interfaceISimpleMediaFile- Parameters:
quality- The quality to use.
-
setVideoNumPicturesInGroupOfPictures
public void setVideoNumPicturesInGroupOfPictures(int gops)
Set the MPEG2 Num Pictures In Group Of Pictures (GOPS) settings- Specified by:
setVideoNumPicturesInGroupOfPicturesin interfaceISimpleMediaFile- Parameters:
gops- Set the GOPS
-
hasAudio
public boolean hasAudio()
Tells whether or not the output stream should have audio- Specified by:
hasAudioin interfaceISimpleMediaFile- Returns:
- Should the output stream have audio?
-
hasVideo
public boolean hasVideo()
Tells whether or not the output stream should have video- Specified by:
hasVideoin interfaceISimpleMediaFile- Returns:
- Should the output stream have video?
-
setHasAudio
public void setHasAudio(boolean hasAudio)
Set whether you want the output stream to have audio- Specified by:
setHasAudioin interfaceISimpleMediaFile- Parameters:
hasAudio- Whether you want the output stream to have audio
-
setHasVideo
public void setHasVideo(boolean hasVideo)
Set whether you want the output stream to have video- Specified by:
setHasVideoin interfaceISimpleMediaFile- Parameters:
hasVideo- Whether you want the output stream to have video
-
getContainerFormat
public IContainerFormat getContainerFormat()
Get the container format, if known, for this container.- Specified by:
getContainerFormatin interfaceISimpleMediaFile- Returns:
- The container format
-
setContainerFormat
public void setContainerFormat(IContainerFormat aFormat)
Sets the container format for this stream- Specified by:
setContainerFormatin interfaceISimpleMediaFile- Parameters:
aFormat- The container format
-
getAudioTimeBase
public IRational getAudioTimeBase()
Get the time base used when encoding or decoding audio.- Specified by:
getAudioTimeBasein interfaceISimpleMediaFile- Returns:
- the timebase, or null if unknown.
-
setAudioTimeBase
public void setAudioTimeBase(IRational aTimeBase)
Set the time base to use when encoding or decoding audio- Specified by:
setAudioTimeBasein interfaceISimpleMediaFile- Parameters:
aTimeBase- The timebase to use, or null if unknown.
-
setAudioBitRateKnown
public void setAudioBitRateKnown(boolean audioBitRateKnown)
set if the audio bit rate is known.- Specified by:
setAudioBitRateKnownin interfaceISimpleMediaFile- Parameters:
audioBitRateKnown- the audioBitRateKnown to set
-
isAudioBitRateKnown
public boolean isAudioBitRateKnown()
is the audio bit rate known?- Specified by:
isAudioBitRateKnownin interfaceISimpleMediaFile- Returns:
- the audioBitRateKnown
-
setAudioChannelsKnown
public void setAudioChannelsKnown(boolean audioChannelsKnown)
set if the audio channels are known- Specified by:
setAudioChannelsKnownin interfaceISimpleMediaFile- Parameters:
audioChannelsKnown- the audioChannelsKnown to set
-
isAudioChannelsKnown
public boolean isAudioChannelsKnown()
are the # of audio channels known?- Specified by:
isAudioChannelsKnownin interfaceISimpleMediaFile- Returns:
- the audioChannelsKnown
-
setAudioSampleRateKnown
public void setAudioSampleRateKnown(boolean audioSampleRateKnown)
set if the audio sample rate is known.- Specified by:
setAudioSampleRateKnownin interfaceISimpleMediaFile- Parameters:
audioSampleRateKnown- the audioSampleRateKnown to set
-
isAudioSampleRateKnown
public boolean isAudioSampleRateKnown()
is the audio sample rate known?- Specified by:
isAudioSampleRateKnownin interfaceISimpleMediaFile- Returns:
- the audioSampleRateKnown
-
setVideoHeightKnown
public void setVideoHeightKnown(boolean videoHeightKnown)
set if the video height is known.- Specified by:
setVideoHeightKnownin interfaceISimpleMediaFile- Parameters:
videoHeightKnown- the videoHeightKnown to set
-
isVideoHeightKnown
public boolean isVideoHeightKnown()
is the video height known?- Specified by:
isVideoHeightKnownin interfaceISimpleMediaFile- Returns:
- the videoHeightKnown
-
setVideoWidthKnown
public void setVideoWidthKnown(boolean videoWidthKnown)
set if the video width is known.- Specified by:
setVideoWidthKnownin interfaceISimpleMediaFile- Parameters:
videoWidthKnown- the videoWidthKnown to set
-
isVideoWidthKnown
public boolean isVideoWidthKnown()
is the video width known?- Specified by:
isVideoWidthKnownin interfaceISimpleMediaFile- Returns:
- the videoWidthKnown
-
setVideoBitRateKnown
public void setVideoBitRateKnown(boolean videoBitRateKnown)
set if the video bit rate is known.- Specified by:
setVideoBitRateKnownin interfaceISimpleMediaFile- Parameters:
videoBitRateKnown- the videoBitRateKnown to set
-
isVideoBitRateKnown
public boolean isVideoBitRateKnown()
is the video bit rate known?- Specified by:
isVideoBitRateKnownin interfaceISimpleMediaFile- Returns:
- the videoBitRateKnown
-
setVideoNumPicturesInGroupOfPicturesKnown
public void setVideoNumPicturesInGroupOfPicturesKnown(boolean videoGOPSKnown)
set if the MPEG number of pictures in a group of pictures is known?- Specified by:
setVideoNumPicturesInGroupOfPicturesKnownin interfaceISimpleMediaFile- Parameters:
videoGOPSKnown- the videoGOPSKnown to set
-
isVideoNumPicturesInGroupOfPicturesKnown
public boolean isVideoNumPicturesInGroupOfPicturesKnown()
is the MPEG number of pictures in a group of pictures known?- Specified by:
isVideoNumPicturesInGroupOfPicturesKnownin interfaceISimpleMediaFile- Returns:
- the videoGOPSKnown
-
setVideoGlobalQualityKnown
public void setVideoGlobalQualityKnown(boolean videoGlobalQualityKnown)
set if the global quality setting is known.- Specified by:
setVideoGlobalQualityKnownin interfaceISimpleMediaFile- Parameters:
videoGlobalQualityKnown- the videoGlobalQualityKnown to set
-
isVideoGlobalQualityKnown
public boolean isVideoGlobalQualityKnown()
is the global quality setting known?- Specified by:
isVideoGlobalQualityKnownin interfaceISimpleMediaFile- Returns:
- the videoGlobalQualityKnown
-
setVideoPixelFormatKnown
public void setVideoPixelFormatKnown(boolean videoPixelFormatKnown)
set if the video pixel format is known.- Specified by:
setVideoPixelFormatKnownin interfaceISimpleMediaFile- Parameters:
videoPixelFormatKnown- the videoPixelFormatKnown to set
-
isVideoPixelFormatKnown
public boolean isVideoPixelFormatKnown()
is the video pixel format known?- Specified by:
isVideoPixelFormatKnownin interfaceISimpleMediaFile- Returns:
- the videoPixelFormatKnown
-
setDuration
public void setDuration(ITimeValue duration)
Set the duration that we'll assume for the stream we're representing.- Specified by:
setDurationin interfaceISimpleMediaFile- Parameters:
duration- the duration to assume for this file. null means unknown.
-
getDuration
public ITimeValue getDuration()
Get the duration that we'll assume for the stream we're representing.- Specified by:
getDurationin interfaceISimpleMediaFile- Returns:
- the duration, or null if unknown.
-
setURL
public void setURL(java.lang.String uRL)
Set the URL that this stream contains info for.- Specified by:
setURLin interfaceISimpleMediaFile- Parameters:
uRL- The url, including protocol string, or null if unknown.
-
getURL
public java.lang.String getURL()
Return the URL for this stream.- Specified by:
getURLin interfaceISimpleMediaFile- Returns:
- The URL, or null if unknown.
-
getAudioSampleFormat
public IAudioSamples.Format getAudioSampleFormat()
Get the audio sample format.- Specified by:
getAudioSampleFormatin interfaceISimpleMediaFile- Returns:
- The audio sample format. Defaults to
IAudioSamples.Format.FMT_S16if not specified.
-
setAudioSampleFormat
public void setAudioSampleFormat(IAudioSamples.Format aFormat)
Set the audio sample format you want to use in this file.- Specified by:
setAudioSampleFormatin interfaceISimpleMediaFile- Parameters:
aFormat- The sample format to use.
-
-