资源预览内容
第1页 / 共15页
第2页 / 共15页
第3页 / 共15页
第4页 / 共15页
第5页 / 共15页
第6页 / 共15页
第7页 / 共15页
第8页 / 共15页
第9页 / 共15页
第10页 / 共15页
亲,该文档总共15页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
Android Multimedia 框架总结(二十二)MediaCodec 中 C+中创建到 start 过程及状态变换从今天开始,将深入源码中看看其 c+过程,看下 Agenda 如下:mediacodec.hCreateByTypeinitMediaCodec 中 BufferInfo 内部类:configure 过程startBufferInfo 在 MediaCodec.h 中对应是一个结构体/create by 逆流的鱼 yuiop on 2016/12/11/blog 地址:http:/blog.csdn.net/hejjunlinstruct BufferInfo uint32_t mBufferID;sp mData;sp mEncryptedData;sp mSharedEncryptedBuffer;sp mNotify;sp mFormat;bool mOwnedByClient;mediacodec.h 的方法的声明,位于frameworksavincludemediastagefright 下/create by 逆流的鱼 yuiop on 2016/12/11/blog 地址:http:/blog.csdn.net/hejjunlinnamespace android struct ABuffer;struct AMessage;struct AReplyToken;struct AString;struct CodecBase;struct IBatteryStats;struct ICrypto;class IMemory;struct MemoryDealer;class IResourceManagerClient;class IResourceManagerService;struct PersistentSurface;struct SoftwareRenderer;struct Surface;struct MediaCodec : public AHandler enum ConfigureFlags CONFIGURE_FLAG_ENCODE = 1,;enum BufferFlags BUFFER_FLAG_SYNCFRAME = 1,BUFFER_FLAG_CODECCONFIG = 2,BUFFER_FLAG_EOS = 4,;enum CB_INPUT_AVAILABLE = 1,CB_OUTPUT_AVAILABLE = 2,CB_ERROR = 3,CB_OUTPUT_FORMAT_CHANGED = 4,CB_RESOURCE_RECLAIMED = 5,;static const pid_t kNoPid = -1;static sp CreateByType(const sp &looper, const char *mime, bool encoder, status_t *err = NULL,pid_t pid = kNoPid);static sp CreateByComponentName(const sp &looper, const char *name, status_t *err = NULL,pid_t pid = kNoPid);static sp CreatePersistentInputSurface();status_t configure(const sp &format,const sp &nativeWindow,const sp &crypto,uint32_t flags);status_t setCallback(const sp status_t setOnFrameRenderedNotification(const sp status_t createInputSurface(sp* bufferProducer);status_t setInputSurface(const sp status_t start();/ Returns to a state in which the component remains allocated but/ unconfigured.status_t stop();/ Resets the codec to the INITIALIZED state. Can be called after an error/ has occured to make the codec usable.status_t reset();/ Client MUST call release before releasing final reference to this/ object. status_t release();status_t flush();status_t queueInputBuffer(size_t index,size_t offset,size_t size,int64_t presentationTimeUs,uint32_t flags,AString *errorDetailMsg = NULL);status_t queueSecureInputBuffer(size_t index,size_t offset,const CryptoPlugin:SubSample *subSamples,size_t numSubSamples,const uint8_t key16,const uint8_t iv16,CryptoPlugin:Mode mode,int64_t presentationTimeUs,uint32_t flags,AString *errorDetailMsg = NULL);status_t dequeueInputBuffer(size_t *index, int64_t timeoutUs = 0ll);status_t dequeueOutputBuffer(size_t *index,size_t *offset,size_t *size,int64_t *presentationTimeUs,uint32_t *flags,int64_t timeoutUs = 0ll);status_t renderOutputBufferAndRelease(size_t index, int64_t timestampNs);status_t renderOutputBufferAndRelease(size_t index);status_t releaseOutputBuffer(size_t index);status_t signalEndOfInputStream();status_t getOutputFormat(sp *format) const;status_t getInputFormat(sp *format) const;status_t getWidevineLegacyBuffers(Vector *buffers) const;status_t getInputBuffers(Vector *buffers) const;status_t getOutputBuffers(Vector *buffers) const;status_t getOutputBuffer(size_t index, sp *buffer);status_t getOutputFormat(size_t index, sp *format);status_t getInputBuffer(size_t index, sp *buffer);status_t setSurface(const sp status_t requestIDRFrame();/ Notification will be posted once there is something to do, i.e./ an input/output buffer has become available, a format change is / pending, an error is pending.void requestActivityNotification(const sp status_t getName(AString *componentName) const;status_t setParameters(const sp / Create a MediaCodec notification message from a list of rendered or dropped render infos/ by adding rendered frame information to a base notification message. Returns the number/ of frames that were rendered.static size_t CreateFramesRenderedMessage(std:list done, sp protected:virtual MediaCodec();virtual void onMessageReceived(const sp private:/ used by ResourceManagerClientstatus_t reclaim(bool force = false);friend struct ResourceManagerClient;private:enum State UNINITIALIZED,INITIALIZING,INITIALIZED,CONFIGURING,CONFIGURED,STARTING,STARTED,FLUSHING,FLUSHED,STOPPING,RELEASING,;enum kPortIndexInput = 0,kPortIndexOutput = 1,;enum kWhatInit = init,kWhatConfigure = conf,kWhatSetSurface = sSur,kWhatCreateInputSurface = cisf,kWhatSetInputSurface = sisf,kWhatStart = strt,kWhatStop = stop,kWhatRelease = rele,kWhatDequeueInputBuffer = deqI, kWhatQueueInputBuffer = queI,kWhatDequeueOutputBuffer = deqO,kWhatReleaseOutputBuffer = relO,kWhatSignalEndOfInputStream = eois,kWhatGetBuffers = getB,kWhatFlush = flu
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号