some fumbling
This commit is contained in:
		
							parent
							
								
									f94f5c836f
								
							
						
					
					
						commit
						d1e7019902
					
				
					 1 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
					@ -110,16 +110,21 @@ impl MyEmulator {
 | 
				
			||||||
        let retro = retro::wrapper::LibretroWrapper::from(raw_retro);
 | 
					        let retro = retro::wrapper::LibretroWrapper::from(raw_retro);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let sys_info = retro.get_system_info();
 | 
					        let sys_info = retro.get_system_info();
 | 
				
			||||||
        let av_info = retro.get_system_av_info();
 | 
					        let mut av_info = retro.get_system_av_info();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let fps_int = av_info.timing.fps.round() as i32;
 | 
					        let fps_int = av_info.timing.fps.round() as i32;
 | 
				
			||||||
        let fps_int = if fps_int == 0 { 60 } else { fps_int };
 | 
					        let fps_int = if fps_int == 0 { 60 } else { fps_int };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        video_encoder.set_time_base(Rational::new(1, fps_int));
 | 
					        video_encoder.set_time_base(Rational::new(1, fps_int));
 | 
				
			||||||
        video_encoder.set_frame_rate(av_info.timing.fps.into());
 | 
					        video_encoder.set_frame_rate(av_info.timing.fps.into());
 | 
				
			||||||
 | 
					        if av_info.geometry.base_height == 0 && av_info.geometry.base_width == 0 {
 | 
				
			||||||
 | 
					            av_info.geometry.base_width = 640;
 | 
				
			||||||
 | 
					            av_info.geometry.base_height = 480;
 | 
				
			||||||
 | 
					            av_info.geometry.aspect_ratio = 4.33;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        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);
 | 
				
			||||||
        video_encoder.set_aspect_ratio(av_info.geometry.aspect_ratio as f64);
 | 
					        //video_encoder.set_aspect_ratio(av_info.geometry.aspect_ratio as f64);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        audio_encoder.set_rate(44100);
 | 
					        audio_encoder.set_rate(44100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -249,7 +254,9 @@ impl retro::wrapper::Handler for MyEmulator {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn set_system_av_info(&mut self, system_av_info: SystemAvInfo) -> bool {
 | 
					    fn set_system_av_info(&mut self, system_av_info: SystemAvInfo) -> bool {
 | 
				
			||||||
        self.video_encoder.set_frame_rate(system_av_info.timing.fps.into());
 | 
					        self.video_encoder.set_frame_rate(system_av_info.timing.fps.into());
 | 
				
			||||||
 | 
					        if system_av_info.timing.sample_rate.round() as i32 > 0 {
 | 
				
			||||||
        self.audio_encoder.set_rate(system_av_info.timing.sample_rate.round() as i32);
 | 
					        self.audio_encoder.set_rate(system_av_info.timing.sample_rate.round() as i32);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        self.av_info.timing = system_av_info.timing;
 | 
					        self.av_info.timing = system_av_info.timing;
 | 
				
			||||||
        self.set_geometry(system_av_info.geometry);
 | 
					        self.set_geometry(system_av_info.geometry);
 | 
				
			||||||
        true
 | 
					        true
 | 
				
			||||||
| 
						 | 
					@ -289,6 +296,7 @@ struct Opt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() -> Fallible<()> {
 | 
					fn main() -> Fallible<()> {
 | 
				
			||||||
    let opt: Opt = Opt::from_args();
 | 
					    let opt: Opt = Opt::from_args();
 | 
				
			||||||
 | 
					    ffmpeg::log::set_level(ffmpeg::log::Level::Trace);
 | 
				
			||||||
    ffmpeg::init().unwrap();
 | 
					    ffmpeg::init().unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let mut octx = format::output(&opt.video)?;
 | 
					    let mut octx = format::output(&opt.video)?;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue