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

Side by Side Diff: media/video/capture/linux/video_capture_device_linux.cc

Issue 22876027: Consolidate duplicated frame / capability structures in video_capture_types.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased: changed media::VideoCaptureCapability::kI420 -> media::PIXEL_FORMAT_I420 etc. Created 7 years, 3 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/video/capture/linux/video_capture_device_linux.h" 5 #include "media/video/capture/linux/video_capture_device_linux.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #if defined(OS_OPENBSD) 9 #if defined(OS_OPENBSD)
10 #include <sys/videoio.h> 10 #include <sys/videoio.h>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 static const int32 kV4l2RawFmts[] = { 43 static const int32 kV4l2RawFmts[] = {
44 V4L2_PIX_FMT_YUV420, 44 V4L2_PIX_FMT_YUV420,
45 V4L2_PIX_FMT_YUYV 45 V4L2_PIX_FMT_YUYV
46 }; 46 };
47 47
48 // Linux USB camera devices have names like "UVC Camera (1234:fdcb)" 48 // Linux USB camera devices have names like "UVC Camera (1234:fdcb)"
49 static const char kUsbSuffixStart[] = " ("; 49 static const char kUsbSuffixStart[] = " (";
50 static const size_t kUsbModelSize = 9; 50 static const size_t kUsbModelSize = 9;
51 static const char kUsbSuffixEnd[] = ")"; 51 static const char kUsbSuffixEnd[] = ")";
52 52
53 static VideoCaptureCapability::Format V4l2ColorToVideoCaptureColorFormat( 53 static VideoPixelFormat V4l2ColorToVideoCaptureColorFormat(
54 int32 v4l2_fourcc) { 54 int32 v4l2_fourcc) {
55 VideoCaptureCapability::Format result = VideoCaptureCapability::kColorUnknown; 55 VideoPixelFormat result = PIXEL_FORMAT_UNKNOWN;
56 switch (v4l2_fourcc) { 56 switch (v4l2_fourcc) {
57 case V4L2_PIX_FMT_YUV420: 57 case V4L2_PIX_FMT_YUV420:
58 result = VideoCaptureCapability::kI420; 58 result = PIXEL_FORMAT_I420;
59 break; 59 break;
60 case V4L2_PIX_FMT_YUYV: 60 case V4L2_PIX_FMT_YUYV:
61 result = VideoCaptureCapability::kYUY2; 61 result = PIXEL_FORMAT_YUY2;
62 break; 62 break;
63 case V4L2_PIX_FMT_MJPEG: 63 case V4L2_PIX_FMT_MJPEG:
64 case V4L2_PIX_FMT_JPEG: 64 case V4L2_PIX_FMT_JPEG:
65 result = VideoCaptureCapability::kMJPEG; 65 result = PIXEL_FORMAT_MJPEG;
66 break; 66 break;
67 } 67 }
68 DCHECK_NE(result, VideoCaptureCapability::kColorUnknown); 68 DCHECK_NE(result, PIXEL_FORMAT_UNKNOWN);
69 return result; 69 return result;
70 } 70 }
71 71
72 static void GetListOfUsableFourCCs(bool favour_mjpeg, std::list<int>* fourccs) { 72 static void GetListOfUsableFourCCs(bool favour_mjpeg, std::list<int>* fourccs) {
73 for (size_t i = 0; i < arraysize(kV4l2RawFmts); ++i) 73 for (size_t i = 0; i < arraysize(kV4l2RawFmts); ++i)
74 fourccs->push_back(kV4l2RawFmts[i]); 74 fourccs->push_back(kV4l2RawFmts[i]);
75 if (favour_mjpeg) 75 if (favour_mjpeg)
76 fourccs->push_front(V4L2_PIX_FMT_MJPEG); 76 fourccs->push_front(V4L2_PIX_FMT_MJPEG);
77 else 77 else
78 fourccs->push_back(V4L2_PIX_FMT_MJPEG); 78 fourccs->push_back(V4L2_PIX_FMT_MJPEG);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 buffer_pool_size_ = 0; 560 buffer_pool_size_ = 0;
561 } 561 }
562 562
563 void VideoCaptureDeviceLinux::SetErrorState(const std::string& reason) { 563 void VideoCaptureDeviceLinux::SetErrorState(const std::string& reason) {
564 DVLOG(1) << reason; 564 DVLOG(1) << reason;
565 state_ = kError; 565 state_ = kError;
566 observer_->OnError(); 566 observer_->OnError();
567 } 567 }
568 568
569 } // namespace media 569 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/fake_video_capture_device.cc ('k') | media/video/capture/mac/video_capture_device_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698