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