mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add support for extracting 32-bit float WAVE
Issue: #3379 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179925320
This commit is contained in:
parent
61b9e846a8
commit
f2bb2d27be
2 changed files with 18 additions and 6 deletions
|
|
@ -36,6 +36,8 @@
|
||||||
* DefaultTrackSelector: Support disabling of individual text track selection
|
* DefaultTrackSelector: Support disabling of individual text track selection
|
||||||
flags.
|
flags.
|
||||||
* New Cast extension: Simplifies toggling between local and Cast playbacks.
|
* New Cast extension: Simplifies toggling between local and Cast playbacks.
|
||||||
|
* Add support for extracting 32-bit WAVE files
|
||||||
|
([#3379](https://github.com/google/ExoPlayer/issues/3379)).
|
||||||
|
|
||||||
### 2.6.1 ###
|
### 2.6.1 ###
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
+ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue