tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

MediaCapabilities.h (2813B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_MediaCapabilities_h_
      8 #define mozilla_dom_MediaCapabilities_h_
      9 
     10 #include "DDLoggedTypeTraits.h"
     11 #include "js/TypeDecls.h"
     12 #include "mozilla/AlreadyAddRefed.h"
     13 #include "mozilla/Maybe.h"
     14 #include "mozilla/dom/MediaKeySystemAccessManager.h"
     15 #include "mozilla/dom/NonRefcountedDOMObject.h"
     16 #include "nsCOMPtr.h"
     17 #include "nsCycleCollectionParticipant.h"
     18 #include "nsISupports.h"
     19 #include "nsStringFwd.h"
     20 #include "nsWrapperCache.h"
     21 
     22 class nsIGlobalObject;
     23 
     24 namespace mozilla {
     25 class ErrorResult;
     26 class MediaContainerType;
     27 
     28 namespace layers {
     29 class KnowsCompositor;
     30 }
     31 namespace dom {
     32 class MediaCapabilities;
     33 }  // namespace dom
     34 DDLoggedTypeName(dom::MediaCapabilities);
     35 
     36 namespace dom {
     37 
     38 struct MediaDecodingConfiguration;
     39 struct MediaEncodingConfiguration;
     40 struct AudioConfiguration;
     41 struct VideoConfiguration;
     42 class Promise;
     43 
     44 class MediaCapabilities final : public nsISupports, public nsWrapperCache {
     45 public:
     46  // Ref counting and cycle collection
     47  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     48  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(MediaCapabilities)
     49 
     50  // WebIDL Methods
     51  already_AddRefed<Promise> DecodingInfo(
     52      const MediaDecodingConfiguration& aConfiguration, ErrorResult& aRv);
     53  already_AddRefed<Promise> EncodingInfo(
     54      const MediaEncodingConfiguration& aConfiguration, ErrorResult& aRv);
     55  // End WebIDL Methods
     56 
     57  explicit MediaCapabilities(nsIGlobalObject* aParent);
     58 
     59  nsIGlobalObject* GetParentObject() const { return mParent; }
     60  JSObject* WrapObject(JSContext* aCx,
     61                       JS::Handle<JSObject*> aGivenProto) override;
     62 
     63 private:
     64  virtual ~MediaCapabilities() = default;
     65  Maybe<MediaContainerType> CheckVideoConfiguration(
     66      const VideoConfiguration& aConfig) const;
     67  Maybe<MediaContainerType> CheckAudioConfiguration(
     68      const AudioConfiguration& aConfig) const;
     69  bool CheckTypeForMediaSource(const nsAString& aType);
     70  bool CheckTypeForFile(const nsAString& aType);
     71  bool CheckTypeForEncoder(const nsAString& aType);
     72  already_AddRefed<layers::KnowsCompositor> GetCompositor();
     73  void CreateMediaCapabilitiesDecodingInfo(
     74      const MediaDecodingConfiguration& aConfiguration, ErrorResult& aRv,
     75      Promise* aPromise);
     76 
     77  RefPtr<MediaKeySystemAccessManager::MediaKeySystemAccessPromise>
     78  CheckEncryptedDecodingSupport(
     79      const MediaDecodingConfiguration& aConfiguration);
     80 
     81  nsCOMPtr<nsIGlobalObject> mParent;
     82 };
     83 
     84 }  // namespace dom
     85 
     86 }  // namespace mozilla
     87 
     88 #endif /* mozilla_dom_MediaCapabilities_h_ */