summaryrefslogtreecommitdiffstats
path: root/libass/ass_utils.c
Commit message (Collapse)AuthorAgeFilesLines
* Constify ass_msg format (NFC)Grigori Goronzy2015-07-101-1/+1
|
* fontselect: add and use strdup_trimmedGrigori Goronzy2015-07-101-7/+11
| | | | This is just a cleaner and safer interface for string trimming.
* Fix trimming functionGrigori Goronzy2015-07-101-1/+1
| | | | Did not correctly handle empty strings (only whitespace). Whoops.
* Trim spaces of font family stringsGrigori Goronzy2015-07-101-1/+19
| | | | | This adds a trimming utility function that is used for trimming strings of font requests in the font sorter.
* Parse and animate all colors and alpha values like VSFilterOleg Oshmyan2015-05-251-28/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Provide a strndup() fallbackwm42014-11-171-0/+14
| | | | | This standard function is not available everywhere, so we detect it and provide a fallback if missing.
* Add another helper-macro for array allocationwm42014-11-141-0/+17
|
* Simplify ass_utils.c codeYouka2014-11-131-48/+22
| | | | Mainly cosmetic, but maybe some optimizations the compiler misses.
* Add ass_realloc_array()wm42014-11-111-0/+18
| | | | Helps with overflow and allocation failure checking.
* parse_tag: remove unnecessary mallocOleg Oshmyan2014-06-061-4/+6
|
* Parse override tag arguments exactly like VSFilter 2.38Oleg Oshmyan2014-06-061-10/+4
| | | | | 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-6/+19
|
* mystrtoll: don't truncate to intOleg Oshmyan2014-05-121-1/+1
|
* Fix limits.h includesGrigori Goronzy2014-02-171-0/+1
| | | | These were missing in several places. Fixes #50.
* Use a function for aligned memory allocationswm42014-02-021-0/+25
| | | | ...instead of doing this manually.
* ass_utils: fix declarationswm42014-01-271-3/+3
| | | | Now they're the same as in ass_utils.h.
* ass_utils: don't include freetype headerswm42014-01-271-2/+0
| | | | They're not even used.
* Added x86 ASM functions11rcombs2014-01-251-0/+36
|
* Combine bitmaps before applying blur and shadow11rcombs2014-01-251-0/+32
|
* Accept colors with arbitrary sequences of leading & and HOleg Oshmyan2014-01-071-1/+5
|
* Parse style names like VSFilter doesOleg Oshmyan2013-06-221-5/+11
| | | | | | 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.
* Fix \r style lookupOleg Oshmyan2013-06-221-0/+20
| | | | | Make \rSTYLENAME with an invalid STYLENAME fall back to line style rather than to Default. This fixes issue #104.
* Support reading the YCbCr Matrix headerOleg Oshmyan2013-03-031-0/+40
| | | | | | | | | | | | 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.
* Support \rSTYLENAME syntaxGrigori Goronzy2012-03-111-0/+24
| | | | | This allows to reset to a certain style, instead of the default style for the current line. For some reason, this was completely missing.
* 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.
* 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.
* Replace strtod with locale-independent strtodGrigori Goronzy2010-01-051-3/+3
| | | | | | | | | strtod respects the locale and in some locales, the decimal separator is not a point, leading to parsing errors in tags like \pos(23.4,5), which are perfectly valid. As there isn't a really portable way to use a particular locale just for one call to strtod, reimplement it. The implementation was taken from the 1.8 branch of Ruby.
* Always parse colors as hex for ASS tracksGrigori Goronzy2009-08-121-2/+3
| | | | | | 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-3/+3
| | | | | | 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.
* Improve message callback APIGrigori Goronzy2009-07-261-1/+1
| | | | | | Instead of passing a pointer to a va_list, pass the va_list itself. Additionally, use const char for the format string and use names in the prototype that describe the arguments' meaning.
* Allow passing user data to callbackGrigori Goronzy2009-07-121-1/+1
| | | | | | It is often useful or necessary to pass custom data to a callback. Add an argument to the callback registering function to pass a void pointer object to the callback each time it is called.
* Message callback funtionalityGrigori Goronzy2009-07-111-16/+15
| | | | | | | | | | | 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-1/+2
| | | | | | 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.
* Move gaussian blur into bitmap handling codeGrigori Goronzy2009-07-101-119/+0
|
* Correctly round doubles to integersGrigori Goronzy2009-07-081-2/+2
| | | | | mystrtoi and mystrtoll did not round correctly for negative numbers, this was fixed.
* Include ass_utils.h instead of mputils.hGrigori Goronzy2009-06-271-1/+0
|
* Incorporate mputils.c into ass_utils.cGrigori Goronzy2009-06-271-20/+195
| | | | | | Move helper functions originating from MPlayer into ass_utils.c. Remove some debugging code that is #if 0'ed for ages now. Delete mputils.c and mputils.h and remove them from the build system.
* Rename mp_msg to ass_msgGrigori Goronzy2009-06-271-1/+1
|
* Reindent all source code.greg2009-06-201-75/+91
| | | | | | | | | | | | | | | 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-5/+5
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* Support ScaledBorderAndShadow property.greg2009-03-051-0/+11
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28820 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove unused function argument.eugeni2009-02-271-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28753 b3059339-0415-0410-9bf9-f77b7e298cf2
* Support fractional arguments for some override tags.eugeni2009-02-271-1/+14
| | | | | | | Done by parsing all integers as doubles first and then converting them to the nearest integer. Patch by Grigori G (greg chown ath cx). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28752 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
* Comment out dump_glyph(): it is unused and, as it is now, breaks compilation.eugeni2008-02-221-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26068 b3059339-0415-0410-9bf9-f77b7e298cf2
* Some debugging routines.eugeni2008-02-221-0/+26
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26066 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove unused includes.eugeni2007-04-101-2/+0
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22965 b3059339-0415-0410-9bf9-f77b7e298cf2
* Collect all includes of mplayer headers in libass in a single file (mputils.h).eugeni2006-11-191-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21042 b3059339-0415-0410-9bf9-f77b7e298cf2
* Introduce MSGT_ASS, use it for all libass messages.eugeni2006-11-031-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20645 b3059339-0415-0410-9bf9-f77b7e298cf2
* Revert r20517.eugeni2006-10-291-76/+0
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20519 b3059339-0415-0410-9bf9-f77b7e298cf2
* Copy the following functions to libass to avoid dependency on the rest of ↵eugeni2006-10-291-0/+76
| | | | | | | | | | | | mplayer: guess_buffer_cp utf8_get_char blur git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20517 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add copyright notice and vim/emacs comments to libass and vf_ass.c.eugeni2006-10-011-0/+20
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20014 b3059339-0415-0410-9bf9-f77b7e298cf2
* Replace stdint.h with inttypes.h.eugeni2006-08-151-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19411 b3059339-0415-0410-9bf9-f77b7e298cf2
* Support some recently discovered color formats.eugeni2006-07-101-3/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19008 b3059339-0415-0410-9bf9-f77b7e298cf2
* Initial libass release (without mencoder support).eugeni2006-07-071-0/+63
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18942 b3059339-0415-0410-9bf9-f77b7e298cf2