summaryrefslogtreecommitdiff
path: root/libavutil/timecode.c
Commit message (Collapse)AuthorAge
* avutil/timecode: use timecode fps for number of frame digitsMarton Balint2022-04-22
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/log: Don't include avutil.hAndreas Rheinhardt2022-02-24
| | | | | | | | | | | | It has been included since af5f434f8c0fb3b4ee3b206ebc1946ca660a8abe for deprecation reasons, but removing it has been forgotten after it had served is purpose. So remove it. For convenience, include version.h instead as LIBAVUTIL_VERSION_INT is supposed to be used when creating AVClasses. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/timecode: Avoid fps overflowMichael Niedermayer2021-03-14
| | | | | | | | Fixes: Integer overflow and division by 0 Fixes: poc-202102-div.mov Found-by: 1vanChen of NSFOCUS Security Team Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Revert "avutil/timecode: fix sscanf format string with garbage at the end"Marton Balint2021-01-23
| | | | | | | | | This reverts commit 6696a07ac62bfec49dd488510a719367918b9f7a. It is wrong to restrict timecodes to always contain leading zeros or for hours or frames to be 2 chars only. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/timecode: Avoid undefined behavior with large framenumMichael Niedermayer2021-01-19
| | | | | | | | Fixes: signed integer overflow: 2147462079 + 2149596 cannot be represented in type 'int' Fixes: 27565/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5091972813160448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/timecode: fix sscanf format string with garbage at the endLimin Wang2021-01-16
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avutil/timecode: add av_timecode_init_from_componentsMarton Balint2020-12-03
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/timecode: allow drop frame timecodes for multiples of 30000/1001 fpsMarton Balint2020-12-03
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/timecode: add av_timecode_make_smpte_tc_string2Marton Balint2020-09-13
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/timecode: do not trash bits on invalid av_timecode_get_smpte argumentsMarton Balint2020-09-13
| | | | | | The function has no way to return error, so let's clip or calculate modulo. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/timecode: cosmetics on av_timecode_get_smpteMarton Balint2020-09-13
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/timecode: fix av_timecode_get_smpte_from_framenum with 50/60 fpsMarton Balint2020-09-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SMPTE 12M timecode can only count frames up to 39, because the tens-of-frames value is stored in 2 bit. In order to resolve this 50/60 fps SMPTE timecode is using the field bit (which is the same bit as the phase correction bit) to signal the least significant bit of a 50/60 fps timecode. See SMPTE ST 12-1:2014 section 12.1. Therefore we slightly change the format of the return value of av_timecode_get_smpte_from_framenum and AV_FRAME_DATA_S12M_TIMECODE and start using the previously unused Phase Correction bit as Field bit. (As the SMPTE standard suggests) We add 50/60 fps support to av_timecode_get_smpte_from_framenum by calling the recently added av_timecode_get_smpte function in it which already handles this properly. This change affects the decklink indev and the DV and MXF muxers. MXF has no fate test for 50/60fps content, DV does, therefore the changes. MediaInfo (a recent version) confirms that half-frame timecode must be inserted to DV. MXFInspect confirms valid timecode insertion to the System Item of MXF files. For MXF, also see EBU R122. Note that for DV the field flag is not used because in the HDV specs (SMPTE 370M) it is still defined as biphase mark polarity correction flag. So it should not matter that the DV muxer overrides the field bit. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/timecode: add function av_timecode_get_smpte()Limin Wang2020-06-28
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avutil/timecode: fix starting frame number for 59.94 fpsGyan Doshi2018-02-23
| | | | | | | The existing code for adjusting starting frame number assumes 29.97 as stream fps. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavu/timecode: clarify error msg for timecode_rateGyan Doshi2017-11-10
| | | | | | | | | | | The user-supplied value for timecode_rate in drawtext is rounded to nearest integer. So, a supplied value of 0.49 or lower is rounded to 0. This throws a misleading error message which says "Timecode frame rate must be specified". Changed message to account for values under one. Also noted supported framerates for drop TC. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-29
|
* avutil/timecode: Fix fps checkMichael Niedermayer2015-12-03
| | | | | | | | | | | | The fps variable is explicitly set to -1 in case of some errors, the check must thus be signed or the code setting it needs to use 0 as error code the type of the field could be changed as well but its in an installed header Fixes: integer overflow Fixes: 9982cc157b1ea90429435640a989122f/asan_generic_3ad004a_3799_22cf198d9cd09928e2d9ad250474fa58.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* timecode: Support HFR valuesVittorio Giovara2015-10-26
|
* timecode: Do not fail for non-standard frameratesVittorio Giovara2015-10-26
| | | | | | Instead just warn, and use the parse fps normally. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* Timecode: Support 48fpsThierry Foucu2014-05-28
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavu/timecode: fix time code calculation for 60000/1001 drop frameJason2013-01-24
| | | | | Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavu/timecode: Allow drop frame mode for 60000/1001 fpsJason2013-01-24
| | | | | Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavu: drop disabled FF_API_OLD_TC_ADJUST_FRAMENUM codeStefano Sabatini2012-11-04
|
* lavu/timecode: add av_timecode_check_frame_rate().Clément Bœsch2012-08-08
|
* timecode: show frame rate when invalid.Clément Bœsch2012-08-01
|
* avutil: support 50 and 60 frame rates in timecode apiMatthieu Bouron2012-07-27
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavu/timecode: use @see for URL in doxygen.Clément Bœsch2012-02-03
|
* lavu: add public timecode API.Clément Bœsch2012-02-02