OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ | 5 #ifndef WEBKIT_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ |
6 #define WEBKIT_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ | 6 #define WEBKIT_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ |
7 | 7 |
8 #include "cc/layers/video_frame_provider.h" | 8 #include "cc/layers/video_frame_provider.h" |
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebVideoFrame.h" | |
10 | |
11 namespace WebKit { | |
12 class WebStreamTextureClient; | |
13 } | |
14 | 9 |
15 namespace webkit_media { | 10 namespace webkit_media { |
16 | 11 |
17 // The proxy class for the gpu thread to notify the compositor thread | 12 // The proxy class for the gpu thread to notify the compositor thread |
18 // when a new video frame is available. | 13 // when a new video frame is available. |
19 class StreamTextureProxy { | 14 class StreamTextureProxy { |
20 public: | 15 public: |
21 virtual ~StreamTextureProxy() {} | 16 virtual ~StreamTextureProxy() {} |
22 | 17 |
23 // Initialize the the stream_id, texture width and height. This should | 18 // Initialize the the stream_id, texture width and height. This should |
24 // be called on the compositor thread. | 19 // be called on the compositor thread. |
25 virtual bool Initialize(int stream_id, int width, int height) = 0; | 20 virtual bool Initialize(int stream_id, int width, int height) = 0; |
26 | 21 |
27 virtual bool IsInitialized() = 0; | 22 virtual bool IsInitialized() = 0; |
28 | 23 |
29 // Setting the target for callback when a frame is available. This function | 24 // Setting the target for callback when a frame is available. This function |
30 // could be called on both the main thread and the compositor thread. | 25 // could be called on both the main thread and the compositor thread. |
31 #ifndef REMOVE_WEBVIDEOFRAME | |
32 virtual void SetClient(WebKit::WebStreamTextureClient* client) = 0; | |
33 #else | |
34 virtual void SetClient(cc::VideoFrameProvider::Client* client) = 0; | 26 virtual void SetClient(cc::VideoFrameProvider::Client* client) = 0; |
35 #endif | |
36 }; | 27 }; |
37 | 28 |
38 | 29 |
39 // Factory class for managing the stream texture. | 30 // Factory class for managing the stream texture. |
40 class StreamTextureFactory { | 31 class StreamTextureFactory { |
41 public: | 32 public: |
42 virtual ~StreamTextureFactory() {} | 33 virtual ~StreamTextureFactory() {} |
43 | 34 |
44 // Create the StreamTextureProxy object. | 35 // Create the StreamTextureProxy object. |
45 virtual StreamTextureProxy* CreateProxy() = 0; | 36 virtual StreamTextureProxy* CreateProxy() = 0; |
46 | 37 |
47 // Send an IPC message to the browser process to request a java surface | 38 // Send an IPC message to the browser process to request a java surface |
48 // object for the given stream_id. After the the surface is created, | 39 // object for the given stream_id. After the the surface is created, |
49 // it will be passed back to the WebMediaPlayerAndroid object identified by | 40 // it will be passed back to the WebMediaPlayerAndroid object identified by |
50 // the player_id. | 41 // the player_id. |
51 virtual void EstablishPeer(int stream_id, int player_id) = 0; | 42 virtual void EstablishPeer(int stream_id, int player_id) = 0; |
52 | 43 |
53 // Create the streamTexture and return the stream Id and set the texture id. | 44 // Create the streamTexture and return the stream Id and set the texture id. |
54 virtual unsigned CreateStreamTexture(unsigned* texture_id) = 0; | 45 virtual unsigned CreateStreamTexture(unsigned* texture_id) = 0; |
55 | 46 |
56 // Destroy the streamTexture for the given texture Id. | 47 // Destroy the streamTexture for the given texture Id. |
57 virtual void DestroyStreamTexture(unsigned texture_id) = 0; | 48 virtual void DestroyStreamTexture(unsigned texture_id) = 0; |
58 }; | 49 }; |
59 | 50 |
60 } // namespace webkit_media | 51 } // namespace webkit_media |
61 | 52 |
62 #endif // WEBKIT_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ | 53 #endif // WEBKIT_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_ |
OLD | NEW |