summaryrefslogtreecommitdiffstats
path: root/webkit/media/android/stream_texture_factory_android.h
blob: 9ef4e4d6e990e0a962a4a216cf9f0d6cfb4f28c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef WEBKIT_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_
#define WEBKIT_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_
#pragma once

namespace WebKit {
class WebStreamTextureClient;
}

namespace webkit_media {

// The proxy class for the gpu thread to notify the compositor thread
// when a new video frame is available.
class StreamTextureProxy {
 public:
  virtual ~StreamTextureProxy() {}

  // Initialize the the stream_id, texture width and height. This should
  // be called on the compositor thread.
  virtual bool Initialize(int stream_id, int width, int height) = 0;

  virtual bool IsInitialized() = 0;

  // Setting the target for callback when a frame is available. This function
  // could be called on both the main thread and the compositor thread.
  virtual void SetClient(WebKit::WebStreamTextureClient* client) = 0;
};


// Factory class for managing the stream texture.
class StreamTextureFactory {
 public:
  virtual ~StreamTextureFactory() {}

  // Create the StreamTextureProxy object.
  virtual StreamTextureProxy* CreateProxy() = 0;

  // Send an IPC message to the browser process to request a java surface
  // object for the given stream_id. After the the surface is created,
  // it will be passed back to the WebMediaPlayerAndroid object identified by
  // the player_id.
  virtual void EstablishPeer(int stream_id, int player_id) = 0;

  // Create the streamTexture and return the stream Id and set the texture id.
  virtual unsigned CreateStreamTexture(unsigned* texture_id) = 0;

  // Destroy the streamTexture for the given texture Id.
  virtual void DestroyStreamTexture(unsigned texture_id) = 0;
};

} // namespace webkit_media

#endif  // WEBKIT_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_ANDROID_H_