| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 WEBKIT_RENDERER_MEDIA_VIDEO_FRAME_PROVIDER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_FRAME_PROVIDER_H_ |
| 6 #define WEBKIT_RENDERER_MEDIA_VIDEO_FRAME_PROVIDER_H_ | 6 #define CONTENT_RENDERER_MEDIA_VIDEO_FRAME_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" |
| 10 | 11 |
| 11 namespace media { | 12 namespace media { |
| 12 class VideoFrame; | 13 class VideoFrame; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace webkit_media { | 16 namespace content { |
| 16 | 17 |
| 17 // Define an interface to provide a sequence of video frames to clients. | 18 // Define an interface to provide a sequence of video frames to clients. |
| 18 // TODO(wjia): remove ref count. | 19 // TODO(wjia): remove ref count. |
| 19 class VideoFrameProvider | 20 // TODO(wjia): rename interface so it doesn't clash with cc::VideoFrameProvider. |
| 21 class CONTENT_EXPORT VideoFrameProvider |
| 20 : public base::RefCountedThreadSafe<VideoFrameProvider> { | 22 : public base::RefCountedThreadSafe<VideoFrameProvider> { |
| 21 public: | 23 public: |
| 22 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>&)> | 24 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>&)> |
| 23 RepaintCB; | 25 RepaintCB; |
| 24 | 26 |
| 25 // Start to provide video frames to the caller. | 27 // Start to provide video frames to the caller. |
| 26 virtual void Start() = 0; | 28 virtual void Start() = 0; |
| 27 | 29 |
| 28 // Stop to provide video frames to the caller. | 30 // Stop to provide video frames to the caller. |
| 29 virtual void Stop() = 0; | 31 virtual void Stop() = 0; |
| 30 | 32 |
| 31 // Resume to provide video frames to the caller after being paused. | 33 // Resume to provide video frames to the caller after being paused. |
| 32 virtual void Play() = 0; | 34 virtual void Play() = 0; |
| 33 | 35 |
| 34 // Put the provider in pause state and the caller will not receive video | 36 // Put the provider in pause state and the caller will not receive video |
| 35 // frames, but the provider might still generate video frames which are | 37 // frames, but the provider might still generate video frames which are |
| 36 // thrown away. | 38 // thrown away. |
| 37 virtual void Pause() = 0; | 39 virtual void Pause() = 0; |
| 38 | 40 |
| 39 protected: | 41 protected: |
| 40 friend class base::RefCountedThreadSafe<VideoFrameProvider>; | 42 friend class base::RefCountedThreadSafe<VideoFrameProvider>; |
| 43 |
| 41 VideoFrameProvider(); | 44 VideoFrameProvider(); |
| 42 virtual ~VideoFrameProvider(); | 45 virtual ~VideoFrameProvider(); |
| 43 | 46 |
| 44 private: | 47 private: |
| 45 DISALLOW_COPY_AND_ASSIGN(VideoFrameProvider); | 48 DISALLOW_COPY_AND_ASSIGN(VideoFrameProvider); |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 } // namespace webkit_media | 51 } // namespace content |
| 49 | 52 |
| 50 #endif // WEBKIT_RENDERER_MEDIA_VIDEO_FRAME_PROVIDER_H_ | 53 #endif // CONTENT_RENDERER_MEDIA_VIDEO_FRAME_PROVIDER_H_ |
| OLD | NEW |