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


Java CamcorderProfile.hasProfile方法代码示例

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


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

示例1: configureRecorder

import android.media.CamcorderProfile; //导入方法依赖的package包/类
protected void configureRecorder(int quality, MediaRecorder recorder) {
    Camera.CameraInfo info = new Camera.CameraInfo();
    Camera.getCameraInfo(cameraInfo.cameraId, info);
    int displayOrientation = getDisplayOrientation(info, false);
    recorder.setOrientationHint(displayOrientation);

    int highProfile = getHigh();
    boolean canGoHigh = CamcorderProfile.hasProfile(cameraInfo.cameraId, highProfile);
    boolean canGoLow = CamcorderProfile.hasProfile(cameraInfo.cameraId, CamcorderProfile.QUALITY_LOW);
    if (canGoHigh && (quality == 1 || !canGoLow)) {
        recorder.setProfile(CamcorderProfile.get(cameraInfo.cameraId, highProfile));
    } else if (canGoLow) {
        recorder.setProfile(CamcorderProfile.get(cameraInfo.cameraId, CamcorderProfile.QUALITY_LOW));
    } else {
        throw new IllegalStateException("cannot find valid CamcorderProfile");
    }
    isVideo = true;
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:19,代码来源:CameraSession.java

示例2: getSizes

import android.media.CamcorderProfile; //导入方法依赖的package包/类
private List<Size> getSizes(StreamConfigurationMap map) {
    Size[] sizes = map.getOutputSizes(MediaRecorder.class);

    // StreamConfigurationMap.getOutputSizes(MediaRecorder.class) only tells us if the
    // camera supports these sizes. It does not tell us if MediaRecorder supports these
    // sizes, odd as that sounds. Therefore, we need to filter ourselves manually.
    List<Size> filtered;
    if (CamcorderProfile.hasProfile(getCameraId(), CamcorderProfile.QUALITY_2160P)) {
        filtered = filter(sizes, SIZE_4K);
        if (!filtered.isEmpty()) {
            return filtered;
        }
    }
    if (CamcorderProfile.hasProfile(getCameraId(), CamcorderProfile.QUALITY_1080P)) {
        filtered = filter(sizes, SIZE_1080P);
        if (!filtered.isEmpty()) {
            return filtered;
        }
    }
    if (CamcorderProfile.hasProfile(getCameraId(), CamcorderProfile.QUALITY_720P)) {
        filtered = filter(sizes, SIZE_720P);
        if (!filtered.isEmpty()) {
            return filtered;
        }
    }
    if (CamcorderProfile.hasProfile(getCameraId(), CamcorderProfile.QUALITY_480P)) {
        filtered = filter(sizes, SIZE_480P);
        if (!filtered.isEmpty()) {
            return filtered;
        }
    }
    return Arrays.asList(sizes);
}
 
开发者ID:Xlythe,项目名称:CameraView,代码行数:34,代码来源:VideoSession.java

示例3: 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

示例4: getNextSupportedVideoQualityIndex

import android.media.CamcorderProfile; //导入方法依赖的package包/类
/**
 * Starting from 'start' this method returns the next supported video
 * quality.
 */
private static int getNextSupportedVideoQualityIndex(int cameraId, int start) {
    for (int i = start + 1; i < sVideoQualities.length; ++i) {
        if (isVideoQualitySupported(sVideoQualities[i])
                && CamcorderProfile.hasProfile(cameraId, sVideoQualities[i])) {
            // We found a new supported quality.
            return i;
        }
    }

    // Failed to find another supported quality.
    if (start < 0 || start >= sVideoQualities.length) {
        // This means we couldn't find any supported quality.
        throw new IllegalArgumentException("Could not find supported video qualities.");
    }

    // We previously found a larger supported size. In this edge case, just
    // return the same index as the previous size.
    return start;
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:24,代码来源:SettingsUtil.java

示例5: configureRecorderProfile

import android.media.CamcorderProfile; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void configureRecorderProfile(int cameraId,
                                     MediaRecorder recorder) {
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
      || CamcorderProfile.hasProfile(cameraId,
                                     CamcorderProfile.QUALITY_HIGH)) {
    recorder.setProfile(CamcorderProfile.get(cameraId,
                                             CamcorderProfile.QUALITY_HIGH));
  }
  else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
      && CamcorderProfile.hasProfile(cameraId,
                                     CamcorderProfile.QUALITY_LOW)) {
    recorder.setProfile(CamcorderProfile.get(cameraId,
                                             CamcorderProfile.QUALITY_LOW));
  }
  else {
    throw new IllegalStateException(
                                    "cannot find valid CamcorderProfile");
  }
}
 
开发者ID:nimengbo,项目名称:MyCamera,代码行数:22,代码来源:SimpleCameraHost.java

示例6: configureRecorder

import android.media.CamcorderProfile; //导入方法依赖的package包/类
@Override
public void configureRecorder(CameraSession session,
                              int cameraId,
                              VideoTransaction xact,
                              MediaRecorder recorder) {
  int highProfile=getHigh();

  boolean canGoHigh=CamcorderProfile.hasProfile(cameraId,
    highProfile);
  boolean canGoLow=CamcorderProfile.hasProfile(cameraId,
    CamcorderProfile.QUALITY_LOW);

  if (canGoHigh && (xact.getQuality()==1 || !canGoLow)) {
    recorder.setProfile(CamcorderProfile.get(cameraId,
      highProfile));
  }
  else if (canGoLow) {
    recorder.setProfile(CamcorderProfile.get(cameraId,
      CamcorderProfile.QUALITY_LOW));
  }
  else {
    throw new IllegalStateException(
      "cannot find valid CamcorderProfile");
  }
}
 
开发者ID:commonsguy,项目名称:cwac-cam2,代码行数:26,代码来源:SizeAndFormatPlugin.java

示例7: 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

示例8: getMaxEncoderSizeSupported

import android.media.CamcorderProfile; //导入方法依赖的package包/类
/**
 * @return max size that device can record.
 */
private Camera.Size getMaxEncoderSizeSupported() {
  if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_2160P)) {
    return camera.new Size(3840, 2160);
  } else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_1080P)) {
    return camera.new Size(1920, 1080);
  } else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P)) {
    return camera.new Size(1280, 720);
  } else {
    return camera.new Size(640, 480);
  }
}
 
开发者ID:pedroSG94,项目名称:rtmp-rtsp-stream-client-java,代码行数:15,代码来源:Camera1ApiManager.java

示例9: addStandardResolutions

import android.media.CamcorderProfile; //导入方法依赖的package包/类
private void addStandardResolutions(double aspectRatio, ArrayList<Resolution> resolutions, Map<Integer, Resolution> resolutionsByHeight) {
    for (int profileId : new int[]{QUALITY_1080P, QUALITY_720P, CamcorderProfile.QUALITY_480P}) {
        try {
            if (!CamcorderProfile.hasProfile(profileId)) continue;
            CamcorderProfile profile = CamcorderProfile.get(profileId);
            if (profile.videoFrameHeight > height && profile.videoFrameWidth > width) {
                continue;
            }
            Resolution existingResolution = resolutionsByHeight.get(profile.videoFrameHeight);
            if (existingResolution != null && existingResolution.getWidth() == profile.videoFrameWidth) {
                continue;
            }

            int paddingHeight = 0;
            int paddingWidth = 0;

            if (profile.videoFrameHeight * aspectRatio > profile.videoFrameWidth) {
                paddingHeight = (int) Math.round((profile.videoFrameHeight - profile.videoFrameWidth / aspectRatio) / 2);
            } else {
                paddingWidth = (int) Math.round((profile.videoFrameWidth - profile.videoFrameHeight * aspectRatio) / 2);
            }
            resolutions.add(new Resolution(R.string.settings_resolution_padding,
                    profile.videoFrameWidth, profile.videoFrameHeight,
                    paddingWidth, paddingHeight));
        } catch (RuntimeException e) {
            Log.w(TAG, "Error when retrieving CamcorderProfile info", e);
        }
    }
}
 
开发者ID:iwo,项目名称:SCR-Screen-Recorder-app,代码行数:30,代码来源:ResolutionsManager.java

示例10: getBaseRecordingProfile

import android.media.CamcorderProfile; //导入方法依赖的package包/类
public CamcorderProfile getBaseRecordingProfile() {
    CamcorderProfile returnProfile;
    if (VERSION.SDK_INT < VERSION_CODES.HONEYCOMB) {
        returnProfile = getDefaultRecordingProfile();
    } else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P)) {
        returnProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_720P);
    } else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_480P)) {
        returnProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_480P);
    } else {
        returnProfile = getDefaultRecordingProfile();
    }
    return returnProfile;
}
 
开发者ID:linglongxin24,项目名称:VideoCamera,代码行数:14,代码来源:CameraWrapper.java

示例11: startRecording

import android.media.CamcorderProfile; //导入方法依赖的package包/类
/**
 * Start recording the video
 * @param fileName store the following video recording under this name
 */
public void startRecording(String fileName) {
    recordingStatus = true;
    camera = Camera.open();
    camera.setDisplayOrientation(90);
    Camera.Parameters parameters = camera.getParameters();
    parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
    parameters.set("cam_mode", 1);
    camera.setParameters(parameters);
    camera.unlock();

    CamcorderProfile profile = null;
    if(CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P)){
        profile = CamcorderProfile.get(CamcorderProfile.QUALITY_720P);
    }else if(CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_480P)){
        profile = CamcorderProfile.get(CamcorderProfile.QUALITY_480P);
    }else{ profile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW); }

    mediaRecorder = new MediaRecorder();
    mediaRecorder.setCamera(camera);
    mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
    mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
    mediaRecorder.setProfile(profile);
    mediaRecorder.setOrientationHint(90);
    mediaRecorder.setOutputFile(Environment.getExternalStorageDirectory().toString() + "/" + fileName + ".mp4");
    mediaRecorder.setPreviewDisplay(globalHolder.getSurface());

    try {
        mediaRecorder.prepare();
    } catch (Exception e) {
        e.printStackTrace();
    }
    mediaRecorder.start();
}
 
开发者ID:jagrutkosti,项目名称:dashit,代码行数:38,代码来源:BackgroundService.java

示例12: setOptimalProfile

import android.media.CamcorderProfile; //导入方法依赖的package包/类
private void setOptimalProfile(MyCameraManager cameraManager) {
	if(cameraManager.getResolutionSize() != null)
	{
		int height = cameraManager.getResolutionSize().height;
		
		if(height == 720) {
			if(CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_720P)) {
				videoRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_720P));
				Log.e(TAG, "setProfile:QUALITY_720P");
				return;
			}
		}
		
		if(height == 480) {
			if(CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_480P)) {
				videoRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_480P));
				Log.e(TAG, "setProfile:QUALITY_480P");
				return;
			}
		}
	}
	
	if(CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_HIGH)) {
		videoRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
		Log.e(TAG, "setProfile:QUALITY_HIGH");
		return;
	}
	if(CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_LOW)) {
		videoRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_LOW));
		Log.e(TAG, "setProfile:QUALITY_LOW");
		return;
	}
}
 
开发者ID:orangecoder,项目名称:VideoRecord,代码行数:34,代码来源:MediaRecorderManager.java

示例13: getSupportedVideoQuality

import android.media.CamcorderProfile; //导入方法依赖的package包/类
private static ArrayList<String> getSupportedVideoQuality(int cameraId) {
    ArrayList<String> supported = new ArrayList<String>();
    // Check for supported quality
    if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_1080P)) {
        supported.add(Integer.toString(CamcorderProfile.QUALITY_1080P));
    }
    if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_720P)) {
        supported.add(Integer.toString(CamcorderProfile.QUALITY_720P));
    }
    if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_480P)) {
        supported.add(Integer.toString(CamcorderProfile.QUALITY_480P));
    }
    return supported;
}
 
开发者ID:asm-products,项目名称:nexus-camera,代码行数:15,代码来源:CameraSettings.java

示例14: checkRecProfile

import android.media.CamcorderProfile; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private boolean checkRecProfile(int profile) {
	try {
		if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
				|| CamcorderProfile.hasProfile(cameraId, profile)) {
			return true;
		}
	} catch (Exception e) {}

	return false;
}
 
开发者ID:zeitgeist87,项目名称:SpartanTimeLapseRecorder,代码行数:12,代码来源:RecSettings.java

示例15: addProfileFrameRate

import android.media.CamcorderProfile; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void addProfileFrameRate(int camId, List<Integer> list, int profile) {
	try {
		if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
				|| CamcorderProfile.hasProfile(camId, profile)) {
			CamcorderProfile p = CamcorderProfile.get(camId, profile);
			list.add(p.videoFrameRate);
		}
	} catch (Exception e) {
	}
}
 
开发者ID:zeitgeist87,项目名称:SpartanTimeLapseRecorder,代码行数:12,代码来源:CameraSettings.java


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