com.xuggle.xuggler
Class IVideoPicture

Package class diagram package IVideoPicture
java.lang.Object
  extended by com.xuggle.ferry.RefCounted
      extended by com.xuggle.xuggler.IMediaData
          extended by com.xuggle.xuggler.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
static class IVideoPicture.PictType
           
 
Field Summary
 
Fields inherited from class com.xuggle.xuggler.IMediaData
DEFAULT_TIME_STAMP_FORMAT
 
Fields inherited from class com.xuggle.ferry.RefCounted
swigCMemOwn
 
Constructor Summary
protected IVideoPicture(long cPtr, boolean cMemoryOwn)
          Internal Only.
protected IVideoPicture(long cPtr, boolean cMemoryOwn, AtomicLong ref)
          Internal Only.
 
Method Summary
 boolean copy(IVideoPicture srcPicture)
          Copy the contents of the given picture into this picture.
 IVideoPicture copyReference()
          Create a new IVideoPicture object that is actually referring to the exact same underlying native object.
 boolean equals(Object obj)
          Compares two values, returning true if the underlying objects in native code are the same object.
static long getCPtr(IVideoPicture obj)
          Internal Only.
 int getDataLineSize(int lineNo)
          Return the size of each line in the VideoPicture data.
 int getHeight()
          What is the height of the picture
 long getMyCPtr()
          Internal Only.
 IVideoPicture.PictType getPictureType()
          Get the picture type.
 IPixelFormat.Type getPixelType()
          Returns the pixel format of the picture.
 long getPts()
          What is the Presentation Time Stamp (in Microseconds) of this picture.
 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()
 int getSize()
          Total size in bytes of the decoded picture.
 int getWidth()
          What is the width of the picture.
 int hashCode()
          Get a hashable value for this object.
 boolean isComplete()
          Is this picture completely decoded?
 boolean isKeyFrame()
          Is this a key frame?
static IVideoPicture make(IBuffer buffer, IPixelFormat.Type format, int width, int height)
          Get a new picture object, by wrapping an existing IBuffer.
static IVideoPicture make(IPixelFormat.Type format, int width, int height)
          Get a new picture object.
static IVideoPicture make(IVideoPicture src)
          Get a new picture by copying the data in an existing frame.
 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.
 void setKeyFrame(boolean aIsKey)
          Reset if this is a key frame or not.
 void setPictureType(IVideoPicture.PictType type)
          Set the picture type.
 void setPts(long value)
          Set the Presentation Time Stamp (in Microseconds) for this picture.
 void setQuality(int newQuality)
          Set the Quality to a new value.
 String toString()
          info about this packet
 
Methods inherited from class com.xuggle.xuggler.IMediaData
delete, get, get, get, get, get, get, get, getByteBuffer, getByteBuffer, getCPtr, getData_internal, getData, getDataCached, getFormattedTimeStamp, getFormattedTimeStamp, getTimeBase, getTimeStamp, isKey, put, put, put, put, put, put, put, setData_internal, setData, setTimeBase, setTimeStamp
 
Methods inherited from class com.xuggle.ferry.RefCounted
acquire, getCPtr, getCurrentRefCount, getJavaRefCount, release
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IVideoPicture

protected IVideoPicture(long cPtr,
                        boolean cMemoryOwn)
Internal Only.


IVideoPicture

protected IVideoPicture(long cPtr,
                        boolean cMemoryOwn,
                        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:
getMyCPtr in class IMediaData
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:
copyReference in class IMediaData
Returns:
the new Java object.

equals

public boolean equals(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:
equals in class IMediaData
Returns:
True if the underlying native object is the same. False otherwise.

hashCode

public int hashCode()
Get a hashable value for this object.

Overrides:
hashCode in class IMediaData
Returns:
the hashable value.

toString

public String toString()
info about this packet

Overrides:
toString in class 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:
getSize in class IMediaData
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
See Also:
getPts()

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 complete
format - 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.

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 XUGGLER 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 XUGGLER to guess when decoding.
height - The height of the picture, in pixels, or -1 if you want XUGGLER 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()

make

public static IVideoPicture make(IBuffer buffer,
                                 IPixelFormat.Type format,
                                 int width,
                                 int height)
Get a new picture object, by wrapping an existing 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 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.


Copyright © 2008, 2010 Xuggle