Bug 1343793 - update rust mp4parser. r=kinetik

MozReview-Commit-ID: GGfv911o5Rb

--HG--
rename : third_party/rust/bitreader/LICENSE => third_party/rust/bitreader/LICENSE-APACHE
extra : rebase_source : a60a623af8465fe2220c5294f60f43f75a8513ec
This commit is contained in:
Alfredo.Yang 2017-03-07 09:30:48 +08:00
Родитель b2fd41c814
Коммит c178f4e8ec
16 изменённых файлов: 100 добавлений и 73 удалений

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

@ -51,9 +51,9 @@ typedef struct mp4parse_track_info {
typedef struct mp4parse_indice {
uint64_t start_offset;
uint64_t end_offset;
uint64_t start_composition;
uint64_t end_composition;
uint64_t start_decode;
int64_t start_composition;
int64_t end_composition;
int64_t start_decode;
bool sync;
} mp4parse_indice;

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

@ -10,9 +10,9 @@ index ff9422c..814c4c6 100644
-afl = { version = "0.1.1", optional = true }
-afl-plugin = { version = "0.1.1", optional = true }
-abort_on_panic = { version = "1.0.0", optional = true }
-bitreader = { version = "0.2.0" }
-bitreader = { version = "0.3.0" }
+byteorder = "1.0.0"
+bitreader = { version = "0.2.0" }
+bitreader = { version = "0.3.0" }
[dev-dependencies]
test-assembler = "0.1.2"
@ -39,7 +39,7 @@ index aeeebc65..5c0836a 100644
[dependencies]
byteorder = "1.0.0"
mp4parse = {version = "0.7.0", path = "../mp4parse"}
mp4parse = {version = "0.7.1", path = "../mp4parse"}
-[build-dependencies]
-rusty-cheddar = "0.3.2"

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

@ -1,6 +1,6 @@
[package]
name = "mp4parse"
version = "0.7.0"
version = "0.7.1"
authors = [
"Ralph Giles <giles@mozilla.com>",
"Matthew Gregan <kinetik@flim.org>",
@ -24,7 +24,7 @@ travis-ci = { repository = "https://github.com/mozilla/mp4parse-rust" }
[dependencies]
byteorder = "1.0.0"
bitreader = { version = "0.2.0" }
bitreader = { version = "0.3.0" }
[dev-dependencies]
test-assembler = "0.1.2"

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

@ -416,9 +416,9 @@ pub struct TrackScaledTime(pub u64, pub usize);
#[derive(Debug, Default)]
pub struct EmptySampleTableBoxes {
// TODO: Track has stts, stsc and stco, this structure can be discarded.
pub empty_stts : bool,
pub empty_stsc : bool,
pub empty_stco : bool,
pub empty_stts: bool,
pub empty_stsc: bool,
pub empty_stco: bool,
}
/// Check boxes contain data.

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

@ -1,6 +1,6 @@
[package]
name = "mp4parse_capi"
version = "0.7.0"
version = "0.7.1"
authors = [
"Ralph Giles <giles@mozilla.com>",
"Matthew Gregan <kinetik@flim.org>",
@ -22,7 +22,7 @@ build = false
[dependencies]
byteorder = "1.0.0"
mp4parse = {version = "0.7.0", path = "../mp4parse"}
mp4parse = {version = "0.7.1", path = "../mp4parse"}
# Somewhat heavy-handed, but we want at least -Z force-overflow-checks=on.
[profile.release]

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

@ -65,6 +65,7 @@ use mp4parse::Track;
use mp4parse_error::*;
use mp4parse_track_type::*;
#[allow(non_camel_case_types)]
#[repr(C)]
#[derive(PartialEq, Debug)]
pub enum mp4parse_error {
@ -76,6 +77,7 @@ pub enum mp4parse_error {
MP4PARSE_ERROR_IO = 5,
}
#[allow(non_camel_case_types)]
#[repr(C)]
#[derive(PartialEq, Debug)]
pub enum mp4parse_track_type {
@ -87,6 +89,7 @@ impl Default for mp4parse_track_type {
fn default() -> Self { mp4parse_track_type::MP4PARSE_TRACK_TYPE_VIDEO }
}
#[allow(non_camel_case_types)]
#[repr(C)]
#[derive(PartialEq, Debug)]
pub enum mp4parse_codec {
@ -119,9 +122,9 @@ pub struct mp4parse_track_info {
pub struct mp4parse_indice {
pub start_offset: u64,
pub end_offset: u64,
pub start_composition: u64,
pub end_composition: u64,
pub start_decode: u64,
pub start_composition: i64,
pub end_composition: i64,
pub start_decode: i64,
pub sync: bool,
}
@ -668,22 +671,29 @@ pub unsafe extern fn mp4parse_get_indice_table(parser: *mut mp4parse_parser, tra
_ => {},
}
let media_time = match (&track.media_time, &track.timescale) {
(&Some(t), &Some(s)) => {
track_time_to_us(t, s).map(|v| v as i64)
},
_ => None,
};
let empty_duration = match (&track.empty_duration, &context.timescale) {
(&Some(e), &Some(s)) => {
media_time_to_us(e, s).map(|v| v as i64)
},
_ => None
};
// Find the track start offset time from 'elst'.
// 'media_time' maps start time onward, 'empty_duration' adds time offset
// before first frame is displayed.
let offset_time =
match (&track.empty_duration, &track.media_time, &context.timescale) {
(&Some(empty_duration), &Some(media_time), &Some(scale)) => {
(empty_duration.0 as i64 - media_time.0 as i64) * scale.0 as i64
},
(&Some(empty_duration), _, &Some(scale)) => {
empty_duration.0 as i64 * scale.0 as i64
},
(_, &Some(media_time), &Some(scale)) => {
(0 - media_time.0 as i64) * scale.0 as i64
},
_ => 0,
};
let offset_time = match (empty_duration, media_time) {
(Some(e), Some(m)) => e - m,
(Some(e), None) => e,
(None, Some(m)) => m,
_ => 0,
};
match create_sample_table(track, offset_time) {
Some(v) => {
@ -962,10 +972,10 @@ fn create_sample_table(track: &Track, track_offset_time: i64) -> Option<Vec<mp4p
// ctts_offset is the current sample offset time.
let ctts_offset = PresentationTime::new(ctts_offset_iter.next_offset_time(), timescale);
let start_composition = (decode_time + ctts_offset.to_us() + track_offset_time) as u64;
let end_composition = (sum_delta.to_us() + ctts_offset.to_us() + track_offset_time) as u64;
let start_composition = decode_time + ctts_offset.to_us() + track_offset_time;
let end_composition = sum_delta.to_us() + ctts_offset.to_us() + track_offset_time;
sample.start_decode = decode_time as u64;
sample.start_decode = decode_time;
sample.start_composition = start_composition;
sample.end_composition = end_composition;
}

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

@ -2,7 +2,7 @@
# Script to update mp4parse-rust sources to latest upstream
# Default version.
VER=1fbd8ce2f76c93b88bc7bc41bb67ca76a9f67712
VER=a422808043e6a21ee98729dd8bfe1e8234897d18
# Accept version or commit from the command line.
if test -n "$1"; then

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

@ -1 +1 @@
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"f79c29325421aef57d8191a6a19450b62a431a78a6a5be39f5e8ec259316cdac","Cargo.toml":"672e17bc43e09796c9af69270ab47db16b77da461176ca8692ac211f6b7c09f5","LICENSE":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30","README.md":"979a08488d27db4ea70e4db255ea759d7f4c4c0b65b53e32bd3743117538d20b","src/lib.rs":"62b815c44f50074bc199b6abe9ef2728c3e5dad9539ebe9107b3d818c32c453f","src/tests.rs":"e90f5e1ccbc4c41c42cb3ad0f88aee26b1e08e953b7979a4ddbe0a0826ddbad4"},"package":"8319aa6588c40cce19a135009ec70dc730a34ed9d27bab2409298b948546da7a"}
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"f9b1ca6ae27d1c18215265024629a8960c31379f206d9ed20f64e0b2dcf79805",".travis.yml":"f79c29325421aef57d8191a6a19450b62a431a78a6a5be39f5e8ec259316cdac","Cargo.toml":"4ea2fe4a12740a572f459cc5c51ca721b1a7b256a0976be561c9b0a9fce0dcc7","LICENSE-APACHE":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30","LICENSE-MIT":"8583712ee2b062ff3d4d6d3e16f19ff0f92bc3a0a4beeec11a81ef00146fbd4f","README.md":"a8bfdd9509bb3bb30b30bbe308a717e9827cf97d7a97e5fb5cd69bdd3c88a490","src/lib.rs":"a7ed9d2607f47b7d5d11ccaccf23486a21d072435231d09f4548ad0c4ad62f5b","src/tests.rs":"c4e99780432b3ad05f625961699da72239a975f838cb0ab1cf2501424baed38c"},"package":"80b13e2ab064ff3aa0bdbf1eff533f9822dc37899821f5f98c67f263eab51707"}

4
third_party/rust/bitreader/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "bitreader"
version = "0.2.0"
version = "0.3.0"
authors = ["Ilkka Rauta <ilkka.rauta@gmail.com>"]
description = """
@ -16,4 +16,4 @@ repository = "https://github.com/irauta/bitreader"
keywords = ["bit", "bits", "bitstream"]
license = "Apache-2.0"
license = "MIT OR Apache-2.0"

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

25
third_party/rust/bitreader/LICENSE-MIT поставляемый Normal file
Просмотреть файл

@ -0,0 +1,25 @@
Copyright (c) 2015 Ilkka Rauta
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

6
third_party/rust/bitreader/README.md поставляемый
Просмотреть файл

@ -4,7 +4,7 @@ BitReader is a helper type to extract strings of bits from a slice of bytes.
[![Published Package](https://img.shields.io/crates/v/bitreader.svg)](https://crates.io/crates/bitreader)
[![Documentation](https://docs.rs/bitreader/badge.svg)](https://docs.rs/bitreader)
[![Build Status](https://travis-ci.org/irauta/bitreader.svg)](https://travis-ci.org/irauta/bitreader)
[![Build Status](https://travis-ci.org/irauta/bitreader.svg?branch=master)](https://travis-ci.org/irauta/bitreader)
Here is how you read first a single bit, then three bits and finally four bits from a byte buffer:
@ -21,3 +21,7 @@ Here is how you read first a single bit, then three bits and finally four bits f
You can naturally read bits from longer buffer of data than just a single byte.
As you read bits, the internal cursor of BitReader moves on along the stream of bits. Little endian format is assumed when reading the multi-byte values. BitReader supports reading maximum of 64 bits at a time (with read_u64).
## License
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.

16
third_party/rust/bitreader/src/lib.rs поставляемый
Просмотреть файл

@ -1,16 +1,10 @@
// Copyright 2015 Ilkka Rauta
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! BitReader is a helper type to extract strings of bits from a slice of bytes.
//!

16
third_party/rust/bitreader/src/tests.rs поставляемый
Просмотреть файл

@ -1,16 +1,10 @@
// Copyright 2015 Ilkka Rauta
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use super::*;

14
toolkit/library/gtest/rust/Cargo.lock сгенерированный
Просмотреть файл

@ -94,7 +94,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitreader"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -369,7 +369,7 @@ name = "gkrust-shared"
version = "0.1.0"
dependencies = [
"geckoservo 0.0.1",
"mp4parse_capi 0.7.0",
"mp4parse_capi 0.7.1",
"nsstring 0.1.0",
"rust_url_capi 0.0.1",
"webrender_bindings 0.1.0",
@ -487,9 +487,9 @@ dependencies = [
[[package]]
name = "mp4parse"
version = "0.7.0"
version = "0.7.1"
dependencies = [
"bitreader 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -499,10 +499,10 @@ version = "0.1.0"
[[package]]
name = "mp4parse_capi"
version = "0.7.0"
version = "0.7.1"
dependencies = [
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"mp4parse 0.7.0",
"mp4parse 0.7.1",
]
[[package]]
@ -1251,7 +1251,7 @@ dependencies = [
"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c"
"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitreader 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8319aa6588c40cce19a135009ec70dc730a34ed9d27bab2409298b948546da7a"
"checksum bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "80b13e2ab064ff3aa0bdbf1eff533f9822dc37899821f5f98c67f263eab51707"
"checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8"
"checksum cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393a5f0088efbe41f9d1fcd062f24e83c278608420e62109feb2c8abee07de7d"
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"

14
toolkit/library/rust/Cargo.lock сгенерированный
Просмотреть файл

@ -92,7 +92,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitreader"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -367,7 +367,7 @@ name = "gkrust-shared"
version = "0.1.0"
dependencies = [
"geckoservo 0.0.1",
"mp4parse_capi 0.7.0",
"mp4parse_capi 0.7.1",
"nsstring 0.1.0",
"rust_url_capi 0.0.1",
"webrender_bindings 0.1.0",
@ -485,18 +485,18 @@ dependencies = [
[[package]]
name = "mp4parse"
version = "0.7.0"
version = "0.7.1"
dependencies = [
"bitreader 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "mp4parse_capi"
version = "0.7.0"
version = "0.7.1"
dependencies = [
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"mp4parse 0.7.0",
"mp4parse 0.7.1",
]
[[package]]
@ -1238,7 +1238,7 @@ dependencies = [
"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c"
"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitreader 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8319aa6588c40cce19a135009ec70dc730a34ed9d27bab2409298b948546da7a"
"checksum bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "80b13e2ab064ff3aa0bdbf1eff533f9822dc37899821f5f98c67f263eab51707"
"checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8"
"checksum cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "393a5f0088efbe41f9d1fcd062f24e83c278608420e62109feb2c8abee07de7d"
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"