• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef ANDROID_DVR_BUFFER_H_
2 #define ANDROID_DVR_BUFFER_H_
3 
4 #include <stdbool.h>
5 #include <stdint.h>
6 #include <sys/cdefs.h>
7 #include <memory>
8 
9 __BEGIN_DECLS
10 
11 typedef struct DvrWriteBuffer DvrWriteBuffer;
12 typedef struct DvrReadBuffer DvrReadBuffer;
13 typedef struct DvrBuffer DvrBuffer;
14 typedef struct AHardwareBuffer AHardwareBuffer;
15 struct native_handle;
16 
17 // Destroys the write buffer.
18 void dvrWriteBufferDestroy(DvrWriteBuffer* write_buffer);
19 
20 // Returns 1 if the given write buffer object contains a buffer, 0 otherwise.
21 int dvrWriteBufferIsValid(DvrWriteBuffer* write_buffer);
22 
23 // Returns the global BufferHub id of this buffer.
24 int dvrWriteBufferGetId(DvrWriteBuffer* write_buffer);
25 
26 // Returns an AHardwareBuffer for the underlying buffer.
27 // Caller must call AHardwareBuffer_release on hardware_buffer.
28 int dvrWriteBufferGetAHardwareBuffer(DvrWriteBuffer* write_buffer,
29                                      AHardwareBuffer** hardware_buffer);
30 
31 // Destroys the read buffer.
32 void dvrReadBufferDestroy(DvrReadBuffer* read_buffer);
33 
34 // Returns 1 if the given write buffer object contains a buffer, 0 otherwise.
35 int dvrReadBufferIsValid(DvrReadBuffer* read_buffer);
36 
37 // Returns the global BufferHub id of this buffer.
38 int dvrReadBufferGetId(DvrReadBuffer* read_buffer);
39 
40 // Returns an AHardwareBuffer for the underlying buffer.
41 // Caller must call AHardwareBuffer_release on hardware_buffer.
42 int dvrReadBufferGetAHardwareBuffer(DvrReadBuffer* read_buffer,
43                                     AHardwareBuffer** hardware_buffer);
44 
45 // Destroys the buffer.
46 void dvrBufferDestroy(DvrBuffer* buffer);
47 
48 // Gets an AHardwareBuffer from the buffer.
49 // Caller must call AHardwareBuffer_release on hardware_buffer.
50 int dvrBufferGetAHardwareBuffer(DvrBuffer* buffer,
51                                 AHardwareBuffer** hardware_buffer);
52 
53 // Retrieve the shared buffer layout version defined in dvr_shared_buffers.h.
54 int dvrBufferGlobalLayoutVersionGet();
55 
56 __END_DECLS
57 
58 #endif  // ANDROID_DVR_BUFFER_H_
59