summaryrefslogtreecommitdiffstats
path: root/dom/media/gmp/GMPLog.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /dom/media/gmp/GMPLog.h
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/gmp/GMPLog.h')
-rw-r--r--dom/media/gmp/GMPLog.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/dom/media/gmp/GMPLog.h b/dom/media/gmp/GMPLog.h
new file mode 100644
index 0000000000..6aa1976427
--- /dev/null
+++ b/dom/media/gmp/GMPLog.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef DOM_MEDIA_GMPLOG_H_
+#define DOM_MEDIA_GMPLOG_H_
+
+#include "content_decryption_module.h"
+#include "mozilla/Logging.h"
+
+namespace mozilla {
+
+extern LogModule* GetGMPLog();
+
+#define GMP_LOG_ERROR(msg, ...) \
+ MOZ_LOG(GetGMPLog(), LogLevel::Error, (msg, ##__VA_ARGS__))
+#define GMP_LOG_WARNING(msg, ...) \
+ MOZ_LOG(GetGMPLog(), LogLevel::Warning, (msg, ##__VA_ARGS__))
+#define GMP_LOG_INFO(msg, ...) \
+ MOZ_LOG(GetGMPLog(), LogLevel::Info, (msg, ##__VA_ARGS__))
+#define GMP_LOG_DEBUG(msg, ...) \
+ MOZ_LOG(GetGMPLog(), LogLevel::Debug, (msg, ##__VA_ARGS__))
+#define GMP_LOG_VERBOSE(msg, ...) \
+ MOZ_LOG(GetGMPLog(), LogLevel::Verbose, (msg, ##__VA_ARGS__))
+
+// Helpers
+
+inline const char* CdmStatusToString(cdm::Status aStatus) {
+ switch (aStatus) {
+ case cdm::Status::kSuccess:
+ return "success";
+ case cdm::Status::kNeedMoreData:
+ return "need more data";
+ case cdm::Status::kNoKey:
+ return "no key";
+ case cdm::Status::kInitializationError:
+ return "initialization error";
+ case cdm::Status::kDecryptError:
+ return "decrypt error";
+ case cdm::Status::kDecodeError:
+ return "decode error";
+ case cdm::Status::kDeferredInitialization:
+ return "deferred initialization";
+ default:
+ MOZ_ASSERT_UNREACHABLE("Should have coverage of entire enum");
+ return "unexpected status code"; // Gracefully handle disabled asserts.
+ }
+}
+
+inline const char* CdmStatusToString(uint32_t aStatus) {
+ return CdmStatusToString(cdm::Status(aStatus));
+}
+
+// End helpers
+
+} // namespace mozilla
+
+#endif // DOM_MEDIA_GMPLOG_H_