Class SupHD

java.lang.Object
bdsup2sub.supstream.hd.SupHD
All Implemented Interfaces:
SubtitleStream

public class SupHD extends Object implements SubtitleStream
Reading of HD-DVD captions demuxed from EVO transport streams (HD-DVD-SUP).
  • Field Details

    • configuration

      private static final Configuration configuration
    • logger

      private static final Logger logger
    • subPictures

      private ArrayList<SubPictureHD> subPictures
      ArrayList of captions contained in the current file
    • palette

      private Palette palette
      color palette of the last decoded caption
    • bitmap

      private Bitmap bitmap
      bitmap of the last decoded caption
    • buffer

      private FileBuffer buffer
      FileBuffer to read from the file
    • primaryColorIndex

      private int primaryColorIndex
      index of dominant color for the current caption
  • Constructor Details

  • Method Details

    • close

      public void close()
      Description copied from interface: SubtitleStream
      Close input stream.
      Specified by:
      close in interface SubtitleStream
    • decodeLine

      private static void decodeLine(byte[] trg, int trgOfs, int width, int maxPixels, BitStream src)
      decode one line from the RLE buffer
      Parameters:
      trg - target buffer for uncompressed data
      trgOfs - offset in target buffer
      width - image width of encoded caption
      maxPixels - maximum number of pixels in caption
      src - source buffer
    • decodeImage

      private Bitmap decodeImage(SubPictureHD pic, int transIdx) throws CoreException
      decode caption from the input stream
      Parameters:
      pic - SubPicture object containing info about the caption
      transIdx - index of the transparent color
      Returns:
      bitmap of the decoded caption
      Throws:
      CoreException
    • decodePalette

      private Palette decodePalette(SubPictureHD pic) throws CoreException
      decode palette from the input stream
      Parameters:
      pic - SubPicture object containing info about the caption
      Returns:
      decoded palette
      Throws:
      CoreException
    • decode

      private void decode(SubPictureHD pic) throws CoreException
      decode given picture
      Parameters:
      pic - SubPicture object containing info about caption
      Throws:
      CoreException
    • decode

      public void decode(int index) throws CoreException
      Description copied from interface: SubtitleStream
      Decode caption.
      Specified by:
      decode in interface SubtitleStream
      Parameters:
      index - Index of caption
      Throws:
      CoreException
    • getPalette

      public Palette getPalette()
      Description copied from interface: SubtitleStream
      Return the Palette of the current (last decoded) frame.
      Specified by:
      getPalette in interface SubtitleStream
      Returns:
      Palette of the current frame
    • getBitmap

      public Bitmap getBitmap()
      Description copied from interface: SubtitleStream
      Return the Bitmap of the current (last decoded) frame.
      Specified by:
      getBitmap in interface SubtitleStream
      Returns:
      Bitmap of the current frame
    • getImage

      public BufferedImage getImage()
      Description copied from interface: SubtitleStream
      Return current (last decoded) frame
      Specified by:
      getImage in interface SubtitleStream
      Returns:
      Current (last decoded) frame
    • getImage

      public BufferedImage getImage(Bitmap bm)
      Description copied from interface: SubtitleStream
      Return given Bitmap as BufferedImage (using current Palette).
      Specified by:
      getImage in interface SubtitleStream
      Parameters:
      bm - Bitmap to convert.
      Returns:
      BufferedImage of given bitmap
    • getPrimaryColorIndex

      public int getPrimaryColorIndex()
      Description copied from interface: SubtitleStream
      Get index of most dominant opaque color (for DVD subtitle export).
      Specified by:
      getPrimaryColorIndex in interface SubtitleStream
      Returns:
      Index of most dominant opaque color
    • getSubPicture

      public SubPicture getSubPicture(int index)
      Description copied from interface: SubtitleStream
      Get SubPicture of given frame.
      Specified by:
      getSubPicture in interface SubtitleStream
      Parameters:
      index - Index of caption
      Returns:
      SubPicture of caption
    • getFrameCount

      public int getFrameCount()
      Description copied from interface: SubtitleStream
      Get number of frames in the currently loaded subtitle stream.
      Specified by:
      getFrameCount in interface SubtitleStream
      Returns:
      Number of frames
    • getForcedFrameCount

      public int getForcedFrameCount()
      Description copied from interface: SubtitleStream
      Get number of forced frames in the currently loaded subtitle stream.
      Specified by:
      getForcedFrameCount in interface SubtitleStream
      Returns:
      Number of forced frames
    • isForced

      public boolean isForced(int index)
      Description copied from interface: SubtitleStream
      Get forced flag of given frame.
      Specified by:
      isForced in interface SubtitleStream
      Parameters:
      index - Index of caption
      Returns:
      Forced flag of given frame
    • getEndTime

      public long getEndTime(int index)
      Description copied from interface: SubtitleStream
      Get end time stamp of given frame.
      Specified by:
      getEndTime in interface SubtitleStream
      Parameters:
      index - Index of caption
      Returns:
      End time stamp of given frame in 90kHz resolution
    • getStartTime

      public long getStartTime(int index)
      Description copied from interface: SubtitleStream
      Get start time stamp of given frame.
      Specified by:
      getStartTime in interface SubtitleStream
      Parameters:
      index - Index of caption
      Returns:
      Start time stamp of given frame in 90kHz resolution
    • getStartOffset

      public long getStartOffset(int index)
      Description copied from interface: SubtitleStream
      Get start offset (in input stream) of given frame.
      Specified by:
      getStartOffset in interface SubtitleStream
      Parameters:
      index - Index of caption
      Returns:
      Start offset of given frame in input stream