Class MpegTransportStreamMetadataExtractor

java.lang.Object
org.codice.ddf.libs.mpeg.transport.MpegTransportStreamMetadataExtractor

public class MpegTransportStreamMetadataExtractor extends Object
This class is for extracting arbitrary metadata (as raw bytes) from an MPEG transport stream.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MpegTransportStreamMetadataExtractor(com.google.common.io.ByteSource byteSource)
    Constructs an MpegTransportStreamMetadataExtractor with the given ByteSource as the provider of the transport stream bytes.
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<Integer,List<byte[]>>
    Parses the transport stream and returns all the metadata packet payloads (in the order in which they were encountered) that belong to each metadata stream.
    void
    getMetadata(BiConsumer<Integer,byte[]> callback)
    Parses the transport stream and calls the given callback for each metadata packet in each metadata stream found in the transport stream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MpegTransportStreamMetadataExtractor

      public MpegTransportStreamMetadataExtractor(com.google.common.io.ByteSource byteSource)
      Constructs an MpegTransportStreamMetadataExtractor with the given ByteSource as the provider of the transport stream bytes.
      Parameters:
      byteSource - the ByteSource providing the transport stream bytes
  • Method Details

    • getMetadata

      public void getMetadata(BiConsumer<Integer,byte[]> callback) throws Exception
      Parses the transport stream and calls the given callback for each metadata packet in each metadata stream found in the transport stream. The callback is called immediately upon finding a complete metadata packet.
      Parameters:
      callback - a callback that will be called for each metadata packet in each metadata stream found in the transport stream, where the first parameter is the packet ID of the metadata stream and the second parameter is the metadata packet's payload
      Throws:
      Exception - if an error occurs while parsing the transport stream
    • getMetadata

      public Map<Integer,List<byte[]>> getMetadata() throws Exception
      Parses the transport stream and returns all the metadata packet payloads (in the order in which they were encountered) that belong to each metadata stream.
      Returns:
      a Map whose keys are the packet IDs of the metadata streams and whose values are the packet payloads belonging to that stream
      Throws:
      Exception - if an error occurs while parsing the transport stream