Class SupXml

java.lang.Object
bdsup2sub.supstream.bdnxml.SupXml
All Implemented Interfaces:
SubtitleStream

public class SupXml extends Object implements SubtitleStream
Reading and writing of Blu-Ray captions in Xml/Png format.
  • Field Details

    • configuration

      private static final Configuration configuration
    • logger

      private static final Logger logger
    • subPictures

      private List<SubPictureXml> 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
    • primaryColorIndex

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

      private int numForcedFrames
      number of forced captions in the current file
    • pathName

      private String pathName
      path of the input stream
    • title

      private String title
      file name of XML file used as title
    • language

      private String language
      language id read from the xml
    • resolution

      private Resolution resolution
      resolution read from the xml
    • fps

      private double fps
      frame rate read from the stream
    • fpsXml

      private double fpsXml
      converted xml frame rate read from the stream
    • xmlStates

      private static final String[] xmlStates
  • Constructor Details

    • SupXml

      public SupXml(String filename) throws CoreException
      Constructor (for reading)
      Parameters:
      filename - file name of Xml file to read
      Throws:
      CoreException
  • Method Details

    • XmlFps

      private static double XmlFps(double fps)
      Return an integer frame rate in BDN XML style
      Parameters:
      fps - source frame rate
      Returns:
      next integer frame rate (yet returned as double)
    • close

      public void close()
      Description copied from interface: SubtitleStream
      Close input stream.
      Specified by:
      close in interface SubtitleStream
    • 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
    • writeXml

      public static void writeXml(String fname, SortedMap<Integer,SubPicture> pics) throws CoreException
      Create Xml file
      Parameters:
      fname - file name
      pics - Map of SubPictures and their original indexes which were used to generate the png file names
      Throws:
      CoreException
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • getPNGname

      public static String getPNGname(String fn, int idx)
      Create PNG name from (xml) file name and index
      Parameters:
      fn - file name
      idx - index
      Returns:
      PNG name
    • getLanguage

      public String getLanguage()
      get language read from Xml
      Returns:
      language as String
    • getFps

      public double getFps()
      get fps read from Xml
      Returns:
      frame rate as double