diff options
Diffstat (limited to 'media')
-rw-r--r-- | media/libnestegg/include/nestegg.h | 2 | ||||
-rw-r--r-- | media/libnestegg/src/nestegg.c | 28 |
2 files changed, 28 insertions, 2 deletions
diff --git a/media/libnestegg/include/nestegg.h b/media/libnestegg/include/nestegg.h index 2baa50bc5..2a9f08f5d 100644 --- a/media/libnestegg/include/nestegg.h +++ b/media/libnestegg/include/nestegg.h @@ -72,6 +72,8 @@ extern "C" { #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' */ +#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 61c30ec6b..051bc50fa 100644 --- a/media/libnestegg/src/nestegg.c +++ b/media/libnestegg/src/nestegg.c @@ -157,6 +157,8 @@ enum ebml_type_enum { #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 @@ -2401,6 +2403,12 @@ nestegg_track_codec_id(nestegg * ctx, unsigned int track) 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; } @@ -2421,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; } @@ -2459,7 +2468,9 @@ nestegg_track_codec_data(nestegg * ctx, unsigned int track, unsigned int item, 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) @@ -2772,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; |