tor-browser

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

EncodingConstraints.h (2115B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=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 file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef _ENCODING_CONSTRAINTS_H_
      8 #define _ENCODING_CONSTRAINTS_H_
      9 
     10 #include "mozilla/Maybe.h"
     11 
     12 namespace mozilla {
     13 class AudioEncodingConstraints {
     14 public:
     15  bool operator==(const AudioEncodingConstraints& constraints) const {
     16    return maxBitrateBps == constraints.maxBitrateBps;
     17  }
     18 
     19  Maybe<uint32_t> maxBitrateBps;
     20 };
     21 
     22 class VideoEncodingConstraints {
     23 public:
     24  VideoEncodingConstraints()
     25      : maxWidth(0),
     26        maxHeight(0),
     27        maxFs(0),
     28        maxBr(0),
     29        maxPps(0),
     30        maxMbps(0),
     31        maxCpb(0),
     32        maxDpb(0),
     33        scaleDownBy(1.0) {}
     34 
     35  bool operator==(const VideoEncodingConstraints& constraints) const {
     36    return maxWidth == constraints.maxWidth &&
     37           maxHeight == constraints.maxHeight && maxFps == constraints.maxFps &&
     38           maxFs == constraints.maxFs && maxBr == constraints.maxBr &&
     39           maxPps == constraints.maxPps && maxMbps == constraints.maxMbps &&
     40           maxCpb == constraints.maxCpb && maxDpb == constraints.maxDpb &&
     41           scaleDownBy == constraints.scaleDownBy;
     42  }
     43 
     44  /**
     45   * This returns true if the constraints affecting resolution are equal.
     46   */
     47  bool ResolutionEquals(const VideoEncodingConstraints& constraints) const {
     48    return maxWidth == constraints.maxWidth &&
     49           maxHeight == constraints.maxHeight && maxFs == constraints.maxFs &&
     50           scaleDownBy == constraints.scaleDownBy;
     51  }
     52 
     53  uint32_t maxWidth;
     54  uint32_t maxHeight;
     55  Maybe<double> maxFps;
     56  uint32_t maxFs;
     57  uint32_t maxBr;
     58  uint32_t maxPps;
     59  uint32_t maxMbps;    // macroblocks per second
     60  uint32_t maxCpb;     // coded picture buffer size
     61  uint32_t maxDpb;     // decoded picture buffer size
     62  double scaleDownBy;  // To preserve resolution
     63 };
     64 }  // namespace mozilla
     65 
     66 #endif  // _ENCODING_CONSTRAINTS_H_