| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 MEDIA_BLINK_STREAM_TEXTURE_WRAPPER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_ |
| 6 #define MEDIA_BLINK_STREAM_TEXTURE_WRAPPER_H_ | 6 #define MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_ |
| 7 | 7 |
| 8 #include "cc/layers/video_frame_provider.h" | |
| 9 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
| 10 | 9 |
| 11 namespace media { | 10 namespace media { |
| 12 class VideoFrame; | 11 class VideoFrame; |
| 13 | 12 |
| 14 // StreamTextureWrapper encapsulates a StreamTexture's creation, initialization | 13 // StreamTextureWrapper encapsulates a StreamTexture's creation, initialization |
| 15 // and registration for later retrieval (in the Browser process). | 14 // and registration for later retrieval (in the Browser process). |
| 16 // | 15 // |
| 17 // TODO(tguilbert): Support registering the underlying SurfaceTexture so it can | 16 // TODO(tguilbert): Support registering the underlying SurfaceTexture so it can |
| 18 // be used by a MediaPlayer in the browser process. See crbug.com/627658. | 17 // be used by a MediaPlayer in the browser process. See crbug.com/627658. |
| 19 class MEDIA_EXPORT StreamTextureWrapper { | 18 class MEDIA_EXPORT StreamTextureWrapper { |
| 20 public: | 19 public: |
| 21 StreamTextureWrapper() {} | 20 StreamTextureWrapper() {} |
| 22 | 21 |
| 23 // Initialize the underlying StreamTexture. | 22 // Initialize the underlying StreamTexture. |
| 24 // See StreamTextureWrapperImpl. | 23 // See StreamTextureWrapperImpl. |
| 25 virtual void Initialize( | 24 virtual void Initialize( |
| 26 cc::VideoFrameProvider::Client* client, | 25 const base::Closure& received_frame_cb, |
| 27 const gfx::Size& natural_size, | 26 const gfx::Size& natural_size, |
| 28 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, | 27 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, |
| 29 const base::Closure& init_cb) = 0; | 28 const base::Closure& init_cb) = 0; |
| 30 | 29 |
| 31 // Called whenever the video's natural size changes. | 30 // Called whenever the video's natural size changes. |
| 32 // See StreamTextureWrapperImpl. | 31 // See StreamTextureWrapperImpl. |
| 33 virtual void UpdateTextureSize(const gfx::Size& natural_size) = 0; | 32 virtual void UpdateTextureSize(const gfx::Size& natural_size) = 0; |
| 34 | 33 |
| 35 // Returns the latest frame. | 34 // Returns the latest frame. |
| 36 // See StreamTextureWrapperImpl. | 35 // See StreamTextureWrapperImpl. |
| 37 virtual scoped_refptr<VideoFrame> GetCurrentFrame() = 0; | 36 virtual scoped_refptr<VideoFrame> GetCurrentFrame() = 0; |
| 38 | 37 |
| 39 struct Deleter { | 38 struct Deleter { |
| 40 inline void operator()(StreamTextureWrapper* ptr) const { ptr->Destroy(); } | 39 inline void operator()(StreamTextureWrapper* ptr) const { ptr->Destroy(); } |
| 41 }; | 40 }; |
| 42 | 41 |
| 43 protected: | 42 protected: |
| 44 virtual ~StreamTextureWrapper() {} | 43 virtual ~StreamTextureWrapper() {} |
| 45 | 44 |
| 46 // Safely destroys the StreamTextureWrapper. | 45 // Safely destroys the StreamTextureWrapper. |
| 47 // See StreamTextureWrapperImpl. | 46 // See StreamTextureWrapperImpl. |
| 48 virtual void Destroy() = 0; | 47 virtual void Destroy() = 0; |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 typedef std::unique_ptr<StreamTextureWrapper, StreamTextureWrapper::Deleter> | 50 typedef std::unique_ptr<StreamTextureWrapper, StreamTextureWrapper::Deleter> |
| 52 ScopedStreamTextureWrapper; | 51 ScopedStreamTextureWrapper; |
| 53 | 52 |
| 54 } // namespace media | 53 } // namespace media |
| 55 | 54 |
| 56 #endif // MEDIA_BLINK_STREAM_TEXTURE_WRAPPER_H_ | 55 #endif // MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_ |
| OLD | NEW |