Class IVideoPicture
- java.lang.Object
-
- com.avpkit.ferry.RefCounted
-
- com.avpkit.core.IMediaData
-
- com.avpkit.core.IVideoPicture
-
public class IVideoPicture extends IMediaData
Represents one raw (undecoded) picture in a video stream, plus a timestamp
for when to display that video picture relative to other items in a {IContainer}.
All timestamps for this object are always in Microseconds.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIVideoPicture.FrameDataTypestatic classIVideoPicture.PictTypeThe different types of images that we can set.
-
Field Summary
-
Fields inherited from class com.avpkit.core.IMediaData
DEFAULT_TIME_STAMP_FORMAT
-
Fields inherited from class com.avpkit.ferry.RefCounted
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIVideoPicture(long cPtr, boolean cMemoryOwn)Internal Only.protectedIVideoPicture(long cPtr, boolean cMemoryOwn, java.util.concurrent.atomic.AtomicLong ref)Internal Only.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancopy(IVideoPicture srcPicture)Copy the contents of the given picture into this picture.IVideoPicturecopyReference()Create a new IVideoPicture object that is actually referring to the exact same underlying native object.booleanequals(java.lang.Object obj)Compares two values, returning true if the underlying objects in native code are the same object.static longgetCPtr(IVideoPicture obj)Internal Only.intgetDataLineSize(int lineNo)Return the size of each line in the VideoPicture data.intgetHeight()What is the height of the picture
longgetMyCPtr()Internal Only.IVideoPicture.PictTypegetPictureType()Get the picture type.IPixelFormat.TypegetPixelType()Returns the pixel format of the picture.
longgetPts()What is the Presentation Time Stamp (in Microseconds) of this picture.
The PTS is is scaled so that 1 PTS =
1/1,000,000 of a second.
intgetQuality()This value is the quality setting this VideoPicture had when it was
decoded, or is the value to use when this picture is next
encoded (if reset with setQuality()
intgetSize()Total size in bytes of the decoded picture.
intgetWidth()What is the width of the picture.
inthashCode()Get a hashable value for this object.booleanisComplete()Is this picture completely decoded?
booleanisKeyFrame()Is this a key frame?
static IVideoPicturemake(IPixelFormat.Type format, int width, int height)Get a new picture object.static IVideoPicturemake(IVideoPicture src)Get a new picture by copying the data in an existing frame.static IVideoPicturemake(IBuffer buffer, IPixelFormat.Type format, int width, int height)Get a new picture object, by wrapping an existing
{com.avpkit.ferry.IBuffer}.voidrender()Render this picture on configured surface.voidrender(boolean drop)Render this picture on configured surface.voidrender(boolean drop, long timeStamp)Render this picture on configured surface.voidsetComplete(boolean aIsComplete, IPixelFormat.Type format, int width, int height, long pts)After modifying the raw data in this buffer, call this function to
let the object know it is now complete.
voidsetKeyFrame(boolean aIsKey)Reset if this is a key frame or not.voidsetPictureType(IVideoPicture.PictType type)Set the picture type.
voidsetPts(long value)Set the Presentation Time Stamp (in Microseconds) for this picture.
voidsetQuality(int newQuality)Set the Quality to a new value.voidsetSideData(IVideoPicture.FrameDataType type, IBuffer buffer)java.lang.StringtoString()info about this packet-
Methods inherited from class com.avpkit.core.IMediaData
delete, get, get, get, get, get, get, get, getByteBuffer, getByteBuffer, getCPtr, getData, getData_internal, getDataCached, getFormattedTimeStamp, getFormattedTimeStamp, getTimeBase, getTimeStamp, isKey, put, put, put, put, put, put, put, setData, setData_internal, setTimeBase, setTimeStamp
-
Methods inherited from class com.avpkit.ferry.RefCounted
acquire, getCPtr, getCurrentRefCount, getJavaRefCount, release
-
-
-
-
Constructor Detail
-
IVideoPicture
protected IVideoPicture(long cPtr, boolean cMemoryOwn)
Internal Only.
-
IVideoPicture
protected IVideoPicture(long cPtr, boolean cMemoryOwn, java.util.concurrent.atomic.AtomicLong ref)
Internal Only.
-
-
Method Detail
-
getCPtr
public static long getCPtr(IVideoPicture obj)
Internal Only. Not part of public API. Get the raw value of the native object that obj is proxying for.- Parameters:
obj- The java proxy object for a native object.- Returns:
- The raw pointer obj is proxying for.
-
getMyCPtr
public long getMyCPtr()
Internal Only. Not part of public API. Get the raw value of the native object that we're proxying for.- Overrides:
getMyCPtrin classIMediaData- Returns:
- The raw pointer we're proxying for.
-
copyReference
public IVideoPicture copyReference()
Create a new IVideoPicture object that is actually referring to the exact same underlying native object.- Overrides:
copyReferencein classIMediaData- Returns:
- the new Java object.
-
equals
public boolean equals(java.lang.Object obj)
Compares two values, returning true if the underlying objects in native code are the same object. That means you can have two different Java objects, but when you do a comparison, you'll find out they are the EXACT same object.- Overrides:
equalsin classIMediaData- Returns:
- True if the underlying native object is the same. False otherwise.
-
hashCode
public int hashCode()
Get a hashable value for this object.- Overrides:
hashCodein classIMediaData- Returns:
- the hashable value.
-
toString
public java.lang.String toString()
info about this packet- Overrides:
toStringin classjava.lang.Object- Returns:
- information about this packet
-
isKeyFrame
public boolean isKeyFrame()
Is this a key frame?
- Returns:
- is this a key frame
-
setKeyFrame
public void setKeyFrame(boolean aIsKey)
Reset if this is a key frame or not. Note that regardless of how
this flag is set, an IVideoPicture always contains raw video data (hence the
key setting isn't really that important).
- Parameters:
aIsKey- True if a key frame; false if not.
-
isComplete
public boolean isComplete()
Is this picture completely decoded?
- Returns:
- is this picture completely decoded?
-
getSize
public int getSize()
Total size in bytes of the decoded picture.
- Overrides:
getSizein classIMediaData- Returns:
- number of bytes of decoded picture
-
getWidth
public int getWidth()
What is the width of the picture.
- Returns:
- the width of the picture
-
getHeight
public int getHeight()
What is the height of the picture
- Returns:
- the height of the picture
-
getPixelType
public IPixelFormat.Type getPixelType()
Returns the pixel format of the picture.
- Returns:
- the pixel format of the picture.
-
getPts
public long getPts()
What is the Presentation Time Stamp (in Microseconds) of this picture.
The PTS is is scaled so that 1 PTS =
1/1,000,000 of a second.
- Returns:
- the presentation time stamp (pts)
-
setPts
public void setPts(long value)
Set the Presentation Time Stamp (in Microseconds) for this picture.
- Parameters:
value- the new timestamp
-
getQuality
public int getQuality()
This value is the quality setting this VideoPicture had when it was
decoded, or is the value to use when this picture is next
encoded (if reset with setQuality()
- Returns:
- The quality.
-
setQuality
public void setQuality(int newQuality)
Set the Quality to a new value. This will be used the
next time this VideoPicture is encoded by a StreamCoder
- Parameters:
newQuality- The new quality.
-
getDataLineSize
public int getDataLineSize(int lineNo)
Return the size of each line in the VideoPicture data. Usually there
are no more than 4 lines, but the first line no that returns 0
is the end of the road.
- Parameters:
lineNo- The line you want to know the (byte) size of.
- Returns:
- The size (in bytes) of that line in data.
-
setComplete
public void setComplete(boolean aIsComplete, IPixelFormat.Type format, int width, int height, long pts)
After modifying the raw data in this buffer, call this function to
let the object know it is now complete.
- Parameters:
aIsComplete- Is this VideoPicture completeformat- The pixel format of the data in this picture. Must match
what the picture was originally constructed with.width- The width of the data in this picture. Must match what
the picture was originally constructed with.height- The height of the data in this picture. Must match what
the picture was originally constructed with.pts- The presentation timestamp of the picture that is now complete.
The caller must ensure this PTS is in units of 1/1,000,000 seconds.
-
copy
public boolean copy(IVideoPicture srcPicture)
Copy the contents of the given picture into this picture. All
buffers are copied by value, not be reference.
- Parameters:
srcPicture- The picture you want to copy.
- Returns:
- true if a successful copy; false if not.
-
render
public void render(boolean drop, long timeStamp)
Render this picture on configured surface.
Works only with HW accelerated {com.avpkit.core.IPixelFormat}.
{com.avpkit.core.IStreamCoder#setHardwareDecoding(IPixelFormat.Type, Object)}
must be called before opening decoder.
-
render
public void render(boolean drop)
Render this picture on configured surface.
Works only with HW accelerated {com.avpkit.core.IPixelFormat}.
{com.avpkit.core.IStreamCoder#setHardwareDecoding(IPixelFormat.Type, Object)}
must be called before opening decoder.
-
render
public void render()
Render this picture on configured surface.
Works only with HW accelerated {com.avpkit.core.IPixelFormat}.
{com.avpkit.core.IStreamCoder#setHardwareDecoding(IPixelFormat.Type, Object)}
must be called before opening decoder.
-
make
public static IVideoPicture make(IPixelFormat.Type format, int width, int height)
Get a new picture object.
You can specify -1 for width and height, in which case all getData() methods
will return error until AVPKIT decodes something into this frame. In general
you should always try to specify the width and height.
Note that any buffers this objects needs will be
lazily allocated (i.e. we won't actually grab all
the memory until we need it).
This is useful because
it allows you to hold a IVideoPicture object that remembers
things like format, width, and height, but know
that it doesn't actually take up a lot of memory until
the first time someone tries to access that memory.
- Parameters:
format- The pixel format (for example, YUV420P).width- The width of the picture, in pixels, or -1 if you want AVPKIT to guess when decoding.height- The height of the picture, in pixels, or -1 if you want AVPKIT to guess when decoding.- Returns:
- A new object, or null if we can't allocate one.
-
make
public static IVideoPicture make(IVideoPicture src)
Get a new picture by copying the data in an existing frame.- Parameters:
src- The picture to copy.- Returns:
- The new picture, or null on error.
-
getPictureType
public IVideoPicture.PictType getPictureType()
Get the picture type.
This will be set on decoding to tell you what type of
packet this was decoded from, and when encoding
is a request to the encoder for how to encode the picture.
The request may be ignored by your codec.
- Returns:
- the picture type.
-
setPictureType
public void setPictureType(IVideoPicture.PictType type)
Set the picture type.
- Parameters:
type- The type.
- See Also:
getPictureType()
-
setSideData
public void setSideData(IVideoPicture.FrameDataType type, IBuffer buffer)
-
make
public static IVideoPicture make(IBuffer buffer, IPixelFormat.Type format, int width, int height)
Get a new picture object, by wrapping an existing
{com.avpkit.ferry.IBuffer}.
Use this method if you have existing video data that you want
to have us wrap and pass to FFmpeg. Note that if decoding
into this video picture and the decoded data actually takes more
space than is in this buffer, this object will release the reference
to the passed in buffer and allocate a new buffer instead so the decode
can continue.
Due to some decoders assembly optimizations, you should ensure the
IBuffer you pass in has at least 8 more bytes than would typically
be required based on the format, width and height.
- Parameters:
buffer- The {com.avpkit.ferry.IBuffer} to wrap.format- The pixel format (for example, YUV420P).width- The width of the picture, in pixels.height- The height of the picture, in pixels.- Returns:
- A new object, or null if we can't allocate one.
-
-