Commit Graph

100 Commits

Author SHA1 Message Date
Limin Wang 8b9ef5a516 avutil/parseutils: use quadhd for Quad HD
qHD is 960x540 (q stands for quarter) and QHD is 2560x1440 (Q is quad).
use quadhd for QHD for abbreviation.

Fix ticket#9591

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-01-12 13:42:26 +08:00
Limin Wang 8dc8c01d6c avutil/parseutils: add qhd(Quad HD) or wqhd(Wide Quad HD) for 1440p
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-03 21:38:37 +08:00
Michael Niedermayer 5d7f17e885 avutil/parseutils: Check sign in av_parse_time()
Fixes: signed integer overflow: -9223372053736 * 1000000 cannot be represented in type 'long'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-6607924558430208

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-03 16:54:20 +01:00
Carl Eugen Hoyos 0cac68bcf9 lavu/parseutils: Allow to parse >= 100 hours.
Reported and tested by gamnark.
Fixes ticket #7721.
2019-02-09 13:59:10 +01:00
Marton Balint 4c777d52b9 avutil/parseutils: fix some overflows in duration calculations
Also properly return AVERROR(ERANGE) in case of actual overflows.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-10-07 20:26:29 +02:00
Marton Balint 8d37dd6ed3 avutil/parseutils: only accept full us duration, do not accept mss duration
Accepting 'u' suffix for a time specification is neither intuitive nor
consistent (now that we don't accept m). Also there was a bug in the code
accepting an extra 's' even after 'ms'.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-09 22:01:38 +01:00
Rostislav Pehlivanov 8218249f1f parseutils: accept only full "ms" suffix
The commit which added those was pushed prematurely before anyone could object
to illogical suffixes like just m for milliseconds. Without this, we'd be locked
into never being able to implement the "m" suffix for minutes.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-03-05 20:38:35 +00:00
Aurelien Jacobs 61c972384d parseutils: add support for ms and us suffix for AV_OPT_TYPE_DURATION
supported suffixes are:
- s: seconds (default when no suffix specified)
- m or ms: milliseconds
- u or us: microseconds
2018-03-02 22:57:08 +01:00
Micah Galizia 489c09ad4b add locale month names to av_small_strptime
Signed-off-by: Micah Galizia <micahgalizia@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-26 17:16:22 +01:00
Marton Balint 593987810e avutil/parseutils: dont assume standard time when parsing a timestamp
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-11 01:06:23 +02:00
Derek Buitenhuis 96d616052b Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'
* commit 'd12b5b2f135aade4099f4b26b0fe678656158c13':
  build: Split test programs off into separate files

Some conversions done by: James Almer <jamrial@gmail.com>
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-11 19:13:03 +01:00
Diego Biurrun d12b5b2f13 build: Split test programs off into separate files
This avoids spurious library rebuilds when only the test program
code is changed and simplifies the build system.
2016-04-07 16:14:42 +02:00
Michael Niedermayer 54f43984e1 avutil/parseutils: mark args as static const
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-24 19:31:02 +01:00
Petru Rares Sincraian f707042c93 Added more tests to libavutil/parseutils.c
- Added tests for av_find_info_tag().
    - Added test for av_get_known_color_name()

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-24 19:29:43 +01:00
Petru Rares Sincraian 68e5976543 Refactor libavutil/parseutils.c
All tests were in the main method which produces a long main. Now, each test
is in his own method.

I think this produces a more clear code and follows more with the main
priority of FFmpeg "simplicity and small code size"

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-24 03:38:12 +01:00
Diego Biurrun a84713e70d parseutils-test: Move some variable declarations to avoid block braces 2016-03-23 09:35:41 +01:00
Marton Balint ae51f9bd6c avutil/parseutils: remove 2112 date from fate test
It is not supported on 32bit.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-14 20:13:15 +01:00
Marton Balint f834f0cab6 avutil/parseutils: accept everything in av_parse_time that ff_iso8601_to_unix_time accepts
Also parse timezone information previously ignored in ff_iso8601_to_unix_time.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-14 01:46:35 +01:00
Marton Balint 3235241061 avutil/parseutils: use microsecond precision when parsing "now" in av_parse_time()
Use av_gettime() instead of time(0) for querying current time.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-14 01:46:35 +01:00
Michael Niedermayer be0fd07457 Merge commit '219b39a71a5694b1c14a07b86477f665a5b6849b'
* commit '219b39a71a5694b1c14a07b86477f665a5b6849b':
  parseutil: Use non ambiguous aliases for uhd

Conflicts:
	doc/ffmpeg.texi
	libavutil/parseutils.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-21 16:55:39 +02:00
Luca Barbato 219b39a71a parseutil: Use non ambiguous aliases for uhd
uhd1 and uhd2 would be ambigous.
2015-07-21 11:43:44 +02:00
Michael Niedermayer 9ebe041e1c Merge commit 'e93ca480c91397f82f2ea5b6a8b82ac6d0e2bfd2'
* commit 'e93ca480c91397f82f2ea5b6a8b82ac6d0e2bfd2':
  parseutil: Add more resolution aliases

Conflicts:
	doc/ffmpeg.texi
	libavutil/parseutils.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-20 04:32:28 +02:00
Luca Barbato e93ca480c9 parseutil: Add more resolution aliases
Add DCI 2k and 4k and uhd1 and uhd2.
2015-07-20 04:05:48 +02:00
Michael Niedermayer 0739179bfb Merge commit '108f2f381acb93827fb4add0517eeae859afa3bf'
* commit '108f2f381acb93827fb4add0517eeae859afa3bf':
  parseutils: Extend small_strptime to be used in avformat

Conflicts:
	libavutil/parseutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-07 20:01:36 +02:00
Luca Barbato 27f2746282 parseutils: Make av_small_strptime public
And use it in libavformat.

Based on a similar patch by Stefano Sabatini <stefasab@gmail.com>.
2015-04-07 12:36:11 +02:00
Luca Barbato 108f2f381a parseutils: Extend small_strptime to be used in avformat
The strptime implementation is supposed to support whitespace and %T.
2015-04-06 18:09:03 +02:00
Michael Niedermayer 6998400c61 Merge commit 'bf704132a51f5d838365158331d4e535e1df4c8e'
* commit 'bf704132a51f5d838365158331d4e535e1df4c8e':
  Don't anonymously typedef structs

Conflicts:
	avprobe.c
	libavutil/parseutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 21:27:44 +01:00
Diego Biurrun bf704132a5 Don't anonymously typedef structs 2015-02-14 10:13:49 -08:00
Michael Niedermayer 4a39d4c65a Merge commit '82ee7d0dda0fec8cdb670f4e844bf5c2927ad9de'
* commit '82ee7d0dda0fec8cdb670f4e844bf5c2927ad9de':
  Use gmtime_r instead of gmtime and localtime_r instead of localtime

Conflicts:
	libavformat/mov.c
	libavformat/mxfenc.c
	libavformat/wtvdec.c
	libavutil/parseutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-26 02:38:26 +01:00
Martin Storsjö 82ee7d0dda Use gmtime_r instead of gmtime and localtime_r instead of localtime
gmtime isn't thread safe in general. In msvcrt (which lacks gmtime_r),
the buffer used by gmtime is thread specific though.

One call to localtime is left in avconv_opt.c, where thread safety
shouldn't matter (instead of making avconv depend on the libavutil
internal header).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-26 00:14:54 +03:00
Michael Niedermayer a435a03374 Merge commit '6b45f05ef5b241fd1513702119af9c30056a0ac5'
* commit '6b45f05ef5b241fd1513702119af9c30056a0ac5':
  parseutils: fix discarding const attribute warning

Conflicts:
	libavutil/parseutils.c

See: fe87b2e79c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-12 19:12:33 +01:00
Vittorio Giovara 6b45f05ef5 parseutils: fix discarding const attribute warning 2013-12-12 16:10:14 +01:00
Stefano Sabatini d61617a523 lavu/parseutils: add av_get_known_color_name() 2013-10-27 09:16:05 +01:00
Niv Sardi 49ba6e56bd lavu/parseutils: add more resolutions
See http://en.wikipedia.org/wiki/Graphics_display_resolution

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
2013-10-07 11:45:03 +02:00
Michael Niedermayer 2215947438 avutil/parseutils:make const tables static const
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-11 16:50:24 +02:00
Carl Eugen Hoyos de4811e910 Force using a 64bit intermediate when calculating calendar time with av_timegm().
Fixes a fate failure with icc 13.1
2013-03-08 02:42:33 +01:00
Reimar Döffinger efa7f42020 Use the avstring.h locale-independent character type functions
Make sure the behavior does not change with the locale.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 15:16:36 +02:00
Reimar Döffinger 88d55b827d Remove incorrect use of ctype.h functions.
As far as I can tell the code should not change behaviour
depending on locale in any of these places.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2013-03-03 21:44:10 +01:00
Senthilnathan M 12a269a522 lavu/parseutils: allow MM:SS format for duration in av_parse_time()
Fix trac ticket #2258.

Signed-off-by: Senthilnathan M <senthilnathan.maadasamy@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
2013-02-22 23:43:46 +01:00
Dave Rice 71956371a7 lavu/parseutils: add digital cinema frame sizes
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
2013-02-03 22:57:04 +01:00
Michael Niedermayer 99efd59626 Merge commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967'
* commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967':
  Remove pointless #undefs of previously forbidden functions.
  fate: Add dependencies for bmp, cdxl, dfa, mp3

Conflicts:
	doc/examples/muxing.c
	libavfilter/filtfmts.c
	libavutil/des.c
	libavutil/eval.c
	libavutil/log.c
	libavutil/parseutils.c
	tests/fate/mp3.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-05 13:34:45 +01:00
Anton Khirnov cb45553f57 Remove pointless #undefs of previously forbidden functions. 2012-12-04 21:40:22 +01:00
Nicolas George 86a2486812 lavu/parseutils: accept %J for hours >= 24.
Allow to parse durations >= 24:00:00.
2012-12-02 11:48:56 +01:00
Stefano Sabatini d4604d10fe lavu/parseutils: add trailing characters check in av_parse_video_size()
Return an error in case the video size specifications contains spurious
trailing chars, like in "320x240foobar".
2012-10-29 17:39:26 +01:00
Stefano Sabatini b6e36a4244 lavu/parseutils: remove unused gcd variable in av_parse_ratio()
Fix warning.
2012-10-22 10:41:51 +02:00
Stefano Sabatini cdea54b4c8 lavu/parseutils: rework rational reduction logic in av_parse_ratio()
Avoid to divide num and den by gcd in case of a parsed expression, since
that is already done in av_d2q(), and force reduction in case of "a:b"
form, allowing to honour the max parameter.

The latter change is consistent with the a/b case, and with the
documentation.
2012-10-20 12:19:53 +02:00
Michael Niedermayer f391e405df Merge commit 'e002e3291e6dc7953f843abf56fc14f08f238b21'
* commit 'e002e3291e6dc7953f843abf56fc14f08f238b21':
  Use the new aes/md5/sha/tree allocation functions
  avutil: Add functions for allocating opaque contexts for algorithms
  svq3: fix pointer type warning
  svq3: replace unsafe pointer casting with intreadwrite macros
  parseutils-test: various cleanups

Conflicts:
	doc/APIchanges
	libavcodec/svq3.c
	libavutil/parseutils.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-12 14:52:34 +02:00
Michael Niedermayer d6135a886d Merge commit '15ba7f6525c0f56f0c8e3e3e0c0c5129de054f41'
* commit '15ba7f6525c0f56f0c8e3e3e0c0c5129de054f41':
  parseutils: fix const removal warning
  prepare 9_beta1 release

Conflicts:
	Changelog
	RELEASE
	libavutil/parseutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-12 14:38:04 +02:00
Mans Rullgard 15ba7f6525 parseutils: fix const removal warning
The const qualifier is still removed although it happens inside
the strtol() function so no warning is generated.

Fixes:
libavutil/parseutils.c:110:11: warning: assignment discards qualifiers from pointer target type

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-11 18:00:27 +01:00
Mans Rullgard 68e360a83c parseutils-test: various cleanups
- make tables static const
- remove useless use of compound literal
- break long lines
- fix a comma/semicolon typo

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-11 18:00:27 +01:00