Adding SurfaceEncoder for encoding FilterFrames

Adding SurfaceEncoder which can be used to encode
custom frame data. In a sense, it is reverse
of what SurfaceTexture does.

SurfaceEncoder takes in frames from a native window and
passes them to an encoder, thus acting like a MediaSource.
It uses GRAlloc buffers underneath for passing data.
The client side sets the geometry, format in the beginning,
which cannot be changed while the recording is going on.

Currently, there is no common pixel format that both
GRAlloc and HAL understand.
Also, the encoder cannot encode using the data from the GRAlloc
buffers.

The SurfaceEncoder_test examines mainly the buffer passage
since true encoding cannot be done at this point.
SimpleDummyRecorder 'reads' the frames in the same thread
as the start(), whereas DummyRecorder 'reads' in a separate
thread much like the MPEG4Writer. The test with DummyRecorder
is much closer to the real encoding implementation.

Related to bug id: 4529323

Change-Id: I58ec19a150f8fe4d6195196dc44f55002b46c7c8
This commit is contained in:
Pannag Sanketi 2011-06-10 18:30:30 -07:00
parent ae6092f5b4
commit acb7b5dfc8
1 changed files with 5 additions and 5 deletions

View File

@ -55,7 +55,7 @@ enum {
PIXEL_FORMAT_OPAQUE = -1,
// System chooses an opaque format (no alpha bits required)
// real pixel formats supported for rendering -----------------------------
PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
@ -84,7 +84,7 @@ struct PixelFormatInfo
INDEX_GREEN = 2,
INDEX_BLUE = 3
};
enum { // components
ALPHA = 1,
RGB = 2,
@ -98,10 +98,10 @@ struct PixelFormatInfo
uint8_t h;
uint8_t l;
};
inline PixelFormatInfo() : version(sizeof(PixelFormatInfo)) { }
size_t getScanlineSize(unsigned int width) const;
size_t getSize(size_t ci) const {
size_t getSize(size_t ci) const {
return (ci <= 3) ? (cinfo[ci].h - cinfo[ci].l) : 0;
}
size_t version;
@ -112,7 +112,7 @@ struct PixelFormatInfo
szinfo cinfo[4];
struct {
uint8_t h_alpha;
uint8_t l_alpha;
uint8_t l_alpha;
uint8_t h_red;
uint8_t l_red;
uint8_t h_green;