]> Some of my projects - aniplayer.git/commitdiff
Make logs of property read/write errors critical errors
authorAPTX <marek321@gmail.com>
Sun, 9 Oct 2022 03:30:59 +0000 (12:30 +0900)
committerAPTX <marek321@gmail.com>
Sun, 9 Oct 2022 03:30:59 +0000 (12:30 +0900)
backendplugins/backend_mpv/mpvhelper.h

index 82838e688103f19c7bbe1b54893ea218af093821..7d70ae430e3c05d4c4139565a67dce2069f590d4 100644 (file)
@@ -180,12 +180,15 @@ auto ReadFormat(const Handle &handle, Format format, const char *name)
     -> Outcome<typename Format::type> {
   typename Format::MpvInternalType data;
   int error = mpv_get_property(handle.get(), name, format.format, &data);
-  qCDebug(mpvHelper()).nospace()
-      << "ReadFormat, property: " << name << ", error: " << error
-      << ", original value: " << data;
   if (error != MPV_ERROR_SUCCESS) {
+    qCCritical(mpvHelper()).nospace()
+        << "ReadFormat failure, property: " << name << ", error: " << error
+        << ", original value: " << data;
     return Error{error};
   }
+  qCDebug(mpvHelper()).nospace()
+      << "ReadFormat, property: " << name << ", original value: " << data;
+
   typename Format::type ret;
   TypeConversion<typename Format::MpvInternalType,
                  typename Format::type>::convert(data, ret);
@@ -201,9 +204,15 @@ int WriteFormat(const Handle &handle, Format format, const char *name,
   int error =
       mpv_set_property(handle.get(), name, format.format,
                        const_cast<typename Format::MpvInternalType *>(&data));
-  qCDebug(mpvHelper()).nospace()
-      << "WriteFormat, property: " << name << ", error: " << error
-      << ", original value: " << value << ", converted value: " << data;
+  if (error != MPV_ERROR_SUCCESS) {
+    qCCritical(mpvHelper()).nospace()
+        << "WriteFormat failure, property: " << name << ", error: " << error
+        << ", original value: " << value << ", converted value: " << data;
+  } else {
+    qCDebug(mpvHelper()).nospace()
+        << "WriteFormat, property: " << name << ", original value: " << value
+        << ", converted value: " << data;
+  }
   return error;
 }