Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx
- 文档编号:16423824
- 上传时间:2022-11-23
- 格式:DOCX
- 页数:21
- 大小:21.31KB
Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx
《Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx》由会员分享,可在线阅读,更多相关《Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx(21页珍藏版)》请在冰豆网上搜索。
classIResourceManagerClient;
classIResourceManagerService;
structPersistentSurface;
structSoftwareRenderer;
structSurface;
structMediaCodec:
publicAHandler{
enumConfigureFlags{
CONFIGURE_FLAG_ENCODE=1,
};
enumBufferFlags{
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,
staticconstpid_tkNoPid=-1;
staticsp<
MediaCodec>
CreateByType(
constsp<
ALooper>
&
looper,constchar*mime,boolencoder,status_t*err=NULL,
pid_tpid=kNoPid);
CreateByComponentName(
looper,constchar*name,status_t*err=NULL,
PersistentSurface>
CreatePersistentInputSurface();
status_tconfigure(
format,
Surface>
nativeWindow,
ICrypto>
crypto,
uint32_tflags);
status_tsetCallback(constsp<
callback);
status_tsetOnFrameRenderedNotification(constsp<
notify);
status_tcreateInputSurface(sp<
IGraphicBufferProducer>
*bufferProducer);
status_tsetInputSurface(constsp<
surface);
status_tstart();
//Returnstoastateinwhichthecomponentremainsallocatedbut
//unconfigured.
status_tstop();
//ResetsthecodectotheINITIALIZEDstate.Canbecalledafteranerror
//hasoccuredtomakethecodecusable.
status_treset();
//ClientMUSTcallreleasebeforereleasingfinalreferencetothis
//object.
status_trelease();
status_tflush();
status_tqueueInputBuffer(
size_tindex,
size_toffset,
size_tsize,
int64_tpresentationTimeUs,
uint32_tflags,
AString*errorDetailMsg=NULL);
status_tqueueSecureInputBuffer(
constCryptoPlugin:
:
SubSample*subSamples,
size_tnumSubSamples,
constuint8_tkey[16],
constuint8_tiv[16],
CryptoPlugin:
Modemode,
status_tdequeueInputBuffer(size_t*index,int64_ttimeoutUs=0ll);
status_tdequeueOutputBuffer(
size_t*index,
size_t*offset,
size_t*size,
int64_t*presentationTimeUs,
uint32_t*flags,
int64_ttimeoutUs=0ll);
status_trenderOutputBufferAndRelease(size_tindex,int64_ttimestampNs);
status_trenderOutputBufferAndRelease(size_tindex);
status_treleaseOutputBuffer(size_tindex);
status_tsignalEndOfInputStream();
status_tgetOutputFormat(sp<
*format)const;
status_tgetInputFormat(sp<
status_tgetWidevineLegacyBuffers(Vector<
sp<
>
*buffers)const;
status_tgetInputBuffers(Vector<
status_tgetOutputBuffers(Vector<
status_tgetOutputBuffer(size_tindex,sp<
*buffer);
status_tgetOutputFormat(size_tindex,sp<
*format);
status_tgetInputBuffer(size_tindex,sp<
status_tsetSurface(constsp<
nativeWindow);
status_trequestIDRFrame();
//Notificationwillbepostedoncethere"
issomethingtodo"
i.e.
//aninput/outputbufferhasbecomeavailable,aformatchangeis
//pending,anerrorispending.
voidrequestActivityNotification(constsp<
status_tgetName(AString*componentName)const;
status_tsetParameters(constsp<
params);
//CreateaMediaCodecnotificationmessagefromalistofrenderedordroppedrenderinfos
//byaddingrenderedframeinformationtoabasenotificationmessage.Returnsthenumber
//offramesthatwererendered.
staticsize_tCreateFramesRenderedMessage(
std:
list<
FrameRenderTracker:
Info>
done,sp<
msg);
protected:
virtual~MediaCodec();
virtualvoidonMessageReceived(constsp<
private:
//usedbyResourceManagerClient
status_treclaim(boolforce=false);
friendstructResourceManagerClient;
enumState{
UNINITIALIZED,
INITIALIZING,
INITIALIZED,
CONFIGURING,
CONFIGURED,
STARTING,
STARTED,
FLUSHING,
FLUSHED,
STOPPING,
RELEASING,
kPortIndexInput=0,
kPortIndexOutput=1,
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='
flus'
kWhatGetOutputFormat='
getO'
kWhatGetInputFormat='
getI'
kWhatDequeueInputTimedOut='
dITO'
kWhatDequeueOutputTimedOut='
dOTO'
kWhatCodecNotify='
codc'
kWhatRequestIDRFrame='
ridr'
kWhatRequestActivityNotification='
racN'
kWhatGetName='
getN'
kWhatSetParameters='
setP'
kWhatSetCallback='
setC'
kWhatSetNotification='
setN'
kFlagUsesSoftwareRenderer=1,
kFlagOutputFormatChanged=2,
kFlagOutputBuffersChanged=4,
kFlagStickyError=8,
kFlagDequeueInputPending=16,
kFlagDequeueOutputPending=32,
kFlagIsSecure=64,
kFlagSawMediaServerDie=128,
kFlagIsEncoder=256,
kFlagGatherCodecSpecificData=512,
kFlagIsAsync=1024,
kFlagIsComponentAllocated=2048,
kFlagPushBlankBuffersOnShutdown=4096,
structBufferInfo{
structResourceManagerServiceProxy:
publicIBinder:
DeathRecipient{
ResourceManagerServiceProxy(pid_tpid);
~ResourceManagerServiceProxy();
voidinit();
//implementsDeathRecipient
virtualvoidbinderDied(constwp<
IBinder>
&
/*who*/);
voidaddResource(
int64_tclientId,
IResourceManagerClient>
client,
constVector<
MediaResource>
resources);
voidremoveResource(int64_tclientId);
boolreclaimResource(constVector<
private:
MutexmLock;
IResourceManagerService>
mService;
pid_tmPid;
StatemState;
boolmReleasedByResourceManager;
mLooper;
mCodecLooper;
CodecBase>
mCodec;
AStringmComponentName;
AReplyToken>
mReplyID;
uint32_tmFlags;
status_tmStickyError;
mSurface;
SoftwareRenderer*mSoftRenderer;
mOutputFormat;
mInputFormat;
mCallback;
mOnFrameRenderedNotification;
MemoryDealer>
mDealer;
mResourceManagerClient;
ResourceManagerServiceProxy>
mResourceManagerService;
boolmBatteryStatNotified;
boolmIsVideo;
int32_tmVideoWidth;
int32_tmVideoHeight;
int32_tmRotationDegrees;
//initialcreateparameters
AStringmInitName;
boolmInitNameIsType;
boolmInitIsEncoder;
//configureparameter
mConfigureMsg;
//UsedonlytosynchronizeasynchronousgetBufferAndFormat
//acrossalltheother(synchronous)bufferstatechange
//operations,suchasde/queueIn/OutputBuffer,startand
//stop/flush/reset/release.
MutexmBufferLock;
List<
size_t>
mAvailPortBuffers[2];
Vector<
BufferInfo>
mPortBuffers[2];
int32_tmDequeueInputTimeoutGeneration;
mDequeueInputReplyID;
int32_tmDequeueOutputTimeoutGeneration;
mDequeueOutputReplyID;
mCrypto;
mCSD;
mActivityNotify;
boolmHaveInputSurface;
boolmHavePendingInputBuffers;
MediaCodec(constsp<
looper,pid_tpid);
staticstatus_tPostAndAwaitResponse(
msg,sp<
*response);
voidPostReplyWithError(constsp<
replyID,int32_terr);
status_tinit(constAString&
name,boolnameIsType,boolencoder);
voidsetState(StatenewState);
voidreturnBuffersToCodec();
voidreturnBuffersToCodecOnPort(int32_tportIndex);
size_tupdateBuffers(int32_tportIndex,constsp<
status_tonQueueInputBuffer(constsp<
status_tonReleaseOutputBuffer(constsp<
ssize_tdequeuePortBuffer(int32_tportIndex);
status_tgetBufferAndFormat(
size_tportIndex,size_tindex,
*buffer,sp<
boolhandleDequeueInputBuffer(constsp<
replyID,boolnewRequest=false);
boolhandleDequeueOutputBuffer(constsp<
voidcancelPendingDequeueOperations();
voidextractCSD(constsp<
format);
status_tqueueCSDInputBuffer(size_tbufferIndex);
status_thandleSetSurface(constsp<
status_tconnectToSurface(constsp<
status_tdisconnectFromSurface();
voidpostActivityNotificationIfPossible();
voidonInputBufferAvailable();
voidonOutputBufferAvailable();
voidonError(status_terr,int32_tac
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Android Multimedia框架总结二十二MediaCodec中C+中创建到start过程及状态变换 Multimedia 框架 总结 十二
![提示](https://static.bdocx.com/images/bang_tan.gif)
链接地址:https://www.bdocx.com/doc/16423824.html