Android on Beagle board

下記のページにパッチやら手順が書かれているので有難く拝借。
http://code.google.com/p/android-development-environment/wiki/EclaironBeagleBoard

で、Androidをmakeするとしばらくすると

hardware/ti/omap3/libopencorehw/android_surface_output_omap34xx.cpp: In constructor 'AndroidSurfaceOutputOmap34xx::AndroidSurfaceOutputOmap34xx()':
hardware/ti/omap3/libopencorehw/android_surface_output_omap34xx.cpp:78: error: 'mNumberOfFramesToHold' was not declared in this scope
hardware/ti/omap3/libopencorehw/android_surface_output_omap34xx.cpp: In member function 'virtual void AndroidSurfaceOutputOmap34xx::setParametersSync(void*, PvmiKvp*, int, PvmiKvp*&)':
hardware/ti/omap3/libopencorehw/android_surface_output_omap34xx.cpp:289: error: 'class PVMFYuvFormatSpecificInfo0' has no member named 'width'
hardware/ti/omap3/libopencorehw/android_surface_output_omap34xx.cpp:293: error: 'class PVMFYuvFormatSpecificInfo0' has no member named 'height'
hardware/ti/omap3/libopencorehw/android_surface_output_omap34xx.cpp:297: error: 'class PVMFYuvFormatSpecificInfo0' has no member named 'display_height'
hardware/ti/omap3/libopencorehw/android_surface_output_omap34xx.cpp:302: error: 'class PVMFYuvFormatSpecificInfo0' has no member named 'display_width'
make: *** [out/target/product/beagle/obj/SHARED_LIBRARIES/libopencorehw_intermediates/android_surface_output_omap34xx.o] Error 1
make: *** Waiting for unfinished jobs....

というコンパイルエラーが発生した。。

どうやら、AndroidSurfaceOutputOmap34xxクラスで存在しないmNumberOfFramesToHoldメンバにアクセスしているのとこれまた、PVMFYuvFormatSpecificInfo0クラスの存在していないwidth、height、display_width、display_heightにアクセスしている。

mNumberOfFramesToHoldの方はhttp://github.com/cyanogen/android_external_opencore/commit/0bb93756e59a04933d4ab896ce593f994bf5267dでmNumberOfFramesToHoldをAndroidSurfaceOutputクラスを追加するパッチを見つけ、githubではコンストラクタで2を設定しているがパッチマージ前のAndroidSurfaceOutputクラスは1をセットしていたので1に変更した。

続いてPVMFYuvFormatSpecificInfo0クラスはソースを読むとpvmi_media_io_fileoutput.cppを基にしているよ的なコメントがあるので、チェックすると

iVideoWidthはbuffer_width
iVideoHeightはbuffer_height
iVideoDisplayWidthtはviewable_width
iVideoDisplayHeightはviewable_height

を設定すればいいことがわかった。

以下、修正パッチ

diff --git a/android/android_surface_output.h b/android/android_surface_output.h
index eac0a96..4044c96 100644

@@ -316,6 +316,18 @@ class AndroidSurfaceOutput : public OsclTimerObject
//This bool is set true when all necassary parameters have been received.
bool iIsMIOConfigured;

  1. /*
  2. * The value of mNumberOfFramesToHold is hardware/platform specific.
  3. * 1. On non-overlay based platforms, its value it set to 2
  4. * so as to avoid potential tearings oberved during video playback.
  5. * 2. On overlay-based platforms, its value should be overwritten.
  6. * We have observed video decoder starvation when a value other than 1.
  7. *
  8. * We set the default value to 2 in this class. Please change its value
  9. * accordingly in the derived class.
  10. */
  11. int mNumberOfFramesToHold;

+
#ifdef PERFORMANCE_MEASUREMENTS_ENABLED
PVProfile PVOmapVideoProfile;
#endif
diff --git a/android/android_surface_output.cpp b/android/android_surface_output.cpp
index 9cf9ab2..965bcac 100755

@@ -48,6 +48,7 @@ OSCL_EXPORT_REF AndroidSurfaceOutput::AndroidSurfaceOutput() :
mPvPlayer = NULL;
mEmulation = false;
iEosReceived = false;

  1. mNumberOfFramesToHold = 1;

}

status_t AndroidSurfaceOutput::set(PVPlayer* pvPlayer, const sp& surface, bool emulation)
@@ -950,7 +951,7 @@ void AndroidSurfaceOutput::Run()
}
else
{

  • processWriteResponseQueue(1);
  1. processWriteResponseQueue(mNumberOfFramesToHold);

}
}

hardware/ti/omap3/libopencorehw/android_surface_output_omap34xx.cpp
289 iVideoWidth = (int32)yuvInfo->buffer_width;
290 iVideoParameterFlags |= VIDEO_WIDTH_VALID;
291 LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Video Width, Value %d", iVideoWidth);
292
293 iVideoHeight = (int32)yuvInfo->buffer_height;
294 iVideoParameterFlags |= VIDEO_HEIGHT_VALID;
295 LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Video Height, Value %d", iVideoHeight);
296
297 iVideoDisplayHeight = (int32)yuvInfo->viewable_height;
298 iVideoParameterFlags |= DISPLAY_HEIGHT_VALID;
299 LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Video Display Height, Value %d", iVideoDisplayHeight);
300
301
302 iVideoDisplayWidth = (int32)yuvInfo->viewable_width;

また、エラーがでた。

java.util.zip.ZipException: duplicate entry: hyts_Foo.c
at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:175)
at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:92)
at sun.tools.jar.Main.addFile(Main.java:713)
at sun.tools.jar.Main.update(Main.java:567)
at sun.tools.jar.Main.run(Main.java:202)
at sun.tools.jar.Main.main(Main.java:1149)
make: *** [out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar] Error 1
make: *** Deleting file `out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar'
make: *** Waiting for unfinished jobs....

これは既にGoogle Code Archive - Long-term storage for Google Code Project Hosting.にバグ登録されていて重複したファイルがあるのがダメみたい。対処方法はhttp://gitorious.org/0xdroid/dalvik/commit/bf0e336a6eb9be3698a15ab93e8e3cb90e616590?diffmode=sidebysideにあって以下のファイルを消せばよい。

libcore/support/src/test/resources/hyts_Foo.c
libcore/xml/src/test/resources/hc_staff.xml
libcore/xml/src/test/resources/staff.dtd
libcore/xml/src/test/resources/staff.xml
libcore/xml/src/test/resources/staff2.dtd
libcore/xml/src/test/resources/staff2.xml
libcore/xml/src/test/resources/staffNS.dtd
libcore/xml/src/test/resources/staffNS.xml
libcore/xml/src/test/resources/xhtml1-strict.dtd