lavc: remove the locking code in avcodec_close()

This function should not modify any global state, so there should be no
reason for any locking.
lavc: add avcodec_free_context().

Right now, the caller has to manually manage some allocated
AVCodecContext fields, like extradata or subtitle_header. This is
fragile and prone to leaks, especially if we want to add more such
fields in the future.

The only reason for this behaviour is so that the AVStream codec context
can be reused for decoding. Such reuse is discouraged anyway, so this
commit is the first step to deprecating it.
4xm: allocate extradata properly.

Pad it with the required amount of zeros, check for malloc failure.
a64: remove unneeded struct qualifier
a64: check that extradata exists before reading from it
yuv4mpeg: split the demuxer and muxer into separate files
yuv4mpegdec: do not set coded_frame properties

coded_frame is not meant to be changed from outside of lavc, and is not
used for decoding.
Set AVCodecContext.field_order instead.
yop: only set extradata size after it has been successfully allocated

Do not leave a non-zero extradata_size set on failure
avienc: sanitize variable naming in write_header()

Do not call an AVCodecContext 'stream', that is highly confusing.
Also, add a local variable for the current AVStream in the loop over all
streams.
lavf: extend avg_frame_rate documentation.
avconv: set output avg_frame_rate when known
dv: do not set codec timebase

It is not supposed to be set from outside of libavcodec.
Set average framerate instead.
doc/APIchanges: fill in missing hashes and dates
doc/APIchanges: mark the release 10 branch point
wavenc: use codec descriptors to get the codec name

Also, return a proper error code.
avconv: set the "encoder" tag when transcoding
movenc: use the "encoder" metadata tag to write stsd Compressorname

This mirrors the demuxer behaviour and avoids accessing
AVCodecContext.codec, which should not be done in muxers.
hevc: templatize pred_planar

Signed-off-by: Anton Khirnov <anton@khirnov.net>
hevc: templatize intra_pred
hevc/intra_pred: optimize EXTEND_()*

Process 4 pixels at once.

Signed-off-by: Anton Khirnov <anton@khirnov.net>