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

Unified Diff: webrtc/media/engine/webrtcvideocapturer.cc

Issue 2765243002: Delete RawVideoType enum, use the VideoType enum instead. (Closed)
Patch Set: Define constant webrtc::kI420, for backwards compatibility. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/common_video/libyuv/webrtc_libyuv.cc ('k') | webrtc/media/engine/webrtcvideocapturer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideocapturer.cc
diff --git a/webrtc/media/engine/webrtcvideocapturer.cc b/webrtc/media/engine/webrtcvideocapturer.cc
index 11458d1ed07f36d45ae95adcb15cb6d37397b772..9e5c9219ec8b8431eaf9b70ef8e7de161d0a7b6c 100644
--- a/webrtc/media/engine/webrtcvideocapturer.cc
+++ b/webrtc/media/engine/webrtcvideocapturer.cc
@@ -25,44 +25,31 @@
namespace cricket {
+namespace {
struct kVideoFourCCEntry {
uint32_t fourcc;
- webrtc::RawVideoType webrtc_type;
+ webrtc::VideoType webrtc_type;
};
// This indicates our format preferences and defines a mapping between
// webrtc::RawVideoType (from video_capture_defines.h) to our FOURCCs.
-static kVideoFourCCEntry kSupportedFourCCs[] = {
- { FOURCC_I420, webrtc::kVideoI420 }, // 12 bpp, no conversion.
- { FOURCC_YV12, webrtc::kVideoYV12 }, // 12 bpp, no conversion.
- { FOURCC_YUY2, webrtc::kVideoYUY2 }, // 16 bpp, fast conversion.
- { FOURCC_UYVY, webrtc::kVideoUYVY }, // 16 bpp, fast conversion.
- { FOURCC_NV12, webrtc::kVideoNV12 }, // 12 bpp, fast conversion.
- { FOURCC_NV21, webrtc::kVideoNV21 }, // 12 bpp, fast conversion.
- { FOURCC_MJPG, webrtc::kVideoMJPEG }, // compressed, slow conversion.
- { FOURCC_ARGB, webrtc::kVideoARGB }, // 32 bpp, slow conversion.
- { FOURCC_24BG, webrtc::kVideoRGB24 }, // 24 bpp, slow conversion.
+kVideoFourCCEntry kSupportedFourCCs[] = {
+ {FOURCC_I420, webrtc::VideoType::kI420}, // 12 bpp, no conversion.
+ {FOURCC_YV12, webrtc::VideoType::kYV12}, // 12 bpp, no conversion.
+ {FOURCC_YUY2, webrtc::VideoType::kYUY2}, // 16 bpp, fast conversion.
+ {FOURCC_UYVY, webrtc::VideoType::kUYVY}, // 16 bpp, fast conversion.
+ {FOURCC_NV12, webrtc::VideoType::kNV12}, // 12 bpp, fast conversion.
+ {FOURCC_NV21, webrtc::VideoType::kNV21}, // 12 bpp, fast conversion.
+ {FOURCC_MJPG, webrtc::VideoType::kMJPEG}, // compressed, slow conversion.
+ {FOURCC_ARGB, webrtc::VideoType::kARGB}, // 32 bpp, slow conversion.
+ {FOURCC_24BG, webrtc::VideoType::kRGB24}, // 24 bpp, slow conversion.
};
-class WebRtcVcmFactory : public WebRtcVcmFactoryInterface {
- public:
- virtual rtc::scoped_refptr<webrtc::VideoCaptureModule> Create(
- const char* device) {
- return webrtc::VideoCaptureFactory::Create(device);
- }
- virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo() {
- return webrtc::VideoCaptureFactory::CreateDeviceInfo();
- }
- virtual void DestroyDeviceInfo(webrtc::VideoCaptureModule::DeviceInfo* info) {
- delete info;
- }
-};
-
-static bool CapabilityToFormat(const webrtc::VideoCaptureCapability& cap,
- VideoFormat* format) {
+bool CapabilityToFormat(const webrtc::VideoCaptureCapability& cap,
+ VideoFormat* format) {
uint32_t fourcc = 0;
for (size_t i = 0; i < arraysize(kSupportedFourCCs); ++i) {
- if (kSupportedFourCCs[i].webrtc_type == cap.rawType) {
+ if (kSupportedFourCCs[i].webrtc_type == cap.videoType) {
fourcc = kSupportedFourCCs[i].fourcc;
break;
}
@@ -78,27 +65,43 @@ static bool CapabilityToFormat(const webrtc::VideoCaptureCapability& cap,
return true;
}
-static bool FormatToCapability(const VideoFormat& format,
- webrtc::VideoCaptureCapability* cap) {
- webrtc::RawVideoType webrtc_type = webrtc::kVideoUnknown;
+bool FormatToCapability(const VideoFormat& format,
+ webrtc::VideoCaptureCapability* cap) {
+ webrtc::VideoType webrtc_type = webrtc::VideoType::kUnknown;
for (size_t i = 0; i < arraysize(kSupportedFourCCs); ++i) {
if (kSupportedFourCCs[i].fourcc == format.fourcc) {
webrtc_type = kSupportedFourCCs[i].webrtc_type;
break;
}
}
- if (webrtc_type == webrtc::kVideoUnknown) {
+ if (webrtc_type == webrtc::VideoType::kUnknown) {
return false;
}
cap->width = format.width;
cap->height = format.height;
cap->maxFPS = VideoFormat::IntervalToFps(format.interval);
- cap->rawType = webrtc_type;
+ cap->videoType = webrtc_type;
cap->interlaced = false;
return true;
}
+} // namespace
+
+class WebRtcVcmFactory : public WebRtcVcmFactoryInterface {
+ public:
+ virtual rtc::scoped_refptr<webrtc::VideoCaptureModule> Create(
+ const char* device) {
+ return webrtc::VideoCaptureFactory::Create(device);
+ }
+ virtual webrtc::VideoCaptureModule::DeviceInfo* CreateDeviceInfo() {
+ return webrtc::VideoCaptureFactory::CreateDeviceInfo();
+ }
+ virtual void DestroyDeviceInfo(webrtc::VideoCaptureModule::DeviceInfo* info) {
+ delete info;
+ }
+};
+
///////////////////////////////////////////////////////////////////////////
// Implementation of class WebRtcVideoCapturer
///////////////////////////////////////////////////////////////////////////
@@ -165,7 +168,7 @@ bool WebRtcVideoCapturer::Init(const Device& device) {
supported.push_back(format);
} else {
LOG(LS_WARNING) << "Ignoring unsupported WebRTC capture format "
- << cap.rawType;
+ << static_cast<int>(cap.videoType);
}
}
}
« no previous file with comments | « webrtc/common_video/libyuv/webrtc_libyuv.cc ('k') | webrtc/media/engine/webrtcvideocapturer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698