OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/layers/video_frame_provider.h" | 10 #include "cc/layers/video_frame_provider.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 virtual void Release() = 0; | 37 virtual void Release() = 0; |
38 | 38 |
39 struct Deleter { | 39 struct Deleter { |
40 inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); } | 40 inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); } |
41 }; | 41 }; |
42 }; | 42 }; |
43 | 43 |
44 typedef scoped_ptr<StreamTextureProxy, StreamTextureProxy::Deleter> | 44 typedef scoped_ptr<StreamTextureProxy, StreamTextureProxy::Deleter> |
45 ScopedStreamTextureProxy; | 45 ScopedStreamTextureProxy; |
46 | 46 |
| 47 class StreamTextureFactoryContextObserver { |
| 48 public: |
| 49 ~StreamTextureFactoryContextObserver() {} |
| 50 virtual void ResetStreamTextureProxy() = 0; |
| 51 }; |
| 52 |
47 // Factory class for managing stream textures. | 53 // Factory class for managing stream textures. |
48 class StreamTextureFactory : public base::RefCounted<StreamTextureFactory> { | 54 class StreamTextureFactory : public base::RefCounted<StreamTextureFactory> { |
49 public: | 55 public: |
50 // Create the StreamTextureProxy object. | 56 // Create the StreamTextureProxy object. |
51 virtual StreamTextureProxy* CreateProxy() = 0; | 57 virtual StreamTextureProxy* CreateProxy() = 0; |
52 | 58 |
53 // Send an IPC message to the browser process to request a java surface | 59 // Send an IPC message to the browser process to request a java surface |
54 // object for the given stream_id. After the the surface is created, | 60 // object for the given stream_id. After the the surface is created, |
55 // it will be passed back to the WebMediaPlayerAndroid object identified by | 61 // it will be passed back to the WebMediaPlayerAndroid object identified by |
56 // the player_id. | 62 // the player_id. |
57 virtual void EstablishPeer(int32 stream_id, int player_id) = 0; | 63 virtual void EstablishPeer(int32 stream_id, int player_id) = 0; |
58 | 64 |
59 // Creates a StreamTexture and returns its id. Sets |*texture_id| to the | 65 // Creates a StreamTexture and returns its id. Sets |*texture_id| to the |
60 // client-side id of the StreamTexture. The texture is produced into | 66 // client-side id of the StreamTexture. The texture is produced into |
61 // a mailbox so it can be shipped in a VideoFrame. | 67 // a mailbox so it can be shipped in a VideoFrame. |
62 virtual unsigned CreateStreamTexture(unsigned texture_target, | 68 virtual unsigned CreateStreamTexture(unsigned texture_target, |
63 unsigned* texture_id, | 69 unsigned* texture_id, |
64 gpu::Mailbox* texture_mailbox) = 0; | 70 gpu::Mailbox* texture_mailbox) = 0; |
65 | 71 |
66 // Set the streamTexture size for the given stream Id. | 72 // Set the streamTexture size for the given stream Id. |
67 virtual void SetStreamTextureSize(int32 texture_id, | 73 virtual void SetStreamTextureSize(int32 texture_id, |
68 const gfx::Size& size) = 0; | 74 const gfx::Size& size) = 0; |
69 | 75 |
70 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; | 76 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; |
71 | 77 |
| 78 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) = 0; |
| 79 virtual void RemoveObserver(StreamTextureFactoryContextObserver* obs) = 0; |
| 80 |
72 protected: | 81 protected: |
73 friend class base::RefCounted<StreamTextureFactory>; | 82 friend class base::RefCounted<StreamTextureFactory>; |
74 virtual ~StreamTextureFactory() {} | 83 virtual ~StreamTextureFactory() {} |
75 }; | 84 }; |
76 | 85 |
77 } // namespace content | 86 } // namespace content |
78 | 87 |
79 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 88 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
OLD | NEW |