From 32c4cdefd02928ac19589278c3511fdc06bfc638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=BCleyman=20Yasir=20KULA?= Date: Thu, 3 Sep 2020 18:26:32 +0300 Subject: [PATCH] Added markTextureNonReadable parameter to GetVideoThumbnail --- .github/README.md | 3 ++- Plugins/NativeCamera/NativeCamera.cs | 4 ++-- Plugins/NativeCamera/README.txt | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/README.md b/.github/README.md index 6eef7a5..4e9cf32 100644 --- a/.github/README.md +++ b/.github/README.md @@ -93,9 +93,10 @@ Beginning with *6.0 Marshmallow*, Android apps must request runtime permissions - **generateMipmaps** determines whether texture should have mipmaps or not - **linearColorSpace** determines whether texture should be in linear color space or sRGB color space -`Texture2D NativeCamera.GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0 )`: creates a Texture2D thumbnail from a video file and returns it. Returns *null*, if something goes wrong. +`Texture2D NativeCamera.GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0, bool markTextureNonReadable = true )`: creates a Texture2D thumbnail from a video file and returns it. Returns *null*, if something goes wrong. - **maxSize** determines the maximum size of the returned Texture2D in pixels. Larger thumbnails will be down-scaled. If untouched, its value will be set to *SystemInfo.maxTextureSize*. It is recommended to set a proper maxSize for better performance - **captureTimeInSeconds** determines the frame of the video that the thumbnail is captured from. If untouched, OS will decide this value +- **markTextureNonReadable** (see *LoadImageAtPath*) ## EXAMPLE CODE diff --git a/Plugins/NativeCamera/NativeCamera.cs b/Plugins/NativeCamera/NativeCamera.cs index 1ac23eb..3f5d6af 100644 --- a/Plugins/NativeCamera/NativeCamera.cs +++ b/Plugins/NativeCamera/NativeCamera.cs @@ -331,7 +331,7 @@ public static Texture2D LoadImageAtPath( string imagePath, int maxSize = -1, boo return result; } - public static Texture2D GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0 ) + public static Texture2D GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0, bool markTextureNonReadable = true ) { if( maxSize <= 0 ) maxSize = SystemInfo.maxTextureSize; @@ -345,7 +345,7 @@ public static Texture2D GetVideoThumbnail( string videoPath, int maxSize = -1, d #endif if( !string.IsNullOrEmpty( thumbnailPath ) ) - return LoadImageAtPath( thumbnailPath, maxSize ); + return LoadImageAtPath( thumbnailPath, maxSize, markTextureNonReadable ); else return null; } diff --git a/Plugins/NativeCamera/README.txt b/Plugins/NativeCamera/README.txt index 8bbe5dc..98e7927 100644 --- a/Plugins/NativeCamera/README.txt +++ b/Plugins/NativeCamera/README.txt @@ -81,7 +81,8 @@ Texture2D NativeCamera.LoadImageAtPath( string imagePath, int maxSize = -1, bool // Creates a Texture2D thumbnail from a video file and returns it. Returns null, if something goes wrong // maxSize: determines the maximum size of the returned Texture2D in pixels. Larger thumbnails will be down-scaled. If untouched, its value will be set to SystemInfo.maxTextureSize. It is recommended to set a proper maxSize for better performance // captureTimeInSeconds: determines the frame of the video that the thumbnail is captured from. If untouched, OS will decide this value -Texture2D NativeCamera.GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0 ); +// markTextureNonReadable: see LoadImageAtPath +Texture2D NativeCamera.GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0, bool markTextureNonReadable = true ); // Returns an ImageProperties instance that holds the width, height and mime type information of an image file without creating a Texture2D object. Mime type will be null, if it can't be determined NativeCamera.ImageProperties NativeCamera.GetImageProperties( string imagePath );