vdpau: add helper for VDPAU to libav error codes conversion

Signed-off-by: Anton Khirnov <anton@khirnov.net>
vdpau: factor out common end-of-frame handling

Also add error handling.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
vdpau: common support for managing the VdpDecoder in avcodec

Using the not so new init and uninit callbacks, avcodec can now take
care of creating and destroying the VDPAU decoder instance.

The application is still responsible for creating the VDPAU device
and allocating video surfaces - this is necessary to keep video
surfaces on the GPU all the way to the output. But the application
will no longer needs to care about any codec-specific aspects.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
vdpau: pass codec-specific parameters from hwaccel

Signed-off-by: Anton Khirnov <anton@khirnov.net>
swresample/swresample: fix sample drop loop end condition

Fixes Ticket3985

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
swresample/swresample: replace always true if() by av_assert0()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
vdpau: force reinitialization when output resolution changes

This is necessary to recreate the decoder with the correct parameters,
as not all codecs invoke get_format() in this case.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
vdpau: add av_vdpau_bind_context()

This function provides an explicit VDPAU device and VDPAU driver to
libavcodec, so that the application is relieved from codec specifics
and VdpDevice life cycle management.

A stub flags parameter is added for future extension. For instance, it
could be used to ignore codec level capabilities (if someone feels
dangerous).

Signed-off-by: Anton Khirnov <anton@khirnov.net>
vdpau: check video surface and decoder capabilities

Signed-off-by: Anton Khirnov <anton@khirnov.net>
avconv_vdpau: update to new VDPAU interface

Signed-off-by: Anton Khirnov <anton@khirnov.net>
Merge commit '319424d25c53f82b87187ce03ed984d438f1bee6'

* commit '319424d25c53f82b87187ce03ed984d438f1bee6':
  vdpau: add helper for VDPAU to libav error codes conversion

Conflicts:
	libavcodec/vdpau.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7'

* commit 'fcc1022611f79c2f3aa2f392a5ce14c74be9c1d7':
  vdpau: factor out common end-of-frame handling

Conflicts:
	libavcodec/vdpau.c
	libavcodec/vdpau_h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'ce083282f0a8b7d63c4047c30b7bac498f9806dd'

* commit 'ce083282f0a8b7d63c4047c30b7bac498f9806dd':
  vdpau: common support for managing the VdpDecoder in avcodec

Conflicts:
	libavcodec/vdpau.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/vdpau_internal: add comment to #endif

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4'

* commit '89ac99ba5f2dc9f69ad3bc294753930eb0b3e4a4':
  vdpau: pass codec-specific parameters from hwaccel

Conflicts:
	libavcodec/vdpau.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/vdpau: warn if the user application has not setup avctx->hwaccel_context instead of potentially crashing

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '502cde409ca5ee97ef70c2cdede88b9101746ff6'

* commit '502cde409ca5ee97ef70c2cdede88b9101746ff6':
  vdpau: force reinitialization when output resolution changes

Conflicts:
	libavcodec/vdpau.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0'

* commit 'e3e158e81f0666b8fe66be9ce1cad63a535920e0':
  vdpau: add av_vdpau_bind_context()

Conflicts:
	doc/APIchanges
	libavcodec/vdpau.h
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'bef067f88c74190cdf7e76d12f02e12e069974aa'

* commit 'bef067f88c74190cdf7e76d12f02e12e069974aa':
  vdpau: check video surface and decoder capabilities

Merged-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg: add vdpau_old to allow continued testing of the older (but not oldest) API

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>