summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2019-07-18 17:34:26 +0000
committerGitHub <noreply@github.com>2019-07-18 17:34:26 +0000
commitbf2610c0cfc96327178a5d3d7121181c2f375f48 (patch)
treeeb35ad416173cc4aa88e90bb8ed235289e1dc7de
parent7979df5512bef6e1a67fbcc390817128fd4e7743 (diff)
parentf820636a8300b44751750354a01be21895b4b536 (diff)
downloadUXP-bf2610c0cfc96327178a5d3d7121181c2f375f48.tar
UXP-bf2610c0cfc96327178a5d3d7121181c2f375f48.tar.gz
UXP-bf2610c0cfc96327178a5d3d7121181c2f375f48.tar.lz
UXP-bf2610c0cfc96327178a5d3d7121181c2f375f48.tar.xz
UXP-bf2610c0cfc96327178a5d3d7121181c2f375f48.zip
Merge pull request #1189 from JeroenVreeken/master
Add support for AAC audio in matroska/webm files
-rw-r--r--dom/media/webm/WebMDecoder.cpp4
-rw-r--r--dom/media/webm/WebMDemuxer.cpp2
-rw-r--r--media/libnestegg/include/nestegg.h1
-rw-r--r--media/libnestegg/src/nestegg.c23
4 files changed, 28 insertions, 2 deletions
diff --git a/dom/media/webm/WebMDecoder.cpp b/dom/media/webm/WebMDecoder.cpp
index 5cb943742..cbe9ffdb7 100644
--- a/dom/media/webm/WebMDecoder.cpp
+++ b/dom/media/webm/WebMDecoder.cpp
@@ -82,6 +82,10 @@ WebMDecoder::CanHandleMediaType(const nsACString& aMIMETypeExcludingCodecs,
continue;
}
+ if (IsAACCodecString(codec)) {
+ continue;
+ }
+
// Some unsupported codec.
return false;
}
diff --git a/dom/media/webm/WebMDemuxer.cpp b/dom/media/webm/WebMDemuxer.cpp
index 2b6d46186..84b4b506e 100644
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -422,6 +422,8 @@ WebMDemuxer::ReadMetadata()
mInfo.mAudio.mMimeType = "audio/opus";
OpusDataDecoder::AppendCodecDelay(mInfo.mAudio.mCodecSpecificConfig,
media::TimeUnit::FromNanoseconds(params.codec_delay).ToMicroseconds());
+ } else if (mAudioCodec == NESTEGG_CODEC_AAC) {
+ mInfo.mAudio.mMimeType = "audio/mp4a-latm";
}
mSeekPreroll = params.seek_preroll;
mInfo.mAudio.mRate = params.rate;
diff --git a/media/libnestegg/include/nestegg.h b/media/libnestegg/include/nestegg.h
index 777555f7b..2a9f08f5d 100644
--- a/media/libnestegg/include/nestegg.h
+++ b/media/libnestegg/include/nestegg.h
@@ -73,6 +73,7 @@ extern "C" {
#define NESTEGG_CODEC_OPUS 3 /**< Track uses Xiph Opus codec. */
#define NESTEGG_CODEC_AV1 4 /**< Track uses AOMedia AV1 codec. */
#define NESTEGG_CODEC_AVC1 5 /**< Track uses AVC1 'h264' */
+#define NESTEGG_CODEC_AAC 6 /**< Track uses AAC 'mp4a' */
#define NESTEGG_CODEC_UNKNOWN INT_MAX /**< Track uses unknown codec. */
#define NESTEGG_VIDEO_MONO 0 /**< Track is mono video. */
diff --git a/media/libnestegg/src/nestegg.c b/media/libnestegg/src/nestegg.c
index 6f0d55b46..051bc50fa 100644
--- a/media/libnestegg/src/nestegg.c
+++ b/media/libnestegg/src/nestegg.c
@@ -158,6 +158,7 @@ enum ebml_type_enum {
#define TRACK_ID_VORBIS "A_VORBIS"
#define TRACK_ID_OPUS "A_OPUS"
#define TRACK_ID_AVC1 "V_MPEG4/ISO/AVC"
+#define TRACK_ID_AAC "A_AAC"
/* Track Encryption */
#define CONTENT_ENC_ALGO_AES 5
@@ -2405,6 +2406,9 @@ nestegg_track_codec_id(nestegg * ctx, unsigned int track)
if (strcmp(codec_id, TRACK_ID_AVC1) == 0)
return NESTEGG_CODEC_AVC1;
+ if (strcmp(codec_id, TRACK_ID_AAC) == 0)
+ return NESTEGG_CODEC_AAC;
+
return NESTEGG_CODEC_UNKNOWN;
}
@@ -2425,7 +2429,8 @@ nestegg_track_codec_data_count(nestegg * ctx, unsigned int track,
codec_id = nestegg_track_codec_id(ctx, track);
- if (codec_id == NESTEGG_CODEC_OPUS) {
+ if (codec_id == NESTEGG_CODEC_OPUS ||
+ codec_id == NESTEGG_CODEC_AAC) {
*count = 1;
return 0;
}
@@ -2464,7 +2469,8 @@ nestegg_track_codec_data(nestegg * ctx, unsigned int track, unsigned int item,
if (nestegg_track_codec_id(ctx, track) != NESTEGG_CODEC_VORBIS &&
nestegg_track_codec_id(ctx, track) != NESTEGG_CODEC_OPUS &&
- nestegg_track_codec_id(ctx, track) != NESTEGG_CODEC_AVC1)
+ nestegg_track_codec_id(ctx, track) != NESTEGG_CODEC_AVC1 &&
+ nestegg_track_codec_id(ctx, track) != NESTEGG_CODEC_AAC)
return -1;
if (ne_get_binary(entry->codec_private, &codec_private) != 0)
@@ -2777,6 +2783,19 @@ nestegg_read_packet(nestegg * ctx, nestegg_packet ** pkt)
if (r != 1)
return r;
+ /* Some files have a crc32 element, since it also has to be first it
+ conflicts with the timecode spec. Just ignore it */
+ if (id == ID_CRC32) {
+ ctx->log(ctx, NESTEGG_LOG_DEBUG,
+ "read_packet: skipping crc element in a cluster");
+ r = ne_io_read_skip(ctx->io, size);
+ if (r != 1)
+ return r;
+ r = ne_read_element(ctx, &id, &size);
+ if (r != 1)
+ return r;
+ }
+
/* Timecode must be the first element in a Cluster, per spec. */
if (id != ID_TIMECODE)
return -1;