1 //
2 // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // StreamProducerImpl.h: Defines the abstract rx::StreamProducerImpl class.
8 
9 #ifndef LIBANGLE_RENDERER_STREAMPRODUCERIMPL_H_
10 #define LIBANGLE_RENDERER_STREAMPRODUCERIMPL_H_
11 
12 #include "common/angleutils.h"
13 #include "libANGLE/Stream.h"
14 
15 namespace rx
16 {
17 
18 class StreamProducerImpl : angle::NonCopyable
19 {
20   public:
StreamProducerImpl()21     explicit StreamProducerImpl() {}
~StreamProducerImpl()22     virtual ~StreamProducerImpl() {}
23 
24     // Validates the ability for the producer to accept an arbitrary pointer to a frame. All
25     // pointers should be validated through this function before being used to produce a frame.
26     virtual egl::Error validateD3DNV12Texture(void *pointer) const = 0;
27 
28     // Constructs a frame from an arbitrary external pointer that points to producer specific frame
29     // data. Replaces the internal frame with the new one.
30     virtual void postD3DNV12Texture(void *pointer, const egl::AttributeMap &attributes) = 0;
31 
32     // Returns an OpenGL texture interpretation of some frame attributes for the purpose of
33     // constructing an OpenGL texture from a frame. Depending on the producer and consumer, some
34     // frames may have multiple "planes" with different OpenGL texture representations.
35     virtual egl::Stream::GLTextureDescription getGLFrameDescription(int planeIndex) = 0;
36 };
37 }  // namespace rx
38 
39 #endif  // LIBANGLE_RENDERER_STREAMPRODUCERIMPL_H_
40