frame: fix the error path in av_frame_copy_props()

First free metadata, then the side data it is contained in.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
matroskaenc: base DefaultDuration on the framerate, not the codec timebase

This results in DefaultDuration not being written when the framerate is
not known, but as this field is purely informative, this should not
break any sane demuxers.
movenc: write avg_frame_rate as the framerate, not the codec timebase
flvenc: only write the framerate tag based on avg_frame_rate

Do not fall back on the codec timebase, since that can be anything for
VFR video.
matroskaenc: set the stream timebase earlier

Fixes calculating the ts offset for audio codecs with delay.
Merge commit 'a53551cba86bb67efcb6105fdc337a36c43132bd'

* commit 'a53551cba86bb67efcb6105fdc337a36c43132bd':
  frame: fix the error path in av_frame_copy_props()

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

* commit '81eec081afea9fc017a175581ceea7c420a0dfc3':
  matroskaenc: base DefaultDuration on the framerate, not the codec timebase

Conflicts:
	libavformat/matroskaenc.c
	tests/ref/lavf/mkv
	tests/ref/seek/lavf-mkv

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

* commit 'cf6977712c9e5abe6dc55289f6322ccbf10321a9':
  movenc: write avg_frame_rate as the framerate, not the codec timebase

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

* commit '43e7f0797f9f821a3866a20f05e512e13c82076a':
  flvenc: only write the framerate tag based on avg_frame_rate

Conflicts:
	tests/ref/lavf/flv_fmt
	tests/ref/seek/lavf-flv_fmt
	tests/ref/seek/vsynth2-flv
	tests/ref/vsynth/vsynth1-flashsv
	tests/ref/vsynth/vsynth1-flv
	tests/ref/vsynth/vsynth2-flashsv
	tests/ref/vsynth/vsynth2-flv

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

* commit '962d63157322466a9a82f9f9d84c1b6f1b582f65':
  matroskaenc: set the stream timebase earlier

Conflicts:
	tests/ref/lavf/mkv
	tests/ref/seek/lavf-mkv

Merged-by: Michael Niedermayer <michaelni@gmx.at>
huffyuv: avoid duplicated defines

Move the defines to the dsp header.

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