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 // This file contains abstract classes used for media filter to handle video | 5 // This file contains abstract classes used for media filter to handle video |
6 // capture devices. | 6 // capture devices. |
7 | 7 |
8 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 8 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
9 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 9 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
14 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.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 class MEDIA_EXPORT VideoCapture { | 19 class MEDIA_EXPORT VideoCapture { |
20 public: | 20 public: |
21 // TODO(wjia): consider merging with media::VideoFrame if possible. | 21 // TODO(wjia): consider merging with media::VideoFrame if possible. |
22 class VideoFrameBuffer : public base::RefCountedThreadSafe<VideoFrameBuffer> { | 22 class VideoFrameBuffer : public base::RefCountedThreadSafe<VideoFrameBuffer> { |
23 public: | 23 public: |
24 VideoFrameBuffer() | 24 VideoFrameBuffer() |
25 : width(0), | 25 : width(0), |
26 height(0), | 26 height(0), |
27 stride(0), | 27 stride(0), |
28 buffer_size(0), | 28 buffer_size(0), |
29 memory_pointer(NULL) {} | 29 memory_pointer(NULL) {} |
30 ~VideoFrameBuffer() {} | |
31 | 30 |
32 int width; | 31 int width; |
33 int height; | 32 int height; |
34 int stride; | 33 int stride; |
35 size_t buffer_size; | 34 size_t buffer_size; |
36 uint8* memory_pointer; | 35 uint8* memory_pointer; |
37 base::Time timestamp; | 36 base::Time timestamp; |
38 | 37 |
39 private: | 38 private: |
| 39 friend class base::RefCountedThreadSafe<VideoFrameBuffer>; |
| 40 ~VideoFrameBuffer() {} |
| 41 |
40 DISALLOW_COPY_AND_ASSIGN(VideoFrameBuffer); | 42 DISALLOW_COPY_AND_ASSIGN(VideoFrameBuffer); |
41 }; | 43 }; |
42 | 44 |
43 // TODO(wjia): add error codes. | 45 // TODO(wjia): add error codes. |
44 // Callbacks provided by client for notification of events. | 46 // Callbacks provided by client for notification of events. |
45 class EventHandler { | 47 class EventHandler { |
46 public: | 48 public: |
47 // Notify client that video capture has been started. | 49 // Notify client that video capture has been started. |
48 virtual void OnStarted(VideoCapture* capture) = 0; | 50 virtual void OnStarted(VideoCapture* capture) = 0; |
49 | 51 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 virtual int CaptureHeight() = 0; | 93 virtual int CaptureHeight() = 0; |
92 virtual int CaptureFrameRate() = 0; | 94 virtual int CaptureFrameRate() = 0; |
93 | 95 |
94 private: | 96 private: |
95 DISALLOW_COPY_AND_ASSIGN(VideoCapture); | 97 DISALLOW_COPY_AND_ASSIGN(VideoCapture); |
96 }; | 98 }; |
97 | 99 |
98 } // namespace media | 100 } // namespace media |
99 | 101 |
100 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 102 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
OLD | NEW |