parent
							
								
									324f0c8a47
								
							
						
					
					
						commit
						b65e9e446d
					
				@ -1,19 +1,73 @@ | 
				
			|||||||
package com.otaliastudios.cameraview; | 
					package com.otaliastudios.cameraview; | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.IntDef; | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
import java.lang.annotation.Retention; | 
					 * Constants for selecting the quality of video recordings. | 
				
			||||||
import java.lang.annotation.RetentionPolicy; | 
					 * | 
				
			||||||
 | 
					 * @see CameraView#setVideoQuality(VideoQuality) | 
				
			||||||
import static com.otaliastudios.cameraview.CameraConstants.VIDEO_QUALITY_1080P; | 
					 */ | 
				
			||||||
import static com.otaliastudios.cameraview.CameraConstants.VIDEO_QUALITY_2160P; | 
					public enum VideoQuality { | 
				
			||||||
import static com.otaliastudios.cameraview.CameraConstants.VIDEO_QUALITY_480P; | 
					
 | 
				
			||||||
import static com.otaliastudios.cameraview.CameraConstants.VIDEO_QUALITY_720P; | 
					
 | 
				
			||||||
import static com.otaliastudios.cameraview.CameraConstants.VIDEO_QUALITY_HIGHEST; | 
					    /** | 
				
			||||||
import static com.otaliastudios.cameraview.CameraConstants.VIDEO_QUALITY_LOWEST; | 
					     * Quality level corresponding to the lowest available resolution. | 
				
			||||||
import static com.otaliastudios.cameraview.CameraConstants.VIDEO_QUALITY_QVGA; | 
					     */ | 
				
			||||||
 | 
					    LOWEST(0), | 
				
			||||||
@Retention(RetentionPolicy.SOURCE) | 
					
 | 
				
			||||||
@IntDef({VIDEO_QUALITY_QVGA, VIDEO_QUALITY_480P, VIDEO_QUALITY_720P, VIDEO_QUALITY_1080P, VIDEO_QUALITY_2160P, VIDEO_QUALITY_HIGHEST, VIDEO_QUALITY_LOWEST}) | 
					    /** | 
				
			||||||
public @interface VideoQuality { | 
					     * Quality level corresponding to the highest available resolution. | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    HIGHEST(1), | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * Quality level corresponding to the QVGA (320x240) resolution. | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    MAX_QVGA(2), | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * Quality level corresponding to the 480p (720 x 480) resolution. | 
				
			||||||
 | 
					     * Note that the horizontal resolution for 480p can also be other | 
				
			||||||
 | 
					     * values, such as 640 or 704, instead of 720. | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    MAX_480P(3), | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * Quality level corresponding to the 720p (1280 x 720) resolution. | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    MAX_720P(4), | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * Quality level corresponding to the 1080p (1920 x 1080) resolution. | 
				
			||||||
 | 
					     * Note that the vertical resolution for 1080p can also be 1088, | 
				
			||||||
 | 
					     * instead of 1080 (used by some vendors to avoid cropping during | 
				
			||||||
 | 
					     * video playback). | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    MAX_1080P(5), | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** | 
				
			||||||
 | 
					     * Quality level corresponding to the 2160p (3840x2160) resolution. | 
				
			||||||
 | 
					     */ | 
				
			||||||
 | 
					    MAX_2160P(6); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    static final VideoQuality DEFAULT = MAX_480P; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private int value; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    VideoQuality(int value) { | 
				
			||||||
 | 
					        this.value = value; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int value() { | 
				
			||||||
 | 
					        return value; | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    static VideoQuality fromValue(int value) { | 
				
			||||||
 | 
					        VideoQuality[] list = VideoQuality.values(); | 
				
			||||||
 | 
					        for (VideoQuality action : list) { | 
				
			||||||
 | 
					            if (action.value() == value) { | 
				
			||||||
 | 
					                return action; | 
				
			||||||
 | 
					            } | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return null; | 
				
			||||||
 | 
					    } | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
				
			|||||||
					Loading…
					
					
				
		Reference in new issue