Bug 1315850 - Stub out ChromiumCDMVideoDecoder. r=jya draft
authorChris Pearce <cpearce@mozilla.com>
Thu, 09 Mar 2017 18:17:14 +1300
changeset 504169 6c5a3706b37e122a67e5ec1670587f37e25a1bc6
parent 504168 3821c378c73067066f3cc67499680bdf546fb4f0
child 504170 018abf2b8e1b351a29ba62275a2681fe9ea4fc24
push id50748
push userbmo:cpearce@mozilla.com
push dateFri, 24 Mar 2017 01:10:17 +0000
reviewersjya
bugs1315850
milestone55.0a1
Bug 1315850 - Stub out ChromiumCDMVideoDecoder. r=jya MozReview-Commit-ID: 6I9N1c1nNMF
dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.h
dom/media/platforms/agnostic/eme/moz.build
new file mode 100644
--- /dev/null
+++ b/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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/. */
+
+#include "ChromiumCDMVideoDecoder.h"
+#include "GMPService.h"
+#include "GMPVideoDecoder.h"
+
+namespace mozilla {
+
+ChromiumCDMVideoDecoder::ChromiumCDMVideoDecoder(
+  const GMPVideoDecoderParams& aParams,
+  CDMProxy* aCDMProxy)
+  : mConfig(aParams.mConfig)
+  , mCrashHelper(aParams.mCrashHelper)
+  , mGMPThread(GetGMPAbstractThread())
+  , mImageContainer(aParams.mImageContainer)
+{
+}
+
+ChromiumCDMVideoDecoder::~ChromiumCDMVideoDecoder()
+{
+}
+
+RefPtr<MediaDataDecoder::InitPromise>
+ChromiumCDMVideoDecoder::Init()
+{
+  return InitPromise::CreateAndResolve(TrackInfo::kUndefinedTrack, __func__);
+}
+
+RefPtr<MediaDataDecoder::DecodePromise>
+ChromiumCDMVideoDecoder::Decode(MediaRawData* aSample)
+{
+  return DecodePromise::CreateAndReject(
+    MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, RESULT_DETAIL("Unimplemented")),
+    __func__);
+}
+
+RefPtr<MediaDataDecoder::FlushPromise>
+ChromiumCDMVideoDecoder::Flush()
+{
+  return FlushPromise::CreateAndReject(
+    MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, RESULT_DETAIL("Unimplemented")),
+    __func__);
+}
+
+RefPtr<MediaDataDecoder::DecodePromise>
+ChromiumCDMVideoDecoder::Drain()
+{
+  return DecodePromise::CreateAndReject(
+    MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, RESULT_DETAIL("Unimplemented")),
+    __func__);
+}
+
+RefPtr<ShutdownPromise>
+ChromiumCDMVideoDecoder::Shutdown()
+{
+  return ShutdownPromise::CreateAndResolve(true, __func__);
+}
+
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.h
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* 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 ChromiumCDMVideoDecoder_h_
+#define ChromiumCDMVideoDecoder_h_
+
+#include "PlatformDecoderModule.h"
+
+namespace mozilla {
+
+class CDMProxy;
+struct GMPVideoDecoderParams;
+
+class ChromiumCDMVideoDecoder : public MediaDataDecoder
+{
+public:
+  ChromiumCDMVideoDecoder(const GMPVideoDecoderParams& aParams,
+                          CDMProxy* aCDMProxy);
+
+  RefPtr<InitPromise> Init() override;
+  RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
+  RefPtr<FlushPromise> Flush() override;
+  RefPtr<DecodePromise> Drain() override;
+  RefPtr<ShutdownPromise> Shutdown() override;
+  const char* GetDescriptionName() const override
+  {
+    return "Chromium CDM video decoder";
+  }
+
+private:
+  ~ChromiumCDMVideoDecoder();
+
+  const VideoInfo mConfig;
+  RefPtr<GMPCrashHelper> mCrashHelper;
+  RefPtr<AbstractThread> mGMPThread;
+  RefPtr<layers::ImageContainer> mImageContainer;
+  MozPromiseHolder<InitPromise> mInitPromise;
+};
+
+} // mozilla
+
+#endif // ChromiumCDMVideoDecoder_h_
--- a/dom/media/platforms/agnostic/eme/moz.build
+++ b/dom/media/platforms/agnostic/eme/moz.build
@@ -1,22 +1,24 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 EXPORTS += [
+    'ChromiumCDMVideoDecoder.h',
     'DecryptThroughputLimit.h',
     'EMEDecoderModule.h',
     'EMEVideoDecoder.h',
     'SamplesWaitingForKey.h',
 ]
 
 UNIFIED_SOURCES += [
+    'ChromiumCDMVideoDecoder.cpp',
     'EMEDecoderModule.cpp',
     'EMEVideoDecoder.cpp',
     'SamplesWaitingForKey.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'