utils: add workaround for AVHWAccel in ff_get_buffer compat code

Since c977039e585bfff28ecc037ef827c6c3d1ed88aa plane count for
PIX_FMT_HWACCEL pixel formats is 0 instead of 1. The created dummy
AVBuffers are still bogus since AVFrame does not hold frame data when
AVHWAccels are used.
hwaccel: fix use with frame based multithreading

Allows use of AVHWAccel based decoders with frame based multithreading.
The decoders will be forced into an non-concurrent mode by delaying
ff_thread_finish_setup() calls after decoding of the current frame
is finished.

This wastes memory by unnecessarily using multiple threads and thus
copies of the decoder context but allows seamless switching between
hardware accelerated and frame threaded software decoding when the
hardware decoder does not support the stream.
configure: fix dependencies of XvMC and old vdpau mpeg2 decoders
vdpau: fix obsolete mpeg1 vdpau decoder when mpeg2 is disabled
vdpau: wrap codec specific functions in appropiate #ifs

Fixes linking when only a subset of the deprecated vdpau decoders is
enabled.
dca: Move ff_dca_convert_bitstream() to the DCA common code

This makes the DCA parser and decoder independent.
cosmetics: Remove unnecessary extern keywords from function declarations
mpeg12: Move some ff_mpeg1_* function declarations to a more suitable place
Split MPEG-1/2 decoder code off from MPEG-1/2 common code
mpeg12: Move Mpeg1Context declaration to the only place it is used
msmpeg4: Split decoding related functions to a separate file

This fixes standalone compilation of the msmpeg4v2, msmpeg4v3
and wmv2 encoders, that previously failed to link due to the
decoder codepaths requiring error_resilience.

Signed-off-by: Martin Storsjö <martin@martin.st>
build: Remove configure-generated .config file on distclean
build: Move setting of SRC_DIR to the only place it is used
ape: use correct context for the bit table printed in debug
configure: Add error_resilience as dependency to the eatqi decoder

This makes standalone compilation of the eatqi decoder
succeed. The dependency comes from the shared mpeg12dec.o file.

Signed-off-by: Martin Storsjö <martin@martin.st>
win32: Allow other programs to open the same files

In order to match Linux behaviour better our Windows-specific
open() replacement should disable Windows default file locking.

Signed-off-by: Martin Storsjö <martin@martin.st>
win32: Make ff_win32_open more robust

- Make MultiByteToWideChar fail when it encounters invalid encoding.
  Without this, invalid characters might just be skipped
- When MultiByteToWideChar fails, assume the file name is in CP_ACP
  and open it via normal open function, even when the file will be
  written
- When malloc fails return error instead of crashing

Signed-off-by: Martin Storsjö <martin@martin.st>
win32: Use 64-bit fstat/lseek variants for MSVC as well

Signed-off-by: Martin Storsjö <martin@martin.st>
configure: Add error_resilience dependencies

This makes standalone compilation of the eamad and eatqi decoders
and mpeg1video and mpeg2video encoders succeed. The dependency
comes from the shared mpeg12.o file.

---
Splitting out the pieces from mpeg12.c that is shared for each
of these components, which doesn't use ER, isn't all that
trivial - patches welcome though.
dsputil: Make square put/avg_pixels functions local to h264qpel

Put a copy of the 8bit functions only in dsputil, where they are
used for some other things (e.g. mpeg4qpel, mspel, cavsqpel). We
could perhaps also try to share specifically the 8bit functions
from h264qpel between it and the others, but that will be slightly
more complicated. H264qpel already had these functions, so we can
simply remove the duplicates.