Bug 580982 - Remove workarounds for old YouTube WebM encodings. Don't treat "matroska" doctype as valid WebM file. r=doublec

--HG--
rename : media/libnestegg/include/_stdint.h => media/libnestegg/include/nestegg-stdint.h
This commit is contained in:
Matthew Gregan 2010-08-05 15:49:27 +12:00
Родитель f21acbc8e6
Коммит 4fa609dc19
8 изменённых файлов: 31 добавлений и 35 удалений

Просмотреть файл

@ -192,6 +192,7 @@ _TEST_FILES += \
bug523816.ogv \
bug533822.ogg \
bug557094.ogv \
bug580982.webm \
chain.ogv \
dirac.ogg \
seek.ogv \

Двоичные данные
content/media/test/bug580982.webm Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -190,6 +190,7 @@ var gErrorTests = [
{ name:"448636.ogv", type:"video/ogg" },
{ name:"bug504843.ogv", type:"video/ogg" },
{ name:"bug501279.ogg", type:"audio/ogg" },
{ name:"bug580982.webm", type:"video/webm" },
{ name:"bogus.duh", type:"bogus/duh" }
];

Просмотреть файл

@ -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 5f0ffb8d31782db47d3db541f038caae4ddee9e6.
The git commit ID used was 844b8bc7695e2d60ad7bde3fb5105c0b24304640.

Просмотреть файл

@ -43,6 +43,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
EXPORTS_NAMESPACES = nestegg
EXPORTS_nestegg = nestegg.h _stdint.h
EXPORTS_nestegg = nestegg.h nestegg-stdint.h
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -7,7 +7,7 @@
#ifndef NESTEGG_671cac2a_365d_ed69_d7a3_4491d3538d79
#define NESTEGG_671cac2a_365d_ed69_d7a3_4491d3538d79
#include "_stdint.h"
#include <nestegg/nestegg-stdint.h>
#ifdef __cplusplus
extern "C" {

Просмотреть файл

@ -1406,7 +1406,7 @@ int
nestegg_init(nestegg ** context, nestegg_io io, nestegg_log callback)
{
int r;
uint64_t id, version;
uint64_t id, version, docversion;
struct ebml_list_node * track;
char * doctype;
nestegg * ctx = NULL;
@ -1446,13 +1446,31 @@ nestegg_init(nestegg ** context, nestegg_io io, nestegg_log callback)
return -1;
}
/* XXX youtube hack: accept webm and matroska for now */
if (get_string(ctx->ebml.doctype, &doctype) == 0 &&
(strcmp(doctype, "webm") == 0 ||
strcmp(doctype, "matroska") == 0) &&
get_uint(ctx->ebml.doctype_read_version, &version) == 0 && version <= 2 &&
get_uint(ctx->ebml.ebml_read_version, &version) == 0 && version <= 1 &&
!ctx->segment.tracks.track_entry.head) {
if (get_uint(ctx->ebml.ebml_read_version, &version) != 0) {
version = 1;
}
if (version != 1) {
nestegg_destroy(ctx);
return -1;
}
if (get_string(ctx->ebml.doctype, &doctype) != 0) {
doctype = "matroska";
}
if (strcmp(doctype, "webm") != 0) {
nestegg_destroy(ctx);
return -1;
}
if (get_uint(ctx->ebml.doctype_read_version, &docversion) != 0) {
docversion = 1;
}
if (docversion < 1 || docversion > 2) {
nestegg_destroy(ctx);
return -1;
}
if (!ctx->segment.tracks.track_entry.head) {
nestegg_destroy(ctx);
return -1;
}
@ -1626,25 +1644,10 @@ nestegg_track_type(nestegg * ctx, unsigned int track)
return -1;
}
struct bitmapinfoheader {
int size;
int width;
int height;
short planes;
short bit_count;
unsigned int compression;
int size_image;
int x_pels_per_meter;
int y_pels_per_meter;
int clr_used;
int clr_important;
};
int
nestegg_track_codec_id(nestegg * ctx, unsigned int track)
{
char * codec_id;
struct ebml_binary codec_private;
struct track_entry * entry;
entry = find_track_entry(ctx, track);
@ -1660,15 +1663,6 @@ nestegg_track_codec_id(nestegg * ctx, unsigned int track)
if (strcmp(codec_id, "A_VORBIS") == 0)
return NESTEGG_CODEC_VORBIS;
/* XXX youtube hack: accept VFW codec id for now */
if (strcmp(codec_id, "V_MS/VFW/FOURCC") == 0 &&
get_binary(entry->codec_private, &codec_private) == 0 &&
codec_private.length >= 40) {
struct bitmapinfoheader * bih = (struct bitmapinfoheader *) codec_private.data;
if (bih->compression == 0x30385056)
return NESTEGG_CODEC_VP8;
}
return -1;
}