Use real_ prefixes where appropriate
Renaming real_ functions, moving utility code
Made printfs conditional on debug mode, or converted to av_log