| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL
ER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/time/time.h" | |
| 11 #include "base/values.h" | |
| 12 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 13 | 11 |
| 12 namespace base { |
| 13 class DictionaryValue; |
| 14 class TimeTicks; |
| 15 } // namespace base |
| 16 |
| 14 namespace gfx { | 17 namespace gfx { |
| 15 class Rect; | 18 class Rect; |
| 16 class Size; | 19 class Size; |
| 17 } // namespace gfx | 20 } // namespace gfx |
| 18 | 21 |
| 19 namespace gpu { | 22 namespace gpu { |
| 20 struct MailboxHolder; | 23 struct MailboxHolder; |
| 21 } // namespace gpu | 24 } // namespace gpu |
| 22 | 25 |
| 23 namespace media { | |
| 24 class VideoCaptureFormat; | |
| 25 } // namespace media | |
| 26 | |
| 27 namespace content { | 26 namespace content { |
| 28 | 27 |
| 29 // ID used for identifying an object of VideoCaptureController. | 28 typedef int VideoCaptureControllerID; |
| 30 struct CONTENT_EXPORT VideoCaptureControllerID { | |
| 31 explicit VideoCaptureControllerID(int device_id); | |
| 32 | |
| 33 bool operator<(const VideoCaptureControllerID& vc) const; | |
| 34 bool operator==(const VideoCaptureControllerID& vc) const; | |
| 35 | |
| 36 int device_id; | |
| 37 }; | |
| 38 | 29 |
| 39 // VideoCaptureControllerEventHandler is the interface for | 30 // VideoCaptureControllerEventHandler is the interface for |
| 40 // VideoCaptureController to notify clients about the events such as | 31 // VideoCaptureController to notify clients about the events such as |
| 41 // BufferReady, FrameInfo, Error, etc. | 32 // BufferReady, FrameInfo, Error, etc. |
| 42 class CONTENT_EXPORT VideoCaptureControllerEventHandler { | 33 class CONTENT_EXPORT VideoCaptureControllerEventHandler { |
| 43 public: | 34 public: |
| 44 // An Error has occurred in the VideoCaptureDevice. | 35 // An Error has occurred in the VideoCaptureDevice. |
| 45 virtual void OnError(const VideoCaptureControllerID& id) = 0; | 36 virtual void OnError(VideoCaptureControllerID id) = 0; |
| 46 | 37 |
| 47 // A buffer has been newly created. | 38 // A buffer has been newly created. |
| 48 virtual void OnBufferCreated(const VideoCaptureControllerID& id, | 39 virtual void OnBufferCreated(VideoCaptureControllerID id, |
| 49 base::SharedMemoryHandle handle, | 40 base::SharedMemoryHandle handle, |
| 50 int length, | 41 int length, |
| 51 int buffer_id) = 0; | 42 int buffer_id) = 0; |
| 52 | 43 |
| 53 // A previously created buffer has been freed and will no longer be used. | 44 // A previously created buffer has been freed and will no longer be used. |
| 54 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id, | 45 virtual void OnBufferDestroyed(VideoCaptureControllerID id, |
| 55 int buffer_id) = 0; | 46 int buffer_id) = 0; |
| 56 | 47 |
| 57 // A buffer has been filled with I420 video. | 48 // A buffer has been filled with I420 video. |
| 58 virtual void OnBufferReady(const VideoCaptureControllerID& id, | 49 virtual void OnBufferReady(VideoCaptureControllerID id, |
| 59 int buffer_id, | 50 int buffer_id, |
| 60 const gfx::Size& coded_size, | 51 const gfx::Size& coded_size, |
| 61 const gfx::Rect& visible_rect, | 52 const gfx::Rect& visible_rect, |
| 62 base::TimeTicks timestamp, | 53 const base::TimeTicks& timestamp, |
| 63 scoped_ptr<base::DictionaryValue> metadata) = 0; | 54 scoped_ptr<base::DictionaryValue> metadata) = 0; |
| 64 | 55 |
| 65 // A texture mailbox buffer has been filled with data. | 56 // A texture mailbox buffer has been filled with data. |
| 66 virtual void OnMailboxBufferReady( | 57 virtual void OnMailboxBufferReady( |
| 67 const VideoCaptureControllerID& id, | 58 VideoCaptureControllerID id, |
| 68 int buffer_id, | 59 int buffer_id, |
| 69 const gpu::MailboxHolder& mailbox_holder, | 60 const gpu::MailboxHolder& mailbox_holder, |
| 70 const gfx::Size& packed_frame_size, | 61 const gfx::Size& packed_frame_size, |
| 71 base::TimeTicks timestamp, | 62 const base::TimeTicks& timestamp, |
| 72 scoped_ptr<base::DictionaryValue> metadata) = 0; | 63 scoped_ptr<base::DictionaryValue> metadata) = 0; |
| 73 | 64 |
| 74 // The capture session has ended and no more frames will be sent. | 65 // The capture session has ended and no more frames will be sent. |
| 75 virtual void OnEnded(const VideoCaptureControllerID& id) = 0; | 66 virtual void OnEnded(VideoCaptureControllerID id) = 0; |
| 76 | 67 |
| 77 protected: | 68 protected: |
| 78 virtual ~VideoCaptureControllerEventHandler() {} | 69 virtual ~VideoCaptureControllerEventHandler() {} |
| 79 }; | 70 }; |
| 80 | 71 |
| 81 } // namespace content | 72 } // namespace content |
| 82 | 73 |
| 83 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ | 74 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA
NDLER_H_ |
| OLD | NEW |