| 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 // Safely destroys the StreamTextureWrapper. |
| 40 // See StreamTextureWrapperImpl. |
| 41 virtual void Destroy() = 0; |
| 42 |
| 43 protected: |
| 44 virtual ~StreamTextureWrapper() {} |
| 45 }; |
| 46 |
| 47 } // namespace media |
| 48 |
| 49 namespace std { |
| 50 |
| 51 // Specialize std::default_delete so that |
| 52 // std::unique_ptr<StreamTextureWrapper> uses "Destroy()" instead of trying to |
| 53 // use the destructor. |
| 54 template <> |
| 55 struct MEDIA_EXPORT default_delete<media::StreamTextureWrapper> { |
| 56 void operator()(media::StreamTextureWrapper* stw) const; |
| 57 }; |
| 58 |
| 59 } // namespace std |
| 60 |
| 61 #endif // MEDIA_BLINK_STREAM_TEXTURE_WRAPPER_H_ |
| OLD | NEW |