Class EncodingAttributes

java.lang.Object
ws.schild.jave.encode.EncodingAttributes
All Implemented Interfaces:
Serializable

public class EncodingAttributes extends Object implements Serializable
Attributes controlling the encoding process.
Author:
Carlo Pelliccia
See Also:
  • Constructor Details

    • EncodingAttributes

      public EncodingAttributes()
  • Method Details

    • getExtraContext

      public Map<String,String> getExtraContext()
      Returns any additional user supplied context. Meant to be used in conjunction with Encoder.addOptionAtIndex(EncodingArgument, Integer)
      Returns:
      extra context
    • setExtraContext

      public EncodingAttributes setExtraContext(Map<String,String> context)
      Adds all key/value pairs from context to the extraContext private variable.Meant to be used in conjunction with Encoder.addOptionAtIndex(EncodingArgument, Integer).Add context here and retrieve the context via an EncodingArgument.
      Parameters:
      context - extra context
      Returns:
      the EncodingAttributes
    • getInputFormat

      public Optional<String> getInputFormat()
      Returns the format name for the incoming multimedia file.
      Returns:
      The format name for the incoming multimedia file.
    • setInputFormat

      public EncodingAttributes setInputFormat(String inputFormat)
      Sets the format name for the source multimedia file.
      Parameters:
      inputFormat - the format name for the incoming multimedia file.
      Returns:
      this instance
    • getOutputFormat

      public Optional<String> getOutputFormat()
      Returns the format name for the encoded target multimedia file.
      Returns:
      The format name for the encoded target multimedia file.
    • setOutputFormat

      public EncodingAttributes setOutputFormat(String format)
      Sets the format name for the encoded target multimedia file. Be sure this format is supported (see Encoder.getSupportedEncodingFormats().
      Parameters:
      format - The format name for the encoded target multimedia file.
      Returns:
      this instance
    • getOffset

      public Optional<Float> getOffset()
      Returns the start offset time (seconds).
      Returns:
      The start offset time (seconds).
    • setOffset

      public EncodingAttributes setOffset(Float offset)
      Sets the start offset time (seconds). If null or not specified no start offset will be applied.
      Parameters:
      offset - The start offset time (seconds).
      Returns:
      this instance
    • getDuration

      public Optional<Float> getDuration()
      Returns the duration (seconds) of the re-encoded stream.
      Returns:
      The duration (seconds) of the re-encoded stream.
    • setDuration

      public EncodingAttributes setDuration(Float duration)
      Sets the duration (seconds) of the re-encoded stream. If null or not specified the source stream, starting from the offset, will be completely re-encoded in the target stream.
      Parameters:
      duration - The duration (seconds) of the re-encoded stream.
      Returns:
      this instance
    • getLoop

      public boolean getLoop()
      Returns if the input is to be considered for looping.
      Returns:
      if the input will be looped.
    • setLoop

      public EncodingAttributes setLoop(boolean loop)
      Sets if the inputs will be looped or not.
      Parameters:
      loop - if the input should be looped.
      Returns:
      this instance
    • getSafe

      public Optional<Integer> getSafe()
      Returns whether or not the encoder will consider file paths "safe".
      Returns:
      Whether or not the encoder will consider file paths "safe".
      See Also:
    • setSafe

      public EncodingAttributes setSafe(Integer safe)
      Are the file paths considered "safe": A file path is considered safe if it does not contain a protocol specification and is relative and all components only contain characters from the portable character set (letters, digits, period, underscore and hyphen) and have no period at the beginning of a component.
      Parameters:
      safe - 0 for not safe; 1 for safe; is equivalent to 1 if the format was automatically probed and 0 otherwise. 1 is the default
      Returns:
      The EncodingAttributes
      See Also:
    • getAudioAttributes

      public Optional<AudioAttributes> getAudioAttributes()
      Returns the attributes for the encoding of the audio stream in the target multimedia file.
      Returns:
      The attributes for the encoding of the audio stream in the target multimedia file.
    • setAudioAttributes

      public EncodingAttributes setAudioAttributes(AudioAttributes audioAttributes)
      Sets the attributes for the encoding of the audio stream in the target multimedia file. If null of not specified no audio stream will be encoded. It cannot be null if also the video field is null.
      Parameters:
      audioAttributes - The attributes for the encoding of the audio stream in the target multimedia file.
      Returns:
      this instance
    • getVideoAttributes

      public Optional<VideoAttributes> getVideoAttributes()
      Returns the attributes for the encoding of the video stream in the target multimedia file.
      Returns:
      The attributes for the encoding of the video stream in the target multimedia file.
    • setVideoAttributes

      public EncodingAttributes setVideoAttributes(VideoAttributes videoAttributes)
      Sets the attributes for the encoding of the video stream in the target multimedia file. If null of not specified no video stream will be encoded. It cannot be null if also the audio field is null.
      Parameters:
      videoAttributes - The attributes for the encoding of the video stream in the target multimedia file.
      Returns:
      this instance
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isMapMetaData

      public boolean isMapMetaData()
      Returns:
      the mapMetaData
    • setMapMetaData

      public EncodingAttributes setMapMetaData(boolean mapMetaData)
      Copy over meta data from original file to new output if possible
      Parameters:
      mapMetaData - the mapMetaData to set
      Returns:
      this instance
    • getFilterThreads

      public Optional<Integer> getFilterThreads()
      Returns:
      Maximum number of cores/cpus to use for filtering -1 means use default of ffmpeg
    • setFilterThreads

      public EncodingAttributes setFilterThreads(int filterThreads)
      ffmpeg uses multiple cores for filtering
      Parameters:
      filterThreads - Maximum number of cores/cpus to use -1 means use default of ffmpeg
      Returns:
      this instance
    • getDecodingThreads

      public Optional<Integer> getDecodingThreads()
      Number of threads to use for decoding (if supported by codec) -1 means use default of ffmpeg
      Returns:
      the decodingThreads
    • setDecodingThreads

      public EncodingAttributes setDecodingThreads(int decodingThreads)
      Number of threads to use for decoding (if supported by codec) -1 means use default of ffmpeg
      Parameters:
      decodingThreads - the decodingThreads to set
      Returns:
      this instance
    • getEncodingThreads

      public Optional<Integer> getEncodingThreads()
      Number of threads to use for encoding (if supported by codec) No value (Optional.empty()) means use default of ffmpeg
      Returns:
      the encodingThreads
    • setEncodingThreads

      public EncodingAttributes setEncodingThreads(Integer encodingThreads)
      Number of threads to use for encoding (if supported by codec) null means use default of ffmpeg
      Parameters:
      encodingThreads - the encodingThreads to set
      Returns:
      this instance
    • validate

      public void validate()