|  |  |  | @ -1,12 +1,21 @@ | 
		
	
		
			
				|  |  |  |  | package com.yinuo.library.vlc.encoder; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import static com.common.commonlib.utils.StorageUtilsKt.NVME_KEYWORDS; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import android.annotation.TargetApi; | 
		
	
		
			
				|  |  |  |  | import android.app.Activity; | 
		
	
		
			
				|  |  |  |  | import android.content.Context; | 
		
	
		
			
				|  |  |  |  | import android.hardware.Camera; | 
		
	
		
			
				|  |  |  |  | import android.os.Build; | 
		
	
		
			
				|  |  |  |  | import android.os.Environment; | 
		
	
		
			
				|  |  |  |  | import android.text.TextUtils; | 
		
	
		
			
				|  |  |  |  | import android.view.Surface; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import androidx.annotation.Nullable; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import com.common.commonlib.CommonApplication; | 
		
	
		
			
				|  |  |  |  | import com.common.commonlib.utils.StorageUtils; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | import java.io.File; | 
		
	
		
			
				|  |  |  |  | import java.text.SimpleDateFormat; | 
		
	
		
			
				|  |  |  |  | import java.util.List; | 
		
	
	
		
			
				
					|  |  |  | @ -187,14 +196,8 @@ public class CameraHelper { | 
		
	
		
			
				|  |  |  |  |     public static File getOutputMediaFile(int type, long time, long duration) { | 
		
	
		
			
				|  |  |  |  |         // To be safe, you should check that the SDCard is mounted
 | 
		
	
		
			
				|  |  |  |  |         // using Environment.getExternalStorageState() before doing this.
 | 
		
	
		
			
				|  |  |  |  |         if (!Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED)) { | 
		
	
		
			
				|  |  |  |  |             return null; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         File mediaStorageDir = Environment.getExternalStoragePublicDirectory("video"); | 
		
	
		
			
				|  |  |  |  |         if (!mediaStorageDir.exists() && !mediaStorageDir.mkdirs()) { | 
		
	
		
			
				|  |  |  |  |             return null; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         File mediaStorageDir = getMediaStorageDir(); | 
		
	
		
			
				|  |  |  |  |         if (mediaStorageDir == null) return null; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         // Create a media file name
 | 
		
	
		
			
				|  |  |  |  |         SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA); | 
		
	
	
		
			
				
					|  |  |  | @ -213,4 +216,29 @@ public class CameraHelper { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         return mediaFile; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     @Nullable | 
		
	
		
			
				|  |  |  |  |     private static File getMediaStorageDir() { | 
		
	
		
			
				|  |  |  |  |         Context context = CommonApplication.Companion.getContext(); | 
		
	
		
			
				|  |  |  |  |         if (context != null) { | 
		
	
		
			
				|  |  |  |  |             String nvmePath = StorageUtils.INSTANCE.getStoragePath(context, NVME_KEYWORDS); | 
		
	
		
			
				|  |  |  |  |             if (!TextUtils.isEmpty(nvmePath)) { | 
		
	
		
			
				|  |  |  |  |                 File mediaStorageDir = new File(nvmePath + File.separator + "video"); | 
		
	
		
			
				|  |  |  |  |                 if (!mediaStorageDir.exists() && !mediaStorageDir.mkdirs()) { | 
		
	
		
			
				|  |  |  |  |                     return null; | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |                 return mediaStorageDir; | 
		
	
		
			
				|  |  |  |  |             } else { | 
		
	
		
			
				|  |  |  |  |                 if (!Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED)) { | 
		
	
		
			
				|  |  |  |  |                     return null; | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |                 File mediaStorageDir = Environment.getExternalStoragePublicDirectory("video"); | 
		
	
		
			
				|  |  |  |  |                 if (!mediaStorageDir.exists() && !mediaStorageDir.mkdirs()) { | 
		
	
		
			
				|  |  |  |  |                     return null; | 
		
	
		
			
				|  |  |  |  |                 } | 
		
	
		
			
				|  |  |  |  |                 return mediaStorageDir; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         return null; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | } | 
		
	
	
		
			
				
					|  |  |  | 
 |