add a lot of debug output

This commit is contained in:
Vivian Lim 2020-11-29 15:12:10 -08:00
parent bdba596d07
commit 15c830f0b1
1 changed files with 17 additions and 4 deletions

View File

@ -53,7 +53,7 @@ fn video_filter(
pixel_aspect, pixel_aspect,
fps, fps,
); );
eprintln!("{}", args); eprintln!("🎥 filter args: {}", args);
vfilter.add(&filter::find("buffer").unwrap(), "in", &args)?; vfilter.add(&filter::find("buffer").unwrap(), "in", &args)?;
//scale? //scale?
vfilter.add(&filter::find("buffersink").unwrap(), "out", "")?; vfilter.add(&filter::find("buffersink").unwrap(), "out", "")?;
@ -65,9 +65,11 @@ fn video_filter(
vfilter.output("in", 0)? vfilter.output("in", 0)?
.input("out", 0)? .input("out", 0)?
.parse("null")?; .parse("null")?; // passthrough filter for video
vfilter.validate()?; vfilter.validate()?;
// human-readable filter graph
eprintln!("{}", vfilter.dump());
Ok(vfilter) Ok(vfilter)
} }
@ -79,7 +81,7 @@ fn audio_filter(
let mut afilter = filter::Graph::new(); let mut afilter = filter::Graph::new();
let sample_rate = if sample_rate == 0.0 { 32040.0 } else { sample_rate }; let sample_rate = if sample_rate == 0.0 { 32040.0 } else { sample_rate };
let args = format!("sample_rate={}:sample_fmt=s16:channel_layout=stereo", sample_rate); let args = format!("sample_rate={}:sample_fmt=s16:channel_layout=stereo", sample_rate);
eprintln!("{}", args); eprintln!("🔊 filter args: {}", args);
afilter.add(&filter::find("abuffer").unwrap(), "in", &args)?; afilter.add(&filter::find("abuffer").unwrap(), "in", &args)?;
//aresample? //aresample?
afilter.add(&filter::find("abuffersink").unwrap(), "out", "")?; afilter.add(&filter::find("abuffersink").unwrap(), "out", "")?;
@ -175,6 +177,12 @@ impl MyEmulator {
self.video_filter.get("in").unwrap().source().add(&vframe).unwrap(); self.video_filter.get("in").unwrap().source().add(&vframe).unwrap();
self.audio_filter.get("in").unwrap().source().add(&aframe).unwrap(); self.audio_filter.get("in").unwrap().source().add(&aframe).unwrap();
while let Ok(..) = self.video_filter.get("out").unwrap().sink().frame(&mut vframe) { while let Ok(..) = self.video_filter.get("out").unwrap().sink().frame(&mut vframe) {
if self.video_filter.get("in").unwrap().source().failed_requests() > 0 {
println!("🎥 failed to put filter input frame");
}
if self.video_filter.get("out").unwrap().source().failed_requests() > 0 {
println!("🎥 failed to get filter output frame");
}
self.video_encoder.encode(&vframe, &mut out).unwrap(); self.video_encoder.encode(&vframe, &mut out).unwrap();
} }
while let Ok(..) = self.audio_filter.get("out").unwrap().sink().frame(&mut aframe) { while let Ok(..) = self.audio_filter.get("out").unwrap().sink().frame(&mut aframe) {
@ -292,6 +300,11 @@ impl retro::wrapper::Handler for MyEmulator {
self.video_filter = video_filter(&self.video_encoder, &self.av_info, pixel_format).unwrap(); self.video_filter = video_filter(&self.video_encoder, &self.av_info, pixel_format).unwrap();
true true
} }
fn log_print(&mut self, level: retro::ffi::LogLevel, msg: &str) {
eprint!("🕹️ [{:?}] {}", level, msg);
}
} }
#[derive(StructOpt)] #[derive(StructOpt)]
@ -341,7 +354,7 @@ fn main() -> Fallible<()> {
emu.frame_properties_locked = true; emu.frame_properties_locked = true;
octx.write_header().unwrap(); octx.write_header().unwrap();
for _ in 0..60*60 { eprintln!("🖼️ frame: {}", frame);
emu.run(); emu.run();
} }