Search in sources :

Example 11 with AudioTrack

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

the class VideoEditorHelper method createAudio.

/**
     *This Method creates object of Type AudioTrack
     *
     * @return OverlayFrame object
     */
public AudioTrack createAudio(VideoEditor videoEditor, String audioTrackId, String filename) {
    AudioTrack audio = null;
    try {
        audio = new AudioTrack(videoEditor, audioTrackId, filename);
        assertNotNull("Cant not create an object of an  AudioTrack " + audioTrackId, audio);
    } catch (IllegalArgumentException e) {
        assertTrue("Can not create object of an AudioTrack " + audioTrackId + " Issue = " + e.toString(), false);
    } catch (IOException e) {
        assertTrue("Can not create object of an AudioTrack " + audioTrackId + " Issue = " + e.toString(), false);
    }
    return audio;
}
Also used : AudioTrack(android.media.videoeditor.AudioTrack) IOException(java.io.IOException)

Example 12 with AudioTrack

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

the class MediaPropertiesTest method testProperties3GPWithoutVideoAudioTrack.

/**
     *To test media properties for Audio Track file. (No Video, AAC Audio)
     */
@LargeTest
public void testProperties3GPWithoutVideoAudioTrack() throws Exception {
    final String audioFilename = INPUT_FILE_PATH + "AACLC_44.1kHz_256kbps_s_1_17.mp4";
    final int duration = 77554;
    final int audioBitrate = 384000;
    final int audioCodecType = MediaProperties.ACODEC_AAC_LC;
    final int audioSamplingFrequency = 44100;
    final int audioChannel = 2;
    final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "a1", audioFilename);
    validateAudioProperties(audioCodecType, duration, audioSamplingFrequency, audioChannel, audioBitrate, audioTrack);
}
Also used : AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 13 with AudioTrack

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

the class MediaPropertiesTest method testPropertiesMP3AudioTrack.

/**
     *To test media properties for Audio Track file. MP3 file
     */
@LargeTest
public void testPropertiesMP3AudioTrack() throws Exception {
    final String audioFilename = INPUT_FILE_PATH + "MP3_48KHz_128kbps_s_1_17.mp3";
    final int duration = 77640;
    final int audioBitrate = 128000;
    final int audioCodecType = MediaProperties.ACODEC_MP3;
    final int audioSamplingFrequency = 48000;
    final int audioChannel = 2;
    final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "a1", audioFilename);
    validateAudioProperties(audioCodecType, duration, audioSamplingFrequency, audioChannel, audioBitrate, audioTrack);
}
Also used : AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 14 with AudioTrack

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

the class VideoEditorAPITest method testAudioTrackExtractBoundaries.

/**
     * To test creation of Audio Track with set extract boundaries
     */
@LargeTest
public void testAudioTrackExtractBoundaries() throws Exception {
    final String audioFileName = INPUT_FILE_PATH + "AACLC_48KHz_256Kbps_s_1_17.3gp";
    boolean flagForException = false;
    final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "audioTrack", audioFileName);
    mVideoEditor.addAudioTrack(audioTrack);
    audioTrack.setExtractBoundaries(1000, 5000);
    assertEquals("Audio Track Start time", 1000, audioTrack.getBoundaryBeginTime());
    assertEquals("Audio Track End time", 5000, audioTrack.getBoundaryEndTime());
    try {
        audioTrack.setExtractBoundaries(0, 100000000);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Audio Track With endTime > FileDuration", flagForException);
    flagForException = false;
    try {
        audioTrack.setExtractBoundaries(100000000, 5000);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Audio Track With startTime > FileDuration", flagForException);
    flagForException = false;
    try {
        audioTrack.setExtractBoundaries(0, 0);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    /* This is under discussion.  Hence, checked for False */
    assertFalse("Audio Track With startTime = endTime", flagForException);
    assertEquals("Audio Track Start time", 0, audioTrack.getBoundaryBeginTime());
    assertEquals("Audio Track End time", 0, audioTrack.getBoundaryEndTime());
    assertEquals("Audio Track Start time", 0, audioTrack.getBoundaryBeginTime());
    assertEquals("Audio Track End time", (audioTrack.getTimelineDuration()), audioTrack.getBoundaryEndTime());
    audioTrack.setExtractBoundaries(0, audioTrack.getDuration() / 2);
    assertEquals("Audio Track Start time", 0, audioTrack.getBoundaryBeginTime());
    assertEquals("Audio Track End time", (audioTrack.getDuration() / 2), audioTrack.getBoundaryEndTime());
    audioTrack.setExtractBoundaries(1, audioTrack.getDuration() - 1);
    assertEquals("Audio Track Start time", 1, audioTrack.getBoundaryBeginTime());
    assertEquals("Audio Track End time", (audioTrack.getDuration() - 1), audioTrack.getBoundaryEndTime());
    flagForException = false;
    try {
        audioTrack.setExtractBoundaries(0, -1);
    } catch (IllegalArgumentException e) {
        flagForException = true;
    }
    assertTrue("Audio Track end time < 0", flagForException);
}
Also used : AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 15 with AudioTrack

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

the class VideoEditorAPITest method testAudioDuckingDisable.

/**
     * To test: Disable ducking
     *
     * @throws Exception
     */
@LargeTest
public void testAudioDuckingDisable() throws Exception {
    final String audioFileName = INPUT_FILE_PATH + "AACLC_48KHz_256Kbps_s_1_17.3gp";
    final AudioTrack audioTrack = mVideoEditorHelper.createAudio(mVideoEditor, "audioTrack", audioFileName);
    mVideoEditor.addAudioTrack(audioTrack);
    audioTrack.disableDucking();
    assertFalse("Audio Track Ducking is Disabled", audioTrack.isDuckingEnabled());
}
Also used : AudioTrack(android.media.videoeditor.AudioTrack) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

AudioTrack (android.media.videoeditor.AudioTrack)26 LargeTest (android.test.suitebuilder.annotation.LargeTest)25 MediaVideoItem (android.media.videoeditor.MediaVideoItem)12 MediaImageItem (android.media.videoeditor.MediaImageItem)10 TransitionCrossfade (android.media.videoeditor.TransitionCrossfade)5 MediaProcessingProgressListener (android.media.videoeditor.VideoEditor.MediaProcessingProgressListener)5 Bitmap (android.graphics.Bitmap)2 Rect (android.graphics.Rect)2 EffectColor (android.media.videoeditor.EffectColor)2 EffectKenBurns (android.media.videoeditor.EffectKenBurns)2 MediaItem (android.media.videoeditor.MediaItem)2 OverlayFrame (android.media.videoeditor.OverlayFrame)2 VideoEditor (android.media.videoeditor.VideoEditor)2 ExportProgressListener (android.media.videoeditor.VideoEditor.ExportProgressListener)2 ExtractAudioWaveformProgressListener (android.media.videoeditor.ExtractAudioWaveformProgressListener)1 Transition (android.media.videoeditor.Transition)1 TransitionAlpha (android.media.videoeditor.TransitionAlpha)1 TransitionFadeBlack (android.media.videoeditor.TransitionFadeBlack)1 TransitionSliding (android.media.videoeditor.TransitionSliding)1 OverlayData (android.media.videoeditor.VideoEditor.OverlayData)1