Search in sources :

Example 1 with Effect

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

the class VideoEditorPreviewTest method testPreviewOfEffects.

/**
     * To test Preview : Preview of current Effects applied
     */
@LargeTest
public void testPreviewOfEffects() throws Exception {
    final String videoItemFileName1 = INPUT_FILE_PATH + "H264_BP_640x480_30fps_256kbps_1_17.mp4";
    final Semaphore blockTillPreviewCompletes = new Semaphore(1);
    previewStart = false;
    previewStop = false;
    final MediaVideoItem mediaVideoItem1 = mVideoEditorHelper.createMediaItem(mVideoEditor, "mediaVideoItem1", videoItemFileName1, MediaItem.RENDERING_MODE_BLACK_BORDER);
    mVideoEditor.addMediaItem(mediaVideoItem1);
    final EffectColor effectNegative = mVideoEditorHelper.createEffectItem(mediaVideoItem1, "effectNegative", 0, 2000, EffectColor.TYPE_NEGATIVE, 0);
    mediaVideoItem1.addEffect(effectNegative);
    final EffectColor effectGreen = mVideoEditorHelper.createEffectItem(mediaVideoItem1, "effectGreen", 2000, 3000, EffectColor.TYPE_COLOR, EffectColor.GREEN);
    mediaVideoItem1.addEffect(effectGreen);
    final EffectColor effectFifties = mVideoEditorHelper.createEffectItem(mediaVideoItem1, "effectFifties", 5000, 4000, EffectColor.TYPE_FIFTIES, 0);
    mediaVideoItem1.addEffect(effectFifties);
    List<Effect> effectList = mediaVideoItem1.getAllEffects();
    assertEquals("Effect List Size", 3, effectList.size());
    assertEquals("Effect negative", effectNegative, effectList.get(0));
    assertEquals("Effect Green", effectGreen, effectList.get(1));
    assertEquals("Effect Fifties", effectFifties, effectList.get(2));
    mVideoEditor.setAspectRatio(MediaProperties.ASPECT_RATIO_4_3);
    assertEquals("Aspect Ratio", MediaProperties.ASPECT_RATIO_4_3, mVideoEditor.getAspectRatio());
    final long storyboardDuration = mVideoEditor.getDuration();
    validatePreviewProgress(0, (int) (storyboardDuration / 2), false, (storyboardDuration / 2));
    assertEquals("Removing Effect : Negative", effectNegative, mediaVideoItem1.removeEffect(effectNegative.getId()));
    effectList = mediaVideoItem1.getAllEffects();
    assertEquals("Effect List Size", 2, effectList.size());
    assertEquals("Effect Green", effectGreen, effectList.get(0));
    assertEquals("Effect Fifties", effectFifties, effectList.get(1));
    validatePreviewProgress(0, -1, false, mVideoEditor.getDuration());
}
Also used : EffectColor(android.media.videoeditor.EffectColor) MediaVideoItem(android.media.videoeditor.MediaVideoItem) Effect(android.media.videoeditor.Effect) Semaphore(java.util.concurrent.Semaphore) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

Effect (android.media.videoeditor.Effect)1 EffectColor (android.media.videoeditor.EffectColor)1 MediaVideoItem (android.media.videoeditor.MediaVideoItem)1 LargeTest (android.test.suitebuilder.annotation.LargeTest)1 Semaphore (java.util.concurrent.Semaphore)1