| OLD | NEW |
| 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 // Windows specific implementation of VideoCaptureDevice. | 5 // Windows specific implementation of VideoCaptureDevice. |
| 6 // DirectShow is used for capturing. DirectShow provide its own threads | 6 // DirectShow is used for capturing. DirectShow provide its own threads |
| 7 // for capturing. | 7 // for capturing. |
| 8 | 8 |
| 9 #ifndef MEDIA_VIDEO_CAPTURE_WIN_CAPABILITY_LIST_WIN_H_ | 9 #ifndef MEDIA_VIDEO_CAPTURE_WIN_CAPABILITY_LIST_WIN_H_ |
| 10 #define MEDIA_VIDEO_CAPTURE_WIN_CAPABILITY_LIST_WIN_H_ | 10 #define MEDIA_VIDEO_CAPTURE_WIN_CAPABILITY_LIST_WIN_H_ |
| 11 | 11 |
| 12 #include <list> | 12 #include <list> |
| 13 | 13 |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 15 #include "media/video/capture/video_capture_types.h" | 15 #include "media/video/capture/video_capture_types.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 | 18 |
| 19 struct VideoCaptureCapabilityWin { | 19 struct VideoCaptureCapabilityWin : public VideoCaptureCapability { |
| 20 explicit VideoCaptureCapabilityWin(int index) | 20 explicit VideoCaptureCapabilityWin(int index) |
| 21 : stream_index(index), | 21 : stream_index(index), |
| 22 frame_rate_numerator(0), | 22 frame_rate_numerator(0), |
| 23 frame_rate_denominator(1) {} | 23 frame_rate_denominator(1) {} |
| 24 int stream_index; | 24 int stream_index; |
| 25 // Internally to Media Foundation Api type devices we use rational framerates | 25 // Internally to Media Foundation Api type devices we use rational framerates |
| 26 // so framerates can be properly represented, f.i. 29.971fps= 30000/1001. | 26 // so framerates can be properly represented, f.i. 29.971fps= 30000/1001. |
| 27 int frame_rate_numerator; | 27 int frame_rate_numerator; |
| 28 int frame_rate_denominator; | 28 int frame_rate_denominator; |
| 29 VideoCaptureFormat supported_format; | |
| 30 }; | 29 }; |
| 31 | 30 |
| 32 class CapabilityList : public base::NonThreadSafe { | 31 class CapabilityList : public base::NonThreadSafe { |
| 33 public: | 32 public: |
| 34 CapabilityList(); | 33 CapabilityList(); |
| 35 ~CapabilityList(); | 34 ~CapabilityList(); |
| 36 | 35 |
| 37 bool empty() const { return capabilities_.empty(); } | 36 bool empty() const { return capabilities_.empty(); } |
| 38 | 37 |
| 39 // Appends an entry to the list. | 38 // Appends an entry to the list. |
| 40 void Add(const VideoCaptureCapabilityWin& capability); | 39 void Add(const VideoCaptureCapabilityWin& capability); |
| 41 | 40 |
| 42 // Loops through the list of capabilities and returns an index of the best | 41 // Loops through the list of capabilities and returns an index of the best |
| 43 // matching capability. The algorithm prioritizes height, width, frame rate | 42 // matching capability. The algorithm prioritizes height, width, frame rate |
| 44 // and color format in that order. | 43 // and color format in that order. |
| 45 const VideoCaptureCapabilityWin& GetBestMatchedFormat( | 44 const VideoCaptureCapabilityWin& GetBestMatchedCapability( |
| 46 int requested_width, | 45 int requested_width, int requested_height, |
| 47 int requested_height, | |
| 48 int requested_frame_rate) const; | 46 int requested_frame_rate) const; |
| 49 | 47 |
| 50 private: | 48 private: |
| 51 typedef std::list<VideoCaptureCapabilityWin> Capabilities; | 49 typedef std::list<VideoCaptureCapabilityWin> Capabilities; |
| 52 Capabilities capabilities_; | 50 Capabilities capabilities_; |
| 53 | 51 |
| 54 DISALLOW_COPY_AND_ASSIGN(CapabilityList); | 52 DISALLOW_COPY_AND_ASSIGN(CapabilityList); |
| 55 }; | 53 }; |
| 56 | 54 |
| 57 } // namespace media | 55 } // namespace media |
| 58 | 56 |
| 59 #endif // MEDIA_VIDEO_CAPTURE_WIN_CAPABILITY_LIST_WIN_H_ | 57 #endif // MEDIA_VIDEO_CAPTURE_WIN_CAPABILITY_LIST_WIN_H_ |
| OLD | NEW |