I'm want to use the library in the Android Emulator and since it
doesn't have webcam support I wan't to stream the pictures from a TCP
source ( http://www.tomgibara.com/android/camera-source ). I've
imported the source files into an Eclipse Project with the core.jar
compiled and I've noticed that CameraManager class does all the Camera
communication stuff.
Anybody knows how to make it happen ?
Me again ... I've managed to capture the bitmap from the TCP source
and I've found out that the "requestPreviewFrame" method from the
"CameraManager" class ( called by the decode thread ) is responsible
for sending back a message with the bitmap attached ( please correct
me if I'm wrong ). The problem is that the handler received in the
"requestPreviewFrame" is null. Does anybody know why ?
final class CameraManager {
public static void init(Context context) {
if (cameraManager == null) {
cameraManager = new CameraManager(context);
}
}
public static CameraManager get() {
return cameraManager;
}
private CameraManager(Context context) {
this.context = context;
}
public void openDriver(SurfaceHolder holder) {
if (!initialized) {
initialized = true;
getScreenResolution();
if ( camera == null ) {
camera = new SocketCamera("192.168.0.10", 9889, 320, 240);
}
}
}
public void closeDriver() { }
public void startPreview() { previewing = true; }
public void stopPreview() { previewing = false; }
public void requestPreviewFrame(Handler handler, int message) {
if (camera == null) {
camera = new SocketCamera("192.168.0.10", 9889, 320, 240);
}
Bitmap b = camera.capture();
if ( handler == null ) Log.d("cameraManager", "handler is null");
Message msg = handler.obtainMessage(message, camera.getWidth(),
camera.getHeight(), b);
msg.sendToTarget();
}
public void requestAutoFocus(Handler handler, int message) {
Message msg = handler.obtainMessage(message);
handler.sendMessageDelayed(msg, 1500L);
}
public Rect getFramingRect() {
return new Rect(0, 0, 320, 240);
}
public Point[] convertResultPoints(ResultPoint[] points) { ....
not modified .... }
public BaseLuminanceSource buildLuminanceSource(byte[] data, int
width, int height) { .... not modified .... }
private Point getScreenResolution() { .... not modified .... }
}
I'll write an article in a couple of days : http://www.scs.ubbcluj.ro/~masd0215/android/
Tnx for this great library ! You rock !
Daniel