Dactyloidae/media/libnestegg/mcp-avcaacsupport.patch
Job Bautista b7a771fce6 Issue #1948 - Update nestegg library.
I separated out the AVC and AAC support code into a patch file so that
 the upstream code can be updated freely without having to re-add AVC
 and AAC support again. At least if the upstream changes are not too
 extensive...
This should effectively backport Mozilla bug 1539686, which allows the
 browser to parse the color information from WebM videos that uses HDR.
2022-07-02 17:00:36 +08:00

59 lines
2 KiB
Diff

diff -u /include/nestegg.h /include/nestegg.h
--- /include/nestegg.h
+++ /include/nestegg.h
@@ -72,6 +72,8 @@
#define NESTEGG_CODEC_VP9 2 /**< Track uses Google On2 VP9 codec. */
#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' codec. */
+#define NESTEGG_CODEC_AAC 6 /**< Track uses AAC 'mp4a' codec. */
#define NESTEGG_CODEC_UNKNOWN INT_MAX /**< Track uses unknown codec. */
#define NESTEGG_VIDEO_MONO 0 /**< Track is mono video. */
diff -u /src/nestegg.c /src/nestegg.c
--- /src/nestegg.c
+++ /src/nestegg.c
@@ -177,6 +177,8 @@
#define TRACK_ID_AV1 "V_AV1"
#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
@@ -2482,6 +2484,12 @@
if (strcmp(codec_id, TRACK_ID_OPUS) == 0)
return NESTEGG_CODEC_OPUS;
+ 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;
}
@@ -2502,7 +2510,8 @@
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;
}
@@ -2540,7 +2549,9 @@
return -1;
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_OPUS &&
+ 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)