summaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/example/rotorm/CameraActivity.java56
1 files changed, 51 insertions, 5 deletions
diff --git a/src/com/example/rotorm/CameraActivity.java b/src/com/example/rotorm/CameraActivity.java
index 84e84fa..fec1dd0 100644
--- a/src/com/example/rotorm/CameraActivity.java
+++ b/src/com/example/rotorm/CameraActivity.java
@@ -8,6 +8,7 @@ import java.util.List;
import android.app.Activity;
import android.content.Context;
+import android.content.Intent;
import android.content.pm.PackageManager;
import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
@@ -15,6 +16,7 @@ import android.media.CamcorderProfile;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.Environment;
+import android.provider.MediaStore;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.View;
@@ -44,6 +46,18 @@ private String filename="";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
+
+ Intent intent = new Intent();
+ intent.setAction(android.content.Intent.ACTION_PICK);
+ intent.setData(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
+ startActivityForResult(intent, 1234); //0 stops picker
+
+}
+
+public void onActivityResult(int requestCode, int resultCode, Intent data){
+ String success=data.getExtras().containsKey("dat")?"YES":"NO";
+ Log.i("returned data from intent: "+success, "SUCCESS");
+
// Create an instance of Camera.
mCamera = getCameraInstance();
@@ -53,6 +67,7 @@ public void onCreate(Bundle savedInstanceState) {
//Object o = this.findViewById(i);
//FrameLayout preview = (FrameLayout) o;
//preview.addView(mPreview);
+
mPreview.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
((FrameLayout) findViewById(R.id.preview)).addView(mPreview);
@@ -159,19 +174,50 @@ private boolean prepareVideoRecorder(){
mMediaRecorder.setCamera(mCamera);
// Step 2: Set sources
+ //and there is no option to set a NULL audio source
//mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
- mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
+ mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
+
+ //if you don't use a profile how to raise quality?
+
+
+ //121113 if you don't set audio source re
+ //11-12 11:56:19.893: E/MediaRecorder(6637): try to set the audio encoder without setting the audio source first
+
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
- mMediaRecorder.setVideoSize(720,480);
- mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
+ //
+ mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); //without this capture doesn't begin
+
+ mMediaRecorder.setVideoSize(1280,720);
+ mMediaRecorder.setVideoFrameRate(25);
+ mMediaRecorder.setVideoEncodingBitRate(1000000);
+ //so the combination of these 3 things does work
+
+ //11-12 11:25:06.138: E/AndroidRuntime(5094): java.lang.RuntimeException: getParameters failed (empty parameters)
+
+ //Camera.Parameters params = mCamera.getParameters(); //how to get parameters?
+ //List<Camera.Size> sizes=params.getSupportedVideoSizes();
+ //params.setPictureSize(1280, 720);
+ //mCamera.setParameters(params);
+
+ //how to manually set profile?????
+
//List<Camera.Size> sizes = mCamera.getSupportedVideoSizes();
//mCamera.setSize(720,480);
- //android.hardware.Camera.Parameters params=mCamera.getParameters(); //how to get in?
+
//mMediaRecorder.setVideoSize(720, 480);
// Step 3: Set a CamcorderProfile (requires API Level 8 or higher)
- //mMediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
+
+
+ //11-12 11:58:28.628: E/AndroidRuntime(6884): java.lang.IllegalArgumentException: Number of channels is not positive
+ //mMediaRecorder.setAudioChannels(0);
+
+ //11-12 11:26:24.213: E/MediaRecorder(5226): setOutputFormat called in an invalid state: 4
+ //mMediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
+
+
// Step 4: Set output file
filename=getOutputMediaFile(MEDIA_TYPE_VIDEO).toString(); //temporary
mMediaRecorder.setOutputFile(getOutputMediaFile(MEDIA_TYPE_VIDEO).toString());