Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Side by Side Diff: third_party/WebKit/public/platform/WebMediaConstraints.h

Issue 1899943008: Macro-based constraints Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed some more code Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 WebString toString() const override; 223 WebString toString() const override;
224 bool hasExact() const { return m_hasExact; } 224 bool hasExact() const { return m_hasExact; }
225 225
226 private: 226 private:
227 unsigned m_ideal : 1; 227 unsigned m_ideal : 1;
228 unsigned m_exact : 1; 228 unsigned m_exact : 1;
229 unsigned m_hasIdeal : 1; 229 unsigned m_hasIdeal : 1;
230 unsigned m_hasExact : 1; 230 unsigned m_hasExact : 1;
231 }; 231 };
232 232
233 // This macro defines all the constraint names and their types.
234 // The expansion of CONSTRAINT_ITEM will depend on context.
235 #define CONSTRAINT_LIST \
236 CONSTRAINT_ITEM(width, Width, Long) \
237 CONSTRAINT_ITEM(height, Height, Long) \
238 CONSTRAINT_ITEM(aspectRatio, AspectRatio, Double) \
239 CONSTRAINT_ITEM(frameRate, FrameRate, Double) \
240 CONSTRAINT_ITEM(facingMode, FacingMode, String) \
241 CONSTRAINT_ITEM(volume, Volume, Double) \
242 CONSTRAINT_ITEM(sampleRate, SampleRate, Long) \
243 CONSTRAINT_ITEM(sampleSize, SampleSize, Long) \
244 CONSTRAINT_ITEM(echoCancellation, EchoCancellation, Boolean) \
245 CONSTRAINT_ITEM(latency, Latency, Double) \
246 CONSTRAINT_ITEM(channelCount, ChannelCount, Long) \
247 CONSTRAINT_ITEM(deviceId, DeviceId, String) \
248 CONSTRAINT_ITEM(groupId, GroupId, String)
249 // End of list.
250
251
233 struct WebMediaTrackConstraintSet { 252 struct WebMediaTrackConstraintSet {
234 public: 253 public:
235 BLINK_PLATFORM_EXPORT WebMediaTrackConstraintSet(); 254 BLINK_PLATFORM_EXPORT WebMediaTrackConstraintSet();
255 bool dummy; // added purely for init-call reasons
256 #define CONSTRAINT_ITEM(lowercase, uppercase, datatype) \
257 datatype##Constraint lowercase;
236 258
237 LongConstraint width; 259 CONSTRAINT_LIST
238 LongConstraint height; 260
239 DoubleConstraint aspectRatio; 261 #undef CONSTRAINT_ITEM
240 DoubleConstraint frameRate; 262
241 StringConstraint facingMode;
242 DoubleConstraint volume;
243 LongConstraint sampleRate;
244 LongConstraint sampleSize;
245 BooleanConstraint echoCancellation;
246 DoubleConstraint latency;
247 LongConstraint channelCount;
248 StringConstraint deviceId;
249 StringConstraint groupId;
250 // Constraints not exposed in Blink at the moment, only through 263 // Constraints not exposed in Blink at the moment, only through
251 // the legacy name interface. 264 // the legacy name interface.
252 StringConstraint mediaStreamSource; // tab, screen, desktop, system 265 StringConstraint mediaStreamSource; // tab, screen, desktop, system
253 BooleanConstraint renderToAssociatedSink; 266 BooleanConstraint renderToAssociatedSink;
254 BooleanConstraint hotwordEnabled; 267 BooleanConstraint hotwordEnabled;
255 BooleanConstraint googEchoCancellation; 268 BooleanConstraint googEchoCancellation;
256 BooleanConstraint googExperimentalEchoCancellation; 269 BooleanConstraint googExperimentalEchoCancellation;
257 BooleanConstraint googAutoGainControl; 270 BooleanConstraint googAutoGainControl;
258 BooleanConstraint googExperimentalAutoGainControl; 271 BooleanConstraint googExperimentalAutoGainControl;
259 BooleanConstraint googNoiseSuppression; 272 BooleanConstraint googNoiseSuppression;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 339
327 BLINK_PLATFORM_EXPORT const WebString toString() const; 340 BLINK_PLATFORM_EXPORT const WebString toString() const;
328 341
329 private: 342 private:
330 WebPrivatePtr<WebMediaConstraintsPrivate> m_private; 343 WebPrivatePtr<WebMediaConstraintsPrivate> m_private;
331 }; 344 };
332 345
333 } // namespace blink 346 } // namespace blink
334 347
335 #endif // WebMediaConstraints_h 348 #endif // WebMediaConstraints_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698