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

    • 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:
        getMyCPtr in class IMediaData
        Returns:
        The raw pointer we're proxying for.
      • 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:
        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 java.lang.String toString()
        info about this packet
        Overrides:
        toString in class java.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:
        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
      • 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 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.
      • 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.
      • 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.