Add support for ffmpeg 6.0
- Use the new send_frame/receive_packet API for encoding
- Use the new channel layout API for audio
- Fix audio recording
- Copy codec parameters to the stream parameters
- Set correct pts for audio frames
- Read audio samples from file directly to the refcounted AVFrame buffer instead of the `g_pSamples` buffer
- Use global AVPackets allocated with `av_packet_alloc`
- Stop trying to write more audio frames when `WriteAudioFrame` fails with a negative error code
- Fix segfault with `g_pContainer->url`. The field has to be allocated with `av_malloc` before writing to it. It's set to `NULL` by default.
- Properly free allocations with `avcodec_free_context` and `avformat_free_context`
use landgen::maze::MazeTemplate;
use serde_derive::Deserialize;
use std::collections::hash_map::HashMap;
#[derive(Deserialize)]
pub struct TemplateDesc {
width: usize,
height: usize,
max_hedgehogs: u8,
cell_size: usize,
distortion_limiting_factor: u32,
braidness: u32,
invert: bool,
}
#[derive(Deserialize)]
pub struct TemplateCollectionDesc {
pub templates: Vec<TemplateDesc>,
pub template_types: HashMap<String, Vec<usize>>,
}
impl From<&TemplateDesc> for MazeTemplate {
fn from(desc: &TemplateDesc) -> Self {
MazeTemplate {
width: desc.width,
height: desc.height,
cell_size: desc.cell_size,
inverted: desc.invert,
distortion_limiting_factor: desc.distortion_limiting_factor,
braidness: desc.braidness,
}
}
}