From bd451cd8a9924cfb7c3fdad54a3c1be560c43e6e Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Mon, 11 Nov 2013 21:44:00 +1300 Subject: [PATCH] Bug 888789 - Update nestegg with VP9 and Opus support. r=kinetik Update our in-tree source to the upstream master branch. --- media/libnestegg/README_MOZILLA | 2 +- media/libnestegg/include/nestegg.h | 2 ++ media/libnestegg/src/macros.h | 2 +- media/libnestegg/src/nestegg.c | 18 ++++++++++++------ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/media/libnestegg/README_MOZILLA b/media/libnestegg/README_MOZILLA index d58c4d8c06ba..ecfdfe06cc44 100644 --- a/media/libnestegg/README_MOZILLA +++ b/media/libnestegg/README_MOZILLA @@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system. The nestegg git repository is: git://github.com/kinetiknz/nestegg.git -The git commit ID used was 7d0f6d22b5a332ce47b95bc19dc259f204d339e1. +The git commit ID used was 26d262114af191b6654cbd5d24ec02e4b6bdb1cd. diff --git a/media/libnestegg/include/nestegg.h b/media/libnestegg/include/nestegg.h index 88ea4a3b097b..6f307aa398bf 100644 --- a/media/libnestegg/include/nestegg.h +++ b/media/libnestegg/include/nestegg.h @@ -67,6 +67,8 @@ extern "C" { #define NESTEGG_CODEC_VP8 0 /**< Track uses Google On2 VP8 codec. */ #define NESTEGG_CODEC_VORBIS 1 /**< Track uses Xiph Vorbis codec. */ +#define NESTEGG_CODEC_VP9 2 /**< Track uses Google On2 VP9 codec. */ +#define NESTEGG_CODEC_OPUS 3 /**< Track uses Xiph Opus codec. */ #define NESTEGG_VIDEO_MONO 0 /**< Track is mono video. */ #define NESTEGG_VIDEO_STEREO_LEFT_RIGHT 1 /**< Track is side-by-side stereo video. Left first. */ diff --git a/media/libnestegg/src/macros.h b/media/libnestegg/src/macros.h index c36b516eed38..1f84bc277936 100644 --- a/media/libnestegg/src/macros.h +++ b/media/libnestegg/src/macros.h @@ -20,7 +20,7 @@ /* restore pointer to the structure by a pointer to its field */ -#define structof(p,t,f) ((t*)(- offsetof(t,f) + (char*)(p))) +#define structof(p,t,f) ((t*)(- (ptrdiff_t) offsetof(t,f) + (char*)(p))) /* * redefine for the target compiler diff --git a/media/libnestegg/src/nestegg.c b/media/libnestegg/src/nestegg.c index c6d685f2db97..b3bc9cb6dd0c 100644 --- a/media/libnestegg/src/nestegg.c +++ b/media/libnestegg/src/nestegg.c @@ -128,7 +128,9 @@ enum ebml_type_enum { /* Track IDs */ #define TRACK_ID_VP8 "V_VP8" +#define TRACK_ID_VP9 "V_VP9" #define TRACK_ID_VORBIS "A_VORBIS" +#define TRACK_ID_OPUS "A_OPUS" enum vint_mask { MASK_NONE, @@ -1422,9 +1424,8 @@ ne_find_cue_position_for_track(nestegg * ctx, struct ebml_list_node * node, unsi if (ne_map_track_number_to_index(ctx, track_number, &t) != 0) return NULL; - if (t == track) { + if (t == track) return pos; - } node = node->next; } @@ -1550,9 +1551,9 @@ ne_buffer_read(void * buffer, size_t length, void * user_data) int rv = 1; size_t available = sb->length - sb->offset; - if (available < length) { + if (available < length) return 0; - } + memcpy(buffer, sb->buffer + sb->offset, length); sb->offset += length; @@ -1577,9 +1578,8 @@ ne_buffer_seek(int64_t offset, int whence, void * user_data) break; } - if (o < 0 || o > (int64_t) sb->length) { + if (o < 0 || o > (int64_t) sb->length) return -1; - } sb->offset = o; return 0; @@ -1933,9 +1933,15 @@ nestegg_track_codec_id(nestegg * ctx, unsigned int track) if (strcmp(codec_id, TRACK_ID_VP8) == 0) return NESTEGG_CODEC_VP8; + if (strcmp(codec_id, TRACK_ID_VP9) == 0) + return NESTEGG_CODEC_VP9; + if (strcmp(codec_id, TRACK_ID_VORBIS) == 0) return NESTEGG_CODEC_VORBIS; + if (strcmp(codec_id, TRACK_ID_OPUS) == 0) + return NESTEGG_CODEC_OPUS; + return -1; }