Search in sources :

Example 66 with MediaVideoItem

use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.

the class MediaItemThumbnailTest method testThumbnailWithNegativeWidth.

/**
     * Check the thumbnail / frame list extraction for Width as Negative Value
     */
@LargeTest
public void testThumbnailWithNegativeWidth() throws Exception {
    final String videoItemFilename = INPUT_FILE_PATH + "MPEG4_SP_176x144_30fps_256kbps_AACLC_44.1kHz_96kbps_s_1_17.3gp";
    final int tnCount = 10;
    final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
    boolean flagForException = false;
    try {
        final MediaVideoItem mediaVideoItem = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename, renderingMode);
        final int outWidth = -1;
        final int outHeight = mediaVideoItem.getHeight();
        final long thumbNailStartTime = mediaVideoItem.getBoundaryBeginTime() / 2;
        final long thumbNailEndTime = mediaVideoItem.getBoundaryEndTime();
        mediaVideoItem.getThumbnailList(outWidth, outHeight, thumbNailStartTime, thumbNailEndTime, tnCount);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Thumbnail List with negative Height", flagForException);
}
Also used : MediaVideoItem(android.media.videoeditor.MediaVideoItem) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 67 with MediaVideoItem

use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.

the class MediaItemThumbnailTest method testThumbnailListH264VGA.

/**
     *To test ThumbnailList for H264 VGA
     */
@LargeTest
public void testThumbnailListH264VGA() throws Exception {
    final String videoItemFilename = INPUT_FILE_PATH + "H264_BP_640x480_30fps_256kbps_1_17.mp4";
    final int tnCount = 10;
    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 startTime = mediaVideoItem.getDuration() / 3;
    final long endTime = mediaVideoItem.getDuration() / 2;
    final Bitmap[] thumbNailBmp = mediaVideoItem.getThumbnailList(outWidth, outHeight, startTime, endTime, 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;
    }
}
Also used : Bitmap(android.graphics.Bitmap) MediaVideoItem(android.media.videoeditor.MediaVideoItem) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 68 with MediaVideoItem

use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.

the class MediaItemThumbnailTest method testThumbnailForMPEG4VGA.

/**
     * To test thumbnail / frame extraction on MPEG4 VGA .
     */
@LargeTest
public void testThumbnailForMPEG4VGA() throws Exception {
    final String videoItemFilename = INPUT_FILE_PATH + "MPEG4_SP_640x480_30fps_512Kbps_0_23.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() / 2);
    final int outHeight = mediaVideoItem.getHeight();
    final Bitmap thumbNailBmp = mediaVideoItem.getThumbnail(outWidth, outHeight, atTime);
    validateThumbnail(thumbNailBmp, outWidth, outHeight);
}
Also used : Bitmap(android.graphics.Bitmap) MediaVideoItem(android.media.videoeditor.MediaVideoItem) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 69 with MediaVideoItem

use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.

the class MediaItemThumbnailTest method testThumbnailListH263QCIF.

/**
     *To test ThumbnailList for H263 QCIF
     */
@LargeTest
public void testThumbnailListH263QCIF() throws Exception {
    final String videoItemFilename = INPUT_FILE_PATH + "H263_profile0_176x144_15fps_256kbps_AACLC_32kHz_128kbps_s_1_17.3gp";
    final int startTime = 0;
    final int tnCount = 10;
    final int renderingMode = MediaItem.RENDERING_MODE_BLACK_BORDER;
    final MediaVideoItem mediaVideoItem = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", videoItemFilename, renderingMode);
    final int outWidth = mediaVideoItem.getWidth() / 4;
    final int outHeight = mediaVideoItem.getHeight() / 4;
    final long endTime = mediaVideoItem.getDuration() / 2;
    final Bitmap[] thumbNailBmp = mediaVideoItem.getThumbnailList(outWidth, outHeight, startTime, endTime, 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;
    }
}
Also used : Bitmap(android.graphics.Bitmap) MediaVideoItem(android.media.videoeditor.MediaVideoItem) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 70 with MediaVideoItem

use of android.media.videoeditor.MediaVideoItem in project android_frameworks_base by ParanoidAndroid.

the class MediaItemThumbnailTest method testThumbnailWithCorruptedVideoPart.

/**
     *To test ThumbnailList for file which has video part corrupted
     */
@LargeTest
public void testThumbnailWithCorruptedVideoPart() throws Exception {
    final String videoItemFilename = INPUT_FILE_PATH + "corrupted_H264_BP_640x480_12.5fps_256kbps_AACLC_16khz_24kbps_s_0_26.mp4";
    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();
        final int outHeight = mediaVideoItem.getHeight() * 2;
        final Bitmap thumbNailBmp = mediaVideoItem.getThumbnail(outWidth, outHeight, mediaVideoItem.getDuration() / 2);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Corrupted File cannot be read", flagForException);
}
Also used : Bitmap(android.graphics.Bitmap) MediaVideoItem(android.media.videoeditor.MediaVideoItem) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

MediaVideoItem (android.media.videoeditor.MediaVideoItem)119 LargeTest (android.test.suitebuilder.annotation.LargeTest)115 Bitmap (android.graphics.Bitmap)39 MediaImageItem (android.media.videoeditor.MediaImageItem)28 MediaProcessingProgressListener (android.media.videoeditor.VideoEditor.MediaProcessingProgressListener)17 EffectColor (android.media.videoeditor.EffectColor)16 TransitionCrossfade (android.media.videoeditor.TransitionCrossfade)15 VideoEditor (android.media.videoeditor.VideoEditor)15 AudioTrack (android.media.videoeditor.AudioTrack)12 OverlayFrame (android.media.videoeditor.OverlayFrame)11 ExportProgressListener (android.media.videoeditor.VideoEditor.ExportProgressListener)11 TransitionAlpha (android.media.videoeditor.TransitionAlpha)9 Semaphore (java.util.concurrent.Semaphore)9 OverlayData (android.media.videoeditor.VideoEditor.OverlayData)7 SurfaceHolder (android.view.SurfaceHolder)7 TransitionFadeBlack (android.media.videoeditor.TransitionFadeBlack)6 TransitionSliding (android.media.videoeditor.TransitionSliding)6 Rect (android.graphics.Rect)5 EffectKenBurns (android.media.videoeditor.EffectKenBurns)5 MediaItem (android.media.videoeditor.MediaItem)5