Separate the dump files from the test assets

This allows us to more easily create different dumps derived from the
same assets.

This moves media/source files from `assets/` to `assets/media/` and
dump files from `assets/` to `assets/extractordumps/` and
`assets/audiosinkdumps/` as appropriate. I intend to add
`assets/playbackdumps/` in a future CL.

PiperOrigin-RevId: 326986283
This commit is contained in:
ibaker 2020-08-17 11:03:17 +01:00 committed by kim-vde
parent 333ccedf80
commit f0ae8afd80
670 changed files with 411 additions and 313 deletions

View file

@ -37,9 +37,10 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class FlacExtractorSeekTest { public final class FlacExtractorSeekTest {
private static final String TEST_FILE_SEEK_TABLE = "flac/bear.flac"; private static final String TEST_FILE_SEEK_TABLE = "media/flac/bear.flac";
private static final String TEST_FILE_BINARY_SEARCH = "flac/bear_one_metadata_block.flac"; private static final String TEST_FILE_BINARY_SEARCH = "media/flac/bear_one_metadata_block.flac";
private static final String TEST_FILE_UNSEEKABLE = "flac/bear_no_seek_table_no_num_samples.flac"; private static final String TEST_FILE_UNSEEKABLE =
"media/flac/bear_no_seek_table_no_num_samples.flac";
private static final int DURATION_US = 2_741_000; private static final int DURATION_US = 2_741_000;
private FlacExtractor extractor = new FlacExtractor(); private FlacExtractor extractor = new FlacExtractor();

View file

@ -39,78 +39,80 @@ public class FlacExtractorTest {
@Test @Test
public void sample() throws Exception { public void sample() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
FlacExtractor::new, /* file= */ "flac/bear.flac", /* dumpFilesPrefix= */ "flac/bear_raw"); FlacExtractor::new,
/* file= */ "media/flac/bear.flac",
/* dumpFilesPrefix= */ "extractordumps/flac/bear_raw");
} }
@Test @Test
public void sampleWithId3HeaderAndId3Enabled() throws Exception { public void sampleWithId3HeaderAndId3Enabled() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
FlacExtractor::new, FlacExtractor::new,
/* file= */ "flac/bear_with_id3.flac", /* file= */ "media/flac/bear_with_id3.flac",
/* dumpFilesPrefix= */ "flac/bear_with_id3_enabled_raw"); /* dumpFilesPrefix= */ "extractordumps/flac/bear_with_id3_enabled_raw");
} }
@Test @Test
public void sampleWithId3HeaderAndId3Disabled() throws Exception { public void sampleWithId3HeaderAndId3Disabled() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
() -> new FlacExtractor(FlacExtractor.FLAG_DISABLE_ID3_METADATA), () -> new FlacExtractor(FlacExtractor.FLAG_DISABLE_ID3_METADATA),
/* file= */ "flac/bear_with_id3.flac", /* file= */ "media/flac/bear_with_id3.flac",
/* dumpFilesPrefix= */ "flac/bear_with_id3_disabled_raw"); /* dumpFilesPrefix= */ "extractordumps/flac/bear_with_id3_disabled_raw");
} }
@Test @Test
public void sampleUnseekable() throws Exception { public void sampleUnseekable() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
FlacExtractor::new, FlacExtractor::new,
/* file= */ "flac/bear_no_seek_table_no_num_samples.flac", /* file= */ "media/flac/bear_no_seek_table_no_num_samples.flac",
/* dumpFilesPrefix= */ "flac/bear_no_seek_table_no_num_samples_raw"); /* dumpFilesPrefix= */ "extractordumps/flac/bear_no_seek_table_no_num_samples_raw");
} }
@Test @Test
public void sampleWithVorbisComments() throws Exception { public void sampleWithVorbisComments() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
FlacExtractor::new, FlacExtractor::new,
/* file= */ "flac/bear_with_vorbis_comments.flac", /* file= */ "media/flac/bear_with_vorbis_comments.flac",
/* dumpFilesPrefix= */ "flac/bear_with_vorbis_comments_raw"); /* dumpFilesPrefix= */ "extractordumps/flac/bear_with_vorbis_comments_raw");
} }
@Test @Test
public void sampleWithPicture() throws Exception { public void sampleWithPicture() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
FlacExtractor::new, FlacExtractor::new,
/* file= */ "flac/bear_with_picture.flac", /* file= */ "media/flac/bear_with_picture.flac",
/* dumpFilesPrefix= */ "flac/bear_with_picture_raw"); /* dumpFilesPrefix= */ "extractordumps/flac/bear_with_picture_raw");
} }
@Test @Test
public void oneMetadataBlock() throws Exception { public void oneMetadataBlock() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
FlacExtractor::new, FlacExtractor::new,
/* file= */ "flac/bear_one_metadata_block.flac", /* file= */ "media/flac/bear_one_metadata_block.flac",
/* dumpFilesPrefix= */ "flac/bear_one_metadata_block_raw"); /* dumpFilesPrefix= */ "extractordumps/flac/bear_one_metadata_block_raw");
} }
@Test @Test
public void noMinMaxFrameSize() throws Exception { public void noMinMaxFrameSize() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
FlacExtractor::new, FlacExtractor::new,
/* file= */ "flac/bear_no_min_max_frame_size.flac", /* file= */ "media/flac/bear_no_min_max_frame_size.flac",
/* dumpFilesPrefix= */ "flac/bear_no_min_max_frame_size_raw"); /* dumpFilesPrefix= */ "extractordumps/flac/bear_no_min_max_frame_size_raw");
} }
@Test @Test
public void noNumSamples() throws Exception { public void noNumSamples() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
FlacExtractor::new, FlacExtractor::new,
/* file= */ "flac/bear_no_num_samples.flac", /* file= */ "media/flac/bear_no_num_samples.flac",
/* dumpFilesPrefix= */ "flac/bear_no_num_samples_raw"); /* dumpFilesPrefix= */ "extractordumps/flac/bear_no_num_samples_raw");
} }
@Test @Test
public void uncommonSampleRate() throws Exception { public void uncommonSampleRate() throws Exception {
ExtractorAsserts.assertAllBehaviors( ExtractorAsserts.assertAllBehaviors(
FlacExtractor::new, FlacExtractor::new,
/* file= */ "flac/bear_uncommon_sample_rate.flac", /* file= */ "media/flac/bear_uncommon_sample_rate.flac",
/* dumpFilesPrefix= */ "flac/bear_uncommon_sample_rate_raw"); /* dumpFilesPrefix= */ "extractordumps/flac/bear_uncommon_sample_rate_raw");
} }
} }

View file

@ -71,7 +71,7 @@ public class FlacPlaybackTest {
TestPlaybackRunnable testPlaybackRunnable = TestPlaybackRunnable testPlaybackRunnable =
new TestPlaybackRunnable( new TestPlaybackRunnable(
Uri.parse("asset:///" + fileName), Uri.parse("asset:///media/" + fileName),
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
audioSink); audioSink);
Thread thread = new Thread(testPlaybackRunnable); Thread thread = new Thread(testPlaybackRunnable);
@ -82,7 +82,9 @@ public class FlacPlaybackTest {
} }
DumpFileAsserts.assertOutput( DumpFileAsserts.assertOutput(
ApplicationProvider.getApplicationContext(), audioSink, fileName + ".audiosink.dump"); ApplicationProvider.getApplicationContext(),
audioSink,
"audiosinkdumps/" + fileName + ".audiosink.dump");
} }
private static class TestPlaybackRunnable implements Player.EventListener, Runnable { private static class TestPlaybackRunnable implements Player.EventListener, Runnable {

View file

@ -39,9 +39,9 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class OpusPlaybackTest { public class OpusPlaybackTest {
private static final String BEAR_OPUS_URI = "asset:///mka/bear-opus.mka"; private static final String BEAR_OPUS_URI = "asset:///media/mka/bear-opus.mka";
private static final String BEAR_OPUS_NEGATIVE_GAIN_URI = private static final String BEAR_OPUS_NEGATIVE_GAIN_URI =
"asset:///mka/bear-opus-negative-gain.mka"; "asset:///media/mka/bear-opus-negative-gain.mka";
@Before @Before
public void setUp() { public void setUp() {

View file

@ -43,10 +43,11 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class VpxPlaybackTest { public class VpxPlaybackTest {
private static final String BEAR_URI = "asset:///vp9/bear-vp9.webm"; private static final String BEAR_URI = "asset:///media/vp9/bear-vp9.webm";
private static final String BEAR_ODD_DIMENSIONS_URI = "asset:///vp9/bear-vp9-odd-dimensions.webm"; private static final String BEAR_ODD_DIMENSIONS_URI =
private static final String ROADTRIP_10BIT_URI = "asset:///vp9/roadtrip-vp92-10bit.webm"; "asset:///media/vp9/bear-vp9-odd-dimensions.webm";
private static final String INVALID_BITSTREAM_URI = "asset:///vp9/invalid-bitstream.webm"; private static final String ROADTRIP_10BIT_URI = "asset:///media/vp9/roadtrip-vp92-10bit.webm";
private static final String INVALID_BITSTREAM_URI = "asset:///media/vp9/invalid-bitstream.webm";
private static final String TAG = "VpxPlaybackTest"; private static final String TAG = "VpxPlaybackTest";

View file

@ -46,7 +46,7 @@ import org.junit.runner.RunWith;
public final class ContentDataSourceTest { public final class ContentDataSourceTest {
private static final String AUTHORITY = "com.google.android.exoplayer2.core.test"; private static final String AUTHORITY = "com.google.android.exoplayer2.core.test";
private static final String DATA_PATH = "mp3/1024_incrementing_bytes.mp3"; private static final String DATA_PATH = "media/mp3/1024_incrementing_bytes.mp3";
@Test @Test
public void read() throws Exception { public void read() throws Exception {

View file

@ -33,9 +33,9 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class AppInfoTableDecoderTest { public final class AppInfoTableDecoderTest {
private static final String TYPICAL_FILE = "dvbsi/ait_typical.bin"; private static final String TYPICAL_FILE = "media/dvbsi/ait_typical.bin";
private static final String NO_URL_BASE_FILE = "dvbsi/ait_no_url_base.bin"; private static final String NO_URL_BASE_FILE = "media/dvbsi/ait_no_url_base.bin";
private static final String NO_URL_PATH_FILE = "dvbsi/ait_no_url_path.bin"; private static final String NO_URL_PATH_FILE = "media/dvbsi/ait_no_url_path.bin";
@Test @Test
public void decode_typical() throws Exception { public void decode_typical() throws Exception {

View file

@ -57,7 +57,7 @@ public class ActionFileTest {
@Test @Test
public void loadNoDataThrowsIOException() throws Exception { public void loadNoDataThrowsIOException() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_no_data.exi"); ActionFile actionFile = getActionFile("media/offline/action_file_no_data.exi");
try { try {
actionFile.load(); actionFile.load();
Assert.fail(); Assert.fail();
@ -68,7 +68,7 @@ public class ActionFileTest {
@Test @Test
public void loadIncompleteHeaderThrowsIOException() throws Exception { public void loadIncompleteHeaderThrowsIOException() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_incomplete_header.exi"); ActionFile actionFile = getActionFile("media/offline/action_file_incomplete_header.exi");
try { try {
actionFile.load(); actionFile.load();
Assert.fail(); Assert.fail();
@ -79,7 +79,7 @@ public class ActionFileTest {
@Test @Test
public void loadZeroActions() throws Exception { public void loadZeroActions() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_zero_actions.exi"); ActionFile actionFile = getActionFile("media/offline/action_file_zero_actions.exi");
DownloadRequest[] actions = actionFile.load(); DownloadRequest[] actions = actionFile.load();
assertThat(actions).isNotNull(); assertThat(actions).isNotNull();
assertThat(actions).hasLength(0); assertThat(actions).hasLength(0);
@ -87,7 +87,7 @@ public class ActionFileTest {
@Test @Test
public void loadOneAction() throws Exception { public void loadOneAction() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_one_action.exi"); ActionFile actionFile = getActionFile("media/offline/action_file_one_action.exi");
DownloadRequest[] actions = actionFile.load(); DownloadRequest[] actions = actionFile.load();
assertThat(actions).hasLength(1); assertThat(actions).hasLength(1);
assertThat(actions[0]).isEqualTo(expectedAction1); assertThat(actions[0]).isEqualTo(expectedAction1);
@ -95,7 +95,7 @@ public class ActionFileTest {
@Test @Test
public void loadTwoActions() throws Exception { public void loadTwoActions() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_two_actions.exi"); ActionFile actionFile = getActionFile("media/offline/action_file_two_actions.exi");
DownloadRequest[] actions = actionFile.load(); DownloadRequest[] actions = actionFile.load();
assertThat(actions).hasLength(2); assertThat(actions).hasLength(2);
assertThat(actions[0]).isEqualTo(expectedAction1); assertThat(actions[0]).isEqualTo(expectedAction1);
@ -104,7 +104,7 @@ public class ActionFileTest {
@Test @Test
public void loadUnsupportedVersion() throws Exception { public void loadUnsupportedVersion() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_unsupported_version.exi"); ActionFile actionFile = getActionFile("media/offline/action_file_unsupported_version.exi");
try { try {
actionFile.load(); actionFile.load();
Assert.fail(); Assert.fail();

View file

@ -61,7 +61,7 @@ public class ActionFileUpgradeUtilTest {
byte[] actionFileBytes = byte[] actionFileBytes =
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
"offline/action_file_for_download_index_upgrade_progressive.exi"); "media/offline/action_file_for_download_index_upgrade_progressive.exi");
try (FileOutputStream output = new FileOutputStream(tempFile)) { try (FileOutputStream output = new FileOutputStream(tempFile)) {
output.write(actionFileBytes); output.write(actionFileBytes);
} }
@ -96,7 +96,7 @@ public class ActionFileUpgradeUtilTest {
byte[] actionFileBytes = byte[] actionFileBytes =
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
"offline/action_file_for_download_index_upgrade_dash.exi"); "media/offline/action_file_for_download_index_upgrade_dash.exi");
try (FileOutputStream output = new FileOutputStream(tempFile)) { try (FileOutputStream output = new FileOutputStream(tempFile)) {
output.write(actionFileBytes); output.write(actionFileBytes);
} }
@ -135,7 +135,7 @@ public class ActionFileUpgradeUtilTest {
byte[] actionFileBytes = byte[] actionFileBytes =
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
"offline/action_file_for_download_index_upgrade_hls.exi"); "media/offline/action_file_for_download_index_upgrade_hls.exi");
try (FileOutputStream output = new FileOutputStream(tempFile)) { try (FileOutputStream output = new FileOutputStream(tempFile)) {
output.write(actionFileBytes); output.write(actionFileBytes);
} }
@ -174,7 +174,7 @@ public class ActionFileUpgradeUtilTest {
byte[] actionFileBytes = byte[] actionFileBytes =
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
"offline/action_file_for_download_index_upgrade_ss.exi"); "media/offline/action_file_for_download_index_upgrade_ss.exi");
try (FileOutputStream output = new FileOutputStream(tempFile)) { try (FileOutputStream output = new FileOutputStream(tempFile)) {
output.write(actionFileBytes); output.write(actionFileBytes);
} }

View file

@ -224,7 +224,7 @@ public class DefaultDownloadIndexTest {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
File databaseFile = context.getDatabasePath(ExoDatabaseProvider.DATABASE_NAME); File databaseFile = context.getDatabasePath(ExoDatabaseProvider.DATABASE_NAME);
try (FileOutputStream output = new FileOutputStream(databaseFile)) { try (FileOutputStream output = new FileOutputStream(databaseFile)) {
output.write(TestUtil.getByteArray(context, "offline/exoplayer_internal_v2.db")); output.write(TestUtil.getByteArray(context, "media/offline/exoplayer_internal_v2.db"));
} }
Download dashDownload = Download dashDownload =
createDownload( createDownload(

View file

@ -46,7 +46,7 @@ public final class ProgressiveMediaPeriodTest {
MediaPeriodId mediaPeriodId = new MediaPeriodId(/* periodUid= */ new Object()); MediaPeriodId mediaPeriodId = new MediaPeriodId(/* periodUid= */ new Object());
ProgressiveMediaPeriod mediaPeriod = ProgressiveMediaPeriod mediaPeriod =
new ProgressiveMediaPeriod( new ProgressiveMediaPeriod(
Uri.parse("asset://android_asset/mp4/sample.mp4"), Uri.parse("asset://android_asset/media/mp4/sample.mp4"),
new AssetDataSource(ApplicationProvider.getApplicationContext()), new AssetDataSource(ApplicationProvider.getApplicationContext()),
() -> new Extractor[] {new Mp4Extractor()}, () -> new Extractor[] {new Mp4Extractor()},
DrmSessionManager.DUMMY, DrmSessionManager.DUMMY,

View file

@ -34,16 +34,16 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class SsaDecoderTest { public final class SsaDecoderTest {
private static final String EMPTY = "ssa/empty"; private static final String EMPTY = "media/ssa/empty";
private static final String TYPICAL = "ssa/typical"; private static final String TYPICAL = "media/ssa/typical";
private static final String TYPICAL_HEADER_ONLY = "ssa/typical_header"; private static final String TYPICAL_HEADER_ONLY = "media/ssa/typical_header";
private static final String TYPICAL_DIALOGUE_ONLY = "ssa/typical_dialogue"; private static final String TYPICAL_DIALOGUE_ONLY = "media/ssa/typical_dialogue";
private static final String TYPICAL_FORMAT_ONLY = "ssa/typical_format"; private static final String TYPICAL_FORMAT_ONLY = "media/ssa/typical_format";
private static final String OVERLAPPING_TIMECODES = "ssa/overlapping_timecodes"; private static final String OVERLAPPING_TIMECODES = "media/ssa/overlapping_timecodes";
private static final String POSITIONS = "ssa/positioning"; private static final String POSITIONS = "media/ssa/positioning";
private static final String INVALID_TIMECODES = "ssa/invalid_timecodes"; private static final String INVALID_TIMECODES = "media/ssa/invalid_timecodes";
private static final String INVALID_POSITIONS = "ssa/invalid_positioning"; private static final String INVALID_POSITIONS = "media/ssa/invalid_positioning";
private static final String POSITIONS_WITHOUT_PLAYRES = "ssa/positioning_without_playres"; private static final String POSITIONS_WITHOUT_PLAYRES = "media/ssa/positioning_without_playres";
@Test @Test
public void decodeEmpty() throws IOException { public void decodeEmpty() throws IOException {

View file

@ -30,16 +30,19 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class SubripDecoderTest { public final class SubripDecoderTest {
private static final String EMPTY_FILE = "subrip/empty"; private static final String EMPTY_FILE = "media/subrip/empty";
private static final String TYPICAL_FILE = "subrip/typical"; private static final String TYPICAL_FILE = "media/subrip/typical";
private static final String TYPICAL_WITH_BYTE_ORDER_MARK = "subrip/typical_with_byte_order_mark"; private static final String TYPICAL_WITH_BYTE_ORDER_MARK =
private static final String TYPICAL_EXTRA_BLANK_LINE = "subrip/typical_extra_blank_line"; "media/subrip/typical_with_byte_order_mark";
private static final String TYPICAL_MISSING_TIMECODE = "subrip/typical_missing_timecode"; private static final String TYPICAL_EXTRA_BLANK_LINE = "media/subrip/typical_extra_blank_line";
private static final String TYPICAL_MISSING_SEQUENCE = "subrip/typical_missing_sequence"; private static final String TYPICAL_MISSING_TIMECODE = "media/subrip/typical_missing_timecode";
private static final String TYPICAL_NEGATIVE_TIMESTAMPS = "subrip/typical_negative_timestamps"; private static final String TYPICAL_MISSING_SEQUENCE = "media/subrip/typical_missing_sequence";
private static final String TYPICAL_UNEXPECTED_END = "subrip/typical_unexpected_end"; private static final String TYPICAL_NEGATIVE_TIMESTAMPS =
private static final String TYPICAL_WITH_TAGS = "subrip/typical_with_tags"; "media/subrip/typical_negative_timestamps";
private static final String TYPICAL_NO_HOURS_AND_MILLIS = "subrip/typical_no_hours_and_millis"; private static final String TYPICAL_UNEXPECTED_END = "media/subrip/typical_unexpected_end";
private static final String TYPICAL_WITH_TAGS = "media/subrip/typical_with_tags";
private static final String TYPICAL_NO_HOURS_AND_MILLIS =
"media/subrip/typical_no_hours_and_millis";
@Test @Test
public void decodeEmpty() throws IOException { public void decodeEmpty() throws IOException {

View file

@ -40,30 +40,33 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class TtmlDecoderTest { public final class TtmlDecoderTest {
private static final String INLINE_ATTRIBUTES_TTML_FILE = "ttml/inline_style_attributes.xml"; private static final String INLINE_ATTRIBUTES_TTML_FILE =
private static final String INHERIT_STYLE_TTML_FILE = "ttml/inherit_style.xml"; "media/ttml/inline_style_attributes.xml";
private static final String INHERIT_STYLE_TTML_FILE = "media/ttml/inherit_style.xml";
private static final String INHERIT_STYLE_OVERRIDE_TTML_FILE = private static final String INHERIT_STYLE_OVERRIDE_TTML_FILE =
"ttml/inherit_and_override_style.xml"; "media/ttml/inherit_and_override_style.xml";
private static final String INHERIT_GLOBAL_AND_PARENT_TTML_FILE = private static final String INHERIT_GLOBAL_AND_PARENT_TTML_FILE =
"ttml/inherit_global_and_parent.xml"; "media/ttml/inherit_global_and_parent.xml";
private static final String INHERIT_MULTIPLE_STYLES_TTML_FILE = private static final String INHERIT_MULTIPLE_STYLES_TTML_FILE =
"ttml/inherit_multiple_styles.xml"; "media/ttml/inherit_multiple_styles.xml";
private static final String CHAIN_MULTIPLE_STYLES_TTML_FILE = "ttml/chain_multiple_styles.xml"; private static final String CHAIN_MULTIPLE_STYLES_TTML_FILE =
private static final String MULTIPLE_REGIONS_TTML_FILE = "ttml/multiple_regions.xml"; "media/ttml/chain_multiple_styles.xml";
private static final String MULTIPLE_REGIONS_TTML_FILE = "media/ttml/multiple_regions.xml";
private static final String NO_UNDERLINE_LINETHROUGH_TTML_FILE = private static final String NO_UNDERLINE_LINETHROUGH_TTML_FILE =
"ttml/no_underline_linethrough.xml"; "media/ttml/no_underline_linethrough.xml";
private static final String FONT_SIZE_TTML_FILE = "ttml/font_size.xml"; private static final String FONT_SIZE_TTML_FILE = "media/ttml/font_size.xml";
private static final String FONT_SIZE_MISSING_UNIT_TTML_FILE = "ttml/font_size_no_unit.xml"; private static final String FONT_SIZE_MISSING_UNIT_TTML_FILE = "media/ttml/font_size_no_unit.xml";
private static final String FONT_SIZE_INVALID_TTML_FILE = "ttml/font_size_invalid.xml"; private static final String FONT_SIZE_INVALID_TTML_FILE = "media/ttml/font_size_invalid.xml";
private static final String FONT_SIZE_EMPTY_TTML_FILE = "ttml/font_size_empty.xml"; private static final String FONT_SIZE_EMPTY_TTML_FILE = "media/ttml/font_size_empty.xml";
private static final String FRAME_RATE_TTML_FILE = "ttml/frame_rate.xml"; private static final String FRAME_RATE_TTML_FILE = "media/ttml/frame_rate.xml";
private static final String BITMAP_REGION_FILE = "ttml/bitmap_percentage_region.xml"; private static final String BITMAP_REGION_FILE = "media/ttml/bitmap_percentage_region.xml";
private static final String BITMAP_PIXEL_REGION_FILE = "ttml/bitmap_pixel_region.xml"; private static final String BITMAP_PIXEL_REGION_FILE = "media/ttml/bitmap_pixel_region.xml";
private static final String BITMAP_UNSUPPORTED_REGION_FILE = "ttml/bitmap_unsupported_region.xml"; private static final String BITMAP_UNSUPPORTED_REGION_FILE =
private static final String TEXT_ALIGN_FILE = "ttml/text_align.xml"; "media/ttml/bitmap_unsupported_region.xml";
private static final String VERTICAL_TEXT_FILE = "ttml/vertical_text.xml"; private static final String TEXT_ALIGN_FILE = "media/ttml/text_align.xml";
private static final String TEXT_COMBINE_FILE = "ttml/text_combine.xml"; private static final String VERTICAL_TEXT_FILE = "media/ttml/vertical_text.xml";
private static final String RUBIES_FILE = "ttml/rubies.xml"; private static final String TEXT_COMBINE_FILE = "media/ttml/text_combine.xml";
private static final String RUBIES_FILE = "media/ttml/rubies.xml";
@Test @Test
public void inlineAttributes() throws IOException, SubtitleDecoderException { public void inlineAttributes() throws IOException, SubtitleDecoderException {

View file

@ -41,17 +41,20 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class Tx3gDecoderTest { public final class Tx3gDecoderTest {
private static final String NO_SUBTITLE = "tx3g/no_subtitle"; private static final String NO_SUBTITLE = "media/tx3g/no_subtitle";
private static final String SAMPLE_JUST_TEXT = "tx3g/sample_just_text"; private static final String SAMPLE_JUST_TEXT = "media/tx3g/sample_just_text";
private static final String SAMPLE_WITH_STYL = "tx3g/sample_with_styl"; private static final String SAMPLE_WITH_STYL = "media/tx3g/sample_with_styl";
private static final String SAMPLE_WITH_STYL_ALL_DEFAULTS = "tx3g/sample_with_styl_all_defaults"; private static final String SAMPLE_WITH_STYL_ALL_DEFAULTS =
private static final String SAMPLE_UTF16_BE_NO_STYL = "tx3g/sample_utf16_be_no_styl"; "media/tx3g/sample_with_styl_all_defaults";
private static final String SAMPLE_UTF16_LE_NO_STYL = "tx3g/sample_utf16_le_no_styl"; private static final String SAMPLE_UTF16_BE_NO_STYL = "media/tx3g/sample_utf16_be_no_styl";
private static final String SAMPLE_WITH_MULTIPLE_STYL = "tx3g/sample_with_multiple_styl"; private static final String SAMPLE_UTF16_LE_NO_STYL = "media/tx3g/sample_utf16_le_no_styl";
private static final String SAMPLE_WITH_OTHER_EXTENSION = "tx3g/sample_with_other_extension"; private static final String SAMPLE_WITH_MULTIPLE_STYL = "media/tx3g/sample_with_multiple_styl";
private static final String SAMPLE_WITH_TBOX = "tx3g/sample_with_tbox"; private static final String SAMPLE_WITH_OTHER_EXTENSION =
private static final String INITIALIZATION = "tx3g/initialization"; "media/tx3g/sample_with_other_extension";
private static final String INITIALIZATION_ALL_DEFAULTS = "tx3g/initialization_all_defaults"; private static final String SAMPLE_WITH_TBOX = "media/tx3g/sample_with_tbox";
private static final String INITIALIZATION = "media/tx3g/initialization";
private static final String INITIALIZATION_ALL_DEFAULTS =
"media/tx3g/initialization_all_defaults";
@Test @Test
public void decodeNoSubtitle() throws IOException, SubtitleDecoderException { public void decodeNoSubtitle() throws IOException, SubtitleDecoderException {

View file

@ -41,23 +41,25 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class WebvttDecoderTest { public class WebvttDecoderTest {
private static final String TYPICAL_FILE = "webvtt/typical"; private static final String TYPICAL_FILE = "media/webvtt/typical";
private static final String TYPICAL_WITH_BAD_TIMESTAMPS = "webvtt/typical_with_bad_timestamps"; private static final String TYPICAL_WITH_BAD_TIMESTAMPS =
private static final String TYPICAL_WITH_IDS_FILE = "webvtt/typical_with_identifiers"; "media/webvtt/typical_with_bad_timestamps";
private static final String TYPICAL_WITH_COMMENTS_FILE = "webvtt/typical_with_comments"; private static final String TYPICAL_WITH_IDS_FILE = "media/webvtt/typical_with_identifiers";
private static final String WITH_POSITIONING_FILE = "webvtt/with_positioning"; private static final String TYPICAL_WITH_COMMENTS_FILE = "media/webvtt/typical_with_comments";
private static final String WITH_POSITIONING_FILE = "media/webvtt/with_positioning";
private static final String WITH_OVERLAPPING_TIMESTAMPS_FILE = private static final String WITH_OVERLAPPING_TIMESTAMPS_FILE =
"webvtt/with_overlapping_timestamps"; "media/webvtt/with_overlapping_timestamps";
private static final String WITH_VERTICAL_FILE = "webvtt/with_vertical"; private static final String WITH_VERTICAL_FILE = "media/webvtt/with_vertical";
private static final String WITH_RUBIES_FILE = "webvtt/with_rubies"; private static final String WITH_RUBIES_FILE = "media/webvtt/with_rubies";
private static final String WITH_BAD_CUE_HEADER_FILE = "webvtt/with_bad_cue_header"; private static final String WITH_BAD_CUE_HEADER_FILE = "media/webvtt/with_bad_cue_header";
private static final String WITH_TAGS_FILE = "webvtt/with_tags"; private static final String WITH_TAGS_FILE = "media/webvtt/with_tags";
private static final String WITH_CSS_STYLES = "webvtt/with_css_styles"; private static final String WITH_CSS_STYLES = "media/webvtt/with_css_styles";
private static final String WITH_CSS_COMPLEX_SELECTORS = "webvtt/with_css_complex_selectors"; private static final String WITH_CSS_COMPLEX_SELECTORS =
"media/webvtt/with_css_complex_selectors";
private static final String WITH_CSS_TEXT_COMBINE_UPRIGHT = private static final String WITH_CSS_TEXT_COMBINE_UPRIGHT =
"webvtt/with_css_text_combine_upright"; "media/webvtt/with_css_text_combine_upright";
private static final String WITH_BOM = "webvtt/with_bom"; private static final String WITH_BOM = "media/webvtt/with_bom";
private static final String EMPTY_FILE = "webvtt/empty"; private static final String EMPTY_FILE = "media/webvtt/empty";
@Rule public final Expect expect = Expect.create(); @Rule public final Expect expect = Expect.create();

View file

@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class AssetDataSourceTest { public final class AssetDataSourceTest {
private static final String DATA_PATH = "mp3/1024_incrementing_bytes.mp3"; private static final String DATA_PATH = "media/mp3/1024_incrementing_bytes.mp3";
@Test @Test
public void readFileUri() throws Exception { public void readFileUri() throws Exception {

View file

@ -58,7 +58,7 @@ public final class DashMediaPeriodTest {
// - Embedded track groups. // - Embedded track groups.
// All cases are deliberately combined in one test to catch potential indexing problems which // All cases are deliberately combined in one test to catch potential indexing problems which
// only occur in combination. // only occur in combination.
DashManifest manifest = parseManifest("mpd/sample_mpd_stream_keys"); DashManifest manifest = parseManifest("media/mpd/sample_mpd_stream_keys");
// Ignore embedded metadata as we don't want to select primary group just to get embedded track. // Ignore embedded metadata as we don't want to select primary group just to get embedded track.
MediaPeriodAsserts.assertGetStreamKeysAndManifestFilterIntegration( MediaPeriodAsserts.assertGetStreamKeysAndManifestFilterIntegration(
@ -70,7 +70,7 @@ public final class DashMediaPeriodTest {
@Test @Test
public void adaptationSetSwitchingProperty_mergesTrackGroups() throws IOException { public void adaptationSetSwitchingProperty_mergesTrackGroups() throws IOException {
DashManifest manifest = parseManifest("mpd/sample_mpd_switching_property"); DashManifest manifest = parseManifest("media/mpd/sample_mpd_switching_property");
DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0); DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0);
List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets; List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets;
@ -91,7 +91,7 @@ public final class DashMediaPeriodTest {
@Test @Test
public void trickPlayProperty_mergesTrackGroups() throws IOException { public void trickPlayProperty_mergesTrackGroups() throws IOException {
DashManifest manifest = parseManifest("mpd/sample_mpd_trick_play_property"); DashManifest manifest = parseManifest("media/mpd/sample_mpd_trick_play_property");
DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0); DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0);
List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets; List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets;
@ -114,7 +114,7 @@ public final class DashMediaPeriodTest {
@Test @Test
public void adaptationSetSwitchingProperty_andTrickPlayProperty_mergesTrackGroups() public void adaptationSetSwitchingProperty_andTrickPlayProperty_mergesTrackGroups()
throws IOException { throws IOException {
DashManifest manifest = parseManifest("mpd/sample_mpd_switching_and_trick_play_property"); DashManifest manifest = parseManifest("media/mpd/sample_mpd_switching_and_trick_play_property");
DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0); DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0);
List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets; List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets;
@ -135,7 +135,7 @@ public final class DashMediaPeriodTest {
@Test @Test
public void cea608AccessibilityDescriptor_createsCea608TrackGroup() throws IOException { public void cea608AccessibilityDescriptor_createsCea608TrackGroup() throws IOException {
DashManifest manifest = parseManifest("mpd/sample_mpd_cea_608_accessibility"); DashManifest manifest = parseManifest("media/mpd/sample_mpd_cea_608_accessibility");
DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0); DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0);
List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets; List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets;
@ -165,7 +165,7 @@ public final class DashMediaPeriodTest {
@Test @Test
public void cea708AccessibilityDescriptor_createsCea708TrackGroup() throws IOException { public void cea708AccessibilityDescriptor_createsCea708TrackGroup() throws IOException {
DashManifest manifest = parseManifest("mpd/sample_mpd_cea_708_accessibility"); DashManifest manifest = parseManifest("media/mpd/sample_mpd_cea_708_accessibility");
DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0); DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0);
List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets; List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets;

View file

@ -42,14 +42,15 @@ import org.xmlpull.v1.XmlPullParserFactory;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class DashManifestParserTest { public class DashManifestParserTest {
private static final String SAMPLE_MPD = "mpd/sample_mpd"; private static final String SAMPLE_MPD = "media/mpd/sample_mpd";
private static final String SAMPLE_MPD_UNKNOWN_MIME_TYPE = "mpd/sample_mpd_unknown_mime_type"; private static final String SAMPLE_MPD_UNKNOWN_MIME_TYPE =
private static final String SAMPLE_MPD_SEGMENT_TEMPLATE = "mpd/sample_mpd_segment_template"; "media/mpd/sample_mpd_unknown_mime_type";
private static final String SAMPLE_MPD_EVENT_STREAM = "mpd/sample_mpd_event_stream"; private static final String SAMPLE_MPD_SEGMENT_TEMPLATE = "media/mpd/sample_mpd_segment_template";
private static final String SAMPLE_MPD_LABELS = "mpd/sample_mpd_labels"; private static final String SAMPLE_MPD_EVENT_STREAM = "media/mpd/sample_mpd_event_stream";
private static final String SAMPLE_MPD_ASSET_IDENTIFIER = "mpd/sample_mpd_asset_identifier"; private static final String SAMPLE_MPD_LABELS = "media/mpd/sample_mpd_labels";
private static final String SAMPLE_MPD_TEXT = "mpd/sample_mpd_text"; private static final String SAMPLE_MPD_ASSET_IDENTIFIER = "media/mpd/sample_mpd_asset_identifier";
private static final String SAMPLE_MPD_TRICK_PLAY = "mpd/sample_mpd_trick_play"; private static final String SAMPLE_MPD_TEXT = "media/mpd/sample_mpd_text";
private static final String SAMPLE_MPD_TRICK_PLAY = "media/mpd/sample_mpd_trick_play";
private static final String NEXT_TAG_NAME = "Next"; private static final String NEXT_TAG_NAME = "Next";
private static final String NEXT_TAG = "<" + NEXT_TAG_NAME + "/>"; private static final String NEXT_TAG = "<" + NEXT_TAG_NAME + "/>";

View file

@ -44,7 +44,7 @@ public class FlacFrameReaderTest {
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = ExtractorInput input =
buildExtractorInputReadingFromFirstFrame( buildExtractorInputReadingFromFirstFrame(
"flac/bear_one_metadata_block.flac", streamMetadataHolder); "media/flac/bear_one_metadata_block.flac", streamMetadataHolder);
int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input); int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input);
ParsableByteArray scratch = new ParsableByteArray(FlacConstants.MAX_FRAME_HEADER_SIZE); ParsableByteArray scratch = new ParsableByteArray(FlacConstants.MAX_FRAME_HEADER_SIZE);
input.read(scratch.getData(), 0, FlacConstants.MAX_FRAME_HEADER_SIZE); input.read(scratch.getData(), 0, FlacConstants.MAX_FRAME_HEADER_SIZE);
@ -64,7 +64,7 @@ public class FlacFrameReaderTest {
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = ExtractorInput input =
buildExtractorInputReadingFromFirstFrame( buildExtractorInputReadingFromFirstFrame(
"flac/bear_one_metadata_block.flac", streamMetadataHolder); "media/flac/bear_one_metadata_block.flac", streamMetadataHolder);
int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input); int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input);
ParsableByteArray scratch = new ParsableByteArray(FlacConstants.MAX_FRAME_HEADER_SIZE); ParsableByteArray scratch = new ParsableByteArray(FlacConstants.MAX_FRAME_HEADER_SIZE);
input.read(scratch.getData(), 0, FlacConstants.MAX_FRAME_HEADER_SIZE); input.read(scratch.getData(), 0, FlacConstants.MAX_FRAME_HEADER_SIZE);
@ -85,7 +85,7 @@ public class FlacFrameReaderTest {
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = ExtractorInput input =
buildExtractorInputReadingFromFirstFrame( buildExtractorInputReadingFromFirstFrame(
"flac/bear_one_metadata_block.flac", streamMetadataHolder); "media/flac/bear_one_metadata_block.flac", streamMetadataHolder);
int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input); int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input);
// Skip first frame. // Skip first frame.
input.skip(5030); input.skip(5030);
@ -105,7 +105,7 @@ public class FlacFrameReaderTest {
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = ExtractorInput input =
buildExtractorInputReadingFromFirstFrame( buildExtractorInputReadingFromFirstFrame(
"flac/bear_one_metadata_block.flac", streamMetadataHolder); "media/flac/bear_one_metadata_block.flac", streamMetadataHolder);
ParsableByteArray scratch = new ParsableByteArray(FlacConstants.MAX_FRAME_HEADER_SIZE); ParsableByteArray scratch = new ParsableByteArray(FlacConstants.MAX_FRAME_HEADER_SIZE);
input.read(scratch.getData(), 0, FlacConstants.MAX_FRAME_HEADER_SIZE); input.read(scratch.getData(), 0, FlacConstants.MAX_FRAME_HEADER_SIZE);
@ -122,7 +122,7 @@ public class FlacFrameReaderTest {
@Test @Test
public void checkFrameHeaderFromPeek_validData_doesNotUpdatePositions() throws Exception { public void checkFrameHeaderFromPeek_validData_doesNotUpdatePositions() throws Exception {
String file = "flac/bear_one_metadata_block.flac"; String file = "media/flac/bear_one_metadata_block.flac";
FlacStreamMetadataHolder streamMetadataHolder = FlacStreamMetadataHolder streamMetadataHolder =
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = buildExtractorInputReadingFromFirstFrame(file, streamMetadataHolder); ExtractorInput input = buildExtractorInputReadingFromFirstFrame(file, streamMetadataHolder);
@ -145,7 +145,7 @@ public class FlacFrameReaderTest {
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = ExtractorInput input =
buildExtractorInputReadingFromFirstFrame( buildExtractorInputReadingFromFirstFrame(
"flac/bear_one_metadata_block.flac", streamMetadataHolder); "media/flac/bear_one_metadata_block.flac", streamMetadataHolder);
int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input); int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input);
boolean result = boolean result =
@ -164,7 +164,7 @@ public class FlacFrameReaderTest {
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = ExtractorInput input =
buildExtractorInputReadingFromFirstFrame( buildExtractorInputReadingFromFirstFrame(
"flac/bear_one_metadata_block.flac", streamMetadataHolder); "media/flac/bear_one_metadata_block.flac", streamMetadataHolder);
int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input); int frameStartMarker = FlacMetadataReader.getFrameStartMarker(input);
// Skip first frame. // Skip first frame.
input.skip(5030); input.skip(5030);
@ -182,7 +182,7 @@ public class FlacFrameReaderTest {
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = ExtractorInput input =
buildExtractorInputReadingFromFirstFrame( buildExtractorInputReadingFromFirstFrame(
"flac/bear_one_metadata_block.flac", streamMetadataHolder); "media/flac/bear_one_metadata_block.flac", streamMetadataHolder);
// The first bytes of the frame are not equal to the frame start marker. // The first bytes of the frame are not equal to the frame start marker.
boolean result = boolean result =
@ -197,7 +197,7 @@ public class FlacFrameReaderTest {
@Test @Test
public void checkFrameHeaderFromPeek_invalidData_doesNotUpdatePositions() throws Exception { public void checkFrameHeaderFromPeek_invalidData_doesNotUpdatePositions() throws Exception {
String file = "flac/bear_one_metadata_block.flac"; String file = "media/flac/bear_one_metadata_block.flac";
FlacStreamMetadataHolder streamMetadataHolder = FlacStreamMetadataHolder streamMetadataHolder =
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = buildExtractorInputReadingFromFirstFrame(file, streamMetadataHolder); ExtractorInput input = buildExtractorInputReadingFromFirstFrame(file, streamMetadataHolder);
@ -224,7 +224,7 @@ public class FlacFrameReaderTest {
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = ExtractorInput input =
buildExtractorInputReadingFromFirstFrame( buildExtractorInputReadingFromFirstFrame(
"flac/bear_one_metadata_block.flac", streamMetadataHolder); "media/flac/bear_one_metadata_block.flac", streamMetadataHolder);
long initialReadPosition = input.getPosition(); long initialReadPosition = input.getPosition();
// Advance peek position after block size bits. // Advance peek position after block size bits.
input.advancePeekPosition(FlacConstants.MAX_FRAME_HEADER_SIZE); input.advancePeekPosition(FlacConstants.MAX_FRAME_HEADER_SIZE);
@ -241,7 +241,7 @@ public class FlacFrameReaderTest {
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
ExtractorInput input = ExtractorInput input =
buildExtractorInputReadingFromFirstFrame( buildExtractorInputReadingFromFirstFrame(
"flac/bear_one_metadata_block.flac", streamMetadataHolder); "media/flac/bear_one_metadata_block.flac", streamMetadataHolder);
// Skip first frame. // Skip first frame.
input.skip(5030); input.skip(5030);
@ -272,7 +272,7 @@ public class FlacFrameReaderTest {
@Test @Test
public void readFrameBlockSizeSamplesFromKey_keyBetween6And7_returnsCorrectBlockSize() public void readFrameBlockSizeSamplesFromKey_keyBetween6And7_returnsCorrectBlockSize()
throws Exception { throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_one_metadata_block.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_one_metadata_block.flac");
// Skip to block size bits of last frame. // Skip to block size bits of last frame.
input.skipFully(164033); input.skipFully(164033);
ParsableByteArray scratch = new ParsableByteArray(2); ParsableByteArray scratch = new ParsableByteArray(2);

View file

@ -45,7 +45,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void peekId3Metadata_updatesPeekPosition() throws Exception { public void peekId3Metadata_updatesPeekPosition() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_with_id3.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_with_id3.flac");
FlacMetadataReader.peekId3Metadata(input, /* parseData= */ false); FlacMetadataReader.peekId3Metadata(input, /* parseData= */ false);
@ -55,7 +55,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void peekId3Metadata_parseData_returnsNonEmptyMetadata() throws Exception { public void peekId3Metadata_parseData_returnsNonEmptyMetadata() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_with_id3.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_with_id3.flac");
Metadata metadata = FlacMetadataReader.peekId3Metadata(input, /* parseData= */ true); Metadata metadata = FlacMetadataReader.peekId3Metadata(input, /* parseData= */ true);
@ -65,7 +65,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void peekId3Metadata_doNotParseData_returnsNull() throws Exception { public void peekId3Metadata_doNotParseData_returnsNull() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_with_id3.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_with_id3.flac");
Metadata metadata = FlacMetadataReader.peekId3Metadata(input, /* parseData= */ false); Metadata metadata = FlacMetadataReader.peekId3Metadata(input, /* parseData= */ false);
@ -74,7 +74,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void peekId3Metadata_noId3Metadata_returnsNull() throws Exception { public void peekId3Metadata_noId3Metadata_returnsNull() throws Exception {
String fileWithoutId3Metadata = "flac/bear.flac"; String fileWithoutId3Metadata = "media/flac/bear.flac";
ExtractorInput input = buildExtractorInput(fileWithoutId3Metadata); ExtractorInput input = buildExtractorInput(fileWithoutId3Metadata);
Metadata metadata = FlacMetadataReader.peekId3Metadata(input, /* parseData= */ true); Metadata metadata = FlacMetadataReader.peekId3Metadata(input, /* parseData= */ true);
@ -84,7 +84,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void checkAndPeekStreamMarker_updatesPeekPosition() throws Exception { public void checkAndPeekStreamMarker_updatesPeekPosition() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
FlacMetadataReader.checkAndPeekStreamMarker(input); FlacMetadataReader.checkAndPeekStreamMarker(input);
@ -94,7 +94,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void checkAndPeekStreamMarker_validData_isTrue() throws Exception { public void checkAndPeekStreamMarker_validData_isTrue() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
boolean result = FlacMetadataReader.checkAndPeekStreamMarker(input); boolean result = FlacMetadataReader.checkAndPeekStreamMarker(input);
@ -103,7 +103,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void checkAndPeekStreamMarker_invalidData_isFalse() throws Exception { public void checkAndPeekStreamMarker_invalidData_isFalse() throws Exception {
ExtractorInput input = buildExtractorInput("mp3/bear-vbr-xing-header.mp3"); ExtractorInput input = buildExtractorInput("media/mp3/bear-vbr-xing-header.mp3");
boolean result = FlacMetadataReader.checkAndPeekStreamMarker(input); boolean result = FlacMetadataReader.checkAndPeekStreamMarker(input);
@ -112,7 +112,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readId3Metadata_updatesReadPositionAndAlignsPeekPosition() throws Exception { public void readId3Metadata_updatesReadPositionAndAlignsPeekPosition() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_with_id3.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_with_id3.flac");
// Advance peek position after ID3 metadata. // Advance peek position after ID3 metadata.
FlacMetadataReader.peekId3Metadata(input, /* parseData= */ false); FlacMetadataReader.peekId3Metadata(input, /* parseData= */ false);
input.advancePeekPosition(1); input.advancePeekPosition(1);
@ -125,7 +125,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readId3Metadata_parseData_returnsNonEmptyMetadata() throws Exception { public void readId3Metadata_parseData_returnsNonEmptyMetadata() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_with_id3.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_with_id3.flac");
Metadata metadata = FlacMetadataReader.readId3Metadata(input, /* parseData= */ true); Metadata metadata = FlacMetadataReader.readId3Metadata(input, /* parseData= */ true);
@ -135,7 +135,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readId3Metadata_doNotParseData_returnsNull() throws Exception { public void readId3Metadata_doNotParseData_returnsNull() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_with_id3.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_with_id3.flac");
Metadata metadata = FlacMetadataReader.readId3Metadata(input, /* parseData= */ false); Metadata metadata = FlacMetadataReader.readId3Metadata(input, /* parseData= */ false);
@ -144,7 +144,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readId3Metadata_noId3Metadata_returnsNull() throws Exception { public void readId3Metadata_noId3Metadata_returnsNull() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
Metadata metadata = FlacMetadataReader.readId3Metadata(input, /* parseData= */ true); Metadata metadata = FlacMetadataReader.readId3Metadata(input, /* parseData= */ true);
@ -153,7 +153,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readStreamMarker_updatesReadPosition() throws Exception { public void readStreamMarker_updatesReadPosition() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
FlacMetadataReader.readStreamMarker(input); FlacMetadataReader.readStreamMarker(input);
@ -163,14 +163,14 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readStreamMarker_invalidData_throwsException() throws Exception { public void readStreamMarker_invalidData_throwsException() throws Exception {
ExtractorInput input = buildExtractorInput("mp3/bear-vbr-xing-header.mp3"); ExtractorInput input = buildExtractorInput("media/mp3/bear-vbr-xing-header.mp3");
assertThrows(ParserException.class, () -> FlacMetadataReader.readStreamMarker(input)); assertThrows(ParserException.class, () -> FlacMetadataReader.readStreamMarker(input));
} }
@Test @Test
public void readMetadataBlock_updatesReadPositionAndAlignsPeekPosition() throws Exception { public void readMetadataBlock_updatesReadPositionAndAlignsPeekPosition() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
input.skipFully(FlacConstants.STREAM_MARKER_SIZE); input.skipFully(FlacConstants.STREAM_MARKER_SIZE);
// Advance peek position after metadata block. // Advance peek position after metadata block.
input.advancePeekPosition(FlacConstants.STREAM_INFO_BLOCK_SIZE + 1); input.advancePeekPosition(FlacConstants.STREAM_INFO_BLOCK_SIZE + 1);
@ -184,7 +184,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readMetadataBlock_lastMetadataBlock_isTrue() throws Exception { public void readMetadataBlock_lastMetadataBlock_isTrue() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_one_metadata_block.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_one_metadata_block.flac");
input.skipFully(FlacConstants.STREAM_MARKER_SIZE); input.skipFully(FlacConstants.STREAM_MARKER_SIZE);
boolean result = boolean result =
@ -196,7 +196,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readMetadataBlock_notLastMetadataBlock_isFalse() throws Exception { public void readMetadataBlock_notLastMetadataBlock_isFalse() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
input.skipFully(FlacConstants.STREAM_MARKER_SIZE); input.skipFully(FlacConstants.STREAM_MARKER_SIZE);
boolean result = boolean result =
@ -208,7 +208,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readMetadataBlock_streamInfoBlock_setsStreamMetadata() throws Exception { public void readMetadataBlock_streamInfoBlock_setsStreamMetadata() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
input.skipFully(FlacConstants.STREAM_MARKER_SIZE); input.skipFully(FlacConstants.STREAM_MARKER_SIZE);
FlacStreamMetadataHolder metadataHolder = FlacStreamMetadataHolder metadataHolder =
new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null); new FlacStreamMetadataHolder(/* flacStreamMetadata= */ null);
@ -221,7 +221,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readMetadataBlock_seekTableBlock_updatesStreamMetadata() throws Exception { public void readMetadataBlock_seekTableBlock_updatesStreamMetadata() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
// Skip to seek table block. // Skip to seek table block.
input.skipFully(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE); input.skipFully(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE);
FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata()); FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata());
@ -238,7 +238,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readMetadataBlock_vorbisCommentBlock_updatesStreamMetadata() throws Exception { public void readMetadataBlock_vorbisCommentBlock_updatesStreamMetadata() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_with_vorbis_comments.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_with_vorbis_comments.flac");
// Skip to Vorbis comment block. // Skip to Vorbis comment block.
input.skipFully(640); input.skipFully(640);
FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata()); FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata());
@ -259,7 +259,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readMetadataBlock_pictureBlock_updatesStreamMetadata() throws Exception { public void readMetadataBlock_pictureBlock_updatesStreamMetadata() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear_with_picture.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear_with_picture.flac");
// Skip to picture block. // Skip to picture block.
input.skipFully(640); input.skipFully(640);
FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata()); FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata());
@ -286,7 +286,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readMetadataBlock_blockToSkip_updatesReadPosition() throws Exception { public void readMetadataBlock_blockToSkip_updatesReadPosition() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
// Skip to padding block. // Skip to padding block.
input.skipFully(640); input.skipFully(640);
FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata()); FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata());
@ -300,7 +300,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readMetadataBlock_nonStreamInfoBlockWithNullStreamMetadata_throwsException() public void readMetadataBlock_nonStreamInfoBlockWithNullStreamMetadata_throwsException()
throws Exception { throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
// Skip to seek table block. // Skip to seek table block.
input.skipFully(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE); input.skipFully(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE);
@ -313,7 +313,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readSeekTableMetadataBlock_updatesPosition() throws Exception { public void readSeekTableMetadataBlock_updatesPosition() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
// Skip to seek table block. // Skip to seek table block.
input.skipFully(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE); input.skipFully(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE);
int seekTableBlockSize = 598; int seekTableBlockSize = 598;
@ -327,7 +327,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readSeekTableMetadataBlock_returnsCorrectSeekPoints() throws Exception { public void readSeekTableMetadataBlock_returnsCorrectSeekPoints() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
// Skip to seek table block. // Skip to seek table block.
input.skipFully(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE); input.skipFully(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE);
int seekTableBlockSize = 598; int seekTableBlockSize = 598;
@ -345,7 +345,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void readSeekTableMetadataBlock_ignoresPlaceholders() throws IOException { public void readSeekTableMetadataBlock_ignoresPlaceholders() throws IOException {
byte[] fileData = byte[] fileData =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), "flac/bear.flac"); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), "media/flac/bear.flac");
ParsableByteArray scratch = new ParsableByteArray(fileData); ParsableByteArray scratch = new ParsableByteArray(fileData);
// Skip to seek table block. // Skip to seek table block.
scratch.skipBytes(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE); scratch.skipBytes(FlacConstants.STREAM_MARKER_SIZE + FlacConstants.STREAM_INFO_BLOCK_SIZE);
@ -359,7 +359,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void getFrameStartMarker_doesNotUpdateReadPositionAndAlignsPeekPosition() public void getFrameStartMarker_doesNotUpdateReadPositionAndAlignsPeekPosition()
throws Exception { throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
int firstFramePosition = 8880; int firstFramePosition = 8880;
input.skipFully(firstFramePosition); input.skipFully(firstFramePosition);
// Advance the peek position after the frame start marker. // Advance the peek position after the frame start marker.
@ -373,7 +373,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void getFrameStartMarker_returnsCorrectFrameStartMarker() throws Exception { public void getFrameStartMarker_returnsCorrectFrameStartMarker() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
// Skip to first frame. // Skip to first frame.
input.skipFully(8880); input.skipFully(8880);
@ -384,7 +384,7 @@ public class FlacMetadataReaderTest {
@Test @Test
public void getFrameStartMarker_invalidData_throwsException() throws Exception { public void getFrameStartMarker_invalidData_throwsException() throws Exception {
ExtractorInput input = buildExtractorInput("flac/bear.flac"); ExtractorInput input = buildExtractorInput("media/flac/bear.flac");
// Input position is incorrect. // Input position is incorrect.
assertThrows(ParserException.class, () -> FlacMetadataReader.getFrameStartMarker(input)); assertThrows(ParserException.class, () -> FlacMetadataReader.getFrameStartMarker(input));

View file

@ -35,7 +35,7 @@ public final class FlacStreamMetadataTest {
@Test @Test
public void constructFromByteArray_setsFieldsCorrectly() throws IOException { public void constructFromByteArray_setsFieldsCorrectly() throws IOException {
byte[] fileData = byte[] fileData =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), "flac/bear.flac"); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), "media/flac/bear.flac");
FlacStreamMetadata streamMetadata = FlacStreamMetadata streamMetadata =
new FlacStreamMetadata( new FlacStreamMetadata(

View file

@ -51,7 +51,8 @@ public final class Id3PeekerTest {
Id3Peeker id3Peeker = new Id3Peeker(); Id3Peeker id3Peeker = new Id3Peeker();
FakeExtractorInput input = FakeExtractorInput input =
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData(getByteArray(ApplicationProvider.getApplicationContext(), "id3/apic.id3")) .setData(
getByteArray(ApplicationProvider.getApplicationContext(), "media/id3/apic.id3"))
.build(); .build();
@Nullable Metadata metadata = id3Peeker.peekId3Data(input, /* id3FramePredicate= */ null); @Nullable Metadata metadata = id3Peeker.peekId3Data(input, /* id3FramePredicate= */ null);
@ -72,7 +73,9 @@ public final class Id3PeekerTest {
Id3Peeker id3Peeker = new Id3Peeker(); Id3Peeker id3Peeker = new Id3Peeker();
FakeExtractorInput input = FakeExtractorInput input =
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData(getByteArray(ApplicationProvider.getApplicationContext(), "id3/comm_apic.id3")) .setData(
getByteArray(
ApplicationProvider.getApplicationContext(), "media/id3/comm_apic.id3"))
.build(); .build();
@Nullable @Nullable

View file

@ -50,7 +50,7 @@ public final class VorbisUtilTest {
public void readIdHeader() throws Exception { public void readIdHeader() throws Exception {
byte[] data = byte[] data =
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "binary/vorbis/id_header"); ApplicationProvider.getApplicationContext(), "media/binary/vorbis/id_header");
ParsableByteArray headerData = new ParsableByteArray(data, data.length); ParsableByteArray headerData = new ParsableByteArray(data, data.length);
VorbisUtil.VorbisIdHeader vorbisIdHeader = VorbisUtil.VorbisIdHeader vorbisIdHeader =
VorbisUtil.readVorbisIdentificationHeader(headerData); VorbisUtil.readVorbisIdentificationHeader(headerData);
@ -70,7 +70,7 @@ public final class VorbisUtilTest {
public void readCommentHeader() throws IOException { public void readCommentHeader() throws IOException {
byte[] data = byte[] data =
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "binary/vorbis/comment_header"); ApplicationProvider.getApplicationContext(), "media/binary/vorbis/comment_header");
ParsableByteArray headerData = new ParsableByteArray(data, data.length); ParsableByteArray headerData = new ParsableByteArray(data, data.length);
VorbisUtil.CommentHeader commentHeader = VorbisUtil.readVorbisCommentHeader(headerData); VorbisUtil.CommentHeader commentHeader = VorbisUtil.readVorbisCommentHeader(headerData);
@ -85,7 +85,7 @@ public final class VorbisUtilTest {
public void readVorbisModes() throws IOException { public void readVorbisModes() throws IOException {
byte[] data = byte[] data =
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "binary/vorbis/setup_header"); ApplicationProvider.getApplicationContext(), "media/binary/vorbis/setup_header");
ParsableByteArray headerData = new ParsableByteArray(data, data.length); ParsableByteArray headerData = new ParsableByteArray(data, data.length);
VorbisUtil.Mode[] modes = VorbisUtil.readVorbisModes(headerData, 2); VorbisUtil.Mode[] modes = VorbisUtil.readVorbisModes(headerData, 2);

View file

@ -42,20 +42,24 @@ public final class AmrExtractorParameterizedTest {
@Test @Test
public void extractingNarrowBandSamples() throws Exception { public void extractingNarrowBandSamples() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
createAmrExtractorFactory(/* withSeeking= */ false), "amr/sample_nb.amr", simulationConfig); createAmrExtractorFactory(/* withSeeking= */ false),
"media/amr/sample_nb.amr",
simulationConfig);
} }
@Test @Test
public void extractingWideBandSamples() throws Exception { public void extractingWideBandSamples() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
createAmrExtractorFactory(/* withSeeking= */ false), "amr/sample_wb.amr", simulationConfig); createAmrExtractorFactory(/* withSeeking= */ false),
"media/amr/sample_wb.amr",
simulationConfig);
} }
@Test @Test
public void extractingNarrowBandSamples_withSeeking() throws Exception { public void extractingNarrowBandSamples_withSeeking() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
createAmrExtractorFactory(/* withSeeking= */ true), createAmrExtractorFactory(/* withSeeking= */ true),
"amr/sample_nb_cbr.amr", "media/amr/sample_nb_cbr.amr",
simulationConfig); simulationConfig);
} }
@ -63,7 +67,7 @@ public final class AmrExtractorParameterizedTest {
public void extractingWideBandSamples_withSeeking() throws Exception { public void extractingWideBandSamples_withSeeking() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
createAmrExtractorFactory(/* withSeeking= */ true), createAmrExtractorFactory(/* withSeeking= */ true),
"amr/sample_wb_cbr.amr", "media/amr/sample_wb_cbr.amr",
simulationConfig); simulationConfig);
} }

View file

@ -39,10 +39,10 @@ public final class AmrExtractorSeekTest {
private static final Random random = new Random(1234L); private static final Random random = new Random(1234L);
private static final String NARROW_BAND_AMR_FILE = "amr/sample_nb.amr"; private static final String NARROW_BAND_AMR_FILE = "media/amr/sample_nb.amr";
private static final int NARROW_BAND_FILE_DURATION_US = 4_360_000; private static final int NARROW_BAND_FILE_DURATION_US = 4_360_000;
private static final String WIDE_BAND_AMR_FILE = "amr/sample_wb.amr"; private static final String WIDE_BAND_AMR_FILE = "media/amr/sample_wb.amr";
private static final int WIDE_BAND_FILE_DURATION_US = 3_380_000; private static final int WIDE_BAND_FILE_DURATION_US = 3_380_000;
private FakeTrackOutput expectedTrackOutput; private FakeTrackOutput expectedTrackOutput;

View file

@ -37,9 +37,10 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class FlacExtractorSeekTest { public class FlacExtractorSeekTest {
private static final String TEST_FILE_SEEK_TABLE = "flac/bear.flac"; private static final String TEST_FILE_SEEK_TABLE = "media/flac/bear.flac";
private static final String TEST_FILE_BINARY_SEARCH = "flac/bear_one_metadata_block.flac"; private static final String TEST_FILE_BINARY_SEARCH = "media/flac/bear_one_metadata_block.flac";
private static final String TEST_FILE_UNSEEKABLE = "flac/bear_no_seek_table_no_num_samples.flac"; private static final String TEST_FILE_UNSEEKABLE =
"media/flac/bear_no_seek_table_no_num_samples.flac";
private static final int DURATION_US = 2_741_000; private static final int DURATION_US = 2_741_000;
private FlacExtractor extractor = new FlacExtractor(); private FlacExtractor extractor = new FlacExtractor();

View file

@ -39,8 +39,8 @@ public class FlacExtractorTest {
public void sample() throws Exception { public void sample() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
FlacExtractor::new, FlacExtractor::new,
"flac/bear.flac", "media/flac/bear.flac",
new AssertionConfig.Builder().setDumpFilesPrefix("flac/bear_flac").build(), new AssertionConfig.Builder().setDumpFilesPrefix("extractordumps/flac/bear_flac").build(),
simulationConfig); simulationConfig);
} }
@ -48,8 +48,10 @@ public class FlacExtractorTest {
public void sampleWithId3HeaderAndId3Enabled() throws Exception { public void sampleWithId3HeaderAndId3Enabled() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
FlacExtractor::new, FlacExtractor::new,
"flac/bear_with_id3.flac", "media/flac/bear_with_id3.flac",
new AssertionConfig.Builder().setDumpFilesPrefix("flac/bear_with_id3_enabled_flac").build(), new AssertionConfig.Builder()
.setDumpFilesPrefix("extractordumps/flac/bear_with_id3_enabled_flac")
.build(),
simulationConfig); simulationConfig);
} }
@ -57,9 +59,9 @@ public class FlacExtractorTest {
public void sampleWithId3HeaderAndId3Disabled() throws Exception { public void sampleWithId3HeaderAndId3Disabled() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
() -> new FlacExtractor(FlacExtractor.FLAG_DISABLE_ID3_METADATA), () -> new FlacExtractor(FlacExtractor.FLAG_DISABLE_ID3_METADATA),
"flac/bear_with_id3.flac", "media/flac/bear_with_id3.flac",
new AssertionConfig.Builder() new AssertionConfig.Builder()
.setDumpFilesPrefix("flac/bear_with_id3_disabled_flac") .setDumpFilesPrefix("extractordumps/flac/bear_with_id3_disabled_flac")
.build(), .build(),
simulationConfig); simulationConfig);
} }
@ -68,9 +70,9 @@ public class FlacExtractorTest {
public void sampleUnseekable() throws Exception { public void sampleUnseekable() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
FlacExtractor::new, FlacExtractor::new,
"flac/bear_no_seek_table_no_num_samples.flac", "media/flac/bear_no_seek_table_no_num_samples.flac",
new AssertionConfig.Builder() new AssertionConfig.Builder()
.setDumpFilesPrefix("flac/bear_no_seek_table_no_num_samples_flac") .setDumpFilesPrefix("extractordumps/flac/bear_no_seek_table_no_num_samples_flac")
.build(), .build(),
simulationConfig); simulationConfig);
} }
@ -79,9 +81,9 @@ public class FlacExtractorTest {
public void sampleWithVorbisComments() throws Exception { public void sampleWithVorbisComments() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
FlacExtractor::new, FlacExtractor::new,
"flac/bear_with_vorbis_comments.flac", "media/flac/bear_with_vorbis_comments.flac",
new AssertionConfig.Builder() new AssertionConfig.Builder()
.setDumpFilesPrefix("flac/bear_with_vorbis_comments_flac") .setDumpFilesPrefix("extractordumps/flac/bear_with_vorbis_comments_flac")
.build(), .build(),
simulationConfig); simulationConfig);
} }
@ -90,8 +92,10 @@ public class FlacExtractorTest {
public void sampleWithPicture() throws Exception { public void sampleWithPicture() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
FlacExtractor::new, FlacExtractor::new,
"flac/bear_with_picture.flac", "media/flac/bear_with_picture.flac",
new AssertionConfig.Builder().setDumpFilesPrefix("flac/bear_with_picture_flac").build(), new AssertionConfig.Builder()
.setDumpFilesPrefix("extractordumps/flac/bear_with_picture_flac")
.build(),
simulationConfig); simulationConfig);
} }
@ -99,9 +103,9 @@ public class FlacExtractorTest {
public void oneMetadataBlock() throws Exception { public void oneMetadataBlock() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
FlacExtractor::new, FlacExtractor::new,
"flac/bear_one_metadata_block.flac", "media/flac/bear_one_metadata_block.flac",
new AssertionConfig.Builder() new AssertionConfig.Builder()
.setDumpFilesPrefix("flac/bear_one_metadata_block_flac") .setDumpFilesPrefix("extractordumps/flac/bear_one_metadata_block_flac")
.build(), .build(),
simulationConfig); simulationConfig);
} }
@ -110,9 +114,9 @@ public class FlacExtractorTest {
public void noMinMaxFrameSize() throws Exception { public void noMinMaxFrameSize() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
FlacExtractor::new, FlacExtractor::new,
"flac/bear_no_min_max_frame_size.flac", "media/flac/bear_no_min_max_frame_size.flac",
new AssertionConfig.Builder() new AssertionConfig.Builder()
.setDumpFilesPrefix("flac/bear_no_min_max_frame_size_flac") .setDumpFilesPrefix("extractordumps/flac/bear_no_min_max_frame_size_flac")
.build(), .build(),
simulationConfig); simulationConfig);
} }
@ -121,8 +125,10 @@ public class FlacExtractorTest {
public void noNumSamples() throws Exception { public void noNumSamples() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
FlacExtractor::new, FlacExtractor::new,
"flac/bear_no_num_samples.flac", "media/flac/bear_no_num_samples.flac",
new AssertionConfig.Builder().setDumpFilesPrefix("flac/bear_no_num_samples_flac").build(), new AssertionConfig.Builder()
.setDumpFilesPrefix("extractordumps/flac/bear_no_num_samples_flac")
.build(),
simulationConfig); simulationConfig);
} }
@ -130,9 +136,9 @@ public class FlacExtractorTest {
public void uncommonSampleRate() throws Exception { public void uncommonSampleRate() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
FlacExtractor::new, FlacExtractor::new,
"flac/bear_uncommon_sample_rate.flac", "media/flac/bear_uncommon_sample_rate.flac",
new AssertionConfig.Builder() new AssertionConfig.Builder()
.setDumpFilesPrefix("flac/bear_uncommon_sample_rate_flac") .setDumpFilesPrefix("extractordumps/flac/bear_uncommon_sample_rate_flac")
.build(), .build(),
simulationConfig); simulationConfig);
} }

View file

@ -36,6 +36,6 @@ public final class FlvExtractorTest {
@Test @Test
public void sample() throws Exception { public void sample() throws Exception {
ExtractorAsserts.assertBehavior(FlvExtractor::new, "flv/sample.flv", simulationConfig); ExtractorAsserts.assertBehavior(FlvExtractor::new, "media/flv/sample.flv", simulationConfig);
} }
} }

View file

@ -36,36 +36,39 @@ public final class MatroskaExtractorTest {
@Test @Test
public void mkvSample() throws Exception { public void mkvSample() throws Exception {
ExtractorAsserts.assertBehavior(MatroskaExtractor::new, "mkv/sample.mkv", simulationConfig); ExtractorAsserts.assertBehavior(
MatroskaExtractor::new, "media/mkv/sample.mkv", simulationConfig);
} }
@Test @Test
public void mkvSample_withSubripSubtitles() throws Exception { public void mkvSample_withSubripSubtitles() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
MatroskaExtractor::new, "mkv/sample_with_srt.mkv", simulationConfig); MatroskaExtractor::new, "media/mkv/sample_with_srt.mkv", simulationConfig);
} }
@Test @Test
public void mkvSample_withHtcRotationInfoInTrackName() throws Exception { public void mkvSample_withHtcRotationInfoInTrackName() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
MatroskaExtractor::new, "mkv/sample_with_htc_rotation_track_name.mkv", simulationConfig); MatroskaExtractor::new,
"media/mkv/sample_with_htc_rotation_track_name.mkv",
simulationConfig);
} }
@Test @Test
public void mkvFullBlocksSample() throws Exception { public void mkvFullBlocksSample() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
MatroskaExtractor::new, "mkv/full_blocks.mkv", simulationConfig); MatroskaExtractor::new, "media/mkv/full_blocks.mkv", simulationConfig);
} }
@Test @Test
public void webmSubsampleEncryption() throws Exception { public void webmSubsampleEncryption() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
MatroskaExtractor::new, "mkv/subsample_encrypted_noaltref.webm", simulationConfig); MatroskaExtractor::new, "media/mkv/subsample_encrypted_noaltref.webm", simulationConfig);
} }
@Test @Test
public void webmSubsampleEncryptionWithAltrefFrames() throws Exception { public void webmSubsampleEncryptionWithAltrefFrames() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
MatroskaExtractor::new, "mkv/subsample_encrypted_altref.webm", simulationConfig); MatroskaExtractor::new, "media/mkv/subsample_encrypted_altref.webm", simulationConfig);
} }
} }

View file

@ -39,9 +39,9 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class ConstantBitrateSeekerTest { public class ConstantBitrateSeekerTest {
private static final String CONSTANT_FRAME_SIZE_TEST_FILE = private static final String CONSTANT_FRAME_SIZE_TEST_FILE =
"mp3/bear-cbr-constant-frame-size-no-seek-table.mp3"; "media/mp3/bear-cbr-constant-frame-size-no-seek-table.mp3";
private static final String VARIABLE_FRAME_SIZE_TEST_FILE = private static final String VARIABLE_FRAME_SIZE_TEST_FILE =
"mp3/bear-cbr-variable-frame-size-no-seek-table.mp3"; "media/mp3/bear-cbr-variable-frame-size-no-seek-table.mp3";
private Mp3Extractor extractor; private Mp3Extractor extractor;
private FakeExtractorOutput extractorOutput; private FakeExtractorOutput extractorOutput;

View file

@ -40,7 +40,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class IndexSeekerTest { public class IndexSeekerTest {
private static final String TEST_FILE_NO_SEEK_TABLE = "mp3/bear-vbr-no-seek-table.mp3"; private static final String TEST_FILE_NO_SEEK_TABLE = "media/mp3/bear-vbr-no-seek-table.mp3";
private static final int TEST_FILE_NO_SEEK_TABLE_DURATION = 2_808_000; private static final int TEST_FILE_NO_SEEK_TABLE_DURATION = 2_808_000;
private Mp3Extractor extractor; private Mp3Extractor extractor;

View file

@ -38,34 +38,39 @@ public final class Mp3ExtractorTest {
@Test @Test
public void mp3SampleWithXingHeader() throws Exception { public void mp3SampleWithXingHeader() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
Mp3Extractor::new, "mp3/bear-vbr-xing-header.mp3", simulationConfig); Mp3Extractor::new, "media/mp3/bear-vbr-xing-header.mp3", simulationConfig);
} }
@Test @Test
public void mp3SampleWithCbrSeeker() throws Exception { public void mp3SampleWithCbrSeeker() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
Mp3Extractor::new, "mp3/bear-cbr-variable-frame-size-no-seek-table.mp3", simulationConfig); Mp3Extractor::new,
"media/mp3/bear-cbr-variable-frame-size-no-seek-table.mp3",
simulationConfig);
} }
@Test @Test
public void mp3SampleWithIndexSeeker() throws Exception { public void mp3SampleWithIndexSeeker() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
() -> new Mp3Extractor(Mp3Extractor.FLAG_ENABLE_INDEX_SEEKING), () -> new Mp3Extractor(Mp3Extractor.FLAG_ENABLE_INDEX_SEEKING),
"mp3/bear-vbr-no-seek-table.mp3", "media/mp3/bear-vbr-no-seek-table.mp3",
simulationConfig); simulationConfig);
} }
@Test @Test
public void trimmedMp3Sample() throws Exception { public void trimmedMp3Sample() throws Exception {
ExtractorAsserts.assertBehavior(Mp3Extractor::new, "mp3/play-trimmed.mp3", simulationConfig); ExtractorAsserts.assertBehavior(
Mp3Extractor::new, "media/mp3/play-trimmed.mp3", simulationConfig);
} }
@Test @Test
public void mp3SampleWithId3Enabled() throws Exception { public void mp3SampleWithId3Enabled() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
Mp3Extractor::new, Mp3Extractor::new,
"mp3/bear-id3.mp3", "media/mp3/bear-id3.mp3",
new AssertionConfig.Builder().setDumpFilesPrefix("mp3/bear-id3-enabled").build(), new AssertionConfig.Builder()
.setDumpFilesPrefix("extractordumps/mp3/bear-id3-enabled")
.build(),
simulationConfig); simulationConfig);
} }
@ -73,8 +78,10 @@ public final class Mp3ExtractorTest {
public void mp3SampleWithId3Disabled() throws Exception { public void mp3SampleWithId3Disabled() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
() -> new Mp3Extractor(Mp3Extractor.FLAG_DISABLE_ID3_METADATA), () -> new Mp3Extractor(Mp3Extractor.FLAG_DISABLE_ID3_METADATA),
"mp3/bear-id3.mp3", "media/mp3/bear-id3.mp3",
new AssertionConfig.Builder().setDumpFilesPrefix("mp3/bear-id3-disabled").build(), new AssertionConfig.Builder()
.setDumpFilesPrefix("extractordumps/mp3/bear-id3-disabled")
.build(),
simulationConfig); simulationConfig);
} }
} }

View file

@ -42,14 +42,16 @@ public final class FragmentedMp4ExtractorTest {
@Test @Test
public void sample() throws Exception { public void sample() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
getExtractorFactory(ImmutableList.of()), "mp4/sample_fragmented.mp4", simulationConfig); getExtractorFactory(ImmutableList.of()),
"media/mp4/sample_fragmented.mp4",
simulationConfig);
} }
@Test @Test
public void sampleSeekable() throws Exception { public void sampleSeekable() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
getExtractorFactory(ImmutableList.of()), getExtractorFactory(ImmutableList.of()),
"mp4/sample_fragmented_seekable.mp4", "media/mp4/sample_fragmented_seekable.mp4",
simulationConfig); simulationConfig);
} }
@ -61,32 +63,38 @@ public final class FragmentedMp4ExtractorTest {
Collections.singletonList( Collections.singletonList(
new Format.Builder().setSampleMimeType(MimeTypes.APPLICATION_CEA608).build())); new Format.Builder().setSampleMimeType(MimeTypes.APPLICATION_CEA608).build()));
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
extractorFactory, "mp4/sample_fragmented_sei.mp4", simulationConfig); extractorFactory, "media/mp4/sample_fragmented_sei.mp4", simulationConfig);
} }
@Test @Test
public void sampleWithAc3Track() throws Exception { public void sampleWithAc3Track() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
getExtractorFactory(ImmutableList.of()), "mp4/sample_ac3_fragmented.mp4", simulationConfig); getExtractorFactory(ImmutableList.of()),
"media/mp4/sample_ac3_fragmented.mp4",
simulationConfig);
} }
@Test @Test
public void sampleWithAc4Track() throws Exception { public void sampleWithAc4Track() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
getExtractorFactory(ImmutableList.of()), "mp4/sample_ac4_fragmented.mp4", simulationConfig); getExtractorFactory(ImmutableList.of()),
"media/mp4/sample_ac4_fragmented.mp4",
simulationConfig);
} }
@Test @Test
public void sampleWithProtectedAc4Track() throws Exception { public void sampleWithProtectedAc4Track() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
getExtractorFactory(ImmutableList.of()), "mp4/sample_ac4_protected.mp4", simulationConfig); getExtractorFactory(ImmutableList.of()),
"media/mp4/sample_ac4_protected.mp4",
simulationConfig);
} }
@Test @Test
public void sampleWithEac3Track() throws Exception { public void sampleWithEac3Track() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
getExtractorFactory(ImmutableList.of()), getExtractorFactory(ImmutableList.of()),
"mp4/sample_eac3_fragmented.mp4", "media/mp4/sample_eac3_fragmented.mp4",
simulationConfig); simulationConfig);
} }
@ -94,7 +102,7 @@ public final class FragmentedMp4ExtractorTest {
public void sampleWithEac3jocTrack() throws Exception { public void sampleWithEac3jocTrack() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
getExtractorFactory(ImmutableList.of()), getExtractorFactory(ImmutableList.of()),
"mp4/sample_eac3joc_fragmented.mp4", "media/mp4/sample_eac3joc_fragmented.mp4",
simulationConfig); simulationConfig);
} }
@ -102,7 +110,7 @@ public final class FragmentedMp4ExtractorTest {
public void sampleWithOpusTrack() throws Exception { public void sampleWithOpusTrack() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
getExtractorFactory(ImmutableList.of()), getExtractorFactory(ImmutableList.of()),
"mp4/sample_opus_fragmented.mp4", "media/mp4/sample_opus_fragmented.mp4",
simulationConfig); simulationConfig);
} }
@ -110,7 +118,7 @@ public final class FragmentedMp4ExtractorTest {
public void samplePartiallyFragmented() throws Exception { public void samplePartiallyFragmented() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
getExtractorFactory(ImmutableList.of()), getExtractorFactory(ImmutableList.of()),
"mp4/sample_partially_fragmented.mp4", "media/mp4/sample_partially_fragmented.mp4",
simulationConfig); simulationConfig);
} }

View file

@ -36,13 +36,13 @@ public final class Mp4ExtractorTest {
@Test @Test
public void mp4Sample() throws Exception { public void mp4Sample() throws Exception {
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample.mp4", simulationConfig); ExtractorAsserts.assertBehavior(Mp4Extractor::new, "media/mp4/sample.mp4", simulationConfig);
} }
@Test @Test
public void mp4SampleWithSlowMotionMetadata() throws Exception { public void mp4SampleWithSlowMotionMetadata() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
Mp4Extractor::new, "mp4/sample_android_slow_motion.mp4", simulationConfig); Mp4Extractor::new, "media/mp4/sample_android_slow_motion.mp4", simulationConfig);
} }
/** /**
@ -52,31 +52,36 @@ public final class Mp4ExtractorTest {
@Test @Test
public void mp4SampleWithMdatTooLong() throws Exception { public void mp4SampleWithMdatTooLong() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
Mp4Extractor::new, "mp4/sample_mdat_too_long.mp4", simulationConfig); Mp4Extractor::new, "media/mp4/sample_mdat_too_long.mp4", simulationConfig);
} }
@Test @Test
public void mp4SampleWithAc3Track() throws Exception { public void mp4SampleWithAc3Track() throws Exception {
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample_ac3.mp4", simulationConfig); ExtractorAsserts.assertBehavior(
Mp4Extractor::new, "media/mp4/sample_ac3.mp4", simulationConfig);
} }
@Test @Test
public void mp4SampleWithAc4Track() throws Exception { public void mp4SampleWithAc4Track() throws Exception {
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample_ac4.mp4", simulationConfig); ExtractorAsserts.assertBehavior(
Mp4Extractor::new, "media/mp4/sample_ac4.mp4", simulationConfig);
} }
@Test @Test
public void mp4SampleWithEac3Track() throws Exception { public void mp4SampleWithEac3Track() throws Exception {
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample_eac3.mp4", simulationConfig); ExtractorAsserts.assertBehavior(
Mp4Extractor::new, "media/mp4/sample_eac3.mp4", simulationConfig);
} }
@Test @Test
public void mp4SampleWithEac3jocTrack() throws Exception { public void mp4SampleWithEac3jocTrack() throws Exception {
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample_eac3joc.mp4", simulationConfig); ExtractorAsserts.assertBehavior(
Mp4Extractor::new, "media/mp4/sample_eac3joc.mp4", simulationConfig);
} }
@Test @Test
public void mp4SampleWithOpusTrack() throws Exception { public void mp4SampleWithOpusTrack() throws Exception {
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample_opus.mp4", simulationConfig); ExtractorAsserts.assertBehavior(
Mp4Extractor::new, "media/mp4/sample_opus.mp4", simulationConfig);
} }
} }

View file

@ -56,7 +56,7 @@ public final class DefaultOggSeekerTest {
@Test @Test
public void seeking() throws Exception { public void seeking() throws Exception {
byte[] data = byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "ogg/random_1000_pages"); getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/random_1000_pages");
int granuleCount = 49269395; int granuleCount = 49269395;
int firstPayloadPageSize = 2023; int firstPayloadPageSize = 2023;
int firstPayloadPageGranuleCount = 57058; int firstPayloadPageGranuleCount = 57058;
@ -123,7 +123,8 @@ public final class DefaultOggSeekerTest {
@Test @Test
public void readGranuleOfLastPage() throws IOException { public void readGranuleOfLastPage() throws IOException {
// This test stream has three headers with granule numbers 20000, 40000 and 60000. // This test stream has three headers with granule numbers 20000, 40000 and 60000.
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/three_headers"); byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/three_headers");
FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ false); FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ false);
assertReadGranuleOfLastPage(input, 60000); assertReadGranuleOfLastPage(input, 60000);
} }

View file

@ -36,38 +36,42 @@ public final class OggExtractorNonParameterizedTest {
@Test @Test
public void sniffVorbis() throws Exception { public void sniffVorbis() throws Exception {
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/vorbis_header"); byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/vorbis_header");
assertSniff(data, /* expectedResult= */ true); assertSniff(data, /* expectedResult= */ true);
} }
@Test @Test
public void sniffFlac() throws Exception { public void sniffFlac() throws Exception {
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/flac_header"); byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/flac_header");
assertSniff(data, /* expectedResult= */ true); assertSniff(data, /* expectedResult= */ true);
} }
@Test @Test
public void sniffFailsOpusFile() throws Exception { public void sniffFailsOpusFile() throws Exception {
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/opus_header"); byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/opus_header");
assertSniff(data, /* expectedResult= */ false); assertSniff(data, /* expectedResult= */ false);
} }
@Test @Test
public void sniffFailsInvalidOggHeader() throws Exception { public void sniffFailsInvalidOggHeader() throws Exception {
byte[] data = byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "ogg/invalid_ogg_header"); getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/invalid_ogg_header");
assertSniff(data, /* expectedResult= */ false); assertSniff(data, /* expectedResult= */ false);
} }
@Test @Test
public void sniffInvalidHeader() throws Exception { public void sniffInvalidHeader() throws Exception {
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/invalid_header"); byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/invalid_header");
assertSniff(data, /* expectedResult= */ false); assertSniff(data, /* expectedResult= */ false);
} }
@Test @Test
public void sniffFailsEOF() throws Exception { public void sniffFailsEOF() throws Exception {
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/eof_header"); byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/eof_header");
assertSniff(data, /* expectedResult= */ false); assertSniff(data, /* expectedResult= */ false);
} }

View file

@ -40,29 +40,31 @@ public final class OggExtractorParameterizedTest {
@Test @Test
public void opus() throws Exception { public void opus() throws Exception {
ExtractorAsserts.assertBehavior(OggExtractor::new, "ogg/bear.opus", simulationConfig); ExtractorAsserts.assertBehavior(OggExtractor::new, "media/ogg/bear.opus", simulationConfig);
} }
@Test @Test
public void flac() throws Exception { public void flac() throws Exception {
ExtractorAsserts.assertBehavior(OggExtractor::new, "ogg/bear_flac.ogg", simulationConfig); ExtractorAsserts.assertBehavior(OggExtractor::new, "media/ogg/bear_flac.ogg", simulationConfig);
} }
@Test @Test
public void flacNoSeektable() throws Exception { public void flacNoSeektable() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
OggExtractor::new, "ogg/bear_flac_noseektable.ogg", simulationConfig); OggExtractor::new, "media/ogg/bear_flac_noseektable.ogg", simulationConfig);
} }
@Test @Test
public void vorbis() throws Exception { public void vorbis() throws Exception {
ExtractorAsserts.assertBehavior(OggExtractor::new, "ogg/bear_vorbis.ogg", simulationConfig); ExtractorAsserts.assertBehavior(
OggExtractor::new, "media/ogg/bear_vorbis.ogg", simulationConfig);
} }
// Ensure the extractor can handle non-contiguous pages by using a file with 10 bytes of garbage // Ensure the extractor can handle non-contiguous pages by using a file with 10 bytes of garbage
// data before the start of the second page. // data before the start of the second page.
@Test @Test
public void vorbisWithGapBeforeSecondPage() throws Exception { public void vorbisWithGapBeforeSecondPage() throws Exception {
ExtractorAsserts.assertBehavior(OggExtractor::new, "ogg/bear_vorbis_gap.ogg", simulationConfig); ExtractorAsserts.assertBehavior(
OggExtractor::new, "media/ogg/bear_vorbis_gap.ogg", simulationConfig);
} }
} }

View file

@ -33,7 +33,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class OggPacketTest { public final class OggPacketTest {
private static final String TEST_FILE = "ogg/bear.opus"; private static final String TEST_FILE = "media/ogg/bear.opus";
private final Random random = new Random(/* seed= */ 0); private final Random random = new Random(/* seed= */ 0);
private final OggPacket oggPacket = new OggPacket(); private final OggPacket oggPacket = new OggPacket();
@ -47,7 +47,8 @@ public final class OggPacketTest {
FakeExtractorInput input = FakeExtractorInput input =
createInput( createInput(
getByteArray( getByteArray(
ApplicationProvider.getApplicationContext(), "ogg/four_packets_with_empty_page")); ApplicationProvider.getApplicationContext(),
"media/ogg/four_packets_with_empty_page"));
assertReadPacket(input, firstPacket); assertReadPacket(input, firstPacket);
assertThat((oggPacket.getPageHeader().type & 0x02) == 0x02).isTrue(); assertThat((oggPacket.getPageHeader().type & 0x02) == 0x02).isTrue();
@ -95,7 +96,7 @@ public final class OggPacketTest {
createInput( createInput(
getByteArray( getByteArray(
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
"ogg/packet_with_zero_size_terminator")); "media/ogg/packet_with_zero_size_terminator"));
assertReadPacket(input, firstPacket); assertReadPacket(input, firstPacket);
assertReadPacket(input, secondPacket); assertReadPacket(input, secondPacket);
@ -109,7 +110,7 @@ public final class OggPacketTest {
createInput( createInput(
getByteArray( getByteArray(
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
"ogg/continued_packet_over_two_pages")); "media/ogg/continued_packet_over_two_pages"));
assertReadPacket(input, firstPacket); assertReadPacket(input, firstPacket);
assertThat((oggPacket.getPageHeader().type & 0x04) == 0x04).isTrue(); assertThat((oggPacket.getPageHeader().type & 0x04) == 0x04).isTrue();
@ -126,7 +127,7 @@ public final class OggPacketTest {
createInput( createInput(
getByteArray( getByteArray(
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
"ogg/continued_packet_over_four_pages")); "media/ogg/continued_packet_over_four_pages"));
assertReadPacket(input, firstPacket); assertReadPacket(input, firstPacket);
assertThat((oggPacket.getPageHeader().type & 0x04) == 0x04).isTrue(); assertThat((oggPacket.getPageHeader().type & 0x04) == 0x04).isTrue();
@ -142,7 +143,8 @@ public final class OggPacketTest {
FakeExtractorInput input = FakeExtractorInput input =
createInput( createInput(
getByteArray( getByteArray(
ApplicationProvider.getApplicationContext(), "ogg/continued_packet_at_start")); ApplicationProvider.getApplicationContext(),
"media/ogg/continued_packet_at_start"));
// Expect the first partial packet to be discarded. // Expect the first partial packet to be discarded.
assertReadPacket(input, Arrays.copyOfRange(pageBody, 256, 256 + 8)); assertReadPacket(input, Arrays.copyOfRange(pageBody, 256, 256 + 8));
@ -158,7 +160,7 @@ public final class OggPacketTest {
createInput( createInput(
getByteArray( getByteArray(
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
"ogg/zero_sized_packets_at_end_of_stream")); "media/ogg/zero_sized_packets_at_end_of_stream"));
assertReadPacket(input, firstPacket); assertReadPacket(input, firstPacket);
assertReadPacket(input, secondPacket); assertReadPacket(input, secondPacket);

View file

@ -88,7 +88,8 @@ public final class OggPageHeaderTest {
@Test @Test
public void populatePageHeader_success() throws Exception { public void populatePageHeader_success() throws Exception {
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/page_header"); byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/page_header");
FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ true); FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ true);
OggPageHeader header = new OggPageHeader(); OggPageHeader header = new OggPageHeader();
@ -121,7 +122,8 @@ public final class OggPageHeaderTest {
@Test @Test
public void populatePageHeader_withNotOgg_returnFalseWithoutException() throws Exception { public void populatePageHeader_withNotOgg_returnFalseWithoutException() throws Exception {
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/page_header"); byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/page_header");
// change from 'O' to 'o' // change from 'O' to 'o'
data[0] = 'o'; data[0] = 'o';
FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ false); FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ false);
@ -134,7 +136,8 @@ public final class OggPageHeaderTest {
@Test @Test
public void populatePageHeader_withWrongRevision_returnFalseWithoutException() throws Exception { public void populatePageHeader_withWrongRevision_returnFalseWithoutException() throws Exception {
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/page_header"); byte[] data =
getByteArray(ApplicationProvider.getApplicationContext(), "media/ogg/page_header");
// change revision from 0 to 1 // change revision from 0 to 1
data[4] = 0x01; data[4] = 0x01;
FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ false); FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ false);

View file

@ -61,7 +61,7 @@ public final class VorbisReaderTest {
// identification, comment and setup header. // identification, comment and setup header.
byte[] data = byte[] data =
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "binary/ogg/vorbis_header_pages"); ApplicationProvider.getApplicationContext(), "media/binary/ogg/vorbis_header_pages");
ExtractorInput input = new FakeExtractorInput.Builder().setData(data).setSimulateIOErrors(true) ExtractorInput input = new FakeExtractorInput.Builder().setData(data).setSimulateIOErrors(true)
.setSimulateUnknownLength(true).setSimulatePartialReads(true).build(); .setSimulateUnknownLength(true).setSimulatePartialReads(true).build();

View file

@ -44,6 +44,6 @@ public final class RawCcExtractorTest {
.setAccessibilityChannel(1) .setAccessibilityChannel(1)
.build(); .build();
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
() -> new RawCcExtractor(format), "rawcc/sample.rawcc", simulationConfig); () -> new RawCcExtractor(format), "media/rawcc/sample.rawcc", simulationConfig);
} }
} }

View file

@ -36,16 +36,17 @@ public final class Ac3ExtractorTest {
@Test @Test
public void ac3Sample() throws Exception { public void ac3Sample() throws Exception {
ExtractorAsserts.assertBehavior(Ac3Extractor::new, "ts/sample.ac3", simulationConfig); ExtractorAsserts.assertBehavior(Ac3Extractor::new, "media/ts/sample.ac3", simulationConfig);
} }
@Test @Test
public void eAc3Sample() throws Exception { public void eAc3Sample() throws Exception {
ExtractorAsserts.assertBehavior(Ac3Extractor::new, "ts/sample.eac3", simulationConfig); ExtractorAsserts.assertBehavior(Ac3Extractor::new, "media/ts/sample.eac3", simulationConfig);
} }
@Test @Test
public void eAc3jocSample() throws Exception { public void eAc3jocSample() throws Exception {
ExtractorAsserts.assertBehavior(Ac3Extractor::new, "ts/sample_eac3joc.ec3", simulationConfig); ExtractorAsserts.assertBehavior(
Ac3Extractor::new, "media/ts/sample_eac3joc.ec3", simulationConfig);
} }
} }

View file

@ -36,6 +36,6 @@ public final class Ac4ExtractorTest {
@Test @Test
public void ac4Sample() throws Exception { public void ac4Sample() throws Exception {
ExtractorAsserts.assertBehavior(Ac4Extractor::new, "ts/sample.ac4", simulationConfig); ExtractorAsserts.assertBehavior(Ac4Extractor::new, "media/ts/sample.ac4", simulationConfig);
} }
} }

View file

@ -39,7 +39,7 @@ public final class AdtsExtractorSeekTest {
private static final Random random = new Random(1234L); private static final Random random = new Random(1234L);
private static final String TEST_FILE = "ts/sample.adts"; private static final String TEST_FILE = "media/ts/sample.adts";
private static final int FILE_DURATION_US = 3_356_772; private static final int FILE_DURATION_US = 3_356_772;
private static final long DELTA_TIMESTAMP_THRESHOLD_US = 200_000; private static final long DELTA_TIMESTAMP_THRESHOLD_US = 200_000;

View file

@ -36,20 +36,20 @@ public final class AdtsExtractorTest {
@Test @Test
public void sample() throws Exception { public void sample() throws Exception {
ExtractorAsserts.assertBehavior(AdtsExtractor::new, "ts/sample.adts", simulationConfig); ExtractorAsserts.assertBehavior(AdtsExtractor::new, "media/ts/sample.adts", simulationConfig);
} }
@Test @Test
public void sample_with_id3() throws Exception { public void sample_with_id3() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
AdtsExtractor::new, "ts/sample_with_id3.adts", simulationConfig); AdtsExtractor::new, "media/ts/sample_with_id3.adts", simulationConfig);
} }
@Test @Test
public void sample_withSeeking() throws Exception { public void sample_withSeeking() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
() -> new AdtsExtractor(/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING), () -> new AdtsExtractor(/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING),
"ts/sample_cbs.adts", "media/ts/sample_cbs.adts",
simulationConfig); simulationConfig);
} }
@ -58,7 +58,7 @@ public final class AdtsExtractorTest {
public void sample_withSeekingAndTruncatedFile() throws Exception { public void sample_withSeekingAndTruncatedFile() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
() -> new AdtsExtractor(/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING), () -> new AdtsExtractor(/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING),
"ts/sample_cbs_truncated.adts", "media/ts/sample_cbs_truncated.adts",
simulationConfig); simulationConfig);
} }
} }

View file

@ -52,7 +52,8 @@ public final class PsDurationReaderTest {
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "ts/sample_h262_mpeg_audio.ps")) ApplicationProvider.getApplicationContext(),
"media/ts/sample_h262_mpeg_audio.ps"))
.build(); .build();
int result = Extractor.RESULT_CONTINUE; int result = Extractor.RESULT_CONTINUE;
@ -72,7 +73,8 @@ public final class PsDurationReaderTest {
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "ts/sample_h262_mpeg_audio.ps")) ApplicationProvider.getApplicationContext(),
"media/ts/sample_h262_mpeg_audio.ps"))
.build(); .build();
input.setPosition(1234); input.setPosition(1234);

View file

@ -46,7 +46,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class PsExtractorSeekTest { public final class PsExtractorSeekTest {
private static final String PS_FILE_PATH = "ts/elephants_dream.mpg"; private static final String PS_FILE_PATH = "media/ts/elephants_dream.mpg";
private static final int DURATION_US = 30436333; private static final int DURATION_US = 30436333;
private static final int VIDEO_TRACK_ID = 224; private static final int VIDEO_TRACK_ID = 224;
private static final long DELTA_TIMESTAMP_THRESHOLD_US = 500_000L; private static final long DELTA_TIMESTAMP_THRESHOLD_US = 500_000L;

View file

@ -37,11 +37,11 @@ public final class PsExtractorTest {
@Test @Test
public void sampleWithH262AndMpegAudio() throws Exception { public void sampleWithH262AndMpegAudio() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
PsExtractor::new, "ts/sample_h262_mpeg_audio.ps", simulationConfig); PsExtractor::new, "media/ts/sample_h262_mpeg_audio.ps", simulationConfig);
} }
@Test @Test
public void sampleWithAc3() throws Exception { public void sampleWithAc3() throws Exception {
ExtractorAsserts.assertBehavior(PsExtractor::new, "ts/sample_ac3.ps", simulationConfig); ExtractorAsserts.assertBehavior(PsExtractor::new, "media/ts/sample_ac3.ps", simulationConfig);
} }
} }

View file

@ -52,7 +52,7 @@ public final class TsDurationReaderTest {
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "ts/bbb_2500ms.ts")) ApplicationProvider.getApplicationContext(), "media/ts/bbb_2500ms.ts"))
.setSimulateIOErrors(false) .setSimulateIOErrors(false)
.setSimulateUnknownLength(false) .setSimulateUnknownLength(false)
.setSimulatePartialReads(false) .setSimulatePartialReads(false)
@ -76,7 +76,7 @@ public final class TsDurationReaderTest {
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "ts/bbb_2500ms.ts")) ApplicationProvider.getApplicationContext(), "media/ts/bbb_2500ms.ts"))
.setSimulateIOErrors(false) .setSimulateIOErrors(false)
.setSimulateUnknownLength(false) .setSimulateUnknownLength(false)
.setSimulatePartialReads(false) .setSimulatePartialReads(false)

View file

@ -41,7 +41,7 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class TsExtractorSeekTest { public final class TsExtractorSeekTest {
private static final String TEST_FILE = "ts/bbb_2500ms.ts"; private static final String TEST_FILE = "media/ts/bbb_2500ms.ts";
private static final int DURATION_US = 2_500_000; private static final int DURATION_US = 2_500_000;
private static final int AUDIO_TRACK_ID = 257; private static final int AUDIO_TRACK_ID = 257;
private static final long MAXIMUM_TIMESTAMP_DELTA_US = 500_000L; private static final long MAXIMUM_TIMESTAMP_DELTA_US = 500_000L;

View file

@ -57,25 +57,25 @@ public final class TsExtractorTest {
@Test @Test
public void sampleWithH262AndMpegAudio() throws Exception { public void sampleWithH262AndMpegAudio() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
TsExtractor::new, "ts/sample_h262_mpeg_audio.ts", simulationConfig); TsExtractor::new, "media/ts/sample_h262_mpeg_audio.ts", simulationConfig);
} }
@Test @Test
public void sampleWithH263() throws Exception { public void sampleWithH263() throws Exception {
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_h263.ts", simulationConfig); ExtractorAsserts.assertBehavior(TsExtractor::new, "media/ts/sample_h263.ts", simulationConfig);
} }
@Test @Test
public void sampleWithH264AndMpegAudio() throws Exception { public void sampleWithH264AndMpegAudio() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
TsExtractor::new, "ts/sample_h264_mpeg_audio.ts", simulationConfig); TsExtractor::new, "media/ts/sample_h264_mpeg_audio.ts", simulationConfig);
} }
@Test @Test
public void sampleWithH264NoAccessUnitDelimiters() throws Exception { public void sampleWithH264NoAccessUnitDelimiters() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
() -> new TsExtractor(FLAG_DETECT_ACCESS_UNITS), () -> new TsExtractor(FLAG_DETECT_ACCESS_UNITS),
"ts/sample_h264_no_access_unit_delimiters.ts", "media/ts/sample_h264_no_access_unit_delimiters.ts",
simulationConfig); simulationConfig);
} }
@ -83,20 +83,20 @@ public final class TsExtractorTest {
public void sampleWithH264AndDtsAudio() throws Exception { public void sampleWithH264AndDtsAudio() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
() -> new TsExtractor(DefaultTsPayloadReaderFactory.FLAG_ENABLE_HDMV_DTS_AUDIO_STREAMS), () -> new TsExtractor(DefaultTsPayloadReaderFactory.FLAG_ENABLE_HDMV_DTS_AUDIO_STREAMS),
"ts/sample_h264_dts_audio.ts", "media/ts/sample_h264_dts_audio.ts",
simulationConfig); simulationConfig);
} }
@Test @Test
public void sampleWithH265() throws Exception { public void sampleWithH265() throws Exception {
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_h265.ts", simulationConfig); ExtractorAsserts.assertBehavior(TsExtractor::new, "media/ts/sample_h265.ts", simulationConfig);
} }
@Test @Test
public void sampleWithScte35() throws Exception { public void sampleWithScte35() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
TsExtractor::new, TsExtractor::new,
"ts/sample_scte35.ts", "media/ts/sample_scte35.ts",
new ExtractorAsserts.AssertionConfig.Builder() new ExtractorAsserts.AssertionConfig.Builder()
.setDeduplicateConsecutiveFormats(true) .setDeduplicateConsecutiveFormats(true)
.build(), .build(),
@ -107,7 +107,7 @@ public final class TsExtractorTest {
public void sampleWithAit() throws Exception { public void sampleWithAit() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
TsExtractor::new, TsExtractor::new,
"ts/sample_ait.ts", "media/ts/sample_ait.ts",
new ExtractorAsserts.AssertionConfig.Builder() new ExtractorAsserts.AssertionConfig.Builder()
.setDeduplicateConsecutiveFormats(true) .setDeduplicateConsecutiveFormats(true)
.build(), .build(),
@ -116,32 +116,34 @@ public final class TsExtractorTest {
@Test @Test
public void sampleWithAc3() throws Exception { public void sampleWithAc3() throws Exception {
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_ac3.ts", simulationConfig); ExtractorAsserts.assertBehavior(TsExtractor::new, "media/ts/sample_ac3.ts", simulationConfig);
} }
@Test @Test
public void sampleWithAc4() throws Exception { public void sampleWithAc4() throws Exception {
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_ac4.ts", simulationConfig); ExtractorAsserts.assertBehavior(TsExtractor::new, "media/ts/sample_ac4.ts", simulationConfig);
} }
@Test @Test
public void sampleWithEac3() throws Exception { public void sampleWithEac3() throws Exception {
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_eac3.ts", simulationConfig); ExtractorAsserts.assertBehavior(TsExtractor::new, "media/ts/sample_eac3.ts", simulationConfig);
} }
@Test @Test
public void sampleWithEac3joc() throws Exception { public void sampleWithEac3joc() throws Exception {
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_eac3joc.ts", simulationConfig); ExtractorAsserts.assertBehavior(
TsExtractor::new, "media/ts/sample_eac3joc.ts", simulationConfig);
} }
@Test @Test
public void sampleWithLatm() throws Exception { public void sampleWithLatm() throws Exception {
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_latm.ts", simulationConfig); ExtractorAsserts.assertBehavior(TsExtractor::new, "media/ts/sample_latm.ts", simulationConfig);
} }
@Test @Test
public void streamWithJunkData() throws Exception { public void streamWithJunkData() throws Exception {
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_with_junk", simulationConfig); ExtractorAsserts.assertBehavior(
TsExtractor::new, "media/ts/sample_with_junk", simulationConfig);
} }
@Test @Test
@ -153,7 +155,8 @@ public final class TsExtractorTest {
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "ts/sample_h262_mpeg_audio.ts")) ApplicationProvider.getApplicationContext(),
"media/ts/sample_h262_mpeg_audio.ts"))
.setSimulateIOErrors(false) .setSimulateIOErrors(false)
.setSimulateUnknownLength(false) .setSimulateUnknownLength(false)
.setSimulatePartialReads(false) .setSimulatePartialReads(false)
@ -190,7 +193,7 @@ public final class TsExtractorTest {
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "ts/sample_with_sdt.ts")) ApplicationProvider.getApplicationContext(), "media/ts/sample_with_sdt.ts"))
.setSimulateIOErrors(false) .setSimulateIOErrors(false)
.setSimulateUnknownLength(false) .setSimulateUnknownLength(false)
.setSimulatePartialReads(false) .setSimulatePartialReads(false)

View file

@ -36,21 +36,21 @@ public final class WavExtractorTest {
@Test @Test
public void sample() throws Exception { public void sample() throws Exception {
ExtractorAsserts.assertBehavior(WavExtractor::new, "wav/sample.wav", simulationConfig); ExtractorAsserts.assertBehavior(WavExtractor::new, "media/wav/sample.wav", simulationConfig);
} }
@Test @Test
public void sample_withTrailingBytes_extractsSameData() throws Exception { public void sample_withTrailingBytes_extractsSameData() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
WavExtractor::new, WavExtractor::new,
"wav/sample_with_trailing_bytes.wav", "media/wav/sample_with_trailing_bytes.wav",
new AssertionConfig.Builder().setDumpFilesPrefix("wav/sample.wav").build(), new AssertionConfig.Builder().setDumpFilesPrefix("extractordumps/wav/sample.wav").build(),
simulationConfig); simulationConfig);
} }
@Test @Test
public void sample_imaAdpcm() throws Exception { public void sample_imaAdpcm() throws Exception {
ExtractorAsserts.assertBehavior( ExtractorAsserts.assertBehavior(
WavExtractor::new, "wav/sample_ima_adpcm.wav", simulationConfig); WavExtractor::new, "media/wav/sample_ima_adpcm.wav", simulationConfig);
} }
} }

View file

@ -63,7 +63,7 @@ public class DefaultHlsExtractorFactoryTest {
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "webvtt/typical")) ApplicationProvider.getApplicationContext(), "media/webvtt/typical"))
.build(); .build();
BundledHlsMediaChunkExtractor result = BundledHlsMediaChunkExtractor result =
@ -86,7 +86,8 @@ public class DefaultHlsExtractorFactoryTest {
ExtractorInput ac3ExtractorInput = ExtractorInput ac3ExtractorInput =
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), "ts/sample.ac3")) TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "media/ts/sample.ac3"))
.build(); .build();
BundledHlsMediaChunkExtractor result = BundledHlsMediaChunkExtractor result =
@ -108,7 +109,7 @@ public class DefaultHlsExtractorFactoryTest {
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "ts/sample_ac3.ts")) ApplicationProvider.getApplicationContext(), "media/ts/sample_ac3.ts"))
.build(); .build();
BundledHlsMediaChunkExtractor result = BundledHlsMediaChunkExtractor result =
@ -131,7 +132,7 @@ public class DefaultHlsExtractorFactoryTest {
new FakeExtractorInput.Builder() new FakeExtractorInput.Builder()
.setData( .setData(
TestUtil.getByteArray( TestUtil.getByteArray(
ApplicationProvider.getApplicationContext(), "mp3/bear-id3.mp3")) ApplicationProvider.getApplicationContext(), "media/mp3/bear-id3.mp3"))
.build(); .build();
BundledHlsMediaChunkExtractor result = BundledHlsMediaChunkExtractor result =

View file

@ -79,7 +79,7 @@ public class WebvttExtractorTest {
TestUtil.extractAllSamplesFromFile( TestUtil.extractAllSamplesFromFile(
extractor, extractor,
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
"webvtt/with_x-timestamp-map_header"); "media/webvtt/with_x-timestamp-map_header");
// The output has a ~5s sampleTime and a large, negative subsampleOffset because the cue // The output has a ~5s sampleTime and a large, negative subsampleOffset because the cue
// timestamps are ~10 days ahead of the PTS (due to wrapping) so the offset is used to ensure // timestamps are ~10 days ahead of the PTS (due to wrapping) so the offset is used to ensure
@ -87,7 +87,7 @@ public class WebvttExtractorTest {
DumpFileAsserts.assertOutput( DumpFileAsserts.assertOutput(
ApplicationProvider.getApplicationContext(), ApplicationProvider.getApplicationContext(),
output, output,
"webvtt/with_x-timestamp-map_header.dump"); "extractordumps/webvtt/with_x-timestamp-map_header.dump");
} }
private static boolean sniffData(byte[] data) throws IOException { private static boolean sniffData(byte[] data) throws IOException {

View file

@ -27,8 +27,8 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public final class SsManifestParserTest { public final class SsManifestParserTest {
private static final String SAMPLE_ISMC_1 = "smooth-streaming/sample_ismc_1"; private static final String SAMPLE_ISMC_1 = "media/smooth-streaming/sample_ismc_1";
private static final String SAMPLE_ISMC_2 = "smooth-streaming/sample_ismc_2"; private static final String SAMPLE_ISMC_2 = "media/smooth-streaming/sample_ismc_2";
/** Simple test to ensure the sample manifests parse without any exceptions being thrown. */ /** Simple test to ensure the sample manifests parse without any exceptions being thrown. */
@Test @Test

Some files were not shown because too many files have changed in this diff Show more