forge
Explore
Log in

Don't you dare go Hollow

edith

Clone
★ 0

0 watching0 forksRust18.3 MiBb02f499Tahinli1 month ago1000 commits

mjpeg.rs23 lines, 1013 bytesHistoryRawDownload
1//! The Motion JPEG software seat (`ec-mjpeg`): baseline and progressive JPEG per frame, 4:2:0,
2//! 4:2:2, 4:4:4 and gray, always full range (`yuvj`; the probe states that as the stream's
3//! colour so the conversion honours it). A packet of two JPEGs is one interlaced frame, woven
4//! and then deinterlaced; the first image is the top field unless the container's `fiel` /
5//! `FieldOrder` says bottom. Every frame is a sync sample. See [`super::intra`].
6
7use ec_core::frame::VideoFrame;
8
9use super::intra::{IntraFacts, Seat, mjpeg_decoder};
10
11pub(crate) struct MjpegSeat(ec_mjpeg::MjpegDecoder);
12
13impl Seat for MjpegSeat {
14 const NAME: &'static str = "MJPEG";
15 fn open(facts: IntraFacts, _: &[u8]) -> Result<Self, String> {
16 mjpeg_decoder(facts.coded_height, facts.field_order()).map(Self)
17 }
18 fn decode(&mut self, sample: &[u8]) -> Result<VideoFrame, String> {
19 self.0.decode(sample, None).map_err(|e| e.to_string())
20 }
21}
22
23pub(crate) type Stream = super::intra::Stream<MjpegSeat>;