summaryrefslogtreecommitdiffstats
path: root/libass/ass.c
Commit message (Collapse)AuthorAgeFilesLines
* string2timecode: don't truncate to intOleg Oshmyan2015-06-091-1/+1
| | | | | | | | | The timecode is a long long, but it is computed as a product whose all multiplicands are (unsigned) ints and so effectively has the value of an (unsigned) int. Fix this, and use the full long long range, by explicitly making one of the first two multiplicands a long long. Found by Coverity Scan.
* Remove several dead storesGrigori Goronzy2015-06-071-1/+0
| | | | Reported by clang scan-build static analysis.
* Fix minor memory leak in ass_read_stylesGrigori Goronzy2015-06-071-1/+2
| | | | | Reported by clang scan-build static analysis. Also fix incorrect return value in case of error.
* Parse and animate all colors and alpha values like VSFilterOleg Oshmyan2015-05-251-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow exactly one of these prefixes in header values: 0x, 0X, &h, &H. Note that "0x0xFFFFFF" is a correct value, as the first 0x is consumed by the parser and the second by the string-to-number conversion following strtol semantics. * Allow arbitrary numbers of leading & and H (and not h) in any order in override tag values. * Reduce header values modulo 2**32 instead of saturating them to LLONG_MIN/MAX. * Saturate override tag values to INT32_MIN/MAX rather than to LLONG_MIN/MAX. * Don't fiddle with bytes in alpha override tag values. (They can be outside of the 0..255 range.) Also change the byte swapping code to be more sensible. Fixes #80. Fixes #145. Fixes #178. Also fixes our behavior in the case described in https://code.google.com/p/xy-vsfilter/issues/detail?id=80.
* Make timestamp parsing more lenientwm42015-03-061-1/+1
| | | | | | | Fixes "[ARR] Musashi no Ken - 01 [AVC][5697986B].ssa", which has timestamps like "00:02:30.85". It starts with 2 zeros instead of one, which probably means it's an invalid file, but it's accepted by various other parsers (VSFilter, MPlayer, vlc, ffmpeg).
* Fix broken memory leak check in legacy APIwm42014-11-221-0/+1
| | | | | | | | | | This was a check for the realloc() call, but the result was never used in the success case - which makes no sense. Doesn't really matter, because it's the legacy charset code which hopefully is not used by anyone. Found by Coverity.
* More malloc checkingwm42014-11-171-3/+1
| | | | | | | | | | Use strndup() instead of malloc+copy. Make all code deal with the possibility that ASS_Drawing.text can be NULL (which can happen on allocation failure). Skip fix_collisions() on malloc failure - the lines will overlap, but at least libass won't crash.
* Check more mallocswm42014-11-091-2/+28
| | | | This is just a start and gets most easy ones.
* Load embedded fonts from memory correctlywm42014-11-041-10/+3
|
* Parse override tag arguments exactly like VSFilter 2.38Oleg Oshmyan2014-06-061-8/+1
| | | | | Also replace strtocolor in ass_utils with string2color from ass.c, because that is more useful everywhere now.
* Move (r)skip_spaces to ass_utilsOleg Oshmyan2014-06-061-22/+1
|
* Remove some ass_msg() callswm42014-01-241-13/+6
| | | | | | | These aren't very useful for debugging due to the high volume of the log output in problem cases. In fact, all they do is making the code slower (the message callback can easily appear in the profiler output, even if the callback doesn't actually print the messages).
* Allocate track array exponentiallywm42014-01-241-2/+1
| | | | This reduces the frequency of reallocations.
* A whole bunch of parsing and default value fixesOleg Oshmyan2014-01-071-2/+11
| | | | Obtained by reading the xy-VSFilter source code.
* Parse Angle overrides as floating-point numbersOleg Oshmyan2014-01-071-1/+1
| | | | This complements 5903771e.
* Try to make really weird looking macro mess more understandablewm42013-11-261-9/+23
| | | | The "if (0) { // cool ;)" is just mindblowing.
* Add ass_library_version()wm42013-11-251-0/+5
| | | | | | Based on the patch by chadr123. See google code issue #113.
* Don't rely on events being sorted in ass_step_sub()wm42013-10-071-19/+31
| | | | | | | | | | | | ass_step_sub() assumed that the subtitle event list was sorted by event start time, but that is not guaranteed. Making the list sorted is not an option. (At least for now - too many issues are in the way to get such a change being done.) Fix this function so that it works with an unsorted event list. Semantics regarding corner cases might be slightly different, such as what happens if the now parameter coincides with event start/end, or behavior with overlapping subtitles.
* enca: fix memory leakwangkun2013-09-241-0/+5
|
* Don't mutate input buffer for ass_read_memory()wm42013-06-231-4/+11
| | | | | | | | | | | | | | | Fixes google code issue #88. process_text() garbles the memory as the text is parsed. This also fixes that the user provided buffer implicitly had to be null terminated. This wasn't obvious, because the caller passes in the buffer length. libass ignored the buffer length (unless a codepage was provided and iconv was enabled), and happily read past the end of the buffer. It would be much nicer if the parsing code would be fixed, instead of just copying the input buffer. Maybe one day.
* Parse style names like VSFilter doesOleg Oshmyan2013-06-221-4/+10
| | | | | | Trim '*' from the start of style name fields of Style and Dialogue lines and normalize the case of "Default" in the style name field of Dialogue lines.
* Support reading the YCbCr Matrix headerOleg Oshmyan2013-03-031-0/+4
| | | | | | | | | | | | The value is parsed and stored as an enum constant that the consumer can read from ASS_Track. All output images are still plain RGB, and the consumer is expected to perform its own color correction. Supported header values: (TV|PC).(601|709|240M|FCC) and None. If the header is missing, a special compatibility value is used that should be treated as TV.601 if the accompanying video stream is YCbCr and as None otherwise. If the header is present but has an invalid/unknown value, a different special value is substituted.
* Add Blur field to ASS_Stylewm42013-01-111-0/+1
| | | | | Useful when applications specify the style manually for non-ASS subtitles.
* Fix fallback event formatsGrigori Goronzy2013-01-091-2/+2
| | | | Fixes issue 83.
* Parse angle in styles as double numberGrigori Goronzy2013-01-071-1/+1
| | | | | | Similar to VSFilter. Thanks to Iroha for reporting this issue. Note: this breaks the ABI!
* Fix leaks when error occurs.Xidorn Quan2012-12-141-1/+4
|
* Support \rSTYLENAME syntaxGrigori Goronzy2012-03-111-24/+0
| | | | | This allows to reset to a certain style, instead of the default style for the current line. For some reason, this was completely missing.
* Support language hint in the Script Info sectionGrigori Goronzy2011-08-011-0/+8
| | | | | | Parse a hint in the form "Language: xx" with xx being an ISO 639-1 language code, and pass it to HarfBuzz. This can be useful to render scripts with language-specific character variants.
* refactor: move track init into ass track parserGrigori Goronzy2011-06-061-0/+33
|
* Nicer default styleGrigori Goronzy2011-05-301-1/+1
| | | | Use 50% alpha for the shadow. Looks nicer and is just like VSFilter.
* Remove misleading comment about style case sensitivityGrigori Goronzy2011-04-091-1/+0
| | | | VSFilter always matches style names case sensitive.
* Much improved "Default" styleGrigori Goronzy2011-04-091-2/+36
| | | | | | Make the "Default" style, useful as a fallback and required by few scripts for proper rendering, actually do something sensible. Font, sizes, et cetera are set up mostly like VSFilter.
* Relicense to ISCGrigori Goronzy2010-09-281-12/+10
| | | | | | In hope to make libass as useful as possible, relicense libass to ISC, a simplified 2-clause BSD license. All contributors who provided non-trivial changes have granted their permission for this.
* Get rid of NULL checks for freeGrigori Goronzy2010-08-091-22/+14
| | | | | The useless "if (foo) free(foo)" idiom is all over the place, just get rid of it finally...
* Fix another minor leak (event_format overwriting)Grigori Goronzy2010-08-091-0/+1
|
* Fix leaking of script-embedded fontsGrigori Goronzy2010-08-091-4/+2
|
* POSIX compliance: add strings.h include where appropriateGrigori Goronzy2010-08-071-0/+1
| | | | | strcasecmp/strncasecmp needs strings.h according to POSIX, so add this include where these occur.
* Limit debug output on parsing errorsGrigori Goronzy2010-07-191-1/+1
| | | | Limit context printed after parsing errors to 30 characters
* Add API function to flush all eventsGrigori Goronzy2010-05-311-0/+14
| | | | | | Add a function to flush all events in a track and increment LIBASS_VERSION to indicate the addition. Initial patch by Aurelien Jacobs (aurel AT gnuage DOT org).
* Basic @font supportGrigori Goronzy2010-04-111-6/+0
| | | | | | Do not skip '@' at the start of a font name in styles; detect '@' at font name start and set a new attribute in ASS_Font accordingly. Rotate affected glyphs after loading and calculate a suitable advance.
* Remove file size limit in ass_read_fileGrigori Goronzy2010-02-061-9/+0
| | | | | | If an application wants to provide some sort of safeguard against loading very big files (which can trash memory), it should do so by itself.
* Up size limit for script filesGrigori Goronzy2010-01-191-2/+3
| | | | | | Change size limit from 10MB to 50MB and clean up code a bit. A limit still might be handy if one selects a very big file for subtitles by accident. 50MB should be enough for even the biggest karaoke files.
* Fix leftovers from conversion to ass_strtodYuriy M. Kaminskiy2010-01-121-3/+5
|
* Don't flag for freeing if codepage is unspecifiedGrigori Goronzy2010-01-061-5/+6
| | | | Patch by Arne Morten Kvarving <spiff@micron.(none)>.
* Disable kerning by default and make it configurableGrigori Goronzy2009-09-081-0/+4
| | | | | | | | | | | | | | | | | | Kerning causes problems with many (broken) fonts. VSFilter doesn't use kerning so these problems won't be apparant, while libass uses kerning by default. For compatibility reasons, disable kerning by default. In addition, make it configurable through style overrides and the Script Info header. I.e. put "Kerning: yes" into the Script Info header to enable kerning. With MPlayer, using "-ass-force-style Kerning=yes" will always enable kerning. This also includes a minor ABI change for tracking the kerning boolean. As this only affects code that creates or modifies ASS_Tracks manually, and I'm not aware of anyone doing that, the SONAME will not be bumped.
* Always parse colors as hex for ASS tracksGrigori Goronzy2009-08-121-1/+1
| | | | | | According to the ASS specification, colors can only be specified in hex. Modify the color parsing accordingly; this especially means that colors where the hex sigil (the "H") is missing can now be parsed.
* Rename typedefs (breaks API)Grigori Goronzy2009-08-061-62/+66
| | | | | | Rename all typedefs from the convention foo_bar_t, which can possibly conflict with POSIX types, to FooBar (and ASS_FooBar for public API typedefs). Fix formatting and stray comments while at it.
* Clean up typedefs/structsGrigori Goronzy2009-07-281-1/+1
| | | | | Remove useless _s suffix from struct names and remove struct name where not needed (only the typedef'd struct is used). Clean up API headers.
* Free tracks properlyGrigori Goronzy2009-07-241-0/+2
| | | | | When freeing a track, also free the track name and the track itself. Leak found by valgrind/memcheck.
* Message callback funtionalityGrigori Goronzy2009-07-111-53/+66
| | | | | | | | | | | Introduce functionality for providing a message callback that is used for passing messages to the controlling application instead of simply printing them to standard output. The function pointer to the callback is stored in the ass_library_t instance. ass_msg needs access to it, so in many places the library instance needs to be passed around now. The default behavior is the old one: messages of MSGL_INFO or lower are printed to the standard output, prefixed with "[ass]".
* Replace string defines with real stringsGrigori Goronzy2009-07-111-38/+37
| | | | | | Instead of referencing string defines from help_mp.h, use the strings directly in ass_msg. Consequently, help_mp.h is useless and can be deleted.
* Fix crash when event format spec is missingGrigori Goronzy2009-07-071-13/+22
| | | | | | | | libass didn't properly initialize its idea about the event format specification (the Format: line in the [Events] section) in case none was explicitly specified. This ends in a crash due to access to a null pointer. It was changed so that the event format is initialized to a reasonable default, the way it is also done for embedded subtitles.
* Remove read_file_recode from APIGrigori Goronzy2009-07-011-1/+1
| | | | | | read_file_recode is only used internally in ass_read_file and shouldn't be exposed in the API. Remove the prototype from ass.h and declare it static.
* API: make process_force_style availableGrigori Goronzy2009-06-291-3/+3
| | | | | Rename process_force_style to ass_process_force_style and make it available in the DSO.
* Include ass_utils.h instead of mputils.hGrigori Goronzy2009-06-271-1/+0
|
* Rename various non-static functionsGrigori Goronzy2009-06-271-1/+1
| | | | | Rename a few functions to avoid symbol clashes. Clean up mputils.h.
* Rename mp_msg to ass_msgGrigori Goronzy2009-06-271-29/+29
|
* Remove static variable modifier in sub_recodegreg2009-06-201-1/+1
| | | | A variable was needlessly static, this has been corrected.
* Reindent all source code.greg2009-06-201-834/+914
| | | | | | | | | | | | | | | Reindent complete source code (*.c, *.h) with indent, the exact command line being: indent -kr -i4 -bap -nut -l76 *.c *.h From now on, new code should use (more or less) K&R style, only spaces and no tabs, 4 spaces indent width. Avoid long lines. Fix function declaration pointer spacing. Remove spaces that were added to many function declarations by indent, like some_func(foo_t * bar). Fix indenting of macros in ass.c
* whitespace cosmetics: Remove all trailing whitespace.diego2009-05-131-44/+44
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* Use ScaledBorderAndShadow: yes by default.greg2009-03-111-0/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28935 b3059339-0415-0410-9bf9-f77b7e298cf2
* Style override for ScaledBorderAndShadow.greg2009-03-051-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28821 b3059339-0415-0410-9bf9-f77b7e298cf2
* Support ScaledBorderAndShadow property.greg2009-03-051-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28820 b3059339-0415-0410-9bf9-f77b7e298cf2
* libass: fix type mismatch between size parameter and the way it's usedaurel2008-09-051-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27531 b3059339-0415-0410-9bf9-f77b7e298cf2
* libass: add a new ass_process_data() to process demuxed subtitle packetsaurel2008-09-051-4/+16
| | | | | | | conforming to the ASS spec git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27530 b3059339-0415-0410-9bf9-f77b7e298cf2
* Rename font-related preprocessor directives.diego2008-08-071-6/+6
| | | | | | | Switch them from a HAVE_ to a CONFIG_ prefix. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27425 b3059339-0415-0410-9bf9-f77b7e298cf2
* Rename some preprocessor directives from CONFIG_* to HAVE_* where appropriate;diego2008-08-011-5/+5
| | | | | | | CONFIG_ prefix for configurable options, HAVE_ for system-dependent stuff. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27391 b3059339-0415-0410-9bf9-f77b7e298cf2
* Start unifying names of internal preprocessor directives.diego2008-07-301-5/+5
| | | | | | | | Replace all USE_ prefixes by CONFIG_ prefixes to indicate options which are configurable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27373 b3059339-0415-0410-9bf9-f77b7e298cf2
* The size of output buffer is stored in 'osize', not 'size'.eugeni2008-05-291-1/+1
| | | | | | | This is just for readability, the code behaviour is not changed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26924 b3059339-0415-0410-9bf9-f77b7e298cf2
* Clear iconv conversion state also in libass.eugeni2008-05-291-3/+11
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26923 b3059339-0415-0410-9bf9-f77b7e298cf2
* Offset should be size_t.eugeni2008-05-291-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26922 b3059339-0415-0410-9bf9-f77b7e298cf2
* In case 2 styles have the same name, prefer the latest one.eugeni2008-05-191-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26839 b3059339-0415-0410-9bf9-f77b7e298cf2
* Speak of libass instead of MPlayer in the libass license headers.diego2008-05-141-4/+4
| | | | | | | | We already use LIBASS_ prefixes for the multiple inclusion guards. Thus libass can be considered separate enough to warrant this. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26770 b3059339-0415-0410-9bf9-f77b7e298cf2
* Use standard license header.diego2008-05-131-16/+18
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26755 b3059339-0415-0410-9bf9-f77b7e298cf2
* Skip '@' at the beginning of the font name.eugeni2008