able to record ok-sounding audio from picodrive
This commit is contained in:
parent
41da935d42
commit
57530da214
|
@ -2,3 +2,12 @@
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
/.idea
|
/.idea
|
||||||
/Cargo.lock
|
/Cargo.lock
|
||||||
|
|
||||||
|
*.so
|
||||||
|
*.dll
|
||||||
|
*.dylib
|
||||||
|
*.mp4
|
||||||
|
*.ogv
|
||||||
|
*.gb
|
||||||
|
*.bin
|
||||||
|
.DS_Store
|
|
@ -160,7 +160,7 @@ let wavname = Path::new("out.wav");
|
||||||
av_info.geometry.aspect_ratio = 4.33;
|
av_info.geometry.aspect_ratio = 4.33;
|
||||||
}
|
}
|
||||||
if av_info.timing.sample_rate == 0.0 {
|
if av_info.timing.sample_rate == 0.0 {
|
||||||
av_info.timing.sample_rate = 32040.0;
|
av_info.timing.sample_rate = 44100.0;
|
||||||
}
|
}
|
||||||
video_encoder.set_width(av_info.geometry.base_width);
|
video_encoder.set_width(av_info.geometry.base_width);
|
||||||
video_encoder.set_height(av_info.geometry.base_height);
|
video_encoder.set_height(av_info.geometry.base_height);
|
||||||
|
@ -303,7 +303,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params,
|
||||||
ChannelLayout::STEREO
|
ChannelLayout::STEREO
|
||||||
);
|
);
|
||||||
aframe.set_channels(2);
|
aframe.set_channels(2);
|
||||||
aframe.set_rate(32040);
|
aframe.set_rate(44100);
|
||||||
let aplane: &mut [(i16, i16)] = aframe.plane_mut(0);
|
let aplane: &mut [(i16, i16)] = aframe.plane_mut(0);
|
||||||
eprintln!("Audio buffer length {} -> {}", self.audio_buf.len(), aplane.len());
|
eprintln!("Audio buffer length {} -> {}", self.audio_buf.len(), aplane.len());
|
||||||
aplane.copy_from_slice(self.audio_buf.as_ref());
|
aplane.copy_from_slice(self.audio_buf.as_ref());
|
||||||
|
@ -355,9 +355,9 @@ static bool ffmpeg_init_config(struct ff_config_param *params,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn end(&mut self) {
|
pub fn end(&mut self) {
|
||||||
self.video_encoder.send_eof().unwrap();
|
self.video_encoder.send_eof();
|
||||||
self.receive_and_write_packets(EncoderToWriteFrom::Video);
|
self.receive_and_write_packets(EncoderToWriteFrom::Video);
|
||||||
self.audio_encoder.send_eof().unwrap();
|
self.audio_encoder.send_eof();
|
||||||
self.receive_and_write_packets(EncoderToWriteFrom::Audio);
|
self.receive_and_write_packets(EncoderToWriteFrom::Audio);
|
||||||
self.octx.write_trailer().unwrap();
|
self.octx.write_trailer().unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue