deadbeef.SupTools
Class Core

java.lang.Object
  extended by java.lang.Thread
      extended by deadbeef.SupTools.Core
All Implemented Interfaces:
java.lang.Runnable

public class Core
extends java.lang.Thread

This class contains the core functionality of BDSup2Sub.
It's meant to be used from the command line as well as from the GUI.

Author:
0xdeadbeef

Nested Class Summary
static class Core.InputMode
          Enumeration of input modes
static class Core.MoveModeX
          Enumeration of modes for moving of captions in X direction
static class Core.MoveModeY
          Enumeration of modes for moving of captions in Y direction
static class Core.OutputMode
          Enumeration of output modes
static class Core.PaletteMode
          Enumeration of palette modes
static class Core.Resolution
          Enumeration of supported resolutions
static class Core.RunType
          Enumeration of functionalities executed in the started thread
static class Core.ScalingFilters
          Enumeration of filters that can be applied for scaling
static class Core.SetState
          Enumeration for set/clear/keep states
static class Core.State
          Enumeration of run states (used for threaded reading/converting)
static class Core.StreamID
          Enumeration of input stream identifiers
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static double FPS_23_975
          Frames per seconds for wrong 24P (23.975)
static double FPS_24HZ
          Frames per seconds for 24Hz (24.0)
static double FPS_24P
          Frames per seconds for 24p (23.976)
static double FPS_NTSC
          Frames per seconds for NTSC progressive (29.97)
static double FPS_NTSC_I
          Frames per seconds for NTSC interlaced (59.94)
static double FPS_PAL
          Frames per seconds for PAL progressive (25.0)
static double FPS_PAL_I
          Frames per seconds for PAL interlaced (50.0)
static double maxScale
          Maximum value for free scaling factor
static double minScale
          Minimum value for free scaling factor
static Props props
          Class used to load/store properties persistently
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Core()
           
 
Method Summary
static void addRecent(java.lang.String s)
          Add a new entry to the list of recently loaded files
static void cancel()
          Force Core to cancel current operation.
static void close()
          Reset the core, close all files
static void convertSup(int index, int displayNum, int displayMax)
          Convert source subpicture image to target subpicture image.
static void convertSup(int index, int displayNum, int displayMax, boolean skipScaling)
          Convert source subpicture image to target subpicture image.
static void createSubThreaded(java.lang.String fname, javax.swing.JFrame parent)
          Write a VobSub or BD-SUP in a thread and display the progress dialog.
static void exit()
          Shut down the Core (write properties, close files etc.).
static int getAlphaCrop()
          Get alpha threshold for cropping.
static int getAlphaThr()
          Get alpha threshold.
static boolean getApplyFreeScale()
          Report whether free scaling is active or not.
static boolean getApplyFreeScaleDefault()
          get default value for applying of free scaling
static java.lang.String getAuthorDate()
          Get author and date info.
static boolean getConvertFPS()
          Get flag that tells whether or not to convert the frame rate.
static boolean getConvertFPSdefault()
          get default value for frame rate conversion
static boolean getConvertResolution()
          Get flag that tells whether or not to convert the resolution.
static boolean getConvertResolutionDefault()
          get default value for resolution conversion
static int getCropOfsY()
          Get Y coordinate cropping offset.
static Palette getCurrentDVDPalette()
          Get current DVD palette.
static Core.StreamID getCurrentStreamID()
          Get current input stream ID.
static Palette getCurSrcDVDPalette()
          Get modified imported palette if input is DVD format.
static Palette getDefaultDVDPalette()
          Get default DVD palette.
static double getDefaultFPS(Core.Resolution r)
          Get default frame rate for given resolution.
static Palette getDefSrcDVDPalette()
          Get imported palette if input is DVD format.
static int getDelayPTS()
          Get delay to add to time stamps.
static int getDelayPTSdefault()
          get default value for delay
static int getErrors()
          Get the number of errors.
static boolean getExportForced()
          Get flag that tells whether or not to export only forced subtitles.
static boolean getFixShortFrames()
          Set flag that tells whether to fix frames shorter than minTimePTS.
static boolean getFixShortFramesDefault()
          get default value for fixing short frame
static boolean getFixZeroAlpha()
          Get: fix completely invisibly subtitles due to alpha=0 (SUB/IDX and SUP/IFO import only).
static Core.SetState getForceAll()
          Request setting of forced flag for all captions
static double getFPS(java.lang.String s)
          Convert a string containing a frame rate to a double representation.
static double getFPSSrc()
          Get source frame rate.
static boolean getFpsSrcCertain()
          Get: source frame rate is certain
static double getFpsSrcDefault()
          get default value for source frame rate
static double getFPSTrg()
          Get target frame rate.
static double getFpsTrgDefault()
          get default value for target frame rate
static int[] getFrameAlpha(int index)
          Return frame alpha values of given subtitle.
static int[] getFramePal(int index)
          Return frame palette of given subtitle.
static double getFreeScaleX()
          Get free scaling factor.
static double getFreeScaleXdefault()
          get default value for free x scaling factor
static double getFreeScaleY()
          Get free scaling factor.
static double getFreeScaleYdefault()
          get default value for free y scaling factor
static Core.InputMode getInputMode()
          Get input mode.
static boolean getKeepFps()
          Get: use source fps for target fps if possible.
static int getLanguageIdx()
          Get language index for VobSub (and XML) export.
static java.lang.String[][] getLanguages()
          Get two dimensional array with languages where [i][0] is full name, [i][1] is two character short name.
static int[] getLumThr()
          Get luminance thresholds.
static deadbeef.GUI.MainFrame getMainFrame()
          Get reference to the main frame.
static int getMergePTSdiff()
          Get maximum time difference for merging captions.
static int getMinTimePTS()
          Get minimum frame duration in 90kHz resolution.
static int getMinTimePTSdefault()
          get default value for minimum display time
static boolean getMoveCaptions()
          Get: keep move settings after loading a new stream
static Core.MoveModeX getMoveModeX()
          Get: move mode in X direction
static Core.MoveModeY getMoveModeY()
          Get: move mode in Y direction
static int getMoveOffsetX()
          Get: Additional x offset to consider when moving
static int getMoveOffsetY()
          Get: Additional y offset to consider when moving
static int getNumForcedFrames()
          Get number of forced subtitles.
static int getNumFrames()
          Get number of subtitles.
static int[] getOriginalFrameAlpha(int index)
          Return original frame alpha values of given subtitle.
static int[] getOriginalFramePal(int index)
          Return original frame palette of given subtitle.
static java.lang.String getOutputFormatName(Core.OutputMode m)
          Get string representation of output mode.
static Core.OutputMode getOutputMode()
          Get output mode.
static Core.Resolution getOutputResolution()
          Get output resolution.
static Core.PaletteMode getPaletteMode()
          Get palette creation mode.
static java.lang.String getPaletteModeName(Core.PaletteMode m)
          Return name string for given palette creation mode.
static java.lang.String getProgName()
          Get program name (excluding version).
static java.lang.String getProgVerName()
          Get program name (including version).
static java.util.ArrayList<java.lang.String> getRecentFiles()
          Return list of recently loaded files
static int[] getResolution(Core.Resolution r)
          Get width and height for given resolution.
static Core.Resolution getResolution(int w, int h)
          Find the most fitting resolution for the given width and height
static Core.Resolution getResolutionDefault()
          get default target resolution
static java.lang.String getResolutionName(Core.Resolution r)
          Get Idx string representation of resolution.
static java.lang.String getResolutionNameXml(Core.Resolution r)
          Get Xml string representation of resolution.
static Core.ScalingFilters getScalingFilter()
          Get current scaling filter.
static java.lang.String getScalingFilterName(Core.ScalingFilters f)
          Get name for scaling filter.
static java.awt.image.BufferedImage getSrcImage()
          Get source image as BufferedImage.
static java.awt.image.BufferedImage getSrcImage(int idx)
          Get source image as BufferedImage.
static java.lang.String getSrcInfoStr(int index)
          Create info string for source subtitle.
static Core.State getStatus()
          Get Core state.
static Core.StreamID getStreamID(byte[] id)
          Identifies a stream by examining the first two bytes.
static SubPicture getSubPictureSrc(int index)
          Get source subpicture.
static SubPicture getSubPictureTrg(int index)
          Get target subpicture.
static boolean getSwapCrCb()
          Get flag that defines whether to swap Cr/Cb components when loading a SUP.
static boolean getTrgExcluded(int index)
          Get exclude (from export) state of target.
static int getTrgHeight(int index)
          Get screen height of target.
static java.awt.image.BufferedImage getTrgImage()
          Get target image as BufferedImage.
static java.awt.image.BufferedImage getTrgImagePatched(SubPicture pic)
          Get target image as BufferedImage.
static int getTrgImgHeight(int index)
          Get subtitle height of target.
static int getTrgImgWidth(int index)
          Get subtitle width of target.
static java.lang.String getTrgInfoStr(int index)
          Create info string for target subtitle.
static int getTrgOfsX(int index)
          Get subtitle x offset of target.
static int getTrgOfsY(int index)
          Get subtitle y offset of target.
static int getTrgWidth(int index)
          Get screen width of target.
static boolean getVerbatim()
          Get verbatim console output mode.
static int getWarnings()
          Get the number of warnings.
static boolean getWritePGCEditPal()
          Get: write PGCEdit palette file on export.
static void init(java.lang.Object c)
          Initialize the Core - call this before calling readSub or other Core functionality.
static boolean isCancelled()
          Get cancel state.
static boolean isReady()
          Get Core ready state.
static void loadedHook()
          Hook to be called when the first file was loaded via the GUI
static void moveAllThreaded(javax.swing.JFrame parent)
          Move all subpictures into or outside given bounds in a thread and display the progress dialog.
static void moveAllToBounds()
          Move all subpictures into or outside given bounds.
static void moveToBounds(SubPicture pic, int idx, double barFactor, int offsetX, int offsetY, Core.MoveModeX mmx, Core.MoveModeY mmy, int cropOffsetY)
          Move subpicture into or outside given bounds.
static void print(java.lang.String s)
          Print string to console or console window (only printed in verbatim mode).
static void printErr(java.lang.String s)
          Print error string to console or console window (always printed).
static void printWarn(java.lang.String s)
          Print warning string to console or console window (always printed).
static void printX(java.lang.String s)
          Print string to console or console window (always printed).
static void readDVDSubstream(java.lang.String fname, boolean isVobSub)
          Read VobSub or SUP/IFO.
static void readStreamThreaded(java.lang.String fname, javax.swing.JFrame parent, Core.StreamID sid)
          Read a subtitle stream in a thread and display the progress dialog.
static void readSup(java.lang.String fname)
          Read BD-SUP or HD-DVD-SUP.
static void readSupIfo(java.lang.String fname)
          Read SUP/IFO.
static void readVobSub(java.lang.String fname)
          Read VobSub.
static void readXml(java.lang.String fname)
          Read Sony BDN XML file.
static void reScanSubtitles(Core.Resolution resOld, double fpsTrgOld, int delayOld, boolean convertFpsOld, double fsXOld, double fsYOld)
          Same as scanSubtitles, but consider existing frame copies.
static void resetErrors()
          Reset the number of errors.
static void resetWarnings()
          Reset the number of warnings.
static boolean restoreApplyFreeScale()
          restore value for applying of free scaling
static boolean restoreConvertFPS()
          restore value for frame rate conversion
static boolean restoreConvertResolution()
          restore value for resolution conversion
static int restoreDelayPTS()
          restore value for delay
static boolean restoreFixShortFrames()
          restore value for fixing short frame
static double restoreFpsSrc()
          restore value for source frame rate
static double restoreFpsTrg()
          restore value for target frame rate
static double restoreFreeScaleX()
          restore value for free x scaling factor
static double restoreFreeScaleY()
          restore value for free y scaling factor
static int restoreMinTimePTS()
          restore value for minimum display time
static Core.Resolution restoreResolution()
          restore default target resolution
 void run()
          Thread used for threaded import/export.
static void scanSubtitles()
          Create a copy of the loaded subpicture information frames.
static void setAlphaCrop(int a)
          Set alpha threshold for cropping.
static void setAlphaThr(int at)
          Set alpha threshold.
static void setApplyFreeScale(boolean f)
          Enable/disable free scaling
static void setCineBarFactor(double f)
          Set: factor of cinemascope bars (needed for moving after cropping).
static void setConvertFPS(boolean b)
          Set flag that tells whether or not to convert the frame rate.
static void setConvertResolution(boolean b)
          Set flag that tells whether or not to convert the resolution.
static void setCropOfsY(int ofs)
          Set Y coordinate cropping offset.
static void setCurrentDVDPalette(Palette pal)
          Set current DVD palette.
static void setCurrentStreamID(Core.StreamID sid)
          Set current input stream ID.
static void setCurSrcDVDPalette(Palette pal)
          Set modified imported palette.
static void setDelayPTS(int delay)
          Set delay to add to time stamps.
static void setExportForced(boolean b)
          Set flag that tells whether or not to export only forced subtitles.
static void setFixShortFrames(boolean b)
          Set flag that tells whether to fix frames shorter than minTimePTS.
static void setFixZeroAlpha(boolean e)
          Set: fix completely invisibly subtitles due to alpha=0 (SUB/IDX and SUP/IFO import only).
static void setForceAll()
          Apply the state of forceAll to all captions
static void setForceAll(Core.SetState f)
          Request setting of forced flag for all captions
static void setFPSSrc(double src)
          Set source frame rate.
static void setFpsSrcCertain(boolean c)
          Set: source frame rate is certain
static void setFPSTrg(double trg)
          Set target frame rate.
static void setFreeScale(double x, double y)
          Set free scaling factor.
static void setKeepFps(boolean e)
          Set: use source fps for target fps if possible.
static void setLanguageIdx(int idx)
          Set language index for VobSub (and XML) export.
static void setLumThr(int[] lt)
          Set luminance thresholds.
static void setMainFrame(deadbeef.GUI.MainFrame mf)
          Set reference to the main frame.
static void setMergePTSdiff(int d)
          Set maximum time difference for merging captions.
static void setMinTimePTS(int t)
          Set minimum frame duration in 90kHz resolution.
static void setMoveCaptions(boolean m)
          Set: keep move settings after loading a new stream
static void setMoveModeX(Core.MoveModeX m)
          Set: move mode in X direction
static void setMoveModeY(Core.MoveModeY m)
          Set: move mode in Y direction
static void setMoveOffsetX(int ofs)
          Set: Additional x offset to consider when moving
static void setMoveOffsetY(int ofs)
          Set: Additional y offset to consider when moving
static void setOutputMode(Core.OutputMode m)
          Set output mode.
static void setOutputResolution(Core.Resolution r)
          Set output resolution.
static void setPaletteMode(Core.PaletteMode m)
          Set palette creation mode.
static void setProgress(int p)
          Set progress in progress bar.
static void setProgressMax(int max)
          Set internal maximum for progress bar.
static void setReady(boolean r)
          Set Core ready state.
static void setScalingFilter(Core.ScalingFilters f)
          Set filter to be used for scaling.
static void setSwapCrCb(boolean b)
          Set flag that defines whether to swap Cr/Cb components when loading a SUP.
static void setVerbatim(boolean e)
          Set verbatim console output mode.
static void setWritePGCEditPal(boolean e)
          Set: write PGCEdit palette file on export.
static void storeApplyFreeScale(boolean f)
          Store: Enable/disable free scaling
static void storeConvertFPS(boolean b)
          Store flag that tells whether or not to convert the frame rate.
static void storeConvertResolution(boolean b)
          Store flag that tells whether or not to convert the resolution.
static void storeDelayPTS(int delay)
          Store delay to add to time stamps.
static void storeFixShortFrames(boolean b)
          Store flag that tells whether to fix frames shorter than minTimePTS.
static void storeFPSSrc(double src)
          Store source frame rate.
static void storeFPSTrg(double trg)
          Store target frame rate.
static void storeFreeScale(double x, double y)
          Store free scaling factor.
static void storeMinTimePTS(int t)
          Store minimum frame duration in 90kHz resolution.
static void storeOutputResolution(Core.Resolution r)
          Store output resolution.
static void storeProps()
          Write properties
static long syncTimePTS(long t, double fps)
          Synchronizes a time stamp in 90kHz resolution to the given frame rate.
static boolean updateTrgPic(int index)
          Update width, height and offsets of target SubPicture.
static boolean usesBT601()
          Get: use of BT.601 color model instead of BT.709.
static void writePGCEditPal(java.lang.String fname, Palette p)
          Create PGCEdit palette file from given Palette.
static void writeSub(java.lang.String fname)
          Create BD-SUP or VobSub or Xml.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FPS_24P

public static final double FPS_24P
Frames per seconds for 24p (23.976)

See Also:
Constant Field Values

FPS_23_975

public static final double FPS_23_975
Frames per seconds for wrong 24P (23.975)

See Also:
Constant Field Values

FPS_24HZ

public static final double FPS_24HZ
Frames per seconds for 24Hz (24.0)

See Also:
Constant Field Values

FPS_PAL

public static final double FPS_PAL
Frames per seconds for PAL progressive (25.0)

See Also:
Constant Field Values

FPS_NTSC

public static final double FPS_NTSC
Frames per seconds for NTSC progressive (29.97)

See Also:
Constant Field Values

FPS_PAL_I

public static final double FPS_PAL_I
Frames per seconds for PAL interlaced (50.0)

See Also:
Constant Field Values

FPS_NTSC_I

public static final double FPS_NTSC_I
Frames per seconds for NTSC interlaced (59.94)

See Also:
Constant Field Values

minScale

public static final double minScale
Minimum value for free scaling factor

See Also:
Constant Field Values

maxScale

public static final double maxScale
Maximum value for free scaling factor

See Also:
Constant Field Values

props

public static Props props
Class used to load/store properties persistently

Constructor Detail

Core

public Core()
Method Detail

run

public void run()
Thread used for threaded import/export.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

init

public static void init(java.lang.Object c)
Initialize the Core - call this before calling readSub or other Core functionality.

Parameters:
c - Main object - needed to determine name of jar and path of ini file

loadedHook

public static void loadedHook()
Hook to be called when the first file was loaded via the GUI


close

public static void close()
Reset the core, close all files


exit

public static void exit()
Shut down the Core (write properties, close files etc.).


storeProps

public static void storeProps()
Write properties


addRecent

public static void addRecent(java.lang.String s)
Add a new entry to the list of recently loaded files

Parameters:
s -

getRecentFiles

public static java.util.ArrayList<java.lang.String> getRecentFiles()
Return list of recently loaded files

Returns:
list of recently loaded files

getStreamID

public static Core.StreamID getStreamID(byte[] id)
Identifies a stream by examining the first two bytes.

Parameters:
id - Byte array holding four bytes at minimum
Returns:
StreamID

syncTimePTS

public static long syncTimePTS(long t,
                               double fps)
Synchronizes a time stamp in 90kHz resolution to the given frame rate.

Parameters:
t - Time stamp in 90kHz resolution
fps - Frame rate
Returns:
Synchronized time stamp in 90kHz resolution

readStreamThreaded

public static void readStreamThreaded(java.lang.String fname,
                                      javax.swing.JFrame parent,
                                      Core.StreamID sid)
                               throws java.lang.Exception
Read a subtitle stream in a thread and display the progress dialog.

Parameters:
fname - File name of subtitle stream to read
parent - Parent frame (needed for progress dialog)
sid - stream identifier
Throws:
java.lang.Exception

createSubThreaded

public static void createSubThreaded(java.lang.String fname,
                                     javax.swing.JFrame parent)
                              throws java.lang.Exception
Write a VobSub or BD-SUP in a thread and display the progress dialog.

Parameters:
fname - File name of subtitle stream to create
parent - Parent frame (needed for progress dialog)
Throws:
java.lang.Exception

readSup

public static void readSup(java.lang.String fname)
                    throws CoreException
Read BD-SUP or HD-DVD-SUP.

Parameters:
fname - File name
Throws:
CoreException

readXml

public static void readXml(java.lang.String fname)
                    throws CoreException
Read Sony BDN XML file.

Parameters:
fname - File name
Throws:
CoreException

readVobSub

public static void readVobSub(java.lang.String fname)
                       throws CoreException
Read VobSub.

Parameters:
fname - File name
Throws:
CoreException

readSupIfo

public static void readSupIfo(java.lang.String fname)
                       throws CoreException
Read SUP/IFO.

Parameters:
fname - File name
Throws:
CoreException

readDVDSubstream

public static void readDVDSubstream(java.lang.String fname,
                                    boolean isVobSub)
                             throws CoreException
Read VobSub or SUP/IFO.

Parameters:
fname - File name
isVobSub - True if SUB/IDX, false if SUP/IFO
Throws:
CoreException

updateTrgPic

public static boolean updateTrgPic(int index)
Update width, height and offsets of target SubPicture.
This is needed if cropping captions during decode (i.e. the source image size changes).

Parameters:
index - Index of caption
Returns:
true: image size has changed, false: image size didn't change.

setForceAll

public static void setForceAll()
Apply the state of forceAll to all captions


scanSubtitles

public static void scanSubtitles()
Create a copy of the loaded subpicture information frames.
Apply scaling and speedup/delay to the copied frames.
Sync frames to target fps.


reScanSubtitles

public static void reScanSubtitles(Core.Resolution resOld,
                                   double fpsTrgOld,
                                   int delayOld,
                                   boolean convertFpsOld,
                                   double fsXOld,
                                   double fsYOld)
Same as scanSubtitles, but consider existing frame copies.
Times and X/Y offsets of existing frames are converted to new settings.

Parameters:
resOld - Resolution of existing frames
fpsTrgOld - Target fps of existing frames
delayOld - Delay of existing frames
convertFpsOld - ConverFPS setting for existing frames
fsXOld - Old free scaling factor in X direction
fsYOld - Old free scaling factor in Y direction

convertSup

public static void convertSup(int index,
                              int displayNum,
                              int displayMax)
                       throws CoreException
Convert source subpicture image to target subpicture image.

Parameters:
index - Index of subtitle to convert
displayNum - Subtitle number to display (needed for forced subs)
displayMax - Maximum subtitle number to display (needed for forced subs)
Throws:
CoreException

convertSup

public static void convertSup(int index,
                              int displayNum,
                              int displayMax,
                              boolean skipScaling)
                       throws CoreException
Convert source subpicture image to target subpicture image.

Parameters:
index - Index of subtitle to convert
displayNum - Subtitle number to display (needed for forced subs)
displayMax - Maximum subtitle number to display (needed for forced subs)
skipScaling - true: skip bitmap scaling and palette transformation (used for moving captions)
Throws:
CoreException

writeSub

public static void writeSub(java.lang.String fname)
                     throws CoreException
Create BD-SUP or VobSub or Xml.

Parameters:
fname - File name of SUP/SUB/XML to create
Throws:
CoreException

getDefaultFPS

public static double getDefaultFPS(Core.Resolution r)
Get default frame rate for given resolution.

Parameters:
r - Output resolution
Returns:
Default frame rate for resolution r

getFPS

public static double getFPS(java.lang.String s)
Convert a string containing a frame rate to a double representation.

Parameters:
s - String containing a frame
Returns:
Double representation of the frame rate

moveAllThreaded

public static void moveAllThreaded(javax.swing.JFrame parent)
                            throws java.lang.Exception
Move all subpictures into or outside given bounds in a thread and display the progress dialog.

Parameters:
parent - Parent frame (needed for progress dialog)
Throws:
java.lang.Exception

moveAllToBounds

public static void moveAllToBounds()
                            throws CoreException
Move all subpictures into or outside given bounds.

Throws:
CoreException

moveToBounds

public static void moveToBounds(SubPicture pic,
                                int idx,
                                double barFactor,
                                int offsetX,
                                int offsetY,
                                Core.MoveModeX mmx,
                                Core.MoveModeY mmy,
                                int cropOffsetY)
Move subpicture into or outside given bounds.

Parameters:
pic - SubPicture object containing coordinates and size
idx - Index (only used for display)
barFactor - Factor to calculate cinemascope bar height from screen height
offsetX - X offset to consider when moving
offsetY - Y offset to consider when moving
mmx - Move mode in X direction
mmy - Move mode in Y direction
cropOffsetY - Number of lines to crop from bottom and top

print

public static void print(java.lang.String s)
Print string to console or console window (only printed in verbatim mode).

Parameters:
s - String containing message to print

printX

public static void printX(java.lang.String s)
Print string to console or console window (always printed).

Parameters:
s - String containing message to print

printErr

public static void printErr(java.lang.String s)
Print error string to console or console window (always printed).

Parameters:
s - String containing error message to print

printWarn

public static void printWarn(java.lang.String s)
Print warning string to console or console window (always printed).

Parameters:
s - String containing warning message to print

writePGCEditPal

public static void writePGCEditPal(java.lang.String fname,
                                   Palette p)
                            throws CoreException
Create PGCEdit palette file from given Palette.

Parameters:
fname - File name
p - Palette
Throws:
CoreException

getLumThr

public static int[] getLumThr()
Get luminance thresholds.

Returns:
Array of thresholds ( 0: med/high, 1: low/med )

setLumThr

public static void setLumThr(int[] lt)
Set luminance thresholds.

Parameters:
lt - Array of luminance thresholds ( 0: med/high, 1: low/med )

getAlphaThr

public static int getAlphaThr()
Get alpha threshold.

Returns:
Current alpha threshold

setAlphaThr

public static void setAlphaThr(int at)
Set alpha threshold.

Parameters:
at - Alpha threshold

isReady

public static boolean isReady()
Get Core ready state.

Returns:
True if the Core is ready

setReady

public static void setReady(boolean r)
Set Core ready state.

Parameters:
r - true if the Core is ready

getOutputResolution

public static Core.Resolution getOutputResolution()
Get output resolution.

Returns:
Current output resolution

setOutputResolution

public static void setOutputResolution(Core.Resolution r)
Set output resolution.

Parameters:
r - output resolution

storeOutputResolution

public static void storeOutputResolution(Core.Resolution r)
Store output resolution.

Parameters:
r - output resolution

getConvertFPSdefault

public static boolean getConvertFPSdefault()
get default value for frame rate conversion

Returns:
default value for frame rate conversion

getConvertResolutionDefault

public static boolean getConvertResolutionDefault()
get default value for resolution conversion

Returns:
default value for resolution conversion

getResolutionDefault

public static Core.Resolution getResolutionDefault()
get default target resolution

Returns:
default target resolution

getFpsSrcDefault

public static double getFpsSrcDefault()
get default value for source frame rate

Returns:
default value for source frame rate

getFpsTrgDefault

public static double getFpsTrgDefault()
get default value for target frame rate

Returns:
default value for target frame rate

getDelayPTSdefault

public static int getDelayPTSdefault()
get default value for delay

Returns:
default value delay

getFixShortFramesDefault

public static boolean getFixShortFramesDefault()
get default value for fixing short frame

Returns:
default value for fixing short frame

getMinTimePTSdefault

public static int getMinTimePTSdefault()
get default value for minimum display time

Returns:
default value for minimum display time

getApplyFreeScaleDefault

public static boolean getApplyFreeScaleDefault()
get default value for applying of free scaling

Returns:
default value for applying of free scaling

getFreeScaleXdefault

public static double getFreeScaleXdefault()
get default value for free x scaling factor

Returns:
default value for free x scaling factor

getFreeScaleYdefault

public static double getFreeScaleYdefault()
get default value for free y scaling factor

Returns:
default value for free y scaling factor

restoreConvertFPS

public static boolean restoreConvertFPS()
restore value for frame rate conversion

Returns:
restored value for frame rate conversion

restoreConvertResolution

public static boolean restoreConvertResolution()
restore value for resolution conversion

Returns:
restored value for resolution conversion

restoreResolution

public static Core.Resolution restoreResolution()
restore default target resolution

Returns:
restored target resolution

restoreFpsSrc

public static double restoreFpsSrc()
restore value for source frame rate

Returns:
restored value for source frame rate

restoreFpsTrg

public static double restoreFpsTrg()
restore value for target frame rate

Returns:
restored value for target frame rate

restoreDelayPTS

public static int restoreDelayPTS()
restore value for delay

Returns:
restored value delay

restoreFixShortFrames

public static boolean restoreFixShortFrames()
restore value for fixing short frame

Returns:
restored value for fixing short frame

restoreMinTimePTS

public static int restoreMinTimePTS()
restore value for minimum display time

Returns:
restored value for minimum display time

restoreApplyFreeScale

public static boolean restoreApplyFreeScale()
restore value for applying of free scaling

Returns:
restored value for applying of free scaling

restoreFreeScaleX

public static double restoreFreeScaleX()
restore value for free x scaling factor

Returns:
restored value for free x scaling factor

restoreFreeScaleY

public static double restoreFreeScaleY()
restore value for free y scaling factor

Returns:
restored value for free y scaling factor

getResolution

public static Core.Resolution getResolution(int w,
                                            int h)
Find the most fitting resolution for the given width and height

Parameters:
w - screen width
h - screen height
Returns:
most fitting resolution

cancel

public static void cancel()
Force Core to cancel current operation.


isCancelled

public static boolean isCancelled()
Get cancel state.

Returns:
True if the current operation was canceled

getStatus

public static Core.State getStatus()
Get Core state.

Returns:
Current Core state

getConvertFPS

public static boolean getConvertFPS()
Get flag that tells whether or not to convert the frame rate.

Returns:
Flag that tells whether or not to convert the frame rate

setConvertFPS

public static void setConvertFPS(boolean b)
Set flag that tells whether or not to convert the frame rate.

Parameters:
b - True: convert frame rate

storeConvertFPS

public static void storeConvertFPS(boolean b)
Store flag that tells whether or not to convert the frame rate.

Parameters:
b - True: convert frame rate

getConvertResolution

public static boolean getConvertResolution()
Get flag that tells whether or not to convert the resolution.

Returns:
Flag that tells whether or not to convert the resolution

setConvertResolution

public static void setConvertResolution(boolean b)
Set flag that tells whether or not to convert the resolution.

Parameters:
b - True: convert resolution

storeConvertResolution

public static void storeConvertResolution(boolean b)
Store flag that tells whether or not to convert the resolution.

Parameters:
b - True: convert resolution

getExportForced

public static boolean getExportForced()
Get flag that tells whether or not to export only forced subtitles.

Returns:
Flag that tells whether or not to export only forced subtitles

setExportForced

public static void setExportForced(boolean b)
Set flag that tells whether or not to export only forced subtitles.

Parameters:
b - True: export only forced subtitles

getForceAll

public static Core.SetState getForceAll()
Request setting of forced flag for all captions

Returns:
current state

setForceAll

public static void setForceAll(Core.SetState f)
Request setting of forced flag for all captions

Parameters:
f - state to set

getFPSSrc

public static double getFPSSrc()
Get source frame rate.

Returns:
Source frame rate

setFPSSrc

public static void setFPSSrc(double src)
Set source frame rate.

Parameters:
src - Source frame rate

storeFPSSrc

public static void storeFPSSrc(double src)
Store source frame rate.

Parameters:
src - Source frame rate

getFPSTrg

public static double getFPSTrg()
Get target frame rate.

Returns:
Target frame rate

setFPSTrg

public static void setFPSTrg(double trg)
Set target frame rate.

Parameters:
trg - Target frame rate

storeFPSTrg

public static void storeFPSTrg(double trg)
Store target frame rate.

Parameters:
trg - Target frame rate

getDelayPTS

public static int getDelayPTS()
Get delay to add to time stamps.

Returns:
Delay in 90kHz resolution

setDelayPTS

public static void setDelayPTS(int delay)
Set delay to add to time stamps.

Parameters:
delay - Delay in 90kHz resolution

storeDelayPTS

public static void storeDelayPTS(int delay)
Store delay to add to time stamps.

Parameters:
delay - Delay in 90kHz resolution

getMainFrame

public static deadbeef.GUI.MainFrame getMainFrame()
Get reference to the main frame.

Returns:
Reference to the main frame

setMainFrame

public static void setMainFrame(deadbeef.GUI.MainFrame mf)
Set reference to the main frame.

Parameters:
mf - Reference to the main frame

getErrors

public static int getErrors()
Get the number of errors.

Returns:
Number of errors since last call to resetErrors

resetErrors

public static void resetErrors()
Reset the number of errors.


getWarnings

public static int getWarnings()
Get the number of warnings.

Returns:
Number of warnings since last call to resetWarnings

resetWarnings

public static void resetWarnings()
Reset the number of warnings.


setProgress

public static void setProgress(int p)
Set progress in progress bar.

Parameters:
p - Subtitle index processed

getOutputFormatName

public static java.lang.String getOutputFormatName(Core.OutputMode m)
Get string representation of output mode.

Parameters:
m - Output mode
Returns:
String representation of output mode

getOutputMode

public static Core.OutputMode getOutputMode()
Get output mode.

Returns:
Current output mode

setOutputMode

public static void setOutputMode(Core.OutputMode m)
Set output mode.

Parameters:
m - Output mode

getInputMode

public static Core.InputMode getInputMode()
Get input mode.

Returns:
Current input mode

getSrcImage

public static java.awt.image.BufferedImage getSrcImage()
Get source image as BufferedImage.

Returns:
Source image as BufferedImage

getSrcImage

public static java.awt.image.BufferedImage getSrcImage(int idx)
                                                throws CoreException
Get source image as BufferedImage.

Parameters:
idx - Index of subtitle
Returns:
Source image as BufferedImage
Throws:
CoreException

getTrgImage

public static java.awt.image.BufferedImage getTrgImage()
Get target image as BufferedImage.

Returns:
Target image as BufferedImage

getTrgImagePatched

public static java.awt.image.BufferedImage getTrgImagePatched(SubPicture pic)
Get target image as BufferedImage.

Parameters:
pic - SubPicture to use for applying erase patches
Returns:
Target image as BufferedImage

getTrgWidth

public static int getTrgWidth(int index)
Get screen width of target.

Parameters:
index - Subtitle index
Returns:
Screen width of target

getTrgHeight

public static int getTrgHeight(int index)
Get screen height of target.

Parameters:
index - Subtitle index
Returns:
Screen height of target

getTrgImgWidth

public static int getTrgImgWidth(int index)
Get subtitle width of target.

Parameters:
index - Subtitle index
Returns:
Subtitle width of target

getTrgImgHeight

public static int getTrgImgHeight(int index)
Get subtitle height of target.

Parameters:
index - Subtitle index
Returns:
Subtitle height of target

getTrgExcluded

public static boolean getTrgExcluded(int index)
Get exclude (from export) state of target.

Parameters:
index - Subtitle index
Returns:
Screen width of target

getTrgOfsX

public static int getTrgOfsX(int index)
Get subtitle x offset of target.

Parameters:
index - Subtitle index
Returns:
Subtitle x offset of target

getTrgOfsY

public static int getTrgOfsY(int index)
Get subtitle y offset of target.

Parameters:
index - Subtitle index
Returns:
Subtitle y offset of target

getNumFrames

public static int getNumFrames()
Get number of subtitles.

Returns:
Number of subtitles

getNumForcedFrames

public static int getNumForcedFrames()
Get number of forced subtitles.

Returns:
Number of forced subtitles

getTrgInfoStr

public static java.lang.String getTrgInfoStr(int index)
Create info string for target subtitle.

Parameters:
index - Index of subtitle
Returns:
Info string for target subtitle

getSrcInfoStr

public static java.lang.String getSrcInfoStr(int index)
Create info string for source subtitle.

Parameters:
index - Index of subtitle
Returns:
Info string for source subtitle

getResolution

public static int[] getResolution(Core.Resolution r)
Get width and height for given resolution.

Parameters:
r - Resolution
Returns:
Integer array containing width [0] and height [1]

getResolutionName

public static java.lang.String getResolutionName(Core.Resolution r)
Get Idx string representation of resolution.

Parameters:
r - Resolution
Returns:
String representation of resolution

getResolutionNameXml

public static java.lang.String getResolutionNameXml(Core.Resolution r)
Get Xml string representation of resolution.

Parameters:
r - Resolution
Returns:
String representation of resolution

getCurrentDVDPalette

public static Palette getCurrentDVDPalette()
Get current DVD palette.

Returns:
DVD palette

setCurrentDVDPalette

public static void setCurrentDVDPalette(Palette pal)
Set current DVD palette.

Parameters:
pal - DVD palette

getDefaultDVDPalette

public static Palette getDefaultDVDPalette()
Get default DVD palette.

Returns:
Default DVD palette

getLanguageIdx

public static int getLanguageIdx()
Get language index for VobSub (and XML) export.

Returns:
Language index for VobSub (and XML) export

setLanguageIdx

public static void setLanguageIdx(int idx)
Set language index for VobSub (and XML) export.

Parameters:
idx - Language index for VobSub (and XML) export

getFixShortFrames

public static boolean getFixShortFrames()
Set flag that tells whether to fix frames shorter than minTimePTS.

Returns:
Flag that tells whether to fix frames shorter than minTimePTS

setFixShortFrames

public static void setFixShortFrames(boolean b)
Set flag that tells whether to fix frames shorter than minTimePTS.

Parameters:
b - True: fix short frames

storeFixShortFrames

public static void storeFixShortFrames(boolean b)
Store flag that tells whether to fix frames shorter than minTimePTS.

Parameters:
b - True: fix short frames

getMinTimePTS

public static int getMinTimePTS()
Get minimum frame duration in 90kHz resolution.

Returns:
Minimum frame duration in 90kHz resolution

setMinTimePTS

public static void setMinTimePTS(int t)
Set minimum frame duration in 90kHz resolution.

Parameters:
t - Minimum frame duration in 90kHz resolution

storeMinTimePTS

public static void storeMinTimePTS(int t)
Store minimum frame duration in 90kHz resolution.

Parameters:
t - Minimum frame duration in 90kHz resolution

getSubPictureTrg

public static SubPicture getSubPictureTrg(int index)
Get target subpicture.

Parameters:
index - Index of subpicture
Returns:
Target SubPicture

getSubPictureSrc

public static SubPicture getSubPictureSrc(int index)
Get source subpicture.

Parameters:
index - Index of subpicture
Returns:
Source SubPicture

getSwapCrCb

public static boolean getSwapCrCb()
Get flag that defines whether to swap Cr/Cb components when loading a SUP.

Returns:
True: swap cr/cb

setSwapCrCb

public static void setSwapCrCb(boolean b)
Set flag that defines whether to swap Cr/Cb components when loading a SUP.

Parameters:
b - True: swap cr/cb

getProgName

public static java.lang.String getProgName()
Get program name (excluding version).

Returns:
Program name (excluding version)

getProgVerName

public static java.lang.String getProgVerName()
Get program name (including version).

Returns:
Program name (including version)

getAuthorDate

public static java.lang.String getAuthorDate()
Get author and date info.

Returns:
Author and date info

getLanguages

public static java.lang.String[][] getLanguages()
Get two dimensional array with languages where [i][0] is full name, [i][1] is two character short name.

Returns:
Two dimensional array with languages where [i][0] is full name, [i][1] is two character short name

setCropOfsY

public static void setCropOfsY(int ofs)
Set Y coordinate cropping offset.

Parameters:
ofs - Cropping Offset (number of lines to crop symmetrically from bottom and top)

getCropOfsY

public static int getCropOfsY()
Get Y coordinate cropping offset.

Returns:
Current cropping Offset (number of lines to crop symmetrically from bottom and top)

usesBT601

public static boolean usesBT601()
Get: use of BT.601 color model instead of BT.709.

Returns:
True if BT.601 is used

getPaletteMode

public static Core.PaletteMode getPaletteMode()
Get palette creation mode.

Returns:
Current palette creation mode

setPaletteMode

public static void setPaletteMode(Core.PaletteMode m)
Set palette creation mode.

Parameters:
m - Palette creation mode

getPaletteModeName

public static java.lang.String getPaletteModeName(Core.PaletteMode m)
Return name string for given palette creation mode.

Parameters:
m - Palette creation mode
Returns:
String for given palette creation mode

getVerbatim

public static boolean getVerbatim()
Get verbatim console output mode.

Returns:
True: verbatim console output mode

setVerbatim

public static void setVerbatim(boolean e)
Set verbatim console output mode.

Parameters:
e - True: verbatim console output mode

setProgressMax

public static void setProgressMax(int max)
Set internal maximum for progress bar.

Parameters:
max - Internal maximum for progress bar (e.g. number of subtitles)

getKeepFps

public static boolean getKeepFps()
Get: use source fps for target fps if possible.

Returns:
True if source fps should be used for target

setKeepFps

public static void setKeepFps(boolean e)
Set: use source fps for target fps if possible.

Parameters:
e - True if source fps should be used for target

getFpsSrcCertain

public static boolean getFpsSrcCertain()
Get: source frame rate is certain

Returns:
true if source frame rate is certain

setFpsSrcCertain

public static void setFpsSrcCertain(boolean c)
Set: source frame rate is certain

Parameters:
c - true if source frame rate is certain

getScalingFilter

public static Core.ScalingFilters getScalingFilter()
Get current scaling filter.

Returns:
Current scaling filter

setScalingFilter

public static void setScalingFilter(Core.ScalingFilters f)
Set filter to be used for scaling.

Parameters:
f - Scaling Filter

getScalingFilterName

public static java.lang.String getScalingFilterName(Core.ScalingFilters f)
Get name for scaling filter.

Parameters:
f - Scaling filter
Returns:
String containing name for scaling filter

getMergePTSdiff

public static int getMergePTSdiff()
Get maximum time difference for merging captions.

Returns:
Maximum time difference for merging captions

setMergePTSdiff

public static void setMergePTSdiff(int d)
Set maximum time difference for merging captions.

Parameters:
d - Maximum time difference for merging captions

getAlphaCrop

public static int getAlphaCrop()
Get alpha threshold for cropping.

Returns:
Alpha threshold for cropping

setAlphaCrop

public static void setAlphaCrop(int a)
Set alpha threshold for cropping.

Parameters:
a - Alpha threshold for cropping

getApplyFreeScale

public static boolean getApplyFreeScale()
Report whether free scaling is active or not.

Returns:
true if free scaling is applied

setApplyFreeScale

public static void setApplyFreeScale(boolean f)
Enable/disable free scaling

Parameters:
f - true: free scaling is applied

storeApplyFreeScale

public static void storeApplyFreeScale(boolean f)
Store: Enable/disable free scaling

Parameters:
f - true: free scaling is applied

getFreeScaleX

public static double getFreeScaleX()
Get free scaling factor.

Returns:
Free X scaling factor

getFreeScaleY

public static double getFreeScaleY()
Get free scaling factor.

Returns:
Free Y scaling factor

setFreeScale

public static void setFreeScale(double x,
                                double y)
Set free scaling factor.

Parameters:
x - Free X scaling factor (limited to 0.5 .. 2.0)
y - Free Y scaling factor (limited to 0.5 .. 2.0)

storeFreeScale

public static void storeFreeScale(double x,
                                  double y)
Store free scaling factor.

Parameters:
x - Free X scaling factor (limited to 0.5 .. 2.0)
y - Free Y scaling factor (limited to 0.5 .. 2.0)

setMoveModeY

public static void setMoveModeY(Core.MoveModeY m)
Set: move mode in Y direction

Parameters:
m - Move mode

getMoveModeY

public static Core.MoveModeY getMoveModeY()
Get: move mode in Y direction

Returns:
Move mode

setMoveModeX

public static void setMoveModeX(Core.MoveModeX m)
Set: move mode in X direction

Parameters:
m - Move mode

getMoveModeX

public static Core.MoveModeX getMoveModeX()
Get: move mode in X direction

Returns:
Move mode

setCineBarFactor

public static void setCineBarFactor(double f)
Set: factor of cinemascope bars (needed for moving after cropping).

Parameters:
f - Factor of cinemascope bars

setMoveOffsetY

public static void setMoveOffsetY(int ofs)
Set: Additional y offset to consider when moving

Parameters:
ofs - Y offset

getMoveOffsetY

public static int getMoveOffsetY()
Get: Additional y offset to consider when moving

Returns:
Y offset

setMoveOffsetX

public static void setMoveOffsetX(int ofs)
Set: Additional x offset to consider when moving

Parameters:
ofs - Y offset

getMoveOffsetX

public static int getMoveOffsetX()
Get: Additional x offset to consider when moving

Returns:
X offset

getMoveCaptions

public static boolean getMoveCaptions()
Get: keep move settings after loading a new stream

Returns:
true: keep settings, false: ignore settings

setMoveCaptions

public static void setMoveCaptions(boolean m)
Set: keep move settings after loading a new stream

Parameters:
m - true: keep settings, false; ignore settings

getCurrentStreamID

public static Core.StreamID getCurrentStreamID()
Get current input stream ID.

Returns:
Stream ID

setCurrentStreamID

public static void setCurrentStreamID(Core.StreamID sid)
Set current input stream ID.

Parameters:
sid - Stream ID

getWritePGCEditPal

public static boolean getWritePGCEditPal()
Get: write PGCEdit palette file on export.

Returns:
True: write

setWritePGCEditPal

public static void setWritePGCEditPal(boolean e)
Set: write PGCEdit palette file on export.

Parameters:
e - True: write

getFixZeroAlpha

public static boolean getFixZeroAlpha()
Get: fix completely invisibly subtitles due to alpha=0 (SUB/IDX and SUP/IFO import only).

Returns:
True: verbatim text mode

setFixZeroAlpha

public static void setFixZeroAlpha(boolean e)
Set: fix completely invisibly subtitles due to alpha=0 (SUB/IDX and SUP/IFO import only).

Parameters:
e - True: verbatim text mode

getDefSrcDVDPalette

public static Palette getDefSrcDVDPalette()
Get imported palette if input is DVD format.

Returns:
Imported palette if input is DVD format, else null

getCurSrcDVDPalette

public static Palette getCurSrcDVDPalette()
Get modified imported palette if input is DVD format.

Returns:
Imported palette if input is DVD format, else null

setCurSrcDVDPalette

public static void setCurSrcDVDPalette(Palette pal)
Set modified imported palette.

Parameters:
pal - Modified imported palette

getFramePal

public static int[] getFramePal(int index)
Return frame palette of given subtitle.

Parameters:
index - Index of subtitle
Returns:
Frame palette of given subtitle as array of int (4 entries)

getFrameAlpha

public static int[] getFrameAlpha(int index)
Return frame alpha values of given subtitle.

Parameters:
index - Index of subtitle
Returns:
Frame alpha values of given subtitle as array of int (4 entries)

getOriginalFramePal

public static int[] getOriginalFramePal(int index)
Return original frame palette of given subtitle.

Parameters:
index - Index of subtitle
Returns:
Frame palette of given subtitle as array of int (4 entries)

getOriginalFrameAlpha

public static int[] getOriginalFrameAlpha(int index)
Return original frame alpha values of given subtitle.

Parameters:
index - Index of subtitle
Returns:
Frame alpha values of given subtitle as array of int (4 entries)