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

Side by Side Diff: media/video/capture/video_capture.h

Issue 242013002: Refactor video capturing code in the render process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge again :( Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // This file contains abstract classes used for media filter to handle video
6 // capture devices.
7
8 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_
9 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_
10
11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/time/time.h"
14 #include "media/base/media_export.h"
15 #include "media/video/capture/video_capture_types.h"
16
17 namespace media {
18
19 class VideoFrame;
20
21 class MEDIA_EXPORT VideoCapture {
22 public:
23 // TODO(wjia): add error codes.
24 // TODO(wjia): support weak ptr.
25 // Callbacks provided by client for notification of events.
26 class MEDIA_EXPORT EventHandler {
27 public:
28 // Notify client that video capture has been started.
29 virtual void OnStarted(VideoCapture* capture) = 0;
30
31 // Notify client that video capture has been stopped.
32 virtual void OnStopped(VideoCapture* capture) = 0;
33
34 // Notify client that video capture has been paused.
35 virtual void OnPaused(VideoCapture* capture) = 0;
36
37 // Notify client that video capture has hit some error |error_code|.
38 virtual void OnError(VideoCapture* capture, int error_code) = 0;
39
40 // Notify client that the client has been removed and no more calls will be
41 // received.
42 virtual void OnRemoved(VideoCapture* capture) = 0;
43
44 // Notify client that a buffer is available.
45 virtual void OnFrameReady(
46 VideoCapture* capture,
47 const scoped_refptr<media::VideoFrame>& frame) = 0;
48
49 protected:
50 virtual ~EventHandler() {}
51 };
52
53 typedef base::Callback<void(const media::VideoCaptureFormats&)>
54 DeviceFormatsCallback;
55
56 typedef base::Callback<void(const media::VideoCaptureFormats&)>
57 DeviceFormatsInUseCallback;
58
59 VideoCapture() {}
60
61 // Request video capture to start capturing with |params|.
62 // Also register |handler| with video capture for event handling.
63 // |handler| must remain valid until it has received |OnRemoved()|.
64 virtual void StartCapture(EventHandler* handler,
65 const VideoCaptureParams& params) = 0;
66
67 // Request video capture to stop capturing for client |handler|.
68 // |handler| must remain valid until it has received |OnRemoved()|.
69 virtual void StopCapture(EventHandler* handler) = 0;
70
71 virtual bool CaptureStarted() = 0;
72 virtual int CaptureFrameRate() = 0;
73
74 // Request the device capture supported formats. This method can be called
75 // before startCapture() and/or after stopCapture() so a |callback| is used
76 // instead of replying via EventHandler.
77 virtual void GetDeviceSupportedFormats(
78 const DeviceFormatsCallback& callback) = 0;
79
80 // Request the device capture in-use format(s), possibly by other user(s) in
81 // other renderer(s). If there is no format in use, the vector returned in
82 // the callback will be empty.
83 virtual void GetDeviceFormatsInUse(
84 const DeviceFormatsInUseCallback& callback) = 0;
85
86 protected:
87 virtual ~VideoCapture() {}
88
89 private:
90 DISALLOW_COPY_AND_ASSIGN(VideoCapture);
91 };
92
93 } // namespace media
94
95 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_
OLDNEW
« no previous file with comments | « media/video/capture/mock_video_capture_event_handler.cc ('k') | media/video/capture/video_capture_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698