fenc: FrameEncoder,
ratectl: RateControl,
+ flipped: bool,
huffman: bool,
version: u8,
}
impl VP6Encoder {
- fn new() -> Self {
+ fn new(flipped: bool) -> Self {
let vt = alloc_video_buffer(NAVideoInfo::new(24, 24, false, VP_YUVA420_FORMAT), 4).unwrap();
let mc_buf = vt.get_vbuf().unwrap();
Self {
ratectl: RateControl::new(),
mc_buf,
+ flipped,
huffman: false,
version: VERSION_VP60,
match encinfo.format {
NACodecTypeInfo::None => {
let mut ofmt = EncodeParameters::default();
- ofmt.format = NACodecTypeInfo::Video(NAVideoInfo::new(0, 0, true, YUV420_FORMAT));
+ ofmt.format = NACodecTypeInfo::Video(NAVideoInfo::new(0, 0, self.flipped, YUV420_FORMAT));
Ok(ofmt)
},
NACodecTypeInfo::Audio(_) => Err(EncoderError::FormatError),
NACodecTypeInfo::Video(vinfo) => {
- let outinfo = NAVideoInfo::new((vinfo.width + 3) & !3, (vinfo.height + 3) & !3, true, YUV420_FORMAT);
+ let outinfo = NAVideoInfo::new((vinfo.width + 3) & !3, (vinfo.height + 3) & !3, self.flipped, YUV420_FORMAT);
let mut ofmt = *encinfo;
ofmt.format = NACodecTypeInfo::Video(outinfo);
Ok(ofmt)
return Err(EncoderError::FormatError);
}
- let out_info = NAVideoInfo::new(vinfo.width, vinfo.height, true, vinfo.format);
- let info = NACodecInfo::new("vp6", NACodecTypeInfo::Video(out_info), None);
+ let out_info = NAVideoInfo::new(vinfo.width, vinfo.height, self.flipped, vinfo.format);
+ let info = NACodecInfo::new(if self.flipped { "vp6" } else { "vp6f" }, NACodecTypeInfo::Video(out_info), None);
let mut stream = NAStream::new(StreamType::Video, stream_id, info, encinfo.tb_num, encinfo.tb_den, 0);
stream.set_num(stream_id as usize);
let stream = stream.into_ref();
}
pub fn get_encoder() -> Box<dyn NAEncoder + Send> {
- Box::new(VP6Encoder::new())
+ Box::new(VP6Encoder::new(true))
+}
+
+pub fn get_encoder_flv() -> Box<dyn NAEncoder + Send> {
+ Box::new(VP6Encoder::new(false))
}
#[cfg(test)]
let mut enc_reg = RegisteredEncoders::new();
duck_register_all_encoders(&mut enc_reg);
+ // sample: https://samples.mplayerhq.hu/V-codecs/VP4/ot171_vp40.avi
let dec_config = DecoderTestParams {
demuxer: "avi",
in_name: "assets/Duck/ot171_vp40.avi",