Add compatiblity for some older ffmpeg versions

Also, define the DEBUG and _DEBUG macros everywhere.