Class AviRiffHandler

java.lang.Object
com.drew.metadata.avi.AviRiffHandler
All Implemented Interfaces:
RiffHandler

public class AviRiffHandler extends Object implements RiffHandler
Implementation of RiffHandler specialising in AVI support. Extracts data from chunk/list types:
  • "avih": width, height, streams
  • "strh": frames/second, samples/second, duration, video codec
Sources: http://www.alexander-noe.com/video/documentation/avi.pdf https://msdn.microsoft.com/en-us/library/ms899422.aspx https://www.loc.gov/preservation/digital/formats/fdd/fdd000025.shtml
Author:
Payton Garland
  • Constructor Details

    • AviRiffHandler

      public AviRiffHandler(Metadata metadata)
  • Method Details

    • shouldAcceptRiffIdentifier

      public boolean shouldAcceptRiffIdentifier(String identifier)
      Description copied from interface: RiffHandler
      Gets whether the specified RIFF identifier is of interest to this handler. Returning false causes processing to stop after reading only the first twelve bytes of data.
      Specified by:
      shouldAcceptRiffIdentifier in interface RiffHandler
      Parameters:
      identifier - The four character code identifying the type of RIFF data
      Returns:
      true if processing should continue, otherwise false
    • shouldAcceptChunk

      public boolean shouldAcceptChunk(String fourCC)
      Description copied from interface: RiffHandler
      Gets whether this handler is interested in the specific chunk type. Returns true if the data should be copied into an array and passed to RiffHandler.processChunk(String, byte[]), or false to avoid the copy and skip to the next chunk in the file, if any.
      Specified by:
      shouldAcceptChunk in interface RiffHandler
      Parameters:
      fourCC - the four character code of this chunk
      Returns:
      true if RiffHandler.processChunk(String, byte[]) should be called, otherwise false
    • shouldAcceptList

      public boolean shouldAcceptList(String fourCC)
      Description copied from interface: RiffHandler
      Gets whether this handler is interested in the specific list type. Returns true if the chunks should continue being processed, or false to avoid any unknown chunks within the list.
      Specified by:
      shouldAcceptList in interface RiffHandler
      Parameters:
      fourCC - the four character code of this chunk
      Returns:
      true if RiffHandler.processChunk(String, byte[]) should be called, otherwise false
    • processChunk

      public void processChunk(String fourCC, byte[] payload)
      Description copied from interface: RiffHandler
      Perform whatever processing is necessary for the type of chunk with its payload. This is only called if a previous call to RiffHandler.shouldAcceptChunk(String) with the same fourCC returned true.
      Specified by:
      processChunk in interface RiffHandler
      Parameters:
      fourCC - the four character code of the chunk
      payload - they payload of the chunk as a byte array
    • addError

      public void addError(String message)
      Description copied from interface: RiffHandler
      Registers an error message for consumption after extraction.
      Specified by:
      addError in interface RiffHandler
      Parameters:
      message - the error message