Fix memory leak in native code
Get the MKV code into its own separate library