Loading media/java/android/media/Image.java +7 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,13 @@ public abstract class Image implements AutoCloseable { */ public abstract long getTimestamp(); /** * Get the transformation associated with this frame. * @return The window transformation that needs to be applied for this frame. * @hide */ public abstract int getTransform(); /** * Get the {@link android.hardware.HardwareBuffer HardwareBuffer} handle of the input image * intended for GPU and/or hardware access. Loading media/java/android/media/ImageReader.java +11 −0 Original line number Diff line number Diff line Loading @@ -875,6 +875,12 @@ public class ImageReader implements AutoCloseable { return mTimestamp; } @Override public int getTransform() { throwISEIfImageIsInvalid(); return mTransform; } @Override public HardwareBuffer getHardwareBuffer() { throwISEIfImageIsInvalid(); Loading Loading @@ -1013,6 +1019,11 @@ public class ImageReader implements AutoCloseable { */ private long mTimestamp; /** * This field is set by native code during nativeImageSetup(). */ private int mTransform; private SurfacePlane[] mPlanes; private int mFormat = ImageFormat.UNKNOWN; // If this image is detached from the ImageReader. Loading media/java/android/media/ImageWriter.java +14 −4 Original line number Diff line number Diff line Loading @@ -371,7 +371,7 @@ public class ImageWriter implements AutoCloseable { Rect crop = image.getCropRect(); nativeQueueInputImage(mNativeContext, image, image.getTimestamp(), crop.left, crop.top, crop.right, crop.bottom); crop.right, crop.bottom, image.getTransform()); /** * Only remove and cleanup the Images that are owned by this Loading Loading @@ -557,7 +557,8 @@ public class ImageWriter implements AutoCloseable { // buffer caused leak. Rect crop = image.getCropRect(); nativeAttachAndQueueImage(mNativeContext, image.getNativeContext(), image.getFormat(), image.getTimestamp(), crop.left, crop.top, crop.right, crop.bottom); image.getTimestamp(), crop.left, crop.top, crop.right, crop.bottom, image.getTransform()); } /** Loading Loading @@ -674,6 +675,8 @@ public class ImageWriter implements AutoCloseable { private final long DEFAULT_TIMESTAMP = Long.MIN_VALUE; private long mTimestamp = DEFAULT_TIMESTAMP; private int mTransform = 0; //Default no transform public WriterSurfaceImage(ImageWriter writer) { mOwner = writer; } Loading Loading @@ -710,6 +713,13 @@ public class ImageWriter implements AutoCloseable { return mHeight; } @Override public int getTransform() { throwISEIfImageIsInvalid(); return mTransform; } @Override public long getTimestamp() { throwISEIfImageIsInvalid(); Loading Loading @@ -856,11 +866,11 @@ public class ImageWriter implements AutoCloseable { private synchronized native void nativeDequeueInputImage(long nativeCtx, Image wi); private synchronized native void nativeQueueInputImage(long nativeCtx, Image image, long timestampNs, int left, int top, int right, int bottom); long timestampNs, int left, int top, int right, int bottom, int transform); private synchronized native int nativeAttachAndQueueImage(long nativeCtx, long imageNativeBuffer, int imageFormat, long timestampNs, int left, int top, int right, int bottom); int top, int right, int bottom, int transform); private synchronized native void cancelImage(long nativeCtx, Image image); Loading media/java/android/media/MediaCodec.java +8 −0 Original line number Diff line number Diff line Loading @@ -3528,6 +3528,8 @@ final public class MediaCodec { private final static int TYPE_YUV = 1; private final int mTransform = 0; //Default no transform @Override public int getFormat() { throwISEIfImageIsInvalid(); Loading @@ -3546,6 +3548,12 @@ final public class MediaCodec { return mWidth; } @Override public int getTransform() { throwISEIfImageIsInvalid(); return mTransform; } @Override public long getTimestamp() { throwISEIfImageIsInvalid(); Loading media/jni/android_media_ImageReader.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #define ANDROID_MEDIA_IMAGEREADER_CTX_JNI_ID "mNativeContext" #define ANDROID_MEDIA_SURFACEIMAGE_BUFFER_JNI_ID "mNativeBuffer" #define ANDROID_MEDIA_SURFACEIMAGE_TS_JNI_ID "mTimestamp" #define ANDROID_MEDIA_SURFACEIMAGE_TF_JNI_ID "mTransform" #define CONSUMER_BUFFER_USAGE_UNKNOWN 0; // ---------------------------------------------------------------------------- Loading @@ -66,6 +67,7 @@ static struct { static struct { jfieldID mNativeBuffer; jfieldID mTimestamp; jfieldID mTransform; jfieldID mPlanes; } gSurfaceImageClassInfo; Loading Loading @@ -307,6 +309,12 @@ static void ImageReader_classInit(JNIEnv* env, jclass clazz) "can't find android/graphics/ImageReader.%s", ANDROID_MEDIA_SURFACEIMAGE_TS_JNI_ID); gSurfaceImageClassInfo.mTransform = env->GetFieldID( imageClazz, ANDROID_MEDIA_SURFACEIMAGE_TF_JNI_ID, "I"); LOG_ALWAYS_FATAL_IF(gSurfaceImageClassInfo.mTransform == NULL, "can't find android/graphics/ImageReader.%s", ANDROID_MEDIA_SURFACEIMAGE_TF_JNI_ID); gSurfaceImageClassInfo.mPlanes = env->GetFieldID( imageClazz, "mPlanes", "[Landroid/media/ImageReader$SurfaceImage$SurfacePlane;"); LOG_ALWAYS_FATAL_IF(gSurfaceImageClassInfo.mPlanes == NULL, Loading Loading @@ -596,6 +604,8 @@ static jint ImageReader_imageSetup(JNIEnv* env, jobject thiz, jobject image) { Image_setBufferItem(env, image, buffer); env->SetLongField(image, gSurfaceImageClassInfo.mTimestamp, static_cast<jlong>(buffer->mTimestamp)); env->SetIntField(image, gSurfaceImageClassInfo.mTransform, static_cast<jint>(buffer->mTransform)); return ACQUIRE_SUCCESS; } Loading Loading
media/java/android/media/Image.java +7 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,13 @@ public abstract class Image implements AutoCloseable { */ public abstract long getTimestamp(); /** * Get the transformation associated with this frame. * @return The window transformation that needs to be applied for this frame. * @hide */ public abstract int getTransform(); /** * Get the {@link android.hardware.HardwareBuffer HardwareBuffer} handle of the input image * intended for GPU and/or hardware access. Loading
media/java/android/media/ImageReader.java +11 −0 Original line number Diff line number Diff line Loading @@ -875,6 +875,12 @@ public class ImageReader implements AutoCloseable { return mTimestamp; } @Override public int getTransform() { throwISEIfImageIsInvalid(); return mTransform; } @Override public HardwareBuffer getHardwareBuffer() { throwISEIfImageIsInvalid(); Loading Loading @@ -1013,6 +1019,11 @@ public class ImageReader implements AutoCloseable { */ private long mTimestamp; /** * This field is set by native code during nativeImageSetup(). */ private int mTransform; private SurfacePlane[] mPlanes; private int mFormat = ImageFormat.UNKNOWN; // If this image is detached from the ImageReader. Loading
media/java/android/media/ImageWriter.java +14 −4 Original line number Diff line number Diff line Loading @@ -371,7 +371,7 @@ public class ImageWriter implements AutoCloseable { Rect crop = image.getCropRect(); nativeQueueInputImage(mNativeContext, image, image.getTimestamp(), crop.left, crop.top, crop.right, crop.bottom); crop.right, crop.bottom, image.getTransform()); /** * Only remove and cleanup the Images that are owned by this Loading Loading @@ -557,7 +557,8 @@ public class ImageWriter implements AutoCloseable { // buffer caused leak. Rect crop = image.getCropRect(); nativeAttachAndQueueImage(mNativeContext, image.getNativeContext(), image.getFormat(), image.getTimestamp(), crop.left, crop.top, crop.right, crop.bottom); image.getTimestamp(), crop.left, crop.top, crop.right, crop.bottom, image.getTransform()); } /** Loading Loading @@ -674,6 +675,8 @@ public class ImageWriter implements AutoCloseable { private final long DEFAULT_TIMESTAMP = Long.MIN_VALUE; private long mTimestamp = DEFAULT_TIMESTAMP; private int mTransform = 0; //Default no transform public WriterSurfaceImage(ImageWriter writer) { mOwner = writer; } Loading Loading @@ -710,6 +713,13 @@ public class ImageWriter implements AutoCloseable { return mHeight; } @Override public int getTransform() { throwISEIfImageIsInvalid(); return mTransform; } @Override public long getTimestamp() { throwISEIfImageIsInvalid(); Loading Loading @@ -856,11 +866,11 @@ public class ImageWriter implements AutoCloseable { private synchronized native void nativeDequeueInputImage(long nativeCtx, Image wi); private synchronized native void nativeQueueInputImage(long nativeCtx, Image image, long timestampNs, int left, int top, int right, int bottom); long timestampNs, int left, int top, int right, int bottom, int transform); private synchronized native int nativeAttachAndQueueImage(long nativeCtx, long imageNativeBuffer, int imageFormat, long timestampNs, int left, int top, int right, int bottom); int top, int right, int bottom, int transform); private synchronized native void cancelImage(long nativeCtx, Image image); Loading
media/java/android/media/MediaCodec.java +8 −0 Original line number Diff line number Diff line Loading @@ -3528,6 +3528,8 @@ final public class MediaCodec { private final static int TYPE_YUV = 1; private final int mTransform = 0; //Default no transform @Override public int getFormat() { throwISEIfImageIsInvalid(); Loading @@ -3546,6 +3548,12 @@ final public class MediaCodec { return mWidth; } @Override public int getTransform() { throwISEIfImageIsInvalid(); return mTransform; } @Override public long getTimestamp() { throwISEIfImageIsInvalid(); Loading
media/jni/android_media_ImageReader.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #define ANDROID_MEDIA_IMAGEREADER_CTX_JNI_ID "mNativeContext" #define ANDROID_MEDIA_SURFACEIMAGE_BUFFER_JNI_ID "mNativeBuffer" #define ANDROID_MEDIA_SURFACEIMAGE_TS_JNI_ID "mTimestamp" #define ANDROID_MEDIA_SURFACEIMAGE_TF_JNI_ID "mTransform" #define CONSUMER_BUFFER_USAGE_UNKNOWN 0; // ---------------------------------------------------------------------------- Loading @@ -66,6 +67,7 @@ static struct { static struct { jfieldID mNativeBuffer; jfieldID mTimestamp; jfieldID mTransform; jfieldID mPlanes; } gSurfaceImageClassInfo; Loading Loading @@ -307,6 +309,12 @@ static void ImageReader_classInit(JNIEnv* env, jclass clazz) "can't find android/graphics/ImageReader.%s", ANDROID_MEDIA_SURFACEIMAGE_TS_JNI_ID); gSurfaceImageClassInfo.mTransform = env->GetFieldID( imageClazz, ANDROID_MEDIA_SURFACEIMAGE_TF_JNI_ID, "I"); LOG_ALWAYS_FATAL_IF(gSurfaceImageClassInfo.mTransform == NULL, "can't find android/graphics/ImageReader.%s", ANDROID_MEDIA_SURFACEIMAGE_TF_JNI_ID); gSurfaceImageClassInfo.mPlanes = env->GetFieldID( imageClazz, "mPlanes", "[Landroid/media/ImageReader$SurfaceImage$SurfacePlane;"); LOG_ALWAYS_FATAL_IF(gSurfaceImageClassInfo.mPlanes == NULL, Loading Loading @@ -596,6 +604,8 @@ static jint ImageReader_imageSetup(JNIEnv* env, jobject thiz, jobject image) { Image_setBufferItem(env, image, buffer); env->SetLongField(image, gSurfaceImageClassInfo.mTimestamp, static_cast<jlong>(buffer->mTimestamp)); env->SetIntField(image, gSurfaceImageClassInfo.mTransform, static_cast<jint>(buffer->mTransform)); return ACQUIRE_SUCCESS; } Loading