Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx

上传人:b****4 文档编号:16423824 上传时间:2022-11-23 格式:DOCX 页数:21 大小:21.31KB
下载 相关 举报
Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx_第1页
第1页 / 共21页
Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx_第2页
第2页 / 共21页
Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx_第3页
第3页 / 共21页
Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx_第4页
第4页 / 共21页
Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx_第5页
第5页 / 共21页
点击查看更多>>
下载资源
资源描述

Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx

《Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx》由会员分享,可在线阅读,更多相关《Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx(21页珍藏版)》请在冰豆网上搜索。

Android Multimedia框架总结二十二MediaCodec中C++中创建到start过程及状态变换Word格式.docx

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

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 表格模板 > 合同协议

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1