Class FrameEncoders

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class FrameEncoders
    extends Inventor
    implements java.lang.Cloneable
    Defines a pair of encoders that are used to encode still and interactive frames. Default value for both still and interactive is NONE when a FrameEncoders object is created. But when a client connects to the service, RemoteViz will set PNG for still frames and JPEG for interactive frames. Frames are considered "interactive" when the user is interacting with the scene, for example dragging the mouse to move the camera. In this case it may be acceptable to use (for example) lossy JPEG encoding to maximize performance, then switch to loss-less PNG encoding for the "still" frame when the user interaction is finished.

    Video encoding (H.264 or VP9) generally provides better performance (frames per second) than image encoding (JPEG and PNG). However this depends on many factors. Video encoded frames usually require less bandwidth, but the encoding of each frame can take more time. See the hardware and software dependencies for each encoder below.

    A FrameEncoders object is passed to the RenderAreaListener methods onOpenedConnection(), onInitializedConnection() and onRefusedEncoder().

    • In the onOpenedConnection() method, use the FrameEncoders object to request non-default encoders. Use the ConnectionSettings.isSupportedEncoders() method to query if the proposed encoders are available.
    • onRefusedEncoder() will be called if one of the encoders is not supported in the current environment or the combination of encoders is not supported. Use the FrameEncoders object to determine which encoder is invalid (see getStillEncoderStatus() and getInteractiveEncoderStatus()), then set new encoders. onRefusedEncoder() will be called again if the requested encoders are not valid.
    • In the onInitializedConnection() method, use the FrameEncoders object to query which encoders will actually be used.

    The current frame encoders can also be queried using ConnectionSettings.getFrameEncoders().

    See also ConnectionSettings.setFrameEncodingPolicy().

    See the examples HelloConeH264 and HelloConeVP9.

    Limitations:

    • Currently it is not possible to "mix" video and image encoding.
      In other words, the interactive and still encoders must be both video encoders (H264, VP9, ...) or both image encoders (JPEG, PNG, ...).
    • Currently, when using video encoding, the interactive and still encoders must be the same, e.g. both H264_NVENC.

    • Constructor Detail

      • FrameEncoders

        public FrameEncoders​(FrameEncoders obj)
        Copy constructor.
      • FrameEncoders

        public FrameEncoders()
        Constructor.
    • Method Detail

      • clone

        public java.lang.Object clone()
      • getInteractiveEncoderStatus

        public FrameEncoders.Status getInteractiveEncoderStatus()
        Gets the interactive encoder status.
        Default value is UNSUPPORTED.

        Returns:
        the interactive encoder status.

      • getInteractiveEncoder

        public FrameEncoders.Encoders getInteractiveEncoder()
        Gets the interactive encoder.
        Default value is NONE when a FrameEncoders object is created. But note that, by default, RemoteViz will set this value to JPEG when a connection is initialized.

        Returns:
        the interactive encoder.

      • getStillEncoderStatus

        public FrameEncoders.Status getStillEncoderStatus()
        Gets the still encoder status.
        Default value is UNSUPPORTED.

        Returns:
        the still encoder status.

      • setStillEncoder

        public void setStillEncoder​(FrameEncoders.Encoders value)
        Sets the still encoder.
        This encoder will be used to encode still frames.
        Default value is NONE when a FrameEncoders object is created. But note that, by default, RemoteViz will set this value to PNG when a connection is initialized.

        Parameters:
        value - : still encoder.
      • setInteractiveEncoder

        public void setInteractiveEncoder​(FrameEncoders.Encoders value)
        Sets the interactive encoder.
        This encoder will be used to encode interactive frames. Default value is NONE when a FrameEncoders object is created. But note that, by default, RemoteViz will set this value to JPEG when a connection is initialized.

        Parameters:
        value - : interactive encoder.
      • getStillEncoder

        public FrameEncoders.Encoders getStillEncoder()
        Gets the still encoder.
        Default value is NONE when a FrameEncoders object is created. But note that, by default, RemoteViz will set this value to PNG when a connection is initialized.

        Returns:
        the still encoder.