| 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_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_ |
| 6 #define _MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_ |
| 7 |
| 8 #include "media/base/video_frame.h" |
| 9 |
| 10 namespace media { |
| 11 class VideoFrame; |
| 12 |
| 13 // StreamTextureWrapper encapsulates a StreamTexture's creation, initialization |
| 14 // and registration for latter retrieval (in the Browser process). |
| 15 // |
| 16 // TODO(tguilbert): Support registering the underlying SurfaceTexture so it can |
| 17 // be used by a MediaPlayer in the browser process. See crbug.com/627658. |
| 18 class MEDIA_EXPORT StreamTextureWrapper { |
| 19 public: |
| 20 StreamTextureWrapper() {} |
| 21 virtual ~StreamTextureWrapper() {} |
| 22 |
| 23 // Initialize the StreamTexture and wrap the underlying texture into a frame. |
| 24 // The provided |compositor_task_runner| will be used to "signal" new frames |
| 25 // to |client|. |
| 26 virtual void Initialize( |
| 27 cc::VideoFrameProvider::Client* client, |
| 28 const gfx::Size& natural_size, |
| 29 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, |
| 30 const base::Closure& init_cb) = 0; |
| 31 |
| 32 // Should be called whenever the Video's natural size changes. |
| 33 virtual void UpdateTextureSize(const gfx::Size& natural_size) = 0; |
| 34 |
| 35 // Returns the latest frame. |
| 36 // N.B: The frame returned is likely always the same frame, wrapping the |
| 37 // underlying texture. See StreamTextureWrapperImpl for more details. |
| 38 virtual scoped_refptr<VideoFrame> GetCurrentFrame() = 0; |
| 39 |
| 40 // Safely destroys the StreamTextureWrapper on the appropritate thread. |
| 41 virtual void Destroy() = 0; |
| 42 }; |
| 43 |
| 44 } // namespace media |
| 45 |
| 46 namespace std { |
| 47 |
| 48 // Specialize std::default_delete so that |
| 49 // std::unique_ptr<StreamTextureWrapper> uses "Destroy()" instead of trying to |
| 50 // use the destructor. |
| 51 template <> |
| 52 struct MEDIA_EXPORT default_delete<media::StreamTextureWrapper> { |
| 53 void operator()(media::StreamTextureWrapper* stw) const; |
| 54 }; |
| 55 |
| 56 } // namespace std |
| 57 |
| 58 #endif // _MEDIA_BASE_ANDROID_STREAM_TEXTURE_WRAPPER_H_ |
| OLD | NEW |