Esempio n. 1
0
 public static void HandleError(mpv_error err, bool throwException, params string[] messages)
 {
     if (throwException)
     {
         throw new Exception(GetError(err));
     }
 }
Esempio n. 2
0
        public static int get_property_int(IntPtr handle, string name, bool throwException = false)
        {
            mpv_error err = mpv_get_property(handle, GetUtf8Bytes(name),
                                             mpv_format.MPV_FORMAT_INT64, out IntPtr lpBuffer);

            if (err < 0)
            {
                HandleError(err, throwException, $"error getting property: {name}");
            }

            return(lpBuffer.ToInt32());
        }
Esempio n. 3
0
        public static double get_property_number(IntPtr handle, string name, bool throwException = false)
        {
            mpv_error err = mpv_get_property(handle, GetUtf8Bytes(name),
                                             mpv_format.MPV_FORMAT_DOUBLE, out double value);

            if (err < 0)
            {
                HandleError(err, throwException, $"error getting property: {name}");
            }

            return(value);
        }
Esempio n. 4
0
        public static string get_property_string(IntPtr handle, string name, bool throwException = false)
        {
            mpv_error err = mpv_get_property(handle, GetUtf8Bytes(name),
                                             mpv_format.MPV_FORMAT_STRING, out IntPtr lpBuffer);

            if (err == 0)
            {
                string ret = ConvertFromUtf8(lpBuffer);
                mpv_free(lpBuffer);
                return(ret);
            }

            HandleError(err, throwException, $"error getting property: {name}");
            return("");
        }
Esempio n. 5
0
 public static extern IntPtr mpv_error_string(mpv_error error);
Esempio n. 6
0
 public static string GetError(mpv_error err) => ConvertFromUtf8(mpv_error_string(err));