use of android.graphics.BitmapFactory in project android_frameworks_base by AOSPA.
the class CodecTest method getThumbnail.
//Test for mediaMeta Data Thumbnail
public static boolean getThumbnail(String filePath, String goldenPath) {
Log.v(TAG, "getThumbnail - " + filePath);
int goldenHeight = 0;
int goldenWidth = 0;
int outputWidth = 0;
int outputHeight = 0;
//This test is only for the short media file
try {
BitmapFactory mBitmapFactory = new BitmapFactory();
MediaMetadataRetriever mMediaMetadataRetriever = new MediaMetadataRetriever();
try {
mMediaMetadataRetriever.setDataSource(filePath);
} catch (Exception e) {
e.printStackTrace();
return false;
}
Bitmap outThumbnail = mMediaMetadataRetriever.getFrameAtTime(-1);
//Verify the thumbnail
Bitmap goldenBitmap = mBitmapFactory.decodeFile(goldenPath);
outputWidth = outThumbnail.getWidth();
outputHeight = outThumbnail.getHeight();
goldenHeight = goldenBitmap.getHeight();
goldenWidth = goldenBitmap.getWidth();
//check the image dimension
if ((outputWidth != goldenWidth) || (outputHeight != goldenHeight))
return false;
// Check half line of pixel
int x = goldenHeight / 2;
for (int j = 1; j < goldenWidth / 2; j++) {
if (goldenBitmap.getPixel(x, j) != outThumbnail.getPixel(x, j)) {
Log.v(TAG, "pixel = " + goldenBitmap.getPixel(x, j));
return false;
}
}
} catch (Exception e) {
Log.v(TAG, e.toString());
return false;
}
return true;
}
use of android.graphics.BitmapFactory in project android_frameworks_base by ResurrectionRemix.
the class CodecTest method getThumbnail.
//Test for mediaMeta Data Thumbnail
public static boolean getThumbnail(String filePath, String goldenPath) {
Log.v(TAG, "getThumbnail - " + filePath);
int goldenHeight = 0;
int goldenWidth = 0;
int outputWidth = 0;
int outputHeight = 0;
//This test is only for the short media file
try {
BitmapFactory mBitmapFactory = new BitmapFactory();
MediaMetadataRetriever mMediaMetadataRetriever = new MediaMetadataRetriever();
try {
mMediaMetadataRetriever.setDataSource(filePath);
} catch (Exception e) {
e.printStackTrace();
return false;
}
Bitmap outThumbnail = mMediaMetadataRetriever.getFrameAtTime(-1);
//Verify the thumbnail
Bitmap goldenBitmap = mBitmapFactory.decodeFile(goldenPath);
outputWidth = outThumbnail.getWidth();
outputHeight = outThumbnail.getHeight();
goldenHeight = goldenBitmap.getHeight();
goldenWidth = goldenBitmap.getWidth();
//check the image dimension
if ((outputWidth != goldenWidth) || (outputHeight != goldenHeight))
return false;
// Check half line of pixel
int x = goldenHeight / 2;
for (int j = 1; j < goldenWidth / 2; j++) {
if (goldenBitmap.getPixel(x, j) != outThumbnail.getPixel(x, j)) {
Log.v(TAG, "pixel = " + goldenBitmap.getPixel(x, j));
return false;
}
}
} catch (Exception e) {
Log.v(TAG, e.toString());
return false;
}
return true;
}
use of android.graphics.BitmapFactory in project android_frameworks_base by crdroidandroid.
the class CodecTest method getThumbnail.
//Test for mediaMeta Data Thumbnail
public static boolean getThumbnail(String filePath, String goldenPath) {
Log.v(TAG, "getThumbnail - " + filePath);
int goldenHeight = 0;
int goldenWidth = 0;
int outputWidth = 0;
int outputHeight = 0;
//This test is only for the short media file
try {
BitmapFactory mBitmapFactory = new BitmapFactory();
MediaMetadataRetriever mMediaMetadataRetriever = new MediaMetadataRetriever();
try {
mMediaMetadataRetriever.setDataSource(filePath);
} catch (Exception e) {
e.printStackTrace();
return false;
}
Bitmap outThumbnail = mMediaMetadataRetriever.getFrameAtTime(-1);
//Verify the thumbnail
Bitmap goldenBitmap = mBitmapFactory.decodeFile(goldenPath);
outputWidth = outThumbnail.getWidth();
outputHeight = outThumbnail.getHeight();
goldenHeight = goldenBitmap.getHeight();
goldenWidth = goldenBitmap.getWidth();
//check the image dimension
if ((outputWidth != goldenWidth) || (outputHeight != goldenHeight))
return false;
// Check half line of pixel
int x = goldenHeight / 2;
for (int j = 1; j < goldenWidth / 2; j++) {
if (goldenBitmap.getPixel(x, j) != outThumbnail.getPixel(x, j)) {
Log.v(TAG, "pixel = " + goldenBitmap.getPixel(x, j));
return false;
}
}
} catch (Exception e) {
Log.v(TAG, e.toString());
return false;
}
return true;
}
Aggregations