Skip to content

Commit

Permalink
change error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jsaowji committed Feb 7, 2024
1 parent 56e8777 commit d27a1e8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 56 deletions.
15 changes: 9 additions & 6 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# dvdsrc2
See https:/Jaded-Encoding-Thaumaturgy/vs-source for usage examples. It is not ment to be used on its own.

# how to build linux
install a52dec mpeg2dec libdvdread rust
cargo build
# how to build under linux
install a52dec mpeg2dec libdvdread rust from your package manager
cargo build --release

# msys
see the github action for reference

#msys
install all the stuff: (rust dvdread dvdcss libmpeg2 a52dec) for mingw64
install all the dependencies: (rust dvdread dvdcss libmpeg2 a52dec) for mingw64

in a mingw64 shell
in a mingw64 shell type:
cargo build --release

#Alternativly if you want to use your windows rust install, change the default target to mingw using rustup and make msys2 mingw64 see cargo by modifying msys2 mingw ini remove # before the inherit line
2 changes: 1 addition & 1 deletion dvdsrc2/src/full_vts_video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ impl Filter for FullVtsFilter {
let mut mut_stuff = self.mut_stuff.lock().unwrap();
{
if mut_stuff.frame_cache.contains_key(&n) {
//eprintln!("getting from cached {}",n);
return Ok(mut_stuff.frame_cache.remove(&n));
}
}
Expand All @@ -217,6 +216,7 @@ impl Filter for FullVtsFilter {
let info = mpeg2_info(mpeg2dec);

let target_vobu = self.vobu_lookup[n as usize];

//TODO: LAST VOBU WITH VIDEO
let last_vobu = self.vobus.len() - 1 == target_vobu as usize;

Expand Down
37 changes: 0 additions & 37 deletions dvdsrccommon/build.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
//use std::path::{Path, PathBuf};

//fn workspace_dir() -> PathBuf {
// let output = std::process::Command::new(env!("CARGO"))
// .arg("locate-project")
// .arg("--workspace")
// .arg("--message-format=plain")
// .output()
// .unwrap()
// .stdout;
// let cargo_path = Path::new(std::str::from_utf8(&output).unwrap().trim());
// cargo_path.parent().unwrap().to_path_buf()
//}

//const LIBRARY_DIR_VARIABLE: &str = "WINDOWSLIB_DIR";

fn main() {
// Make sure the build script is re-run if our env variable is changed.
// println!("cargo:rerun-if-env-changed={}", LIBRARY_DIR_VARIABLE);
Expand All @@ -28,25 +12,4 @@ fn main() {
println!("cargo:rustc-link-lib=mpeg2");
println!("cargo:rustc-link-lib=a52");
}

//let target = std::env::var("TARGET").unwrap();

// if target == "x86_64-pc-windows-gnu" {
// println!("cargo:rustc-link-lib=static=dvdread");
// println!("cargo:rustc-link-lib=static=mpeg2");
//
// //does not have pkg config on msys2
// println!("cargo:rustc-link-lib=static=a52");
//
// // cc::Build::new()
// // // .compiler("zig cc")
// // .file("jsonstuff.cpp")
// // .include(format!("{}/libdvdread-6.1.3/src",workspace_dir().join("windows_libs").to_string_lossy()))
// // .compile("jsonstuff");
// } else {
// // println!("cargo:rustc-link-lib=dvdread");
// // println!("cargo:rustc-link-lib=mpeg2");
// // println!("cargo:rustc-link-lib=a52");
// }
// println!("cargo:rustc-link-lib=jsonstuff");
}
5 changes: 4 additions & 1 deletion dvdsrccommon/src/audio_demuxing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ pub fn raw_audio_frames_init(
let is_last = v.0 == last_i;
let aua = v.1.v.streams.iter().find(|e| e.id == real_stream_idx);
if aua.is_none() {
eprintln!("VOBU without audio: {}", v.1.i);
eprintln!(
"WARNING: Found a VOBU without audio: {}",
v.1.i
);
continue;
}
let aua = aua.unwrap();
Expand Down
21 changes: 10 additions & 11 deletions dvdsrccommon/src/do_index_dvd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ fn do_index(dvd: *mut dvd_reader_s, vts: i32) -> Result<IndexedVts, std::io::Err
.map(|e| e.temporal_reference)
.max();
a.temporal_reference = maxi.unwrap() + 1;
eprintln!("FOUND BAD TEMPORAL REFERENCE TRYING TO FIX\nWILL ONLY WORK IF ITS THE ONE CASE I SAW");

eprintln!(
"WARNING: Found a bad temporal reference trying to make it still work"
);
}
}
let mut sort_frames = g.frames.clone();
Expand Down Expand Up @@ -203,11 +206,10 @@ fn do_index(dvd: *mut dvd_reader_s, vts: i32) -> Result<IndexedVts, std::io::Err

loop {
let crnt = b.seek(SeekFrom::Current(0))?;
//eprintln!("{:.02} \r",100.0 * crnt as f32 / maxsize as f32);

if crnt == maxsize {
break;
}
//dbg!(b.seek(SeekFrom::Current(0))?,maxsize);

assert_eq!(start_code(&mut b)?, 0xBA);
b.read_exact(&mut scratch[0..10])?;
Expand All @@ -219,9 +221,6 @@ fn do_index(dvd: *mut dvd_reader_s, vts: i32) -> Result<IndexedVts, std::io::Err
loop {
let nxt = start_code(&mut b)?;
let sz = b.read_u16::<BE>()? as usize;
//if crnt >= (6.5 * 1024.0 * 1024.0 * 1024.0) as _{
// println!("{} {:X}",crnt,nxt);
//}

match nxt {
0xBF => {
Expand Down Expand Up @@ -371,7 +370,7 @@ struct Gopaliser {}

impl Gopaliser {
pub fn doit(video_data: &[u8]) -> Result<(Vec<Gop>, bool), std::io::Error> {
let mut b = Cursor::new(video_data.clone());
let mut b = Cursor::new(video_data);

let mut has_seq_end = false;

Expand All @@ -389,11 +388,11 @@ impl Gopaliser {
}
ii += 1;
if ii > 10 {
panic!("something went wrong");
panic!("ERROR: Something went wrong; GOP does not start as expected");
}
}
if ii != 0 {
eprintln!("Please open issue i am looking for more samples of this phenomen");
eprintln!("WARNING: Had to use a workaround to find video start");
}

loop {
Expand Down Expand Up @@ -473,12 +472,12 @@ impl Gopaliser {
}
0xB7 => {
has_seq_end = true;
eprintln!("seq end");
eprintln!("INFO: Found a SEQUENCE_END");
}
e => {
if e >= 0x01 && e <= 0xAF {
} else {
eprintln!("{:X}", e);
eprintln!("WARNING: Found unexpected start code: {:X}", e);
}
}
}
Expand Down

0 comments on commit d27a1e8

Please sign in to comment.