use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.
the class MediaItemThumbnailTest method testThumbnailForMPEG4QCIF.
/**
* To test thumbnail / frame extraction on MPEG4 QCIF.
*/
@LargeTest
public void testThumbnailForMPEG4QCIF() throws Exception {
final String videoItemFilename = INPUT_FILE_PATH + "MPEG4_SP_176x144_30fps_256kbps_AACLC_44.1kHz_96kbps_s_1_17.3gp";
final int atTime = 0;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
final MediaVideoItem mediaVideoItem = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename, renderingMode);
final int outWidth = mediaVideoItem.getWidth();
final int outHeight = mediaVideoItem.getHeight() * 2;
final Bitmap thumbNailBmp = mediaVideoItem.getThumbnail(outWidth, outHeight, atTime);
validateThumbnail(thumbNailBmp, outWidth, outHeight);
}
use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.
the class MediaItemThumbnailTest method testThumbnailWithHeightAsZero.
/**
* Check the thumbnail for Height as Zero
*/
@LargeTest
public void testThumbnailWithHeightAsZero() throws Exception {
final String videoItemFilename = INPUT_FILE_PATH + "MPEG4_SP_176x144_30fps_256kbps_AACLC_44.1kHz_96kbps_s_1_17.3gp";
final int atTime = 100;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
boolean flagForException = false;
try {
final MediaVideoItem mediaVideoItem = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename, renderingMode);
final int outWidth = (mediaVideoItem.getWidth() / 2);
final int outHeight = -1;
mediaVideoItem.getThumbnail(outWidth, outHeight, atTime);
} catch (IllegalArgumentException e) {
flagForException = true;
}
assertTrue("Thumbnail List with Zero Height", flagForException);
}
use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.
the class MediaItemThumbnailTest method testThumbnailListH264WVGAWithStartEqualEnd.
/**
*To test ThumbnailList for H264 WVGA with startTime = End Time
*/
@LargeTest
public void testThumbnailListH264WVGAWithStartEqualEnd() throws Exception {
final String videoItemFilename = INPUT_FILE_PATH + "H264_BP_800x480_15fps_512kbps_AACLC_24KHz_38Kbps_s_1_17.mp4";
final int tnCount = 1;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
final MediaVideoItem mediaVideoItem = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename, renderingMode);
final int outWidth = (mediaVideoItem.getWidth() / 2);
final int outHeight = (mediaVideoItem.getHeight() / 2);
final long thumbNailStartTime = mediaVideoItem.getDuration() / 2;
final long thumbNailEndTime = thumbNailStartTime;
final Bitmap[] thumbNailBmp = mediaVideoItem.getThumbnailList(outWidth, outHeight, thumbNailStartTime, thumbNailEndTime, tnCount);
assertNotNull("Thumbnail Retrived is Null", thumbNailBmp);
assertEquals("Thumbnail Count", tnCount, thumbNailBmp.length);
for (int i = 0; i < thumbNailBmp.length; i++) {
validateThumbnail(thumbNailBmp[i], outWidth, outHeight);
thumbNailBmp[i] = null;
}
}
use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.
the class MediaItemThumbnailTest method testThumbnailForH264HD960.
/**
* To test thumbnail / frame extraction on H264 960x720.
*/
@LargeTest
public void testThumbnailForH264HD960() throws Exception {
final String videoItemFilename = INPUT_FILE_PATH + "H264_BP_960x720_25fps_800kbps_AACLC_48Khz_192Kbps_s_1_17.mp4";
final int outWidth = 75;
final int outHeight = 75;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
final MediaVideoItem mediaVideoItem = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename, renderingMode);
final long atTime = mediaVideoItem.getDuration() - 1000;
final Bitmap thumbNailBmp = mediaVideoItem.getThumbnail(outWidth, outHeight, atTime);
validateThumbnail(thumbNailBmp, outWidth, outHeight);
}
use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.
the class MediaItemThumbnailTest method testThumbnailForMPEG4WVGA.
/**
* To test thumbnail / frame extraction on MPEG4 WVGA.
*/
@LargeTest
public void testThumbnailForMPEG4WVGA() throws Exception {
final String videoItemFilename = INPUT_FILE_PATH + "MPEG4_SP_800x480_515kbps_15fps_AMR_NB_8KHz_12.2kbps_m_0_26.mp4";
final int atTime = 0;
final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
final MediaVideoItem mediaVideoItem = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename, renderingMode);
final int outWidth = mediaVideoItem.getWidth() * 2;
final int outHeight = mediaVideoItem.getHeight();
final Bitmap thumbNailBmp = mediaVideoItem.getThumbnail(outWidth, outHeight, atTime);
validateThumbnail(thumbNailBmp, outWidth, outHeight);
}
Aggregations