发布网友 发布时间:2022-04-22 07:20
共1个回答
热心网友 时间:2022-06-17 14:07
使用下面程序 实现: (1)MidiPlayer -- *.mid文件 (2)VobisPlayer -- *.ogg文件 (3)PVPlayer -- 除了以上两类之外的所有文媒体文件(底层实现就在opencore里边) @FROM <android-src>/frameworks/base/media/libmediaplayerservice/MediaPlayerService.cpp C/C++ codestatic sp<MediaPlayerBase> createPlayer(player_type playerType, void* cookie, notify_callback_f notifyFunc) { sp<MediaPlayerBase> p; switch (playerType) { #ifndef NO_OPENCORE case PV_PLAYER: LOGV(" create PVPlayer"); p = new PVPlayer(); break; #endif case SONIVOX_PLAYER: LOGV(" create MidiFile"); p = new MidiFile(); break; case VORBIS_PLAYER: LOGV(" create VorbisPlayer"); p = new VorbisPlayer(); break; #if BUILD_WITH_FULL_STAGEFRIGHT case STAGEFRIGHT_PLAYER: LOGV(" create StagefrightPlayer"); p = new StagefrightPlayer; break; #endif case TEST_PLAYER: LOGV("Create Test Player stub"); p = new TestPlayerStub(); break; } if (p != NULL) { if (p->initCheck() == NO_ERROR) { p->setNotifyCallback(cookie, notifyFunc); // ->setNotifyCallback() } else { p.clear(); } } if (p == NULL) { LOGE("Failed to create player object"); } return p; }