Aller au contenu

Problème camera avec les HTC


XiTo

Recommended Posts

Bonjour à tous!

Voilà je créé une application android (ludique) qui est le Taquin. Et nous faisons une option permettant de prendre une photo afin de jouer avec, cependant l'appareil photo marche sur un Galaxy spica (3.2 mega pixel) mais pas sur mon HTC Desire (5 mega pixel). J'ai essayé également sur un Wildfire (5MP) ou un HTC Desire HD (8MP) mais ce dernier ne marche pas non plus :( . Allez savoir pourquoi...

Voici le main.java :

package src.src;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;

import android.app.Activity;
import android.content.ContentValues;
import android.hardware.Camera;
import android.hardware.Camera.PictureCallback;
import android.hardware.Camera.ShutterCallback;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore.Images;
import android.provider.MediaStore.Images.Media;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;

public class Main extends Activity implements SurfaceHolder.Callback,PictureCallback,ShutterCallback {
   /** Called when the activity is first created. */

private static final String LOG_TAG_VIDEO_PREVIEW ="videoPreview";
private  SurfaceView surfaceView;
private SurfaceHolder surfaceHolder;
private Camera camera;

   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
       setContentView(R.layout.main);
       surfaceView=(SurfaceView)findViewById(R.id.SurfaceView01);
       surfaceHolder=surfaceView.getHolder();
       surfaceHolder.addCallback(this);
       surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

       Button prendrePhoto=(Button)findViewById(R.id.take);
       prendrePhoto.setOnClickListener(new View.OnClickListener() {

		@Override
		public void onClick(View v) {
			camera.takePicture(Main.this,null,Main.this);	
		}
	});
   }

@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
		int height) {
	if(camera != null){
		camera.stopPreview();
		Camera.Parameters p = this.camera.getParameters();
		p.setPreviewSize(width, height);
		this.camera.setParameters(p);

		try {
			this.camera.setPreviewDisplay(holder);
			this.camera.startPreview();
		} catch (IOException e) {
			Log.e(LOG_TAG_VIDEO_PREVIEW, "erreur lors du set PreviewDisplay... voir livre page 254",e);
		}	
	}
}

@Override
public void surfaceCreated(SurfaceHolder holder) {
	camera=Camera.open();		
}

@Override
public void surfaceDestroyed(SurfaceHolder holder) {
	if(camera != null){
		camera.startPreview();
		camera.release();
	}

}
@Override
public void onPictureTaken(byte[] data, Camera camera) {
	ContentValues values =new ContentValues();
	values.put(Media.TITLE,"Mon Image");
	values.put(Media.DESCRIPTION, "images Prise par le téléphone");
	Uri uri=getContentResolver().insert(Images.Media.EXTERNAL_CONTENT_URI, values);

	OutputStream os;
	try{
		os=getContentResolver().openOutputStream(uri);
		os.write(data);
		os.flush();
		os.close();			
	}catch (FileNotFoundException e){
		Log.e(getClass().getSimpleName(), "Fichier nom Trouvé a l'écriture de L'image",e);
	}catch (IOException e){
		Log.e(getClass().getSimpleName(), "Erruer à L'enregistrement de l'image",e);
	}
	camera.startPreview();
}

@Override
public void onShutter() {
	Log.d(getClass().getSimpleName(), "Clic clac !");		
}
}

Voici le main.xml :

<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   >
<SurfaceView android:id="@+id/SurfaceView01" android:layout_height="fill_parent" android:layout_width="380px"></SurfaceView>
<Button android:text="Clap Clap" android:id="@+id/take" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</TableRow>

Et enfin voici le camera.xml :


<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   >
<SurfaceView android:id="@+id/SurfaceView01" android:layout_height="fill_parent" android:layout_width="380px"></SurfaceView>
<Button android:text="Clap Clap" android:id="@+id/take" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</TableRow>

Si vous avez une idée sur le problème, n'hésitez pas!!! Personnellement je ne vois pas du tout.

Je vous remercie d'avance.

Lien vers le commentaire
Partager sur d’autres sites

Oh, excuses moi...

Le message d'erreur est le suivant :

"Désolé

Fermeture soudaine de l'application..."

Le message d'erreur que l'on peut voir un peu partout. Mais ce message d'erreur se fait seulement sur les HTC dans ce que j'ai testé ou le Galaxy S aussi, mais sur un Spica ca marche très bien.

Du coup je n'arrive pas à avoir l'écran de l'appareil photo.

Voila pour les logs (Si c'est bien ça) :

01-18 09:38:00.048: ERROR/ClockWidget(208): weatherClock onReceive~ mUseAnimation:false
01-18 09:38:00.048: ERROR/ClockWidget(208): weatherClock onReceive~ mUseAnimation:false
01-18 09:38:00.898: DEBUG/AndroidRuntime(7136): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
01-18 09:38:00.898: DEBUG/AndroidRuntime(7136): CheckJNI is OFF
01-18 09:38:00.898: DEBUG/dalvikvm(7136): creating instr width table
01-18 09:38:00.928: DEBUG/AndroidRuntime(7136): --- registering native functions ---
01-18 09:38:01.128: DEBUG/AndroidRuntime(7136): Shutting down VM
01-18 09:38:01.138: DEBUG/dalvikvm(7136): Debugger has detached; object registry had 1 entries
01-18 09:38:01.138: INFO/AndroidRuntime(7136): NOTE: attach of thread 'Binder Thread #3' failed
01-18 09:38:01.258: DEBUG/AndroidRuntime(7145): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
01-18 09:38:01.258: DEBUG/AndroidRuntime(7145): CheckJNI is OFF
01-18 09:38:01.258: DEBUG/dalvikvm(7145): creating instr width table
01-18 09:38:01.298: DEBUG/AndroidRuntime(7145): --- registering native functions ---
01-18 09:38:01.498: INFO/ActivityManager(99): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=src.src/.Main }
01-18 09:38:01.508: DEBUG/SurfaceFlinger(99): Layer::setBuffers(this=0x80d560), pid=99, w=1, h=1
01-18 09:38:01.508: DEBUG/SurfaceFlinger(99): Layer::setBuffers(this=0x80d560), pid=99, w=1, h=1
01-18 09:38:01.528: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x80d560), index=0, pid=99, w=480, h=800 success
01-18 09:38:01.538: DEBUG/AndroidRuntime(7145): Shutting down VM
01-18 09:38:01.538: DEBUG/dalvikvm(7145): Debugger has detached; object registry had 1 entries
01-18 09:38:01.538: DEBUG/dalvikvm(7145): Compiler shutdown in progress - discarding request
01-18 09:38:01.538: DEBUG/dalvikvm(7145): Compiler shutdown in progress - discarding request
01-18 09:38:01.548: INFO/ActivityManager(99): Start proc src.src for activity src.src/.Main: pid=7153 uid=10059 gids={1006, 1015}
01-18 09:38:01.548: INFO/AndroidRuntime(7145): NOTE: attach of thread 'Binder Thread #3' failed
01-18 09:38:01.598: DEBUG/AK8973(72): Compass Start
01-18 09:38:01.598: DEBUG/Sensors(99): open_akm, fd=161
01-18 09:38:01.598: INFO/WindowManager(99): Setting rotation to 1, animFlags=1
01-18 09:38:01.618: INFO/ActivityManager(99): Config changed: { scale=1.0 imsi=208/1 loc=fr_FR touch=3 keys=1/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=210}
01-18 09:38:01.688: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5274e8), index=1, pid=99, w=800, h=714 success
01-18 09:38:01.818: DEBUG/dalvikvm(99): GC_EXTERNAL_ALLOC freed 2433 objects / 105456 bytes in 98ms
01-18 09:38:01.858: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x53c478), index=1, pid=99, w=800, h=38 success
01-18 09:38:01.869: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5274e8), index=0, pid=99, w=800, h=714 success
01-18 09:38:01.908: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5274e8), index=1, pid=99, w=800, h=394 success
01-18 09:38:01.948: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5274e8), index=0, pid=99, w=800, h=394 success
01-18 09:38:01.998: DEBUG/SurfaceFlinger(99): Layer::setBuffers(this=0x906dd0), pid=7153, w=1, h=1
01-18 09:38:01.998: DEBUG/SurfaceFlinger(99): Layer::setBuffers(this=0x906dd0), pid=7153, w=1, h=1
01-18 09:38:01.998: INFO/ActivityManager(99): Displayed activity src.src/.Main: 472 ms (total 19492 ms)
01-18 09:38:02.018: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x80d560), index=1, pid=99, w=800, h=480 success
01-18 09:38:02.028: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x906dd0), index=0, pid=7153, w=800, h=480 success
01-18 09:38:02.048: WARN/CameraSwitch(7153): open main camera
01-18 09:38:02.048: WARN/CameraSwitch(7153): no file - can't switch camera
01-18 09:38:02.048: DEBUG/CameraService(67): CameraService::connect E (pid 7153, client 0x1f478)
01-18 09:38:02.048: DEBUG/CameraService(67): Client::Client E (pid 7153)
01-18 09:38:02.048: DEBUG/QualcommCameraHardware(67): createInstance: E
01-18 09:38:02.048: DEBUG/QualcommCameraHardware(67):  Storing the current target type as 1 
01-18 09:38:02.048: DEBUG/QualcommCameraHardware(67): constructor EX
01-18 09:38:02.048: DEBUG/QualcommCameraHardware(67): startCamera E
01-18 09:38:02.059: DEBUG/QualcommCameraHardware(67): loading liboemcamera at 0xb001140c
01-18 09:38:02.059: INFO/QualcommCameraHardware(67): Set main cam and main cam only
01-18 09:38:02.059: INFO/mm-camera-mmap(67): set sensor selection :0
01-18 09:38:02.238: INFO/QualcommCameraHardware(67): Open Device node : /dev/msm_camera/control0
01-18 09:38:02.238: INFO/mm-camera-config(67): cam_conf fd cfgctrl.camfd:0
01-18 09:38:02.238: INFO/mm-camera-config(67): Open config device node : /dev/msm_camera/config0
01-18 09:38:02.238: INFO/(67): [AWB Calibration]:ctrlfd:24
01-18 09:38:02.298: INFO/(67): [AWB Calibration] cfg.fuse_id_word1:0x0
01-18 09:38:02.298: INFO/(67): [AWB Calibration] cfg.fuse_id_word2:0x1
01-18 09:38:02.298: INFO/(67): [AWB Calibration] cfg.fuse_id_word3:0x45002
01-18 09:38:02.298: INFO/(67): [AWB Calibration] cfg.fuse_id_word4:0x3e5137
01-18 09:38:02.298: DEBUG/mm-camera-s5k3e2fx_u(67): lcd type = 0
01-18 09:38:02.298: INFO/(67): [AWB Calibration] rg_ratio_GS_table[0]:0.733340
01-18 09:38:02.298: INFO/(67): [AWB Calibration] rg_ratio_GS_table[1]:0.733340
01-18 09:38:02.298: INFO/(67): [AWB Calibration] rg_ratio_GS_table[2]:0.754883
01-18 09:38:02.298: INFO/(67): [AWB Calibration] bg_ratio_GS_table[0]:0.601600
01-18 09:38:02.298: INFO/(67): [AWB Calibration] bg_ratio_GS_table[1]:0.601600
01-18 09:38:02.298: INFO/(67): [AWB Calibration] bg_ratio_GS_table[2]:0.598633
01-18 09:38:02.298: INFO/(67): [AWB Calibration] sfuse.fuse_id_word1:0x0
01-18 09:38:02.298: INFO/(67): [AWB Calibration] sfuse.fuse_id_word2:0x1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] sfuse.fuse_id_word3:0x45002
01-18 09:38:02.308: INFO/(67): [AWB Calibration] sfuse.fuse_id_word4:0x3e5137
01-18 09:38:02.308: INFO/(67): [AWB Calibration] fuse_id : 0x0, 0x1, 0x45002, 0x3e5137
01-18 09:38:02.308: INFO/(67): [AWB Calibration] fail to read /data/awb_cal 
01-18 09:38:02.308: INFO/(67): [AWB Calibration] read from file OK: /sys/android_camera_awb_cal/awb_ca
01-18 09:38:02.308: INFO/(67): [AWB Calibration] read all c1b ,ok=1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] read all 2f1 ,ok=1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] read all 218 ,ok=1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] read all 0 ,ok=1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] read all 1 ,ok=1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] read all 45002 ,ok=1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] read all 3e5137 ,ok=1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] read all 18acbfb1 ,ok=1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] check sum=18acbfb1, OK
01-18 09:38:02.308: INFO/(67): [AWB Calibration] caBuff[0]:0x00000c1b
01-18 09:38:02.308: INFO/(67): [AWB Calibration] caBuff[1]:0x000002f1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] caBuff[2]:0x00000218
01-18 09:38:02.308: INFO/(67): [AWB Calibration] caBuff[3]:0x00000000
01-18 09:38:02.308: INFO/(67): [AWB Calibration] caBuff[4]:0x00000001
01-18 09:38:02.308: INFO/(67): [AWB Calibration] caBuff[5]:0x00045002
01-18 09:38:02.308: INFO/(67): [AWB Calibration] caBuff[6]:0x003e5137
01-18 09:38:02.308: INFO/(67): [AWB Calibration] caBuff[7]:0x18acbfb1
01-18 09:38:02.308: INFO/(67): [AWB Calibration] fuse_id_word1:0x00000000
01-18 09:38:02.308: INFO/(67): [AWB Calibration] fuse_id_word2:0x00000001
01-18 09:38:02.308: INFO/(67): [AWB Calibration] fuse_id_word3:0x00045002
01-18 09:38:02.308: INFO/(67): [AWB Calibration] fuse_id_word4:0x003e5137
01-18 09:38:02.308: INFO/(67): [AWB Calibration] caBuff[0]:3099
01-18 09:38:02.308: INFO/(67): [AWB Calibration] valid bit and fuseID pass, use new white points
01-18 09:38:02.308: INFO/(67): [AWB Calibration] use light version: v3
01-18 09:38:02.308: INFO/mm-camera-aec(67): Touch AEC  == numRegions:256
01-18 09:38:02.308: INFO/mm-camera-aec(67): Touch AEC aecCtrl->aec_state.aec_algo:1
01-18 09:38:02.308: INFO/QualcommCameraHardware(67): startCamera: camsensor name s5k3e2fx, flash 1
01-18 09:38:02.308: DEBUG/QualcommCameraHardware(67): startCamera X
01-18 09:38:02.308: DEBUG/QualcommCameraHardware(67): initDefaultParameters E
01-18 09:38:02.308: DEBUG/QualcommCameraHardware(67): product 4
01-18 09:38:02.308: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 1, length 32
01-18 09:38:02.318: ERROR/QualcommCameraHardware(67): native_access_parm: error (No such file or directory): fd 23, type 1, length 32, status 0
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 64, length 4
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 65, length 4
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 66, length 4
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): requested preview size 768 x 432
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): requested picture size 1024 x 768
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): value:20801, country value:208, country code:208
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 21, length 4
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 14, length 4
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): setFlash 0
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 49, length 4
01-18 09:38:02.318: DEBUG/mm-camera-ctrlcmd(67): In config_proc_CAMERA_SET_PARM_LED_MODE: 0
01-18 09:38:02.318: INFO/QualcommCameraHardware(67): Set zoom=0 20
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 2, length 4
01-18 09:38:02.318: INFO/QualcommCameraHardware(67): Setting Contrast is 5
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 6, length 4
01-18 09:38:02.318: INFO/QualcommCameraHardware(67): Setting Brightness is 3
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 7, length 4
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 12, length 4
01-18 09:38:02.318: INFO/mm-camera-ctrlcmd(67): md.d.aec_mode.aec_mode:1
01-18 09:38:02.318: INFO/mm-camera-aec(67): Touch AEC  == numRegions:256
01-18 09:38:02.318: INFO/mm-camera-aec(67): Touch AEC aecCtrl->aec_state.aec_algo:1
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): not defined touch-focus yet, or AP without touch-focus function
01-18 09:38:02.318: INFO/QualcommCameraHardware(67): Before Setting coordinate x:384 y:216
01-18 09:38:02.318: INFO/QualcommCameraHardware(67): Setting coordinate x:2 y:2
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 60, length 28
01-18 09:38:02.318: INFO/mm-camera 8x vfe(67): vfe_set_coordinate x:2 y:2
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 26, length 4
01-18 09:38:02.318: DEBUG/mm-camera-ctrlcmd(67): md.d.aec_iso_mode = 0
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 62, length 4
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 8, length 4
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): virtual android::status_t android::QualcommCameraHardware::setParameters(const android::CameraParameters&), final_rc=0
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): initDefaultParameters X
01-18 09:38:02.318: DEBUG/QualcommCameraHardware(67): createInstance: X created hardware=0x4ae08
01-18 09:38:02.318: VERBOSE/MediaPlayerService(67): Client(99) constructor
01-18 09:38:02.318: VERBOSE/MediaPlayerService(67): Create new client(99) from pid 67, url=/system/media/audio/ui/camera_click.ogg, connId=99
01-18 09:38:02.318: VERBOSE/MediaPlayerService(67): setDataSource(/system/media/audio/ui/camera_click.ogg)
01-18 09:38:02.318: VERBOSE/MediaPlayerService(67): player type = 3
01-18 09:38:02.318: DEBUG/MediaPlayerService(67): player type = VORBIS_PLAYER
01-18 09:38:02.318: VERBOSE/MediaPlayerService(67):  create VorbisPlayer
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67):  setDataSource
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67): [99] setAudioStreamType(7)
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67): [99] prepareAsync
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67): [99] notify (0x1ac40, 1, 0, 0)
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67): Client(100) constructor
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67): Create new client(100) from pid 67, url=/system/media/audio/ui/VideoRecord.ogg, connId=100
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67): setDataSource(/system/media/audio/ui/VideoRecord.ogg)
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67): player type = 3
01-18 09:38:02.328: DEBUG/MediaPlayerService(67): player type = VORBIS_PLAYER
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67):  create VorbisPlayer
01-18 09:38:02.328: VERBOSE/MediaPlayerService(67):  setDataSource
01-18 09:38:02.338: VERBOSE/MediaPlayerService(67): [100] setAudioStreamType(7)
01-18 09:38:02.338: VERBOSE/MediaPlayerService(67): [100] prepareAsync
01-18 09:38:02.338: VERBOSE/MediaPlayerService(67): [100] notify (0x45b68, 1, 0, 0)
01-18 09:38:02.338: DEBUG/CameraService(67): Client::Client X (pid 7153)
01-18 09:38:02.338: DEBUG/CameraService(67): CameraService::connect X
01-18 09:38:02.338: DEBUG/QualcommCameraHardware(67): stopPreview: E
01-18 09:38:02.338: DEBUG/QualcommCameraHardware(67): stopPreviewInternal E: 0
01-18 09:38:02.338: DEBUG/QualcommCameraHardware(67): stopPreviewInternal X: 0
01-18 09:38:02.338: DEBUG/QualcommCameraHardware(67): stopPreview: X
01-18 09:38:02.348: INFO/CameraService(67): setParameters(sharpness-max=30;zoom=0;taking-picture-zoom=0;zoom-supported=true;sharpness-min=0;sharpness=10;contrast=5;whitebalance=auto;jpeg-quality=100;preview-format-values=yuv420sp;jpeg-thumbnail-quality=75;preview-format=yuv420sp;preview-size=380x295;focal-length=4.31;iso=auto;meter-mode=meter-center;front-camera-mode=mirror;flash-mode-values=off,auto,on,torch;preview-frame-rate-values=15;preview-frame-rate=15;focus-mode-values=auto,infinity;jpeg-thumbnail-width=768;jpeg-thumbnail-size-values=768x576,640x480,512x384,0x0;zoom-ratios=100,114,131,151,174,200;saturation-def=5;preview-size-values=1280x720,800x480,768x432,720x480,640x480,576x432,480x320,400x240,384x288,352x288,320x240,272x272,240x240,240x160,176x144;smart-contrast=off;picture-size-values=2592x1952,2592x1728,2592x1552,2560x1920,2560x1712,2048x1536,2048x1360,2048x1216,2016x1344,1600x1200,1584x1056,1280x960,1280x848,1280x768,1248x832,1024x768,640x480,640x416,640x384,624x416,512x384,400x400,272x272;contrast-min=0;min-exposure-compensation=-4;bri
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): requested preview size 380 x 295
01-18 09:38:02.348: ERROR/QualcommCameraHardware(67): Invalid preview size requested: 380x295
01-18 09:38:02.348: ERROR/QualcommCameraHardware(67): virtual android::status_t android::QualcommCameraHardware::setParameters(const android::CameraParameters&): 2944, rc = -22
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): requested picture size 1024 x 768
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): value:20801, country value:208, country code:208
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 21, length 4
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 14, length 4
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): setFlash 0
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 49, length 4
01-18 09:38:02.348: DEBUG/mm-camera-ctrlcmd(67): In config_proc_CAMERA_SET_PARM_LED_MODE: 0
01-18 09:38:02.348: INFO/QualcommCameraHardware(67): Set zoom=0 20
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 2, length 4
01-18 09:38:02.348: INFO/QualcommCameraHardware(67): Setting Contrast is 5
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 6, length 4
01-18 09:38:02.348: INFO/QualcommCameraHardware(67): Setting Brightness is 3
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 7, length 4
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 12, length 4
01-18 09:38:02.348: INFO/mm-camera-ctrlcmd(67): md.d.aec_mode.aec_mode:1
01-18 09:38:02.348: INFO/mm-camera-aec(67): Touch AEC  == numRegions:256
01-18 09:38:02.348: INFO/mm-camera-aec(67): Touch AEC aecCtrl->aec_state.aec_algo:1
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): not defined touch-focus yet, or AP without touch-focus function
01-18 09:38:02.348: INFO/QualcommCameraHardware(67): Before Setting coordinate x:384 y:216
01-18 09:38:02.348: INFO/QualcommCameraHardware(67): Setting coordinate x:2 y:2
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 60, length 28
01-18 09:38:02.348: INFO/mm-camera 8x vfe(67): vfe_set_coordinate x:2 y:2
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 26, length 4
01-18 09:38:02.348: DEBUG/mm-camera-ctrlcmd(67): md.d.aec_iso_mode = 0
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 62, length 4
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): native_access_parm: fd 23, type 8, length 4
01-18 09:38:02.348: DEBUG/QualcommCameraHardware(67): virtual android::status_t android::QualcommCameraHardware::setParameters(const android::CameraParameters&), final_rc=-22
01-18 09:38:02.358: DEBUG/AndroidRuntime(7153): Shutting down VM
01-18 09:38:02.358: WARN/dalvikvm(7153): threadid=1: thread exiting with uncaught exception (group=0x400259f8)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153): FATAL EXCEPTION: main
01-18 09:38:02.368: ERROR/AndroidRuntime(7153): java.lang.RuntimeException: setParameters failed
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.hardware.Camera.native_setParameters(Native Method)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.hardware.Camera.setParameters(Camera.java:655)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at src.src.Main.surfaceChanged(Main.java:58)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.SurfaceView.updateWindow(SurfaceView.java:546)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.SurfaceView.dispatchDraw(SurfaceView.java:339)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.View.draw(View.java:6742)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.View.draw(View.java:6742)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1872)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewRoot.draw(ViewRoot.java:1422)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1167)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.os.Looper.loop(Looper.java:144)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at android.app.ActivityThread.main(ActivityThread.java:4937)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at java.lang.reflect.Method.invokeNative(Native Method)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at java.lang.reflect.Method.invoke(Method.java:521)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-18 09:38:02.368: ERROR/AndroidRuntime(7153):     at dalvik.system.NativeStart.main(Native Method)
01-18 09:38:02.368: WARN/ActivityManager(99):   Force finishing activity src.src/.Main
01-18 09:38:02.398: DEBUG/SurfaceFlinger(99): Layer::setBuffers(this=0x5bc0a8), pid=99, w=1, h=1
01-18 09:38:02.398: DEBUG/SurfaceFlinger(99): Layer::setBuffers(this=0x5bc0a8), pid=99, w=1, h=1
01-18 09:38:02.418: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5bc0a8), index=0, pid=99, w=800, h=324 success
01-18 09:38:02.638: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x53c478), index=0, pid=99, w=800, h=38 success
01-18 09:38:02.868: WARN/ActivityManager(99): Activity pause timeout for HistoryRecord{460180c8 src.src/.Main}
01-18 09:38:02.918: DEBUG/Sensors(99): close_akm, fd=161
01-18 09:38:03.008: DEBUG/dalvikvm(99): GC_EXPLICIT freed 806 objects / 42624 bytes in 92ms
01-18 09:38:03.008: INFO/WindowManager(99): Setting rotation to 0, animFlags=1
01-18 09:38:03.028: DEBUG/SurfaceFlinger(99): Layer::setBuffers(this=0x5c5ef8), pid=208, w=480, h=800
01-18 09:38:03.028: DEBUG/SurfaceFlinger(99): Layer::setBuffers(this=0x5c5ef8), pid=208, w=480, h=800
01-18 09:38:03.038: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5c5ef8), index=0, pid=208, w=480, h=800 success
01-18 09:38:03.038: INFO/ActivityManager(99): Config changed: { scale=1.0 imsi=208/1 loc=fr_FR touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=211}
01-18 09:38:03.098: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x4eb3c8), index=0, pid=99, w=800, h=480 success
01-18 09:38:03.128: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x4eb3c8), index=1, pid=99, w=480, h=800 success
01-18 09:38:03.138: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5274e8), index=1, pid=99, w=480, h=394 success
01-18 09:38:03.168: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5bc0a8), index=1, pid=99, w=480, h=387 success
01-18 09:38:03.249: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5bc0a8), index=0, pid=99, w=480, h=387 success
01-18 09:38:03.268: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x53c478), index=1, pid=99, w=480, h=38 success
01-18 09:38:03.308: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5274e8), index=0, pid=99, w=480, h=394 success
01-18 09:38:03.379: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5274e8), index=1, pid=99, w=480, h=714 success
01-18 09:38:03.398: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5bc0a8), index=1, pid=99, w=480, h=387 success
01-18 09:38:03.438: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5274e8), index=0, pid=99, w=480, h=714 success
01-18 09:38:03.508: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x5c5ef8), index=1, pid=208, w=480, h=800 success
01-18 09:38:03.638: DEBUG/SurfaceFlinger(99): Layer::requestBuffer(this=0x53c478), index=0, pid=99, w=480, h=38 success
01-18 09:38:03.728: DEBUG/dalvikvm(206): GC_FOR_MALLOC freed 10332 objects / 502600 bytes in 71ms
01-18 09:38:03.788: DEBUG/AK8973(72): Compass CLOSE 
01-18 09:38:05.398: DEBUG/dalvikvm(99): GC_EXPLICIT freed 513 objects / 26152 bytes in 113ms
01-18 09:38:08.618: DEBUG/dalvikvm(6930): GC_EXPLICIT freed 4618 objects / 252160 bytes in 72ms
01-18 09:38:08.783: INFO/BatteryStatsImpl(99): notePhoneSignalStrengthLocked: 3->4

Si tu veux d'autres précisions...

Merci de ton aide si tu le peux.

Lien vers le commentaire
Partager sur d’autres sites

Tu as une exception qui se produit sur cette ligne:

                       this.camera.setParameters(p);

dans la méthode surfaceChanged.

L'appareil photo ne doit pas aimer la taille de preview que tu lui indiques. Il faut peut-être récupérer auparavant les capabilities de l'appareil. Mais je ne connais pas suffisamment l'API Camera pour t'aider plus en avant

Lien vers le commentaire
Partager sur d’autres sites

Je ne dois pas la connaître beaucoup plus que toi^^.

J'ai essayé de mettre une taille fixe, ca a marché, et d'un coup plus rien...:'(

Franchement je ne vois pas d'où peut venir le problème. Je suis désespéré là...

Lien vers le commentaire
Partager sur d’autres sites

  • 4 weeks later...
  • 2 weeks later...

Bonjour !

Je travaille également sur l'affichage d'une preview pour prendre des photos.

Le problème vient de cette ligne :

parameters.setPreviewSize(width, height);

En fait, les valeurs récupérées par la fonction ne sont pas bonnes, comme l'a dit AÐÐ LIN€, si on donne des valeurs fixes (

parameters.setPreviewSize(480, 320);

), ça marche.

Mais on a un nouveau problème (sur HTC en tout cas), la preview est déformée et étirée et il y a une rotation. Par contre une fois l'image capturée, celle-ci est bonne (pas de déformation).

Apparemment c'est un bug connu de la preview, mais je ne trouve pas de solution, j'essaie de modifier l'orientation avec des

parameters.set("orientation","portrait");

etc. Mais rien n'y fait.

Quelqu'un aurait-il une solution ? Merci.

Lien vers le commentaire
Partager sur d’autres sites

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

×
×
  • Créer...