diff --git a/Cargo.lock b/Cargo.lock index 8cc3462..f3820e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,7 +85,7 @@ dependencies = [ "alto 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "ogg 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ogg 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -129,7 +129,7 @@ dependencies = [ [[package]] name = "ogg" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -301,7 +301,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" "checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527" "checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699" -"checksum ogg 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb472858ac9015c8d3faa91e9cb2d06230db7d8c351f43ae7663423e67d6bd1e" +"checksum ogg 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c4663614e6994a1bd003633f93bfef54c16b420d5622e11ffc36d9c27632cae" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" "checksum parking_lot_core 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f610cb9664da38e417ea3225f23051f589851999535290e077939838ab7a595" diff --git a/Cargo.toml b/Cargo.toml index b38d699..f272a14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,12 +17,12 @@ async_ogg = ["ogg", "ogg/async", "futures", "tokio-io"] [dependencies] byteorder = "1.0" smallvec = "0.6" -ogg = { version = "0.6", optional = true } +ogg = { version = "0.6.1", optional = true } tokio-io = { version = "0.1", optional = true } futures = { version = "0.1", optional = true } [dev-dependencies] -ogg = "0.6" +ogg = "0.6.1" alto = "3" [package.metadata.docs.rs] diff --git a/dev/cmp/Cargo.lock b/dev/cmp/Cargo.lock index 3cf1724..1f3c52e 100644 --- a/dev/cmp/Cargo.lock +++ b/dev/cmp/Cargo.lock @@ -75,7 +75,7 @@ name = "lewton" version = "0.9.2" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ogg 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ogg 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -97,7 +97,7 @@ dependencies = [ [[package]] name = "ogg" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -275,7 +275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e6412c5e2ad9584b0b8e979393122026cdd6d2a80b933f890dcd694ddbe73739" "checksum libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "d1419b2939a0bc44b77feb34661583c7546b532b192feab36249ab584b86856c" "checksum libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16" -"checksum ogg 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb472858ac9015c8d3faa91e9cb2d06230db7d8c351f43ae7663423e67d6bd1e" +"checksum ogg 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c4663614e6994a1bd003633f93bfef54c16b420d5622e11ffc36d9c27632cae" "checksum ogg-sys 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "a95b8c172e17df1a41bf8d666301d3b2c4efeb90d9d0415e2a4dc0668b35fdb2" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" "checksum openssl-sys 0.9.31 (registry+https://github.com/rust-lang/crates.io-index)" = "a4d6a27d108b29befe1822d40e2e22f85518dac59acbf7f30fdc532f48fd0a77" diff --git a/dev/cmp/tests/vals.rs b/dev/cmp/tests/vals.rs index 3de3d0c..f02cd32 100644 --- a/dev/cmp/tests/vals.rs +++ b/dev/cmp/tests/vals.rs @@ -53,7 +53,15 @@ fn test_libnogg_vals() { cmp_output!("6ch-long-first-packet.ogg", 0); cmp_output!("6ch-moving-sine-floor0.ogg", 0); cmp_output!("6ch-moving-sine.ogg", 0); - ensure_malformed!("bad-continued-packet-flag.ogg", OggError(InvalidData)); + // NOTE: The bad-continued-packet-flag.ogg test is + // actually supposed to return an error in libnogg. + // However, libvorbis doesn't, nor does lewton. + // Given a (slightly) erroneous ogg file where there + // are audio packets following the last header packet, + // we follow libvorbis behaviour and simply ignore those packets. + // Apparently the test case has been created in a way + // where this behaviour doesn't evoke an error from lewton. + cmp_output!("bad-continued-packet-flag.ogg", 0); cmp_output!("bitrate-123.ogg", 0); cmp_output!("bitrate-456-0.ogg", 0); cmp_output!("bitrate-456-789.ogg", 0); @@ -113,8 +121,7 @@ fn test_xiph_vals_2() { // TODO fix these //cmp_output!("chain-test1.ogg", 1); cmp_output!("chain-test2.ogg", 0); - // stb_vorbis can't open this file at all (gives VORBIS_invalid_setup) - //cmp_output!("chain-test3.ogg", 1); + cmp_output!("chain-test3.ogg", 1); cmp_output!("highrate-test.ogg", 0); } @@ -157,9 +164,7 @@ fn test_xiph_vals_5() { cmp_output!("singlemap-test.ogg", 0); cmp_output!("sleepzor.ogg", 9); - // TODO fix this test as well - // stb_vorbis can't open this file at all (gives VORBIS_invalid_setup) - cmp_output!("test-short.ogg", 69); + cmp_output!("test-short.ogg", 1); cmp_output!("test-short2.ogg", 0); // Contains an out of bounds mode index ensure_malformed!("unused-mode-test.ogg", BadAudio(AudioBadFormat)); diff --git a/src/header.rs b/src/header.rs index bfa57fa..239ce65 100644 --- a/src/header.rs +++ b/src/header.rs @@ -503,8 +503,8 @@ fn lookup_vec_val_decode(lup :&CodebookVqLookup, codebook_entries :u32, codebook } } } else { - let mut last = 0.; for lookup_offset in 0 .. codebook_entries { + let mut last = 0.; let mut multiplicand_offset :usize = lookup_offset as usize * codebook_dimensions as usize; for _ in 0 .. codebook_dimensions { let vec_elem = lup.codebook_multiplicands[multiplicand_offset] as f32 * diff --git a/src/inside_ogg.rs b/src/inside_ogg.rs index 7138a57..51217b1 100644 --- a/src/inside_ogg.rs +++ b/src/inside_ogg.rs @@ -37,6 +37,7 @@ pub fn read_headers<'a, T: Read + Seek + 'a>(rdr: &mut PacketReader) -> let setup_hdr = try!(read_header_setup(&pck.data, ident_hdr.audio_channels, (ident_hdr.blocksize_0, ident_hdr.blocksize_1))); + rdr.delete_unread_packets(); return Ok(((ident_hdr, comment_hdr, setup_hdr), pck.stream_serial)); }