Confirmed users
157
edits
| Line 142: | Line 142: | ||
class MediaCodec { | class MediaCodec { | ||
public: | public: | ||
enum EncodingState { | |||
COLLOCTING, /* indicate the encoder still wait enough data to be encoded */ | |||
ENCODING, /* there is enough data to be encoded, but incomplete */ | |||
ENCODED, /* indicate there is some output can be get from this codec */ | |||
} | |||
MediaCodec(); | MediaCodec(); | ||
status_t Init() = 0; | status_t Init() = 0; | ||
| Line 156: | Line 162: | ||
status_t Encode() = 0; | status_t Encode() = 0; | ||
/* Read the encoded data from encoder, | /* Read the encoded data from encoder, check the status before attempt to read, otherwise error would returned */ | ||
EncoderState GetCurrentState(); | |||
status_t GetEncodedData(MediaSegment& encData) = 0; | status_t GetEncodedData(MediaSegment& encData) = 0; | ||
/* codec specific | /* codec specific header to describe self type/version/etc. */ | ||
Metadata | Metadata GetCodecHeader(); | ||
/* force the encoder to output current available data */ | |||
/* XXX: this maybe required to support MediaEncoder::Request, but may not supported by all encoder backend */ | |||
void Flush() = 0; | void Flush() = 0; | ||
| Line 208: | Line 218: | ||
} | } | ||
</code> | </code> | ||
== Working flow == | == Working flow == | ||
# MediaEncoder create MediaCodecs, MediaWriter based on request | # MediaEncoder create MediaCodecs, MediaWriter based on request | ||