當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。