Subtitle module - SPSubInterface
Module used to manipulate single subtitles in the subtitles collections.
Constants
Subtitles number
See Subtitles
module.
Property number
Use this to specify which property should be manipulated by a
particular getter or setter function - what_prop
parameter. Always use the constants, the actual numbers may change in
future versions of SP.
Integer
SUB_SF = 1
SUB_EF = 2
SUB_REF = 3 (get only)
SUB_NSF = 4 (get only)
SUB_DURATION_F = 5 (get
only)
SUB_MARGIN_L = 13
SUB_MARGIN_R = 14
SUB_MARGIN_V = 15
SUB_MARGIN_V2 = 16
SUB_TEXT_CHAR_COUNT = 21 (get only)
SUB_LINE_COUNT = 22
Floating point
SUB_ST = 6
SUB_ET = 7
SUB_RET = 8 (get only)
SUB_NST = 9 (get only)
SUB_DURATION_T = 10 (get
only)
String
SUB_STYLE = 11
SUB_PAINT_STYLE = 12 (get only)
SUB_CHARACTER_NAME = 17
SUB_EFFECT = 18
SUB_TEXT_DELIMITER = 19
SUB_TEXT = 20
Line properties
SUB_LINE_TEXT = 23
SUB_LINE_STYLE = 24
SUB_LINE_POS_X = 25
SUB_LINE_POS_Y = 26
Property getters and setters
These functions are used to set or get values of subtitles
collection's properties. Common parameters are:
- subs_no: select which subtitles
collection will be used
- sub_no: index of the subtitle to be
manipulated
- what_prop: select what property shall
be used.
- prop_value: value of the property (for
setter function). Ensure that proper data type is passed, otherwise
access violations will occur!!!
Return value of getter function is either:
- nil: invalid subtitles collection or
property number was specified
- property value otherwise.
Return value of setter function can be either:
- true: property was successfully set
- false: invalid subtitles collection or
property number was specified.
get_subtitle_int_prop(subs_no, sub_no,
what_prop)
- Get value of integer property
set_subtitle_int_prop(subs_no, sub_no,
what_prop, prop_value)
- Set value of integer property
get_subtitle_float_prop(subs_no, sub_no,
what_prop)
- Get value of floating-point property
set_subtitle_float_prop(subs_no, sub_no, what_prop, prop_value)
- Set value of floating-point property
get_subtitle_string_prop(subs_no, sub_no,
what_prop)
- Get value of string property
set_subtitle_string_prop(subs_no, sub_no,
what_prop, prop_value)
- Set value of string property
get_subtitle_line_prop(subs_no, sub_no,
line_no, what_prop)
- Get value of line property - each line of text can have
properties (used for MVD format)
- line_no: index of the subtitle line
set_subtitle_line_prop(subs_no, sub_no,
line_no, what_prop, prop_value)
- Set value of line property
- line_no: index of the subtitle line
Subtitle manipulation methods
These functions of SPSubInterface enable to call corresponding
methods of TSubtitle in SP. Common parameters are subs_no
and sub_no with the same meaning as with
property
getters.
recalc_fps(subs_no, sub_no)
- Recalculate frame or time timestamps according to parent time
mode (e.g. recalculate frames if parent's time mode is Time)
shift_f(subs_no, sub_no, delta)
- Shift timestamps of subtitle by delta
frames (must be integer)
shift_t(subs_no, sub_no, delta)
- Shift timestamps of subtitle by delta
seconds (can be floating-point)
clear(subs_no, sub_no)
- Clear subtitle (set all properties to defaults)
text_remove_line(subs_no, sub_no, line_no)
- Delete specified line line with all properties from subtitle
check_sub_length(subs_no, sub_no,
max_length)
- Check subtitle whether any line is longer than max_length pixels.
- Return:
- line number if such line exists
- -1 otherwise
swap_content(subs_no, sub_no, other_subs,
other_sub)
- swap content of specified subtitle with the other subtitle. Both
subtitles can be in different collections.
- subs_no, sub_no: determine the first
subtitle
- other_subs, other_sub: determine the
second subtitle