OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ | |
6 #define WEBKIT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "cc/layers/video_frame_provider.h" | |
10 | |
11 namespace webkit_media { | |
12 | |
13 // The proxy class for the gpu thread to notify the compositor thread | |
14 // when a new video frame is available. | |
15 class StreamTextureProxy { | |
16 public: | |
17 // Initialize and bind to the current thread, which becomes the thread that | |
18 // a connected client will receive callbacks on. | |
19 virtual void BindToCurrentThread(int stream_id, int width, int height) = 0; | |
20 | |
21 virtual bool IsBoundToThread() = 0; | |
22 | |
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. | |
25 virtual void SetClient(cc::VideoFrameProvider::Client* client) = 0; | |
26 | |
27 struct Deleter { | |
28 inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); } | |
29 }; | |
30 | |
31 protected: | |
32 virtual ~StreamTextureProxy() {} | |
33 | |
34 // Causes this instance to be deleted on the thread it is bound to. | |
35 virtual void Release() = 0; | |
36 }; | |
37 | |
38 typedef scoped_ptr<StreamTextureProxy, StreamTextureProxy::Deleter> | |
39 ScopedStreamTextureProxy; | |
40 | |
41 // Factory class for managing the stream texture. | |
42 class StreamTextureFactory { | |
43 public: | |
44 virtual ~StreamTextureFactory() {} | |
45 | |
46 // Create the StreamTextureProxy object. | |
47 virtual StreamTextureProxy* CreateProxy() = 0; | |
48 | |
49 // Send an IPC message to the browser process to request a java surface | |
50 // object for the given stream_id. After the the surface is created, | |
51 // it will be passed back to the WebMediaPlayerAndroid object identified by | |
52 // the player_id. | |
53 virtual void EstablishPeer(int stream_id, int player_id) = 0; | |
54 | |
55 // Create the streamTexture and return the stream Id and set the texture id. | |
56 virtual unsigned CreateStreamTexture(unsigned* texture_id) = 0; | |
57 | |
58 // Destroy the streamTexture for the given texture Id. | |
59 virtual void DestroyStreamTexture(unsigned texture_id) = 0; | |
60 }; | |
61 | |
62 } // namespace webkit_media | |
63 | |
64 #endif // WEBKIT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ | |
OLD | NEW |