我有以下代码:setOutputFormat称为处于无效状态:4(为什么)
Log.i("xx","A");
media_recorder = new MediaRecorder();
Log.i("xx","B");
media_recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
Log.i("xx","C");
media_recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
Log.i("xx","D");
media_recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
Log.i("xx","E");
media_recorder.setVideoSize(320, 240);
Log.i("xx","F");
media_recorder.setVideoFrameRate(15);
Log.i("xx","G");
CamcorderProfile profile = CamcorderProfile.get(CameraInfo.CAMERA_FACING_FRONT,CamcorderProfile.QUALITY_LOW);
Log.i("xx","H");
media_recorder.setProfile(profile);
Log.i("xx","I");
media_recorder.setOutputFile(fname);
当执行的代码,我看到在我的日志以下;
02-07 16:12:47.628: I/xx(15436): A
02-07 16:12:47.628: I/xx(15436): B
02-07 16:12:47.638: I/xx(15436): C
02-07 16:12:47.638: I/xx(15436): D
02-07 16:12:47.638: I/xx(15436): E
02-07 16:12:47.638: I/xx(15436): F
02-07 16:12:47.638: I/xx(15436): G
02-07 16:12:47.638: I/xx(15436): H
02-07 16:12:47.638: E/MediaRecorder(15436): setOutputFormat called in an invalid state: 4
这混淆了我,因为到setOutputFormat
呼叫被“C”和“d”之间进行的,但错误的报告显示H(从来没有达到“I”)后,立即。所以现在我不知道是什么导致了错误,而且我对发生错误的位置感到困惑。
编辑:我刚刚在调试器中加入代码 - 并确信在调用setProfile(profile)期间发生错误...因此,看起来对setOutputFormat(在“C” &“D”)肯定已经工作了,但是然后setProfile必须自己再次调用setOutputFormat,然后失败......这是怎么回事?
编辑:什么是无效状态4实际上是什么意思?是否有某个列表可以告诉您每个可能的无效状态编号1,2,3,4 ...等的含义?