summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorwjia@google.com <wjia@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-06 20:12:11 +0000
committerwjia@google.com <wjia@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-06 20:12:11 +0000
commit04a7eb978095cf7991593cd271ec6bf90a43b372 (patch)
treea024a548409a5a48dfa2ed0cc175d4f57d7bb0ed /media
parent1f2a4abbcff73b8518cc45b5ce9b329e7dfdd9c8 (diff)
downloadchromium_src-04a7eb978095cf7991593cd271ec6bf90a43b372.zip
chromium_src-04a7eb978095cf7991593cd271ec6bf90a43b372.tar.gz
chromium_src-04a7eb978095cf7991593cd271ec6bf90a43b372.tar.bz2
add video capture message filter and its unit test.
BUG=none TEST=try bots Review URL: http://codereview.chromium.org/6903018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84489 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/media.gyp1
-rw-r--r--media/video/capture/video_capture.h41
-rw-r--r--media/video/capture/video_capture_types.h24
3 files changed, 42 insertions, 24 deletions
diff --git a/media/media.gyp b/media/media.gyp
index 13e2b51..8021741 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -179,6 +179,7 @@
'video/capture/linux/video_capture_device_linux.h',
'video/capture/video_capture.h',
'video/capture/video_capture_device.h',
+ 'video/capture/video_capture_types.h',
'video/ffmpeg_video_allocator.cc',
'video/ffmpeg_video_allocator.h',
'video/ffmpeg_video_decode_engine.cc',
diff --git a/media/video/capture/video_capture.h b/media/video/capture/video_capture.h
index f885614..5339a47 100644
--- a/media/video/capture/video_capture.h
+++ b/media/video/capture/video_capture.h
@@ -11,15 +11,12 @@
#include "base/memory/ref_counted.h"
#include "base/time.h"
#include "media/base/video_frame.h"
+#include "media/video/capture/video_capture_types.h"
namespace media {
class VideoCapture {
public:
- // TODO(wjia): this type should be defined in a common place and
- // shared with device manager.
- typedef uint64 VideoCaptureId;
-
// Current status of the video capture device in the browser process. Browser
// process sends information about the current capture state and error to the
// renderer process using this type.
@@ -30,25 +27,14 @@ class VideoCapture {
kError,
};
- // Parameters for starting video capture and device information.
- struct CaptureParams {
- CaptureParams() {}
- ~CaptureParams() {}
-
- uint32 width;
- uint32 height;
- uint32 frame_rate;
- VideoCaptureId session_id;
- };
-
// TODO(wjia): consider merging with media::VideoFrame if possible.
class VideoFrameBuffer : public base::RefCountedThreadSafe<VideoFrameBuffer> {
public:
VideoFrameBuffer() {}
~VideoFrameBuffer() {}
- uint32 width;
- uint32 height;
+ int width;
+ int height;
int stride;
size_t buffer_size;
void* memory_pointer;
@@ -77,13 +63,20 @@ class VideoCapture {
// Notify client that a buffer is available.
virtual void OnBufferReady(VideoCapture* capture,
scoped_refptr<VideoFrameBuffer> buffer) = 0;
+
+ // Notify client about device info.
+ virtual void OnDeviceInfoReceived(
+ VideoCapture* capture,
+ const VideoCaptureParams& device_info) = 0;
};
+ // TODO(wjia): merge with similar struct in browser process and move it to
+ // video_capture_types.h.
struct VideoCaptureCapability {
- uint32 width; // desired width.
- uint32 height; // desired height.
- uint32 max_fps; // desired maximum frame rate.
- uint32 expected_capture_delay; // expected delay in millisecond.
+ int width; // desired width.
+ int height; // desired height.
+ int max_fps; // desired maximum frame rate.
+ int expected_capture_delay; // expected delay in millisecond.
media::VideoFrame::Format raw_type; // desired video type.
bool interlaced; // need interlace format.
bool resolution_fixed; // indicate requested resolution can't be altered.
@@ -105,9 +98,9 @@ class VideoCapture {
// virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) = 0;
virtual bool CaptureStarted() = 0;
- virtual uint32 CaptureWidth() = 0;
- virtual uint32 CaptureHeight() = 0;
- virtual uint32 CaptureFrameRate() = 0;
+ virtual int CaptureWidth() = 0;
+ virtual int CaptureHeight() = 0;
+ virtual int CaptureFrameRate() = 0;
private:
DISALLOW_COPY_AND_ASSIGN(VideoCapture);
diff --git a/media/video/capture/video_capture_types.h b/media/video/capture/video_capture_types.h
new file mode 100644
index 0000000..4a7651a
--- /dev/null
+++ b/media/video/capture/video_capture_types.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_
+#define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_
+
+namespace media {
+
+// TODO(wjia): this type should be defined in a common place and
+// shared with device manager.
+typedef int VideoCaptureSessionId;
+
+// Parameters for starting video capture and device information.
+struct VideoCaptureParams {
+ int width;
+ int height;
+ int frame_per_second;
+ VideoCaptureSessionId session_id;
+};
+
+} // namespace media
+
+#endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_TYPES_H_