Bug 1267887 - Update script for mp4parse v0.4.0. r=kinetik

Remove patches for issues which are fixed upstream.

Update the script to generate the C api header file by running
`cargo build` before copying it.

Update byteorder mod-ification patch to apply to 0.5.3.

MozReview-Commit-ID: 8FDpbcSWt1o
This commit is contained in:
Ralph Giles 2016-06-23 09:38:19 -07:00
Родитель 711f285ffd
Коммит 1382abe1f6
3 изменённых файлов: 35 добавлений и 60 удалений

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

@ -1,39 +1,55 @@
diff --git a/media/libstagefright/binding/mp4parse/byteorder/mod.rs b/media/libstagefright/binding/mp4parse/byteorder/mod.rs
index 7eea1e3..8a108cf 100644
index a25bab6..13db30a 100644
--- a/media/libstagefright/binding/mp4parse/byteorder/mod.rs
+++ b/media/libstagefright/binding/mp4parse/byteorder/mod.rs
@@ -36,7 +36,6 @@ assert_eq!(wtr, vec![5, 2, 0, 3]);
@@ -36,24 +36,17 @@ assert_eq!(wtr, vec![5, 2, 0, 3]);
```
*/
-#![crate_name = "byteorder"]
#![doc(html_root_url = "http://burntsushi.net/rustdoc/byteorder")]
-#![cfg_attr(not(feature = "std"), no_std)]
-
#![deny(missing_docs)]
@@ -45,10 +44,11 @@ use std::mem::transmute;
use std::ptr::copy_nonoverlapping;
#[cfg(not(feature = "no-std"))]
-pub use new::{ReadBytesExt, WriteBytesExt, Error, Result};
+pub use byteorder::new::{ReadBytesExt, WriteBytesExt, Error, Result};
-#[cfg(feature = "std")]
-extern crate core;
-
-use core::mem::transmute;
-use core::ptr::copy_nonoverlapping;
+use std::mem::transmute;
+use std::ptr::copy_nonoverlapping;
#[cfg(not(feature = "no-std"))]
-#[cfg(feature = "std")]
-pub use new::{ReadBytesExt, WriteBytesExt};
+pub use byteorder::new::{ReadBytesExt, WriteBytesExt};
-#[cfg(feature = "std")]
-mod new;
+// Re-export new so gecko can build us as a mod intead of a crate.
+// Re-export new so gecko can build us as a mod instead of a crate.
+pub mod new;
#[inline]
fn extend_sign(val: u64, nbytes: usize) -> i64 {
@@ -300,7 +293,7 @@ pub type NativeEndian = BigEndian;
macro_rules! read_num_bytes {
($ty:ty, $size:expr, $src:expr, $which:ident) => ({
- assert!($size == ::core::mem::size_of::<$ty>());
+ assert!($size == ::std::mem::size_of::<$ty>());
assert!($size <= $src.len());
let mut data: $ty = 0;
unsafe {
diff --git a/media/libstagefright/binding/mp4parse/byteorder/new.rs b/media/libstagefright/binding/mp4parse/byteorder/new.rs
index 54ee6a7..4efcbc3 100644
index b5f3770..b32f97b 100644
--- a/media/libstagefright/binding/mp4parse/byteorder/new.rs
+++ b/media/libstagefright/binding/mp4parse/byteorder/new.rs
@@ -3,7 +3,7 @@ use std::fmt;
use std::io;
use std::result;
@@ -1,6 +1,6 @@
use std::io::{self, Result};
-use ByteOrder;
+use byteorder::ByteOrder;
/// A short-hand for `result::Result<T, byteorder::Error>`.
pub type Result<T> = result::Result<T, Error>;
/// Extends `Read` with methods for reading numbers. (For `std::io`.)
///

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

@ -1,42 +0,0 @@
diff --git a/media/libstagefright/binding/mp4parse/capi.rs b/media/libstagefright/binding/mp4parse/capi.rs
index 6e8c6f9..ed7e566 100644
--- a/media/libstagefright/binding/mp4parse/capi.rs
+++ b/media/libstagefright/binding/mp4parse/capi.rs
@@ -174,22 +174,21 @@ pub unsafe extern "C" fn mp4parse_get_track_info(context: *mut MediaContext, tra
return MP4PARSE_ERROR_INVALID;
}
- std::thread::spawn(move || {
- let track = &context.tracks[track_index];
- let empty_duration = if track.empty_duration.is_some() {
- media_time_to_ms(track.empty_duration.unwrap(), context.timescale.unwrap())
- } else {
- 0
- };
- info.media_time = if track.media_time.is_some() {
- track_time_to_ms(track.media_time.unwrap(), track.timescale.unwrap()) as i64 - empty_duration as i64
- } else {
- 0
- };
- info.duration = track_time_to_ms(track.duration.unwrap(), track.timescale.unwrap());
- info.track_id = track.track_id.unwrap();
- MP4PARSE_OK
- }).join().unwrap_or(MP4PARSE_ERROR_INVALID)
+ let track = &context.tracks[track_index];
+ let empty_duration = if track.empty_duration.is_some() {
+ media_time_to_ms(track.empty_duration.unwrap(), context.timescale.unwrap())
+ } else {
+ 0
+ };
+ info.media_time = if track.media_time.is_some() {
+ track_time_to_ms(track.media_time.unwrap(), track.timescale.unwrap()) as i64 - empty_duration as i64
+ } else {
+ 0
+ };
+ info.duration = track_time_to_ms(track.duration.unwrap(), track.timescale.unwrap());
+ info.track_id = track.track_id.unwrap();
+
+ MP4PARSE_OK
}
#[no_mangle]

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

@ -2,7 +2,7 @@
# Script to update mp4parse-rust sources to latest upstream
# Default version.
VER=v0.2.1
VER=v0.4.0
# Accept version or commit from the command line.
if test -n "$1"; then
@ -14,6 +14,8 @@ rm -rf _upstream
git clone https://github.com/mozilla/mp4parse-rust _upstream/mp4parse
pushd _upstream/mp4parse
git checkout ${VER}
echo "Constructing C api header..."
cargo build
popd
rm -rf mp4parse
mkdir mp4parse
@ -24,7 +26,7 @@ cp _upstream/mp4parse/include/mp4parse.h include/
git clone https://github.com/BurntSushi/byteorder _upstream/byteorder
pushd _upstream/byteorder
git checkout 0.4.2
git checkout 0.5.3
popd
rm -rf mp4parse/byteorder
mkdir mp4parse/byteorder
@ -34,7 +36,6 @@ cp _upstream/byteorder/src/new.rs mp4parse/byteorder/new.rs
echo "Applying patches..."
patch -p4 < byteorder-mod.patch
patch -p4 < mp4parse-mod.patch
patch -p4 < mp4parse-thread.patch
echo "Cleaning up..."
rm -rf _upstream