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;
}
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);
}
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);
}
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);
}
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());
}
Aggregations