Skip to content

Commit

Permalink
TIKA-1530: Include parsed mp4 duration in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Oskar Wickström committed Jan 27, 2015
1 parent effdea6 commit 714e611
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Release 1.8 - Current Development

* Include media duration in metadata parsed by MP4Parser (TIKA-1530).

* Support password protected 7zip files (using a PasswordProvider,
in keeping with the other password supporting formats) (TIKA-1521)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public void parse(

// Get the duration
double durationSeconds = ((double)mHeader.getDuration()) / mHeader.getTimescale();
metadata.set(XMPDM.DURATION, durationSeconds);
// TODO Use this

// The timescale is normally the sampling rate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public void testMP4ParsingAudio() throws Exception {
assertEquals("44100", metadata.get(XMPDM.AUDIO_SAMPLE_RATE));
assertEquals("Stereo", metadata.get(XMPDM.AUDIO_CHANNEL_TYPE));
assertEquals("M4A", metadata.get(XMPDM.AUDIO_COMPRESSOR));
// Only compare two decimals to avoid floating point comparison error.
assertEquals("0.06", metadata.get(XMPDM.DURATION).substring(0, 4));

assertEquals("iTunes 10.5.3.3", metadata.get(XMP.CREATOR_TOOL));

Expand Down

0 comments on commit 714e611

Please sign in to comment.