flv: add support for G.711

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
rtpdec: Don't explicitly include unistd.h any longer

unistd.h used to be required for gethostname. On windows, gethostname
is provided by winsock2.h. Now network.h includes both unistd.h and
winsock2.h if they exist.

Signed-off-by: Martin Storsjö <martin@martin.st>
doc: Indicate that RTMPT is natively implemented in libavformat

Signed-off-by: Martin Storsjö <martin@martin.st>
random_seed: Only read /dev/*random if we have unistd.h

unistd.h is used for open/read/close, but if this header does not
exist, there's probably no use in trying to open /dev/*random
at all.

Signed-off-by: Martin Storsjö <martin@martin.st>
file: Only include unistd.h if it exists

It is included for the open/read/write/close functions. On
MSVC, where this header does not exist, the same functions
are provided by io.h, which is already included.

On windows, these functions are provided by io.h. Make sure
io.h is included if it exists, regardless of the setmode
function.

Signed-off-by: Martin Storsjö <martin@martin.st>
x86: vc1: fix and enable optimised loop filter

The problem is that the ssse3 psign instruction does the wrong
thing here.  Commit ea60dfe incorrectly removed a macro emulating
this instruction for pre-ssse3 code.  However, the emulation is
incorrect, and the code relies on the behaviour of the macro.
Specifically, the psign sets destination elements to zero where
the corresponding source element is zero, whereas the emulation
only negates destination elements where the source is negative.

Furthermore, the PSIGNW_MMX macro in x86util.asm is totally bogus,
which is why the original VC-1 code had an additional right shift
when using it.  Since the psign instruction cannot be used here,
skip all the macro hell and use the working instruction sequence
directly.

None of this was noticed due a stray return statement in
ff_vc1dsp_init_mmx() which meant that only the mmx version of the
loop filter was ever used (before being removed in ea60dfe).

Signed-off-by: Mans Rullgard <mans@mansr.com>
os_support: Include all the necessary headers for the win32 open function

io.h is required for open and _wopen, and fcntl.h is required for
the O_CREAT flag. On mingw, fcntl.h is included by os_support.h (and
the mingw fcntl.h includes io.h), but include it explicitly here
since this implementation requires it.

Also move the #undef open up. open must not be defined to ff_win32_open
while including the headers that declare the open function. On mingw,
this happened in os_support.h before open was redirected.

Signed-off-by: Martin Storsjö <martin@martin.st>
os_support: Don't compare a negative number against socket descriptors

The fds are unsigned integers in the windows definition of struct
sockfds. Due to this, the comparison if (fds[i].fd > n) was always
false.

Signed-off-by: Martin Storsjö <martin@martin.st>
network: Check for struct pollfd

We need to include winsock2.h here, to make sure we have the
real pollfd struct definition, if one exists, before defining the
fallback poll function.

Signed-off-by: Martin Storsjö <martin@martin.st>
os_support: Rename the poll fallback function to ff_poll

The fallback function is a non-static function, we shouldn't be
defining non-static functions outside of the proper ff/av prefix
namespaces.

This is especially important for a function like poll, which
other parties (other libraries, or executables linking these
libraries) also might provide similar but incompatible fallbacks for.

Signed-off-by: Martin Storsjö <martin@martin.st>
os_support: Add fallback definitions for stat flags

Mingw headers provide similar defines already (unconditional #defines,
without any #undef or #ifdef around it), while MSVC doesn't have
them.

Signed-off-by: Martin Storsjö <martin@martin.st>
cmdutils: Pass the actual chosen encoder to filter_codec_opts

This allows passing the right options to encoders when there's more
than one encoder for a certain codec id.

Signed-off-by: Martin Storsjö <martin@martin.st>
attributes: Add a definition of av_always_inline for MSVC

Signed-off-by: Martin Storsjö <martin@martin.st>
x86: fmtconvert: add special asm for float_to_int16_interleave_misc_*

This gets rid of a variable-length array and a for loop in C code.

Signed-off-by: Martin Storsjö <martin@martin.st>
dnxhdenc: add space between function argument type and comment.

Signed-off-by: Martin Storsjö <martin@martin.st>
dsputilenc_mmx: split assignment of ff_sse16_sse2 to SSE2 section.
ARM: generate position independent code to access data symbols

This creates proper position independent code when accessing
data symbols if CONFIG_PIC is set.

References to external symbols should now use the movrelx macro.
Some additional code changes are required since this macro may
need a register to hold the GOT pointer.

Signed-off-by: Mans Rullgard <mans@mansr.com>
x86: cpu: clean up check for cpuid instruction support

This adds macros for accessing the EFLAGS register and uses
these instead of coding the entire check in inline asm.

Signed-off-by: Mans Rullgard <mans@mansr.com>
wma: Lower the maximum number of channels to 2

ff_wma_init is used only by wmadec and wmaenc, and neither of them
can handle more than 2 channels.

This fixes crashes with invalid files.

Based on patch by Piotr Bandurski and Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin@martin.st>
mathematics: Don't use division by zero in NAN/INFINITY macros

Some compilers, MSVC among them, don't recognize the divisions by
zero as meaning infinity/nan.

These macros should, according to the standard, expand to constant
expressions, but this shouldn't matter for our usage.

Signed-off-by: Martin Storsjö <martin@martin.st>