Commit Graph

19 Commits

Author SHA1 Message Date
Martin Storsjö
ab79263419 seek: Fix crashes in ff_seek_frame_binary if built with latest Clang 14
Passing an uninitialized variable as argument to a function is
undefined behaviour (UB). The compiler can assume that UB does not
happen.

Hence, the compiler can assume that the variables are never
uninitialized when passed as argument, which means that the codepaths
that initializes them must be taken.

In ff_seek_frame_binary, this means that the compiler can assume
that the codepaths that initialize pos_min and pos_max are taken,
which means that the conditions "if (sti->index_entries)" and
"if (index >= 0)" can be optimized out.

Current Clang git versions (upcoming Clang 14) enabled an optimization
that does this, which broke the current version of this function
(which intentionally left the variables uninitialized, but silencing
warnings about being uninitialized). See [1] for discussion on
the matter.

[1] https://reviews.llvm.org/D105169#3069555

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-10-18 14:34:30 +03:00
Andreas Rheinhardt
cf7c51f24b avformat/utils: Move seeking code out into a new file
libavformat/utils.c has over 5500 lines and is supposed to contain
"various utility functions for use within FFmpeg". In reality it
contains all that and the whole demuxing+seeking core of libavformat.
This is especially bad, because said file includes the FFMPEG_VERSION
(the git commit sha) so that it is rebuilt whenever the commit HEAD
points to changes. Therefore this commit starts making it smaller
by factoring the seeking code out.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-17 13:53:30 +02:00
wm4
6a5b8ca432 lavf: remove unused code
Nothing uses it, and it provides no public API.

Archeological finds:

Commit 101036adb9 added the API.
Commit a8dd8dc6e9 made mpegts.c use it.
Commit af8aae3fa3 disabled it by default in mpegts.c.
Commit ae2bb52cd2 removed all uses of this from mpegts.c.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-02-08 21:34:05 +01:00
Diego Biurrun
8f8bc92365 Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
Anton Khirnov
2ba68dd044 lavf: remove unreliable timestamp guessing heuristic 2013-10-28 09:28:19 +01:00
Anton Khirnov
27c7ca9c12 lavf: deobfuscate read_frame_internal().
Split off packet parsing into a separate function. Parse full packets at
once and store them in a queue, eliminating the need for tracking
parsing state in AVStream.

The horrible unreadable loop in read_frame_internal() now isn't weirdly
ordered and doesn't contain evil gotos, so it should be much easier to
understand.

compute_pkt_fields() now invents slightly different timestamps for two
raw vc1 tests, due to has_b_frames being set a bit later. They shouldn't
be more wrong (or right) than previous ones.
2012-03-05 18:47:05 +01:00
Alex Converse
7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Mans Rullgard
0ebcdf5cda Do not include mathematics.h in avutil.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:42:06 +01:00
Mans Rullgard
2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Anton Khirnov
a2704c9712 avio: add avio_tell macro as a replacement for url_ftell
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-04 11:26:57 -05:00
Anton Khirnov
6b4aa5dac8 avio: avio_ prefix for url_fseek
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-01 12:12:33 -05:00
Jean-Daniel Dupas
cc947f04cc Replace all occurences of PKT_FLAG_KEY with AV_PKT_FLAG_KEY.
Patch by Jean-Daniel Dupas, devlists shadowlab org

Originally committed as revision 22744 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-31 12:29:58 +00:00
Aurelien Jacobs
972ffe6220 rename av_read_frame_flush to ff_read_frame_flush
it is an internal function, not part of public API

Originally committed as revision 22562 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-15 23:15:24 +00:00
David Conrad
457c08ba3c Add internal.h include for av_read_frame_flush prototype
Fixes build with clang

Originally committed as revision 22273 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-07 02:35:45 +00:00
Måns Rullgård
e16c73e67e Move av_read_frame_flush() prototype to lavf/internal.h
Originally committed as revision 22268 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-06 23:19:05 +00:00
Reimar Döffinger
f0cb55af88 Use av_compare_ts from libavutil instead of the locale compare_ts, the
calculations in the later one are not correct with large time stamps.

Originally committed as revision 21744 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-10 19:43:57 +00:00
Ivan Schreter
dbe0ad85c1 Use I/O buffer size as initial value for backoff for seeking sync point search.
Originally committed as revision 19829 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-13 08:57:30 +00:00
Ivan Schreter
7a656933c9 cosmetic changes (indentation, doxygen comments, braces, put structures for API to header, ...)
Originally committed as revision 19773 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-05 19:31:01 +00:00
Ivan Schreter
101036adb9 Support for generic multi-stream key frame finding for new seek API.
Originally committed as revision 19680 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-08-22 16:05:43 +00:00