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_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ |
6 #define WEBKIT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/layers/video_frame_provider.h" | 9 #include "cc/layers/video_frame_provider.h" |
10 | 10 |
11 namespace webkit_media { | 11 namespace content { |
12 | 12 |
13 // The proxy class for the gpu thread to notify the compositor thread | 13 // The proxy class for the gpu thread to notify the compositor thread |
14 // when a new video frame is available. | 14 // when a new video frame is available. |
15 class StreamTextureProxy { | 15 class StreamTextureProxy { |
16 public: | 16 public: |
17 // Initialize and bind to the current thread, which becomes the thread that | 17 // Initialize and bind to the current thread, which becomes the thread that |
18 // a connected client will receive callbacks on. | 18 // a connected client will receive callbacks on. |
19 virtual void BindToCurrentThread(int stream_id, int width, int height) = 0; | 19 virtual void BindToCurrentThread(int stream_id, int width, int height) = 0; |
20 | 20 |
21 virtual bool IsBoundToThread() = 0; | 21 virtual bool IsBoundToThread() = 0; |
22 | 22 |
23 // Setting the target for callback when a frame is available. This function | 23 // Setting the target for callback when a frame is available. This function |
24 // could be called on both the main thread and the compositor thread. | 24 // could be called on both the main thread and the compositor thread. |
25 virtual void SetClient(cc::VideoFrameProvider::Client* client) = 0; | 25 virtual void SetClient(cc::VideoFrameProvider::Client* client) = 0; |
26 | 26 |
27 struct Deleter { | 27 struct Deleter { |
28 inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); } | 28 inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); } |
qinmin
2013/06/21 04:37:05
Other than this deleter struct, we don't need thes
scherkus (not reviewing)
2013/06/21 21:37:59
Yeah was going to defer to a future CL but I'll ta
| |
29 }; | 29 }; |
30 | 30 |
31 protected: | 31 protected: |
32 virtual ~StreamTextureProxy() {} | 32 virtual ~StreamTextureProxy() {} |
33 | 33 |
34 // Causes this instance to be deleted on the thread it is bound to. | 34 // Causes this instance to be deleted on the thread it is bound to. |
35 virtual void Release() = 0; | 35 virtual void Release() = 0; |
36 }; | 36 }; |
37 | 37 |
38 typedef scoped_ptr<StreamTextureProxy, StreamTextureProxy::Deleter> | 38 typedef scoped_ptr<StreamTextureProxy, StreamTextureProxy::Deleter> |
(...skipping 13 matching lines...) Expand all Loading... | |
52 // the player_id. | 52 // the player_id. |
53 virtual void EstablishPeer(int stream_id, int player_id) = 0; | 53 virtual void EstablishPeer(int stream_id, int player_id) = 0; |
54 | 54 |
55 // Create the streamTexture and return the stream Id and set the texture id. | 55 // Create the streamTexture and return the stream Id and set the texture id. |
56 virtual unsigned CreateStreamTexture(unsigned* texture_id) = 0; | 56 virtual unsigned CreateStreamTexture(unsigned* texture_id) = 0; |
57 | 57 |
58 // Destroy the streamTexture for the given texture Id. | 58 // Destroy the streamTexture for the given texture Id. |
59 virtual void DestroyStreamTexture(unsigned texture_id) = 0; | 59 virtual void DestroyStreamTexture(unsigned texture_id) = 0; |
60 }; | 60 }; |
61 | 61 |
62 } // namespace webkit_media | 62 } // namespace content |
63 | 63 |
64 #endif // WEBKIT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ | 64 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ |
OLD | NEW |