Go to the documentation of this file.00001 #if !defined(libstagefright) && ANDROID_VER>=420
00002 #define libstagefright
00003
00004 #include "libstagefright_foundation.h"
00005
00006 namespace android {
00007
00008 struct ABuffer;
00009 struct ACodec;
00010 struct AMessage;
00011 struct AString;
00012 struct SoftwareRenderer;
00013 class ICrypto;
00014 class Surface;
00015 class IGraphicBufferProducer;
00016 class SurfaceTextureClient;
00017
00018 struct MediaCodec : public AHandler {
00019 enum ConfigureFlags {
00020 CONFIGURE_FLAG_ENCODE = 1,
00021 };
00022
00023 enum BufferFlags {
00024 BUFFER_FLAG_SYNCFRAME = 1,
00025 BUFFER_FLAG_CODECCONFIG = 2,
00026 BUFFER_FLAG_EOS = 4,
00027 };
00028
00029 static sp<MediaCodec> CreateByType(const sp<ALooper> &looper, const char *mime, bool encoder);
00030 #if (ANDROID_VER>=440)
00031 status_t configure(const sp<AMessage> &format, const sp<Surface> &nativeWindow, const sp<ICrypto> &crypto, uint32_t flags);
00032 status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer);
00033 #elif (ANDROID_VER>=420)
00034 status_t configure(const sp<AMessage> &format, const sp<SurfaceTextureClient> &st, const sp<ICrypto> &crypto, uint32_t flags);
00035 #elif (ANDROID_VER>=440)
00036 #endif
00037 status_t start();
00038 status_t dequeueOutputBuffer(size_t *index, size_t *offset, size_t *size, int64_t *presentationTimeUs, uint32_t *flags, int64_t timeoutUs = 0ll);
00039 status_t releaseOutputBuffer(size_t index);
00040 status_t getOutputBuffers(Vector<sp<ABuffer> > *buffers) const;
00041 status_t getInputBuffers(Vector<sp<ABuffer> > *buffers) const;
00042 status_t dequeueInputBuffer(size_t *index, int64_t timeoutUs = 0ll);
00043 status_t queueInputBuffer(size_t index, size_t offset, size_t size, int64_t presentationTimeUs, uint32_t flags, AString *errorDetailMsg = NULL);
00044
00045 protected:
00046 virtual ~MediaCodec();
00047 virtual void onMessageReceived(const sp<AMessage> &msg);
00048 private:
00049 char __data[sizeof(void*)*256];
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 };
00080
00081
00082 }
00083
00084 #endif //end of lib