The only FFmpeg internal symbols required were some constants. Define them in the file itself instead. Also add some checks and fixes to make the code more robust and fix a potential memory corruption problem.