Commit Graph

168 Commits

Author SHA1 Message Date
Alex Smith 09f2581dc5 msvc/icl: Use __declspec(deprecated)
Prior to this on msvc/icl there was no handling of deprecated functions
and the deprecated warning was disabled.

After enabling there are a number of warnings relating to the CRT and
the use of the non-secure versions of several functions.  Defining
_CRT_SECURE_NO_WARNINGS silences these warnings.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-20 14:40:06 +03:00
Martin Storsjö e743e7ae6e libavutil: Make avpriv_open a library-internal function on msvcrt
Add one copy of the function into each of the libraries, similarly
to what we do for log2_tab. When using static libs, only one
copy of the file_open.o object file gets included, while when
using shared libraries, each of them get a copy of its own.

This fixes DLL builds with a statically linked C runtime, where
each DLL effectively has got its own instance of the C runtime,
where file descriptors can't be shared across runtimes.

On systems not using msvcrt, the function is not duplicated.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-10 00:53:33 +03:00
Martin Storsjö 33237123c8 libavutil: Enable the MSVC DLL symbol loading workaround in shared builds as well
This used to only be necessary in static builds (when using the
dynamically linked C runtime), since the _imp prefixed symbols do
exist when linking to the actual DLL. When building testprogs,
however, the current library (e.g. libavutil for some of the testprogs)
is linked statically.

This fixes make fate on DLL builds when using the dynamically
linked C runtime.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-10 00:53:25 +03:00
Rémi Denis-Courmont 869b04e891 libavutil: add avpriv_open() to open files with close-on-exec flag
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-07 21:12:20 +02:00
Diego Biurrun 3a7050ffed build: Add _Pragma macro to disable deprecated declaration warnings 2013-08-02 19:19:02 +02:00
Martin Storsjö 06122c2533 msvc: Move linker pragma from config.h to libavutil/internal.h
This makes linking succeed for tools that include config.h but
don't link to libavutil.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-05-08 01:28:25 +03:00
Diego Biurrun f099d3d1d5 Add av_log_{ask_for_sample|missing_feature} replacements to libavutil
This allows reporting missing features and requesting samples from
all libraries in a standard way; with a simplified API.
2013-03-13 20:42:06 +01:00
Diego Biurrun 4db96649ca avutil: Ensure that emms_c is always defined, even on non-x86 2013-02-14 19:29:04 +01:00
Diego Biurrun ab441e20ff avutil: Move emms code to x86-specific header 2013-02-14 17:37:34 +01:00
Luca Barbato fd1abf4269 lavu: avoid clashing definition of E
E is usually defined as a shorthand for AV_OPT_FLAG_ENCODING_PARAM.
Rename the single expansion E(x) now used in libavutil to E1.
2013-02-12 11:47:43 +01:00
Diego Biurrun 218aefce44 dsputil: Move LOCAL_ALIGNED macros to libavutil 2013-02-08 23:13:37 +01:00
Martin Storsjö f4facd2ce7 x86: Add a Yasm-based emms() replacement
This provides a fallback when building with Yasm enabled, but neither
inline assembly, nor the _mm_empty intrinsic are available or enabled.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-18 22:02:13 +01:00
Janne Grunau e96d90eed6 remove #defines to prevent use of discouraged external functions
Preventing the use of discouraged or 'insecure' external functions
through defines in an internal header is not a good solution. The
header is not guaranteed to be included universally which makes
overlooking bad use of said functions during review more likely.

There are cases were those functions either are the most straight
forward solution or even have to be used. Using malloc or free is
required if the allocation or release is done by other libraries.
2012-11-25 23:02:04 +01:00
Martin Storsjö d66c52c2b3 Add support for building shared libraries with MSVC
This requires the makedef perl script by Derek, from the
c89-to-c99 repo. That scripts produces a .def file, listing
the symbols to be exported, based on the gcc version scripts
and the built object files.

To properly load non-function symbols from DLL files, the
data symbol declarations need to have the attribute
__declspec(dllimport) when building the calling code. (On mingw,
the linker can fix this up automatically, which is why it has not
been an issue so far. If this attribute is omitted, linking
actually succeeds, but reads from the table will not produce the
desired results at runtime.)

MSVC seems to manage to link DLLs (and run properly) even if
this attribute is present while building the library itself
(which normally isn't recommended) - other object files in the
same library manage to link to the symbol (with a small warning
at link time, like "warning LNK4049: locally defined symbol
_avpriv_mpa_bitrate_tab imported" - it doesn't seem to be possible
to squelch this warning), and the definition of the tables
themselves produce a warning that can be squelched ("warning C4273:
'avpriv_mpa_bitrate_tab' : inconsistent dll linkage, see previous
definition of 'avpriv_mpa_bitrate_tab').

In this setup, mingw isn't able to link object files that refer to
data symbols with __declspec(dllimport) without those symbols
actually being linked via a DLL (linking avcodec.dll ends up with
errors like "undefined reference to `__imp__avpriv_mpa_freq_tab'").
The dllimport declspec isn't needed at all in mingw, so we simply
choose not to declare it for other compilers than MSVC that requires
it. (If ICL support later requires it, the condition can be extended
later to include both of them.)

This also implies that code that is built to link to a certain
library as a DLL can't link to the same library as a static library.
Therefore, we only allow building either static or shared but not
both at the same time. (That is, static libraries as such can be,
and actually are, built - this is used for linking the test tools to
internal symbols in the libraries - but e.g. libavformat built to
link to libavcodec as a DLL cannot link statically to libavcodec.)

Also, linking to DLLs is slightly different from linking to shared
libraries on other platforms. DLLs use a thing called import
libraries, which is basically a stub library allowing the linker
to know which symbols exist in the DLL and what name the DLL will
have at runtime.

In mingw/gcc, the import library is usually named libfoo.dll.a,
which goes next to a static library named libfoo.a. This allows
gcc to pick the dynamic one, if available, from the normal -lfoo
switches, just as it does for libfoo.a vs libfoo.so on Unix. On
MSVC however, you need to literally specify the name of the import
library instead of the static library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-18 14:26:15 +03:00
Mans Rullgard 05e209c04c Allow use of strncpy()
There are cases where strncpy() does exactly what is required.
A blanket ban forces more convoluted solutions to be used in those
cases and has been a cause of bugs.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-03 14:36:51 +01:00
Diego Biurrun 17337f54c0 x86: Split inline and external assembly #ifdefs 2012-08-31 01:53:25 +02:00
Mans Rullgard 33de86db2b dict: move struct AVDictionary definition to dict.c
This makes struct AVDictionary fully opaque now that nothing
needs to access it directly any more.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-10 15:15:00 +01:00
Mans Rullgard 54918d0394 libavutil: remove unused av_abort() macro
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 20:52:39 +01:00
Mans Rullgard 1c4ab37c38 libavutil: drop offsetof() fallback definition
The only compiler I have that does not define the standard
offsetof() macro is "Bruce's C Compiler", a simple compiler
for producing 8/16-bit 8086 code, usually for use in early
stages of PC booting.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 20:52:39 +01:00
Mans Rullgard d913fd1f00 libavutil: drop fallback definitions of INTxx_MIN/MAX
This list is incomplete (we also use UINT16_MAX), so there does
not appear to be any system we care about that needs these.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 20:52:39 +01:00
Mans Rullgard d7a4f8f8b9 Move MASK_ABS macro to libavcodec/mathops.h
This macro is only used in two places, both in libavcodec, so this
is a more sensible place for it.

Two small tweaks to the macro are made:

- removing the trailing semicolon
- dropping unnecessary 'volatile' from the x86 asm

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 00:58:20 +01:00
Mans Rullgard 070a402b60 x86: move MANGLE() and related macros to libavutil/x86/asm.h
These x86-specific macros do not belong in generic code.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 00:58:20 +01:00
Ronald S. Bultje f80ddd5bf7 lavu: use intrinsics for emms on systems lacking inline asm support
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-10 14:33:09 +03:00
Ronald S. Bultje 8123e0901f x86: place some inline asm under #if HAVE_INLINE_ASM
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-25 13:23:12 +01:00
Diego Biurrun 58c42af722 doxygen: misc consistency, spelling and wording fixes 2011-12-12 23:06:23 +01:00
Reimar Döffinger de8d1940b5 avutil: Don't allow using strcasecmp/strncasecmp
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-06 11:52:59 +02:00
Anton Khirnov d9f80ea2a7 Move metadata API from lavf to lavu.
Rename it to AVDictionary, since it will be used as such.  Tags
documentation and metadata conversion API is lavf-specific, so remains
there.
2011-06-08 07:43:45 +02:00
Diego Biurrun fb8648ad4b Remove unnecessary LIBAVFORMAT_BUILD #ifdef. 2011-06-05 16:01:01 +02:00
Ronald S. Bultje e973557211 Move emms_c() from libavcodec to libavutil. 2011-05-24 14:48:49 -04:00
Alex Converse 1569554153 Ban strncpy() it's too easy to misuse. 2011-05-08 12:49:07 -07:00
Mans Rullgard 820818a330 Remove unnecessary icc version checks
With unknown attribute warnings disabled, these checks are no
longer needed.  Removing them improves readability while having
no effect on generated code.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-23 12:39:58 +00: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
Alexander Strange 37b00b47cb Frame-based multithreading framework using pthreads
See doc/multithreading.txt for details on use in codecs.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-09 09:17:28 -05:00
Mans Rullgard 365e3c7878 Rename attribute_used to av_used and move it to attributes.h
This is consistent with most of the other attribute macros.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-31 16:01:26 +00:00
Luca Barbato dfd2a005eb Replace dprintf with av_dlog
dprintf clashes with POSIX.1-2008
2011-01-29 23:55:37 +01:00
Carl Eugen Hoyos 086e997e34 Intel C compiler 12.0 does not suport these attributes: may_alias, force_align_arg_pointer and alloc_size.
Originally committed as revision 25716 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-11-10 12:45:41 +00:00
Carl Eugen Hoyos eedc4ee5d8 Use attribute force_align_arg_pointer only on x86_32.
Originally committed as revision 24290 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-17 16:35:01 +00:00
Måns Rullgård cae70f99a3 Improve FF_SYMVER documentation
Originally committed as revision 23911 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-30 20:09:55 +00:00
Måns Rullgård 49bd8e4b84 Fix grammar errors in documentation
Originally committed as revision 23904 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-30 15:38:06 +00:00
Michael Niedermayer 33586ee770 Document FF_SYMVER and attribute_used
Originally committed as revision 23622 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-16 04:53:09 +00:00
Måns Rullgård ccc87908a9 Fix symbol version compat wrappers on systems with export prefixes
Originally committed as revision 23615 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-15 15:24:28 +00:00
Måns Rullgård b462d13262 Add compatibility wrappers for functions moved from lavf to lavc
When symbol versioning is enabled, moving symbols from one library to
another breaks binary compatibility.  This adds wrappers with the old
version tag for the av_*packet functions recently moved to lavc.

Originally committed as revision 23611 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-15 13:26:52 +00:00
Michael Niedermayer a74d707cb7 av_alias is an attribute and belongs to attributes.h
also attributes.h is public and external api and can thus not depend
on configure tested compiler support thus this part is removed. A
different solution must be found if this breaks for some compiler
which i hope it does not.

Originally committed as revision 23115 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-05-13 16:30:58 +00:00
Diego Biurrun ba87f0801d Remove explicit filename from Doxygen @file commands.
Passing an explicit filename to this command is only necessary if the
documentation in the @file block refers to a file different from the
one the block resides in.

Originally committed as revision 22921 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-20 14:45:34 +00:00
Måns Rullgård 2ed6f39944 Replace many includes of libavutil/common.h with what is actually needed
This reduces the number of false dependencies on header files and
speeds up compilation.

Originally committed as revision 22407 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-09 17:39:19 +00:00
Måns Rullgård 335ee1aadd Move libm replacements to new header libm.h
ffmpeg.c uses lrintf(), which is missing on some systems.  Previously
it picked up the replacement via libavutil/internal.h due to
HAVE_AV_CONFIG_H being erroneously defined.

Moving these replacements to a separate header enables ffmpeg.c to
use them without being exposed to internal interfaces.

This use of a non-public header is justified by the header in question
not being part of the internal interface either.  It should rather be
considered as part of the build system, which is shared between the
libraries and the applications.

This header cannot be installed since the tested conditions depend on
the compiler.

Originally committed as revision 22399 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-09 15:10:23 +00:00
Måns Rullgård 94ca624fbc Move ff_sqrt() to libavutil/intmath.h
Originally committed as revision 22345 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-08 21:19:56 +00:00
Måns Rullgård 7ed63ca2e7 Add casts to correct return type in macros for missing libm funcs
Originally committed as revision 21922 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-20 16:02:48 +00:00
Carl Eugen Hoyos 8e339d4aa0 Gcc attribute may_alias is not supported (or silently ignored) by all supported compilers.
Originally committed as revision 21917 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-20 12:22:24 +00:00
Måns Rullgård 8e05f06912 Define missing llrint() as macro instead of inline function
This fixes building on some broken systems.

Originally committed as revision 21735 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-09 22:55:16 +00:00