“Android MediaCodec trace”的版本间的差异
来自个人维基
free6d1823(讨论 | 贡献) (以“* MediaPlayer calling flow MediaPlayer mp = new MediaPlayer(); 1. mp.setDataSource(filePath); 2. mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHo...”为内容创建页面) |
free6d1823(讨论 | 贡献) |
||
第8行: | 第8行: | ||
6. EmptyBuffer | 6. EmptyBuffer | ||
− | 1. setDataSource(filePath) | + | 1. setDataSource(filePath) |
− | <MediaPlayerBase> mPlayer = Create form (playerType of source); | + | |
+ | <source lang="c"> | ||
+ | <MediaPlayerBase> mPlayer = Create form (playerType of source); | ||
// => new NuPlayerDriver(pid) { | // => new NuPlayerDriver(pid) { | ||
mLooper->setName("NuPlayerDriver Looper")->start(PRIORITY_AUDIO); | mLooper->setName("NuPlayerDriver Looper")->start(PRIORITY_AUDIO); | ||
第16行: | 第18行: | ||
//绑定Extractor、omx、codec2服务的death监听, | //绑定Extractor、omx、codec2服务的death监听, | ||
//mPlayer->setDataSource(dataSource) | //mPlayer->setDataSource(dataSource) | ||
+ | </source> | ||
− | 2. setDisplay(SurfaceHolder sh){ | + | 2. setDisplay(SurfaceHolder sh) |
− | + | <source lang="c"> | |
− | + | { | |
− | + | mSurfaceHolder = sh; | |
− | + | _setVideoSurface(sh.getSurface());--> | |
− | + | { | |
− | + | MediaPlayer.cpp { | |
− | + | sp<IGraphicBufferProducer> new_st = surface->getIGraphicBufferProducer(); | |
− | + | MediaPlayerService mp->setVideoSurfaceTexture(new_st); | |
− | + | } | |
− | MediaPlayerService::Client::setVideoSurfaceTexture( | + | MediaPlayerService::Client::setVideoSurfaceTexture(<IGraphicBufferProducer>& bufferProducer) |
− | + | sp<ANativeWindow> anw; | |
− | + | if (bufferProducer != NULL) { | |
− | + | ||
− | + | ||
anw = new Surface(bufferProducer, true /* controlledByApp */); | anw = new Surface(bufferProducer, true /* controlledByApp */); | ||
status_t err = native_window_api_connect(anw.get(), | status_t err = native_window_api_connect(anw.get(), | ||
NATIVE_WINDOW_API_MEDIA); | NATIVE_WINDOW_API_MEDIA); | ||
− | p->setVideoSurfaceTexture(bufferProducer); | + | p->setVideoSurfaceTexture(bufferProducer); |
− | mConnectedWindow = anw; //decoder | + | mConnectedWindow = anw; //decoder |
+ | } | ||
+ | } | ||
+ | |||
+ | </source> |
2020年6月9日 (二) 21:43的版本
- MediaPlayer calling flow
MediaPlayer mp = new MediaPlayer(); 1. mp.setDataSource(filePath); 2. mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHolder()); 3. mp.prepare(); //获取和解码媒体数据 4. mp.start(); 5. FillBuffer 6. EmptyBuffer
1. setDataSource(filePath)
<MediaPlayerBase> mPlayer = Create form (playerType of source); // => new NuPlayerDriver(pid) { mLooper->setName("NuPlayerDriver Looper")->start(PRIORITY_AUDIO); mPlayer = new NuPlayer(pid); } //绑定Extractor、omx、codec2服务的death监听, //mPlayer->setDataSource(dataSource)
2. setDisplay(SurfaceHolder sh)
{ mSurfaceHolder = sh; _setVideoSurface(sh.getSurface());--> { MediaPlayer.cpp { sp<IGraphicBufferProducer> new_st = surface->getIGraphicBufferProducer(); MediaPlayerService mp->setVideoSurfaceTexture(new_st); } MediaPlayerService::Client::setVideoSurfaceTexture(<IGraphicBufferProducer>& bufferProducer) sp<ANativeWindow> anw; if (bufferProducer != NULL) { anw = new Surface(bufferProducer, true /* controlledByApp */); status_t err = native_window_api_connect(anw.get(), NATIVE_WINDOW_API_MEDIA); p->setVideoSurfaceTexture(bufferProducer); mConnectedWindow = anw; //decoder } }