Commit 42a3e2e9 by andrewlewis Committed by Oliver Woodman

Add support for extracting 32-bit float WAVE

Issue: #3379

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179925320
parent f8c76f62
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
* Audio: * Audio:
* Support 32-bit PCM float output from `DefaultAudioSink`, and add an option * Support 32-bit PCM float output from `DefaultAudioSink`, and add an option
to use this with `FfmpegAudioRenderer`. to use this with `FfmpegAudioRenderer`.
* Add support for extracting 32-bit WAVE files
([#3379](https://github.com/google/ExoPlayer/issues/3379)).
* Support extraction and decoding of Dolby Atmos * Support extraction and decoding of Dolby Atmos
([#2465](https://github.com/google/ExoPlayer/issues/2465)). ([#2465](https://github.com/google/ExoPlayer/issues/2465)).
* Fix handling of playback parameter changes while paused when followed by a * Fix handling of playback parameter changes while paused when followed by a
......
...@@ -31,6 +31,8 @@ import java.io.IOException; ...@@ -31,6 +31,8 @@ import java.io.IOException;
/** Integer PCM audio data. */ /** Integer PCM audio data. */
private static final int TYPE_PCM = 0x0001; private static final int TYPE_PCM = 0x0001;
/** Float PCM audio data. */
private static final int TYPE_FLOAT = 0x0003;
/** Extended WAVE format. */ /** Extended WAVE format. */
private static final int TYPE_WAVE_FORMAT_EXTENSIBLE = 0xFFFE; private static final int TYPE_WAVE_FORMAT_EXTENSIBLE = 0xFFFE;
...@@ -87,14 +89,22 @@ import java.io.IOException; ...@@ -87,14 +89,22 @@ import java.io.IOException;
+ blockAlignment); + blockAlignment);
} }
@C.PcmEncoding int encoding = Util.getPcmEncoding(bitsPerSample); @C.PcmEncoding int encoding;
if (encoding == C.ENCODING_INVALID) { switch (type) {
Log.e(TAG, "Unsupported WAV bit depth: " + bitsPerSample); case TYPE_PCM:
case TYPE_WAVE_FORMAT_EXTENSIBLE:
encoding = Util.getPcmEncoding(bitsPerSample);
break;
case TYPE_FLOAT:
encoding = bitsPerSample == 32 ? C.ENCODING_PCM_FLOAT : C.ENCODING_INVALID;
break;
default:
Log.e(TAG, "Unsupported WAV format type: " + type);
return null; return null;
} }
if (type != TYPE_PCM && type != TYPE_WAVE_FORMAT_EXTENSIBLE) { if (encoding == C.ENCODING_INVALID) {
Log.e(TAG, "Unsupported WAV format type: " + type); Log.e(TAG, "Unsupported WAV bit depth " + bitsPerSample + " for type " + type);
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment