Hi Mathias,
Thank you very much for your response. Actually I am not too concerned
about portability because this is a prototyping project that will have
to be rewritten before an official release. I anticipate that Google
will provide updates to the Java Camera Callback feature in the near
future considering that it is not possible to execute the callback at
15 fps when the callback is nearly empty. If I am incorrect about
this, please let me know, but I can only get 11 fps when the callback
is doing nothing more than incrementing a counter and writing the
count to a TextView. But in the mean time, I would like to get a feel
for the capabilities of the G1 hardware and it would be nice to have
some way to access frames from native code. It doesn't matter whether
I link to the native libraries or not. Perhaps it would be possible to
access a pointer to a memory region inside the surface class. Any help
would be greatly appreciated.

On Feb 5, 10:53 am, Mathias Agopian <pixelflin...@google.com> wrote:
> You CANNOT do that. Please, understand that Native APIS ARE NOT PUBLIC
> (sorry for shouting).
> All these APIS may/will go away or change in ways that will make your
> application *crash* in the near future.
> We are not, and will not, try to maintain binary compatibility on native APIs.
>
> You *can* use native code if you wish, but you ABSOLUTELY CANNOT call
> into Android native APIs. That's a no-no. And you won't find help from
> the Android team here about this subject.
>
> >  android::QualcommCameraHardware *qcam = NULL;
> >  android::sp<android::CameraHardwareInterface> cam(qcam);
> >  //android::sp<android::CameraHardwareInterface> cam;
>
> This is HORRIBLE, basically it show that you have no understanding of
> the native camera framework -- and I don't blame you because we have
> not released any documentation about it, for the very simple reason
> that this framework is NOT public, and should not be used by
> applications.
>
> Using the "QualcommCameraHardware" class directly is a guaranteed way
> to make your application crash the day it runs on a device that is not
> a Dream, or on a new version of the Dream software.
>
> Sorry.
>
> Mathias
>
>
>
> On Thu, Feb 5, 2009 at 10:30 AM, Chris Clark <clark...@gmail.com> wrote:
> > Goal: I am trying to gain access to raw camera data on the G1 from native
> > code (JNI C++) so that I can do real time image processing on camera frames
> > at 15 fps. This will not work in the Java API because it takes too long for
> > the camera preview callback to load the data.
>
> > Setup: I am using the CodeSourcery C++ cross-compilation toolchain for ARM
> > development on Windows. I include the relevant header files from the
> > Android
> > source code and create a shared library object using the following commands
> > (my project name is flow):
>
> > arm-none-linux-gnueabi-g++ -I"C:\Program Files\Java\jdk1.6.0_11\include"
> >  -I"C:\Program Files\Java\jdk1.6.0_11\include\linux"
> >  -I"C:\Program
> > Files\Eclipse\SDK\android-sdk-windows-1.0_r2\source\core\include"
> >  -I"C:\Program
> > Files\Eclipse\SDK\android-sdk-windows-1.0_r2\source\base\include"
> >  -I"C:\Program Files\Eclipse\SDK\android-sdk-windows-1.0_r2\source\msm7k"
> >  -I"C:\Program
> > Files\Eclipse\SDK\android-sdk-windows-1.0_r2\source\base\camera\libcamerase­rvice"
> >  -I"C:\Program
> > Files\Eclipse\SDK\android-sdk-windows-1.0_r2\source\common\include"
> >  -fpic -c flow.c
>
> > arm-none-linux-gnueabi-ld
> >  --dynamic-linker /system/bin/linker -nostdlib -I /system/bin/linker
> >  -rpath-link /system/lib
> >  -L"C:\Program Files\CodeSourcery\Sourcery G++
> > Lite\arm-none-linux-gnueabi\lib\ldscripts" -L.
> >  -shared -o libflow.so flow.o
> >  -z now @minlibs.inc
>
> > where minlibs.inc contains:
> >  -lcameraservice -lcamera -lui -lpixelflinger -lhardware -lgps -lcorecg
> > -lOmxH264Dec -lutils
> >  -lqcamera -lwpa_client -lnetutils -lcutils -lrpc -llog -lz -lstdc++ -lm
> > -lc
> > -ldl
>
> > In order to link, I pulled copies of all the libraries in the /system/lib
> > folder on the device to my computer. Then I take this shared library object
> > and copy it to the resource directory of my Java Android project in
> > Eclipse.
> > This Android activity uses System.load() to load my shared object and then
> > I
> > call the functions in the shared object from Java by standard JNI.
>
> > What works: I am able to run activities on the phone that call JNI
> > functions
> > which contain calls to Android functions. For example, I was able to write
> > a
> > message to the log and call android::CameraService::instantiate() and see
> > the log messages in the ddms debugger.
>
> > Problem: The camera libraries that I would like to interface with are using
> > a template class sp. A function I want to use returns type:
> > android::sp<android::CameraHardwareInterface>. As soon as I declare a
> > variable of this type, the constructor and destructor are required. Despite
> > lengthy efforts, I have not been able to get a program to run that contains
> > this type declaration. The code builds and links fine on my computer,
> > without warnings, but the Activity crashes immediately upon execution and
> > the ddms debugger just says that my shared object is "not found" whenever
> > this type declaration is present. I do not know how to get any more
> > detailed
> > debug messages from the dynamic linker.
>
> > What I've tried: I made a batch file that scans through all the libraries
> > using arm-none-linux-gnueabi-nm -C -D to find the symbols needed to declare
> > this type. I believe that my minlibs.inc file contains all necessary
> > libraries, however I am not sure. The code for the constructor and
> > destructor of sp is directly in the header files that I have included and
> > the only functions they reference are incStrong and decStrong, which are
> > found in libutils.so, which I have linked to. I also sorted the relevant
> > libraries based on dependencies obtained using
> > arm-none-linux-gnueabi-objdump -p as can be seen in the minlibs.inc file
> > above. I also tried using an alternate constructor by passing in a null
> > pointer:
>
> >  android::QualcommCameraHardware *qcam = NULL;
> >  android::sp<android::CameraHardwareInterface> cam(qcam);
> >  //android::sp<android::CameraHardwareInterface> cam;
>
> > My C++ function really only contains these lines, a call to
> > __android_log_write, and return.
>
> > Question: Any ideas on how to get this to run without crashing?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to