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