tor-browser

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

MediaEngine.h (1882B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #ifndef MEDIAENGINE_H_
      6 #define MEDIAENGINE_H_
      7 
      8 #include "DOMMediaStream.h"
      9 #include "MediaEventSource.h"
     10 #include "MediaTrackConstraints.h"
     11 #include "MediaTrackGraph.h"
     12 #include "mozilla/RefPtr.h"
     13 #include "mozilla/dom/MediaStreamTrackBinding.h"
     14 #include "mozilla/dom/VideoStreamTrack.h"
     15 
     16 namespace mozilla {
     17 
     18 namespace dom {
     19 class Blob;
     20 }  // namespace dom
     21 
     22 class AllocationHandle;
     23 class MediaDevice;
     24 class MediaEngineSource;
     25 
     26 enum MediaSinkEnum {
     27  Speaker,
     28  Other,
     29 };
     30 
     31 enum { kVideoTrack = 1, kAudioTrack = 2, kTrackCount };
     32 
     33 class MediaEngine {
     34 public:
     35  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaEngine)
     36  NS_DECL_OWNINGEVENTTARGET
     37 
     38  void AssertIsOnOwningThread() const { NS_ASSERT_OWNINGTHREAD(MediaEngine); }
     39 
     40  /**
     41   * Populate an array of sources of the requested type in the nsTArray.
     42   * Also include devices that are currently unavailable.
     43   */
     44  virtual void EnumerateDevices(dom::MediaSourceEnum, MediaSinkEnum,
     45                                nsTArray<RefPtr<MediaDevice>>*) = 0;
     46 
     47  virtual void Shutdown() = 0;
     48 
     49  virtual RefPtr<MediaEngineSource> CreateSource(
     50      const MediaDevice* aDevice) = 0;
     51 
     52  /**
     53   * Like CreateSource but in addition copies over capabilities and settings
     54   * from another source.
     55   */
     56  virtual RefPtr<MediaEngineSource> CreateSourceFrom(
     57      const MediaEngineSource* aSource, const MediaDevice* aDevice) = 0;
     58 
     59  virtual MediaEventSource<void>& DeviceListChangeEvent() = 0;
     60  /**
     61   * Return true if devices returned from EnumerateDevices are emulated media
     62   * devices.
     63   */
     64  virtual bool IsFake() const = 0;
     65 
     66 protected:
     67  virtual ~MediaEngine() = default;
     68 };
     69 
     70 }  // namespace mozilla
     71 
     72 #endif /* MEDIAENGINE_H_ */