Skip to content

Instantly share code, notes, and snippets.

@myrup
Last active August 29, 2015 14:23
Show Gist options
  • Save myrup/3cefb8c7ecf4c1fe2b81 to your computer and use it in GitHub Desktop.
Save myrup/3cefb8c7ecf4c1fe2b81 to your computer and use it in GitHub Desktop.
public static class LibMpv {
const string mpv = "mpv-1.dll";
[DllImport(mpv, EntryPoint = "mpv_command_string", CallingConvention = CallingConvention.Cdecl)]
public static extern MpvError Command(IntPtr ctx, [In()] [MarshalAs(UnmanagedType.LPStr)] string args);
[DllImport(mpv, EntryPoint = "mpv_initialize", CallingConvention = CallingConvention.Cdecl)]
public static extern MpvError Initialize(IntPtr ctx);
[DllImport(mpv, EntryPoint = "mpv_create", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Create();
public enum MpvError
{
MPV_ERROR_SUCCESS = 0,
MPV_ERROR_EVENT_QUEUE_FULL = -1,
MPV_ERROR_NOMEM = -2,
MPV_ERROR_UNINITIALIZED = -3,
MPV_ERROR_INVALID_PARAMETER = -4,
MPV_ERROR_OPTION_NOT_FOUND = -5,
MPV_ERROR_OPTION_FORMAT = -6,
MPV_ERROR_OPTION_ERROR = -7,
MPV_ERROR_PROPERTY_NOT_FOUND = -8,
MPV_ERROR_PROPERTY_FORMAT = -9,
MPV_ERROR_PROPERTY_UNAVAILABLE = -10,
MPV_ERROR_PROPERTY_ERROR = -11,
MPV_ERROR_COMMAND = -12,
MPV_ERROR_LOADING_FAILED = -13,
MPV_ERROR_AO_INIT_FAILED = -14,
MPV_ERROR_VO_INIT_FAILED = -15,
MPV_ERROR_NOTHING_TO_PLAY = -16,
MPV_ERROR_UNKNOWN_FORMAT = -17,
MPV_ERROR_UNSUPPORTED = -18,
MPV_ERROR_NOT_IMPLEMENTED = -19
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment