Skip to content

Commit

Permalink
Merge pull request #1265 from DolbyLaboratories:dlb/ac4-level4/dev_new2
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 696157037
(cherry picked from commit 74611bb)
  • Loading branch information
copybara-github authored and icbaker committed Nov 19, 2024
1 parent 57d0721 commit 47f3aab
Show file tree
Hide file tree
Showing 16 changed files with 1,393 additions and 11 deletions.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### Unreleased changes

* Extractors:
* Add AC-4 Level-4 ISO base media file format support
([#1265](https://github.com/androidx/media/pull/1265)).
* Text:
* Fix garbled CEA-608 subtitles in content with more than one SEI message
per sample.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2250,6 +2250,24 @@ public static int getAudioTrackChannelConfig(int channelCount) {
}
case 12:
return AudioFormat.CHANNEL_OUT_7POINT1POINT4;
case 24:
if (Util.SDK_INT >= 32) {
return AudioFormat.CHANNEL_OUT_7POINT1POINT4
| AudioFormat.CHANNEL_OUT_FRONT_LEFT_OF_CENTER
| AudioFormat.CHANNEL_OUT_FRONT_RIGHT_OF_CENTER
| AudioFormat.CHANNEL_OUT_BACK_CENTER
| AudioFormat.CHANNEL_OUT_TOP_CENTER
| AudioFormat.CHANNEL_OUT_TOP_FRONT_CENTER
| AudioFormat.CHANNEL_OUT_TOP_BACK_CENTER
| AudioFormat.CHANNEL_OUT_TOP_SIDE_LEFT
| AudioFormat.CHANNEL_OUT_TOP_SIDE_RIGHT
| AudioFormat.CHANNEL_OUT_BOTTOM_FRONT_LEFT
| AudioFormat.CHANNEL_OUT_BOTTOM_FRONT_RIGHT
| AudioFormat.CHANNEL_OUT_BOTTOM_FRONT_CENTER
| AudioFormat.CHANNEL_OUT_LOW_FREQUENCY_2;
} else {
return AudioFormat.CHANNEL_INVALID;
}
default:
return AudioFormat.CHANNEL_INVALID;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4224,18 +4224,22 @@ public boolean isEnabled() {

public boolean canBeSpatialized(AudioAttributes audioAttributes, Format format) {
int linearChannelCount;
if (Objects.equals(format.sampleMimeType, MimeTypes.AUDIO_E_AC3_JOC)
&& format.channelCount == 16) {
if (Objects.equals(format.sampleMimeType, MimeTypes.AUDIO_E_AC3_JOC)) {
// For E-AC3 JOC, the format is object based. When the channel count is 16, this maps to 12
// linear channels and the rest are used for objects. See
// https://github.com/google/ExoPlayer/pull/10322#discussion_r895265881
linearChannelCount = 12;
} else if (Objects.equals(format.sampleMimeType, MimeTypes.AUDIO_IAMF)
&& format.channelCount == Format.NO_VALUE) {
linearChannelCount = format.channelCount == 16 ? 12 : format.channelCount;
} else if (Objects.equals(format.sampleMimeType, MimeTypes.AUDIO_IAMF)) {
// IAMF with no channel count specified, assume 5.1 channels. This depends on
// IamfDecoder.SPATIALIZED_OUTPUT_LAYOUT being set to AudioFormat.CHANNEL_OUT_5POINT1. Any
// changes to that constant will require updates to this logic.
linearChannelCount = 6;
linearChannelCount = format.channelCount == Format.NO_VALUE ? 6 : format.channelCount;
} else if (Objects.equals(format.sampleMimeType, MimeTypes.AUDIO_AC4)) {
// For AC-4 level 3 or level 4, the format may be object based. When the channel count is
// 18 (level 3 17.1 OBI) or 21 (level 4 20.1 OBI), it is mapped to 24 linear channels (some
// channels are used for metadata transfer).
linearChannelCount =
(format.channelCount == 18 || format.channelCount == 21) ? 24 : format.channelCount;
} else {
linearChannelCount = format.channelCount;
}
Expand Down
Loading

0 comments on commit 47f3aab

Please sign in to comment.