As a sidenote, if you are attempting to access and assess only OpenCORE through a command line console app., maybe you could use the pvplayer_engine test app. [[http://android.git.kernel.org/?p=platform/ external/opencore.git;a=blob_plain;f=quick_start.txt;hb=master]]
-Ravi On Feb 12, 12:52 am, Freepine <[email protected]> wrote: > Yep. I think that explains why sometimes my test app aborted during > exiting... Thanks:)And I guess you were saying > IPCThreadState::Self()->stopProcess(), right? I thought joinThreadPool() > would put the calling thread itself in the thread pool to talk with binder > driver which will keep the calling processes alive? (just like media > server:) > > On Thu, Feb 12, 2009 at 2:22 PM, Dave Sparks <[email protected]>wrote: > > > > > Minor technicality, you should call proc->joinThreadPool() on exit to > > ensure that all the binder worker threads have terminated. > > > On Feb 11, 9:18 pm, Freepine <[email protected]> wrote: > > > Media playback is actually happening in media server process, to enable > > the > > > communication between your client process and media server via binder > > > driver, you should add below code in your main function: > > > sp<ProcessState> proc = ProcessState::self(); > > > proc->startThreadPool(); > > > Otherwise it can't receive prepared message from media server. > > > > Below is a simple implemetation I wrote some time before: > > > ================================================= > > > int main(int argc, char** argv) > > > { > > > sp<ProcessState> proc = ProcessState::self(); > > > proc->startThreadPool(); > > > MediaPlayer mediaplayer; > > > if(argc > 1) > > > { > > > LOGI("set datasource: %s", argv[1]); > > > mediaplayer.setDataSource(argv[1]); > > > } > > > else > > > { > > > LOGI("set default datasource: /data/test.mp4"); > > > mediaplayer.setDataSource("/data/test.mp4"); > > > } > > > sp<SurfaceComposerClient> client = new SurfaceComposerClient; > > > int pid = getpid(); > > > sp<Surface> surface(client->createSurface(pid, 0, 176, 144, > > > PIXEL_FORMAT_OPAQUE, > > > ISurfaceComposer::eFXSurfaceNormal|ISurfaceComposer::ePushBuffers)); > > > mediaplayer.setVideoSurface(surface); > > > mediaplayer.prepare(); > > > mediaplayer.start(); > > > for(int i=0; i<10; i++) > > > { > > > sleep(1); > > > LOGI("playing, %d seconds\n", i); > > > } > > > mediaplayer.stop(); > > > LOGI("quiting..."); > > > > } > > > On Thu, Feb 12, 2009 at 12:56 PM, andy_fw <[email protected]> wrote: > > > > > I wrote a very simple console C++ application that attempts to mimic > > > > part of the functionality of android_media_MediaPlayer JNI layer. I > > > > have added it to the toolbox by modifying the toolbox Android.mk file. > > > > The idea is to have a command line utility which supports a > > > > rudimentary media player. The appl uses PV framework for the playback > > > > engine (just as JNI does). It's based on Android 1.0. > > > > > The following C++ code snippet shows that the MediaPlayer class is > > > > used to create an instance, setDataSource, prepare, and start based on > > > > a URL (i.e. local file). I've trimmed it to what I think is the > > > > minimum to achieve my desired result of playing a media file for a > > > > short period of time. I can run the Android APIDemo appl to playback a > > > > local audio file and the log traces show that these methods are all > > > > that's needed to hear a clip play (ignore cleanup and such for now - > > > > I'm only trying to hear the clip play). In fact, I have compared the > > > > log traces of both the console appl and the java appl (which always > > > > successfully plays the clip), and they are very nearly the same. The > > > > key difference is during the notify callbacks when executing the > > > > console appl. The remote()->transact() method doesn't appear to behave > > > > the same. The onTransact() method is not invoked in the console > > > > environment. Please see the log snippet of the java appl included > > > > below. I indicated the primary differences between the java and > > > > console logs with "<===missing" tokens. > > > > > Do the framework experts have any insight as to what's wrong/missing? > > > > Am I incorrect to think that a console appl can use the PV framework > > > > in such a simple form? > > > > > playmedia.cpp: > > > > #include <media/mediaplayer.h> > > > > > using namespace android; > > > > > static int do_it(const char * url) > > > > { > > > > MediaPlayer * mp = new MediaPlayer(); > > > > > mp->setDataSource(url); > > > > mp->prepare(); > > > > mp->start(); > > > > > sleep(30); > > > > > return 0; > > > > } > > > > > extern "C" int playmedia_main(int argc, char *argv[]) > > > > { > > > > if(argc > 1) return do_it(argv[1]); > > > > > return do_it("/data/test_aud.mp3"); > > > > } > > > > > Logcat from java API Demo.media_Audio (I've added some extra LOGI > > > > entries into the code): > > > > > I/MediaPlayer-JNI( 170): native_setup <===missing from console (not > > > > an issue - included for completeness) > > > > I/MediaPlayer( 170): constructor > > > > I/MediaPlayer( 170): setDataSource(/data/test_aud.mp3) > > > > I/MediaPlayer( 170): creating service w/url=/data/test_aud.mp3 > > > > I/MediaPlayerService( 35): Client(1) constructor pid=170 > > > > I/MediaPlayerService( 35): Create new client(1) from pid 170, url=/ > > > > data/test_aud.mp3, connId=1 > > > > I/MediaPlayerService( 35): Client::setDataSource(/data/test_aud.mp3) > > > > I/MediaPlayerService( 35): create PVPlayer > > > > I/PlayerDriver( 35): constructor > > > > I/PlayerDriver( 35): start player thread > > > > I/MediaPlayerService( 35): Setting Notify callback 0xe200 > > > > I/MediaPlayerService( 35): setDataSource > > > > I/MediaPlayerService( 35): create(url) out > > > > I/MediaPlayer-JNI( 170): Calling mp->prepare > > > > I/MediaPlayer( 170): prepare > > > > I/MediaPlayer( 170): prepareAsync_l > > > > I/MediaPlayerService( 35): prepareAsync(1) > > > > I/MediaPlayerService( 35): prepareAsync out > > > > I/MediaPlayer( 170): prepare wait for done > > > > I/PlayerDriver( 35): handlePrepare > > > > I/PVPlayerEng( 35): PVPlayerEngine::DoPrepare() In > > > > I/PVPlayerEng( 35): PVPlayerEngine::DoPrepare() Out > > > > E/QC_OMX_CORE( 35): Dynamically Loading the library : libmm-adec- > > > > omxmp3.so.1.0.0 > > > > E/QC_OMX_CORE( 35): Dynamically Loading the library : libmm-adec- > > > > omxmp3.so.1.0.0 > > > > I/PlayerDriver( 35): PLAYER_PREPARE complete > > > > mDownloadContextData=0x0, mDataReadyReceived=0 > > > > I/MediaPlayerService( 35): (1) notify (0xe200, 1, 0, 0) > > > > I/IMediaPlayerClient( 35): Client::notify() > > > > I/IPCThreadState( 35): transact start 2 > > > > I/IPCThreadState( 170): >>>> TRANSACT from pid 0 uid 1013 > > > > I/IMediaPlayerClient( 170): onTransact > > > > <==========missing from console appl start > > > > I/MediaPlayer( 170): notify() message received msg=1, ext1=0, ext2=0 > > > > I/MediaPlayer( 170): prepared > > > > I/MediaPlayer( 170): signal application thread > > > > I/MediaPlayer( 170): prepare complete - status=0 > > > > <===========missing end > > > > I/MediaPlayerService( 35): done calling client->notify callback > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "android-framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-framework?hl=en -~----------~----~----~----~------~----~------~--~---
