summaryrefslogtreecommitdiff
path: root/chromium/components/mirroring/service/mirror_settings.h
blob: ac2ee3c528dda06ea761210ec5f882fa0e047f63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_MIRRORING_SERVICE_MIRROR_SETTINGS_H_
#define COMPONENTS_MIRRORING_SERVICE_MIRROR_SETTINGS_H_

#include "base/time/time.h"
#include "base/values.h"
#include "media/capture/video_capture_types.h"
#include "media/cast/cast_config.h"

namespace media {
class AudioParameters;
}  // namespace media

namespace mirroring {

// Holds the default settings for a mirroring session. This class provides the
// audio/video configs that this sender supports. And also provides the
// audio/video constraints used for capturing.
// TODO(xjz): Add the function to generate the audio capture contraints.
// TODO(xjz): Add setters to the settings that might be overriden by integration
// tests.
class MirrorSettings {
 public:
  MirrorSettings();
  ~MirrorSettings();

  // Get the audio/video config with given codec.
  static media::cast::FrameSenderConfig GetDefaultAudioConfig(
      media::cast::RtpPayloadType payload_type,
      media::cast::Codec codec);
  static media::cast::FrameSenderConfig GetDefaultVideoConfig(
      media::cast::RtpPayloadType payload_type,
      media::cast::Codec codec);

  // Call to override the default resolution settings.
  void SetResolutionContraints(int max_width, int max_height);

  // Get video capture constraints with the current settings.
  media::VideoCaptureParams GetVideoCaptureParams();

  // Get Audio capture constraints with the current settings.
  media::AudioParameters GetAudioCaptureParams();

  int max_width() const { return max_width_; }
  int max_height() const { return max_height_; }

  // Returns a dictionary value of the current settings.
  base::Value ToDictionaryValue();

 private:
  const int min_width_;
  const int min_height_;
  int max_width_;
  int max_height_;

  DISALLOW_COPY_AND_ASSIGN(MirrorSettings);
};

}  // namespace mirroring

#endif  // COMPONENTS_MIRRORING_SERVICE_MIRROR_SETTINGS_H_