_pop7
unread,Aug 28, 2010, 3:05:15 AM8/28/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-ndk
hi, nobody but you :)
i just wanna build a executable which can play music in a android
emulator of froyo by direct calling the function in libmedia.so, my
code is below:
============================================================
sp<MediaPlayer> mplay = new MediaPlayer();
status_t set_ret = mplay->reset();
LOGE("playing reset return %d", set_ret);
set_ret = mplay->setDataSource("/mnt/sdcard/sky.mp3", NULL);
LOGE("playing set data source return %d", set_ret);
set_ret = mplay->prepare();
LOGE("playing prepare return %d", set_ret);
set_ret = mplay->start();
LOGE("playing start return %d", set_ret);
-------------------------------------------------------------------------------------------------------------------------
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := nativemedia.cpp
LOCAL_C_INCLUDES += \
/cygdrive/d/myandroid/frameworks/base/include \
/cygdrive/d/myandroid/system/core/include \
/cygdrive/d/myandroid/bionic
LOCAL_LDLIBS += -llog -lmedia
LOCAL_MODULE := nativemedia
include $(BUILD_EXECUTABLE)
=============================================================
after successful build the nativemedia, i adb push it to the emulator
and run. checking the logcat, we can see the
the two message printed by nativemedia: playing reset return 0;
playing set data source return 0; which indicated
the nativemedia successful called the method reset and setDataSource
in the libmedia.so. however, then the nativemedia stucked in calling
the method prepare in libmedia.so, which just can't continue and
waiting here do nothing.
thanks