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

Unified Diff: webrtc/modules/desktop_capture/desktop_capture_types.h

Issue 2771573002: Use constexpr function FourCC instead of macro (Closed)
Patch Set: Resolve review comments Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/desktop_capture/desktop_capture_types.h
diff --git a/webrtc/modules/desktop_capture/desktop_capture_types.h b/webrtc/modules/desktop_capture/desktop_capture_types.h
index 8b8c116af29b732b9cd4358f1a2b6398f85d0c9d..f816773bb7c42b7da6e14262aa802ea3e840ce70 100644
--- a/webrtc/modules/desktop_capture/desktop_capture_types.h
+++ b/webrtc/modules/desktop_capture/desktop_capture_types.h
@@ -36,32 +36,20 @@ const ScreenId kFullDesktopScreenId = -1;
const ScreenId kInvalidScreenId = -2;
-// Depends on webrtc/media:rtc_media_base will trigger a build break in
-// Chromium (Refer to https://codereview.chromium.org/2759493002/). The root
-// cause is still unclear. Before the root cause has been found, copy-paste the
-// definition of the FOURCC() macro here is a simple choice.
-
-/**** Copy from webrtc/media/base/videocommon.h ****/
-// Convert four characters to a FourCC code.
-// Needs to be a macro otherwise the OS X compiler complains when the kFormat*
-// constants are used in a switch.
-#define FOURCC(a, b, c, d) \
- ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \
- (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24))
-// Some pages discussing FourCC codes:
-// http://www.fourcc.org/yuv.php
-// http://v4l2spec.bytesex.org/spec/book1.htm
-// http://developer.apple.com/quicktime/icefloe/dispatch020.html
-// http://msdn.microsoft.com/library/windows/desktop/dd206750.aspx#nv12
-// http://people.xiph.org/~xiphmont/containers/nut/nut4cc.txt
-/**** End copy from webrtc/media/base/videocommon.h ****/
-
// An integer to attach to each DesktopFrame to differentiate the generator of
// the frame.
namespace DesktopCapturerId {
+ constexpr uint32_t CreateFourCC(char a, char b, char c, char d) {
+ return ((static_cast<uint32_t>(a)) |
+ (static_cast<uint32_t>(b) << 8) |
+ (static_cast<uint32_t>(c) << 16) |
+ (static_cast<uint32_t>(d) << 24));
+ }
+
constexpr uint32_t kUnknown = 0;
- constexpr uint32_t kScreenCapturerWinGdi = FOURCC('G', 'D', 'I', ' ');
- constexpr uint32_t kScreenCapturerWinDirectx = FOURCC('D', 'X', 'G', 'I');
+ constexpr uint32_t kScreenCapturerWinGdi = CreateFourCC('G', 'D', 'I', ' ');
+ constexpr uint32_t kScreenCapturerWinDirectx =
+ CreateFourCC('D', 'X', 'G', 'I');
} // namespace DesktopCapturerId
} // namespace webrtc
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698