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

Side by Side Diff: media/video/capture/win/capability_list_win.h

Issue 558503003: Windows video capture: Remove duplicated code from GetDeviceSupportedFormats* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 // 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/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/threading/non_thread_safe.h" 15 #include "base/threading/non_thread_safe.h"
16 #include "media/video/capture/video_capture_types.h" 16 #include "media/video/capture/video_capture_types.h"
17 17
18 namespace media { 18 namespace media {
19 19
20 struct VideoCaptureCapabilityWin { 20 struct VideoCaptureCapabilityWin {
21 explicit VideoCaptureCapabilityWin(int index) 21 explicit VideoCaptureCapabilityWin(int index) : stream_index(index) {}
22 : stream_index(index),
23 frame_rate_numerator(0),
24 frame_rate_denominator(1) {}
25 int stream_index; 22 int stream_index;
tommi (sloooow) - chröme 2014/10/22 16:23:13 can this be const?
26 // Internally to Media Foundation Api type devices we use rational framerates
27 // so framerates can be properly represented, f.i. 29.971fps= 30000/1001.
28 int frame_rate_numerator;
29 int frame_rate_denominator;
30 VideoCaptureFormat supported_format; 23 VideoCaptureFormat supported_format;
31 }; 24 };
32 25
33 class CapabilityList : public base::NonThreadSafe { 26 class CapabilityList : public base::NonThreadSafe {
34 public: 27 public:
35 CapabilityList(); 28 CapabilityList();
36 ~CapabilityList(); 29 ~CapabilityList();
37 30
38 bool empty() const { return capabilities_.empty(); } 31 bool empty() const { return capabilities_.empty(); }
39 32
40 // Appends an entry to the list. 33 // Appends an entry to the list.
41 void Add(const VideoCaptureCapabilityWin& capability); 34 void Add(const VideoCaptureCapabilityWin& capability);
42 35
43 // Loops through the list of capabilities and returns an index of the best 36 // Loops through the list of capabilities and returns an index of the best
44 // matching capability. The algorithm prioritizes height, width, frame rate 37 // matching capability. The algorithm prioritizes height, width, frame rate
45 // and color format in that order. 38 // and color format in that order.
46 const VideoCaptureCapabilityWin& GetBestMatchedFormat( 39 const VideoCaptureCapabilityWin& GetBestMatchedFormat(
47 int requested_width, 40 int requested_width,
48 int requested_height, 41 int requested_height,
49 float requested_frame_rate) const; 42 float requested_frame_rate) const;
50 43
44 void CapabilitiesToVideoCaptureFormats(VideoCaptureFormats* formats) const;
45
51 private: 46 private:
52 typedef std::list<VideoCaptureCapabilityWin> Capabilities; 47 typedef std::list<VideoCaptureCapabilityWin> Capabilities;
53 Capabilities capabilities_; 48 Capabilities capabilities_;
54 49
55 DISALLOW_COPY_AND_ASSIGN(CapabilityList); 50 DISALLOW_COPY_AND_ASSIGN(CapabilityList);
56 }; 51 };
57 52
58 } // namespace media 53 } // namespace media
59 54
60 #endif // MEDIA_VIDEO_CAPTURE_WIN_CAPABILITY_LIST_WIN_H_ 55 #endif // MEDIA_VIDEO_CAPTURE_WIN_CAPABILITY_LIST_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698