#ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_
#define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "cc/layers/video_frame_provider.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "ui/gfx/size.h"
namespace gpu {
namespace gles2 {
class GLES2Interface;
}
}
namespace content {
class StreamTextureProxy {
public:
virtual ~StreamTextureProxy() {}
virtual void BindToCurrentThread(int32 stream_id) = 0;
virtual void SetClient(cc::VideoFrameProvider::Client* client) = 0;
virtual void Release() = 0;
struct Deleter {
inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); }
};
};
typedef scoped_ptr<StreamTextureProxy, StreamTextureProxy::Deleter>
ScopedStreamTextureProxy;
class StreamTextureFactory : public base::RefCounted<StreamTextureFactory> {
public:
virtual StreamTextureProxy* CreateProxy() = 0;
virtual void EstablishPeer(int32 stream_id, int player_id) = 0;
virtual unsigned CreateStreamTexture(unsigned texture_target,
unsigned* texture_id,
gpu::Mailbox* texture_mailbox) = 0;
virtual void SetStreamTextureSize(int32 texture_id,
const gfx::Size& size) = 0;
virtual gpu::gles2::GLES2Interface* ContextGL() = 0;
protected:
friend class base::RefCounted<StreamTextureFactory>;
virtual ~StreamTextureFactory() {}
};
}
#endif