当前位置: 首页>>代码示例>>Java>>正文


Java CamcorderProfile.get方法代码示例

本文整理汇总了Java中android.media.CamcorderProfile.get方法的典型用法代码示例。如果您正苦于以下问题:Java CamcorderProfile.get方法的具体用法?Java CamcorderProfile.get怎么用?Java CamcorderProfile.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.media.CamcorderProfile的用法示例。


在下文中一共展示了CamcorderProfile.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCamcorderProfile

import android.media.CamcorderProfile; //导入方法依赖的package包/类
public static CamcorderProfile getCamcorderProfile(int currentCameraId, long maximumFileSize, int minimumDurationInSeconds) {
    if (maximumFileSize <= 0)
        return CamcorderProfile.get(currentCameraId, Configuration.MEDIA_QUALITY_HIGHEST);

    int[] qualities = new int[]{Configuration.MEDIA_QUALITY_HIGHEST,
            Configuration.MEDIA_QUALITY_HIGH, Configuration.MEDIA_QUALITY_MEDIUM,
            Configuration.MEDIA_QUALITY_LOW, Configuration.MEDIA_QUALITY_LOWEST};

    CamcorderProfile camcorderProfile;
    for (int i = 0; i < qualities.length; ++i) {
        camcorderProfile = CameraHelper.getCamcorderProfile(qualities[i], currentCameraId);
        double fileSize = CameraHelper.calculateApproximateVideoSize(camcorderProfile, minimumDurationInSeconds);

        if (fileSize > maximumFileSize) {
            long minimumRequiredBitRate = calculateMinimumRequiredBitRate(camcorderProfile, maximumFileSize, minimumDurationInSeconds);

            if (minimumRequiredBitRate >= camcorderProfile.videoBitRate / 4 && minimumRequiredBitRate <= camcorderProfile.videoBitRate) {
                camcorderProfile.videoBitRate = (int) minimumRequiredBitRate;
                return camcorderProfile;
            }
        } else return camcorderProfile;
    }
    return CameraHelper.getCamcorderProfile(Configuration.MEDIA_QUALITY_LOWEST, currentCameraId);
}
 
开发者ID:florent37,项目名称:CameraFragment,代码行数:25,代码来源:CameraHelper.java

示例2: getCamcorderProfile

import android.media.CamcorderProfile; //导入方法依赖的package包/类
public static CamcorderProfile getCamcorderProfile(int currentCameraId, long maximumFileSize, int minimumDurationInSeconds) {
    if (maximumFileSize <= 0)
        return CamcorderProfile.get(currentCameraId, CameraConfiguration.MEDIA_QUALITY_HIGHEST);

    int[] qualities = new int[]{CameraConfiguration.MEDIA_QUALITY_HIGHEST,
            CameraConfiguration.MEDIA_QUALITY_HIGH, CameraConfiguration.MEDIA_QUALITY_MEDIUM,
            CameraConfiguration.MEDIA_QUALITY_LOW, CameraConfiguration.MEDIA_QUALITY_LOWEST};

    CamcorderProfile camcorderProfile;
    for (int i = 0; i < qualities.length; ++i) {
        camcorderProfile = CameraHelper.getCamcorderProfile(qualities[i], currentCameraId);
        double fileSize = CameraHelper.calculateApproximateVideoSize(camcorderProfile, minimumDurationInSeconds);

        if (fileSize > maximumFileSize) {
            long minimumRequiredBitRate = calculateMinimumRequiredBitRate(camcorderProfile, maximumFileSize, minimumDurationInSeconds);

            if (minimumRequiredBitRate >= camcorderProfile.videoBitRate / 4 && minimumRequiredBitRate <= camcorderProfile.videoBitRate) {
                camcorderProfile.videoBitRate = (int) minimumRequiredBitRate;
                return camcorderProfile;
            }
        } else return camcorderProfile;
    }
    return CameraHelper.getCamcorderProfile(CameraConfiguration.MEDIA_QUALITY_LOWEST, currentCameraId);
}
 
开发者ID:MartinRGB,项目名称:android_camera_experiment,代码行数:25,代码来源:CameraHelper.java

示例3: getCamcorderProfile

import android.media.CamcorderProfile; //导入方法依赖的package包/类
public static CamcorderProfile getCamcorderProfile(int currentCameraId, long maximumFileSize, int minimumDurationInSeconds) {
    if (maximumFileSize <= 0)
        return CamcorderProfile.get(currentCameraId, AnncaConfiguration.MEDIA_QUALITY_HIGHEST);

    int[] qualities = new int[]{AnncaConfiguration.MEDIA_QUALITY_HIGHEST,
            AnncaConfiguration.MEDIA_QUALITY_HIGH, AnncaConfiguration.MEDIA_QUALITY_MEDIUM,
            AnncaConfiguration.MEDIA_QUALITY_LOW, AnncaConfiguration.MEDIA_QUALITY_LOWEST};

    CamcorderProfile camcorderProfile;
    for (int i = 0; i < qualities.length; ++i) {
        camcorderProfile = CameraHelper.getCamcorderProfile(qualities[i], currentCameraId);
        double fileSize = CameraHelper.calculateApproximateVideoSize(camcorderProfile, minimumDurationInSeconds);

        if (fileSize > maximumFileSize) {
            long minimumRequiredBitRate = calculateMinimumRequiredBitRate(camcorderProfile, maximumFileSize, minimumDurationInSeconds);

            if (minimumRequiredBitRate >= camcorderProfile.videoBitRate / 4 && minimumRequiredBitRate <= camcorderProfile.videoBitRate) {
                camcorderProfile.videoBitRate = (int) minimumRequiredBitRate;
                return camcorderProfile;
            }
        } else return camcorderProfile;
    }
    return CameraHelper.getCamcorderProfile(AnncaConfiguration.MEDIA_QUALITY_LOWEST, currentCameraId);
}
 
开发者ID:memfis19,项目名称:Annca,代码行数:25,代码来源:CameraHelper.java

示例4: chooseCamcorderProfile

import android.media.CamcorderProfile; //导入方法依赖的package包/类
private void chooseCamcorderProfile(Size sizeHint) {
	// For android 2.3 devices video quality = low
	if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
		profile = (CamcorderProfile.get(CamcorderProfile.QUALITY_LOW));
	else {
		// For >= Android 3.0 devices select 720p, 480p or low quality of video
		if (CamcorderProfile.hasProfile(getCameraID(), CamcorderProfile.QUALITY_720P)
				&& (sizeHint == null || sizeHint.height >= 720)) {
			profile = (CamcorderProfile.get(CamcorderProfile.QUALITY_720P));
			return;
		}

		if (CamcorderProfile.hasProfile(getCameraID(), CamcorderProfile.QUALITY_480P)
				&& (sizeHint == null || sizeHint.height >= 480)) {
			profile = (CamcorderProfile.get(CamcorderProfile.QUALITY_480P));
			return;
		}

		profile = (CamcorderProfile.get(CamcorderProfile.QUALITY_LOW));
	}
}
 
开发者ID:lukamarin,项目名称:Rocket.Chat-android,代码行数:22,代码来源:CameraManager.java

示例5: CaptureSurface

import android.media.CamcorderProfile; //导入方法依赖的package包/类
public CaptureSurface(Context context, AttributeSet attrs) {
        super(context, attrs);
        holder = getHolder();
        holder.addCallback(this);
        holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        Log.d(Tag, "Setting up recorder.");
        recorder = new MediaRecorder();
        recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
        CamcorderProfile cpHigh = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
       // recorder.setMaxDuration(50000); // 50 seconds
       // recorder.setMaxFileSize(5000000); // Approximately 5 megabytes
        //CamcorderProfile cpHigh = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
        recorder.setProfile(cpHigh);
//    recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
//    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
//    recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
        outputFile = Environment.getExternalStorageDirectory().getPath() + "/videoexample.mp4";
        recorder.setOutputFile(outputFile);
        Log.d(Tag, "finished setting up recorder.");
    }
 
开发者ID:JimSeker,项目名称:AudioVideo,代码行数:22,代码来源:CaptureSurface.java

示例6: initRecorder

import android.media.CamcorderProfile; //导入方法依赖的package包/类
private void initRecorder() {
    Log.d(TAG, "initRecorder");
    // recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
    recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);

    CamcorderProfile cpHigh = CamcorderProfile
            .get(CamcorderProfile.QUALITY_HIGH);
    recorder.setProfile(cpHigh);
    VideoFile = MainActivity.getOutputMediaFile(MainActivity.MEDIA_TYPE_VIDEO);
    Log.d(TAG, "File is " + VideoFile.toString());
    recorder.setOutputFile(VideoFile.toString());

    //if you wanted to limit the video size, you can use one of these.
    //     recorder.setMaxDuration(50000); // 50 seconds
    // recorder.setMaxFileSize(5000000); // Approximately 5 megabytes
}
 
开发者ID:JimSeker,项目名称:AudioVideo,代码行数:18,代码来源:CamFragment.java

示例7: CaptureSurface

import android.media.CamcorderProfile; //导入方法依赖的package包/类
public CaptureSurface(Context context, AttributeSet attrs) {
    super(context, attrs);
    holder = getHolder();
    holder.addCallback(this);
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    Log.d(Tag, "Setting up recorder.");
    recorder = new MediaRecorder();
    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
    CamcorderProfile cpHigh = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
	recorder.setMaxDuration(50000); // 50 seconds
	recorder.setMaxFileSize(5000000); // Approximately 5 megabytes
    //CamcorderProfile cpHigh = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
    recorder.setProfile(cpHigh);
//    recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
//    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
//    recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
    outputFile = Environment.getExternalStorageDirectory().getPath() +"/videoexample.mp4";
    recorder.setOutputFile(outputFile);
    Log.d(Tag, "finished setting up recorder.");
  }
 
开发者ID:JimSeker,项目名称:AudioVideo,代码行数:22,代码来源:CaptureSurface.java

示例8: getVideoCaptureDurationLimit

import android.media.CamcorderProfile; //导入方法依赖的package包/类
public static int getVideoCaptureDurationLimit(long bytesAvailable) {
    CamcorderProfile camcorder = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
    if (camcorder == null) {
        return 0;
    }
    bytesAvailable *= 8;        // convert to bits
    long seconds = bytesAvailable / (camcorder.audioBitRate + camcorder.videoBitRate);

    // Find the best match for one of the fixed durations
    for (int i = sVideoDuration.length - 1; i >= 0; i--) {
        if (seconds >= sVideoDuration[i]) {
            return sVideoDuration[i];
        }
    }
    return 0;
}
 
开发者ID:moezbhatti,项目名称:qksms,代码行数:17,代码来源:MessageUtils.java

示例9: getRecordingInfo

import android.media.CamcorderProfile; //导入方法依赖的package包/类
private RecordingInfo getRecordingInfo() {
  DisplayMetrics displayMetrics = new DisplayMetrics();
  WindowManager wm = (WindowManager) context.getSystemService(WINDOW_SERVICE);
  wm.getDefaultDisplay().getRealMetrics(displayMetrics);
  int displayWidth = displayMetrics.widthPixels;
  int displayHeight = displayMetrics.heightPixels;
  int displayDensity = displayMetrics.densityDpi;
  Timber.d("Display size: %s x %s @ %s", displayWidth, displayHeight, displayDensity);

  Configuration configuration = context.getResources().getConfiguration();
  boolean isLandscape = configuration.orientation == ORIENTATION_LANDSCAPE;
  Timber.d("Display landscape: %s", isLandscape);

  // Get the best camera profile available. We assume MediaRecorder supports the highest.
  CamcorderProfile camcorderProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
  int cameraWidth = camcorderProfile != null ? camcorderProfile.videoFrameWidth : -1;
  int cameraHeight = camcorderProfile != null ? camcorderProfile.videoFrameHeight : -1;
  int cameraFrameRate = camcorderProfile != null ? camcorderProfile.videoFrameRate : 30;
  Timber.d("Camera size: %s x %s framerate: %s", cameraWidth, cameraHeight, cameraFrameRate);

  int sizePercentage = videoSizePercentage.get();
  Timber.d("Size percentage: %s", sizePercentage);

  return calculateRecordingInfo(displayWidth, displayHeight, displayDensity, isLandscape,
      cameraWidth, cameraHeight, cameraFrameRate, sizePercentage);
}
 
开发者ID:JakeWharton,项目名称:Telecine,代码行数:27,代码来源:RecordingSession.java

示例10: startRecord

import android.media.CamcorderProfile; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1)
void startRecord(boolean audioOnly) {
	try {
		mRecorder = new MediaRecorder();
		if (audioOnly == false) {
			mRecorder.setVideoSource(VideoSource.CAMERA);
		}
		
		mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
		
		CamcorderProfile camcorderProfile_HQ = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
		mRecorder.setProfile(camcorderProfile_HQ);
		mPreview.getHolder().addCallback(this);
		mPreview.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
		
		//mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
		mRecorder.setOutputFile(pathName);

	  // Recording is now started
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:naver,项目名称:deview2014-androidApp-demo,代码行数:24,代码来源:MemoRecorder.java

示例11: getMaxSupportedVideoRes

import android.media.CamcorderProfile; //导入方法依赖的package包/类
/**
 * Determine maximum video resolution that device supports.
 * 
 * @return VIDEO_720P if device supports 720p video recording, <br>
 *         VIDEO_360P if device supports 360p video recording, and <br>
 *         UNSUPPORTED if it supports less than 360p video recording.
 *         <p>
 *         If it is impossible to determine video recording frame size we
 *         assume that device support VIDEO_720p.
 */
static public EVideoRecorderCapability getMaxSupportedVideoRes()
{
	  EVideoRecorderCapability videoResolution = EVideoRecorderCapability.VIDEO_720P;
	  CamcorderProfile profile = null;
	  
	  profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);

	  if (profile != null) {
		    if (profile.videoFrameHeight >= 720) {
		    	videoResolution = EVideoRecorderCapability.VIDEO_720P;
		    } else if (profile.videoFrameHeight >= 360) {
		    	videoResolution = EVideoRecorderCapability.VIDEO_360P;
		    } else if (profile.videoFrameHeight < 360) {
		    	videoResolution = EVideoRecorderCapability.NOT_SUPPORTED;
		    }
	    }
	    
    return videoResolution;
}
 
开发者ID:fblandroidhackathon,项目名称:persontracker,代码行数:30,代码来源:DeviceCapabilitiesUtils.java

示例12: refreshCamera

import android.media.CamcorderProfile; //导入方法依赖的package包/类
public void refreshCamera() {
    CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_720P);
    Camera.Parameters parameters = camera.getParameters();
    parameters.setPreviewSize(profile.videoFrameWidth, profile.videoFrameHeight);
    camera.setParameters(parameters);
    try {
        camera.setPreviewDisplay(surfaceHolder);
        camera.startPreview();
    } catch (IOException e) {
        Log.e(TAG, "Error starting camera preview: " + e.getMessage());
    }
}
 
开发者ID:marcplouhinec,项目名称:speaking-glasses,代码行数:13,代码来源:CameraPreview.java

示例13: _startRecording

import android.media.CamcorderProfile; //导入方法依赖的package包/类
private synchronized void _startRecording(Camera camera, String outPutFile, int rotationHint, int maxdurationMillis)
{
    CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
    profile.videoFrameWidth = 640;
    profile.videoFrameHeight = 480;
    profile.audioBitRate = 128;
    profile.audioCodec = MediaRecorder.AudioEncoder.AAC;

    _startRecording(camera, outPutFile, rotationHint, maxdurationMillis, profile);
}
 
开发者ID:ravindu1024,项目名称:android-imaging-utils,代码行数:11,代码来源:VideoRecorder.java

示例14: canRecordVideo

import android.media.CamcorderProfile; //导入方法依赖的package包/类
public boolean canRecordVideo(@VideoMode int videoMode) {
    try {
        CamcorderProfile.get(getIdForRequestedCamera(mFacing), videoMode);
        return true;
    } catch (Exception e) {
        return false;
    }
}
 
开发者ID:EzequielAdrianM,项目名称:Camera2Vision,代码行数:9,代码来源:CameraSource.java

示例15: getCamcorderProfile

import android.media.CamcorderProfile; //导入方法依赖的package包/类
CamcorderProfile getCamcorderProfile() {
    if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_HIGH)) {
        return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_HIGH);
    }
    if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_480P)) {
        return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_480P);
    }
    return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_LOW);
}
 
开发者ID:team-supercharge,项目名称:SCCameraView,代码行数:10,代码来源:BaseCameraView.java


注:本文中的android.media.CamcorderProfile.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。