shim(oxideav-core): drop the arms only the vendored H.265 tree needed
Browse files at this commitd8c174c5da204a0a0c9c4fe4bb9739d5b22162eeParent: 5f557681 changed file +0 -135
- shims/oxideav-core/src/lib.rs +0 -135
shims/oxideav-core/src/lib.rsmodified+0 -135
| @@ -145,60 +145,6 @@ impl From<String> for CodecId { | ||
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | -/// How a codec is named by a container, so a demuxer can map what it read to a | |
| 149 | -/// registration. | |
| 150 | -#[derive(Clone, Debug, PartialEq, Eq, Hash)] | |
| 151 | -pub enum CodecTag { | |
| 152 | - /// A four-character code, as mp4 sample entries and RIFF write it. | |
| 153 | - FourCc([u8; 4]), | |
| 154 | - /// An MPEG-4 `ObjectTypeIndication`. | |
| 155 | - Mp4ObjectType(u8), | |
| 156 | - /// A Matroska `CodecID` string. | |
| 157 | - Matroska(String), | |
| 158 | -} | |
| 159 | - | |
| 160 | -impl CodecTag { | |
| 161 | - /// The four-character code `code`. | |
| 162 | - pub fn fourcc(code: &[u8; 4]) -> CodecTag { | |
| 163 | - CodecTag::FourCc(*code) | |
| 164 | - } | |
| 165 | - | |
| 166 | - /// The MPEG-4 object type `oti`. | |
| 167 | - pub fn mp4_object_type(oti: u8) -> CodecTag { | |
| 168 | - CodecTag::Mp4ObjectType(oti) | |
| 169 | - } | |
| 170 | - | |
| 171 | - /// The Matroska `CodecID` `id`. | |
| 172 | - pub fn matroska(id: impl Into<String>) -> CodecTag { | |
| 173 | - CodecTag::Matroska(id.into()) | |
| 174 | - } | |
| 175 | -} | |
| 176 | - | |
| 177 | -/// How samples are laid out in a video frame. Only the format the family's own | |
| 178 | -/// encoders take and hand out is named; a caller that needs another adds it. | |
| 179 | -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] | |
| 180 | -pub enum PixelFormat { | |
| 181 | - /// Planar 4:2:0 8-bit. | |
| 182 | - #[default] | |
| 183 | - Yuv420P, | |
| 184 | -} | |
| 185 | - | |
| 186 | -/// A codec's string-keyed knobs, parsed by whichever codec declares them. | |
| 187 | -#[derive(Clone, Debug, Default, PartialEq, Eq)] | |
| 188 | -pub struct CodecOptions(HashMap<String, String>); | |
| 189 | - | |
| 190 | -impl CodecOptions { | |
| 191 | - /// The value set for `key`, if any. | |
| 192 | - pub fn get(&self, key: &str) -> Option<&str> { | |
| 193 | - self.0.get(key).map(String::as_str) | |
| 194 | - } | |
| 195 | - | |
| 196 | - /// Set `key` to `value`, replacing what was there. | |
| 197 | - pub fn set(&mut self, key: impl Into<String>, value: impl Into<String>) { | |
| 198 | - self.0.insert(key.into(), value.into()); | |
| 199 | - } | |
| 200 | -} | |
| 201 | - | |
| 202 | 148 | /// What kind of stream a set of parameters describes. |
| 203 | 149 | #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] |
| 204 | 150 | pub enum MediaType { |
| @@ -230,12 +176,8 @@ pub struct CodecParameters { | ||
| 230 | 176 | pub width: Option<u32>, |
| 231 | 177 | /// Coded height. |
| 232 | 178 | pub height: Option<u32>, |
| 233 | - /// How a video stream's samples are laid out. | |
| 234 | - pub pixel_format: Option<PixelFormat>, | |
| 235 | 179 | /// Codec setup bytes. |
| 236 | 180 | pub extradata: Vec<u8>, |
| 237 | - /// Codec-specific knobs, read by whichever codec declares them. | |
| 238 | - pub options: CodecOptions, | |
| 239 | 181 | } |
| 240 | 182 | |
| 241 | 183 | impl CodecParameters { |
| @@ -379,26 +321,6 @@ pub trait Decoder: Send { | ||
| 379 | 321 | } |
| 380 | 322 | } |
| 381 | 323 | |
| 382 | -/// An encoder: frames in, packets out. | |
| 383 | -pub trait Encoder: Send { | |
| 384 | - /// The codec this produces. | |
| 385 | - fn codec_id(&self) -> &CodecId; | |
| 386 | - | |
| 387 | - /// Parameters describing the stream it produces, for the muxer. | |
| 388 | - fn output_params(&self) -> &CodecParameters; | |
| 389 | - | |
| 390 | - /// Feed one uncompressed frame. | |
| 391 | - fn send_frame(&mut self, frame: &Frame) -> Result<()>; | |
| 392 | - | |
| 393 | - /// Take one packet, or [`Error::NeedMore`] when the encoder wants another | |
| 394 | - /// frame first. | |
| 395 | - fn receive_packet(&mut self) -> Result<Packet>; | |
| 396 | - | |
| 397 | - /// Signal end of input, so the lookahead drains into | |
| 398 | - /// [`receive_packet`](Encoder::receive_packet). | |
| 399 | - fn flush(&mut self) -> Result<()>; | |
| 400 | -} | |
| 401 | - | |
| 402 | 324 | /// A container writer. |
| 403 | 325 | pub trait Muxer: Send { |
| 404 | 326 | /// The format's short name. |
| @@ -417,9 +339,6 @@ pub trait Muxer: Send { | ||
| 417 | 339 | /// How a codec crate hands out decoders. |
| 418 | 340 | pub type DecoderFactory = fn(&CodecParameters) -> Result<Box<dyn Decoder>>; |
| 419 | 341 | |
| 420 | -/// How a codec crate hands out encoders. | |
| 421 | -pub type EncoderFactory = fn(&CodecParameters) -> Result<Box<dyn Encoder>>; | |
| 422 | - | |
| 423 | 342 | /// One codec's registration. |
| 424 | 343 | #[derive(Clone)] |
| 425 | 344 | pub struct CodecInfo { |
| @@ -427,10 +346,6 @@ pub struct CodecInfo { | ||
| 427 | 346 | pub id: CodecId, |
| 428 | 347 | /// How to build a decoder for it. |
| 429 | 348 | pub decoder_factory: Option<DecoderFactory>, |
| 430 | - /// How to build an encoder for it. | |
| 431 | - pub encoder_factory: Option<EncoderFactory>, | |
| 432 | - /// The container-level names that mean this codec. | |
| 433 | - pub tags: Vec<CodecTag>, | |
| 434 | 349 | } |
| 435 | 350 | |
| 436 | 351 | impl CodecInfo { |
| @@ -439,8 +354,6 @@ impl CodecInfo { | ||
| 439 | 354 | CodecInfo { |
| 440 | 355 | id, |
| 441 | 356 | decoder_factory: None, |
| 442 | - encoder_factory: None, | |
| 443 | - tags: Vec::new(), | |
| 444 | 357 | } |
| 445 | 358 | } |
| 446 | 359 | |
| @@ -449,18 +362,6 @@ impl CodecInfo { | ||
| 449 | 362 | self.decoder_factory = Some(factory); |
| 450 | 363 | self |
| 451 | 364 | } |
| 452 | - | |
| 453 | - /// The same registration, with an encoder. | |
| 454 | - pub fn encoder(mut self, factory: EncoderFactory) -> CodecInfo { | |
| 455 | - self.encoder_factory = Some(factory); | |
| 456 | - self | |
| 457 | - } | |
| 458 | - | |
| 459 | - /// The same registration, claiming `tags` on top of whatever it claimed. | |
| 460 | - pub fn tags(mut self, tags: impl IntoIterator<Item = CodecTag>) -> CodecInfo { | |
| 461 | - self.tags.extend(tags); | |
| 462 | - self | |
| 463 | - } | |
| 464 | 365 | } |
| 465 | 366 | |
| 466 | 367 | /// The codecs a caller has registered, in registration order per id. |
| @@ -501,42 +402,6 @@ impl CodecRegistry { | ||
| 501 | 402 | } |
| 502 | 403 | } |
| 503 | 404 | |
| 504 | -/// What a codec crate is handed to register itself into. | |
| 505 | -/// | |
| 506 | -/// The incumbent's context carries four sub-registries; this one carries the | |
| 507 | -/// codecs, because a container, source or filter crate registering into the | |
| 508 | -/// replica's build does not exist. | |
| 509 | -#[derive(Clone, Default)] | |
| 510 | -pub struct RuntimeContext { | |
| 511 | - /// Decoder and encoder factories, by codec id. | |
| 512 | - pub codecs: CodecRegistry, | |
| 513 | -} | |
| 514 | - | |
| 515 | -impl RuntimeContext { | |
| 516 | - /// An empty context. | |
| 517 | - pub fn new() -> RuntimeContext { | |
| 518 | - RuntimeContext::default() | |
| 519 | - } | |
| 520 | -} | |
| 521 | - | |
| 522 | -/// Declare a codec crate's registration entry point, as the family's crates | |
| 523 | -/// spell it: `oxideav_core::register!("h265", register);`. | |
| 524 | -/// | |
| 525 | -/// The name is carried for documentation only, exactly as the incumbent does — | |
| 526 | -/// what the generated `__oxideav_entry` runs is `$func`. | |
| 527 | -#[macro_export] | |
| 528 | -macro_rules! register { | |
| 529 | - ($name:literal, $func:path) => { | |
| 530 | - /// This crate's registration entry point, generated by | |
| 531 | - /// [`oxideav_core::register!`]. | |
| 532 | - #[doc(hidden)] | |
| 533 | - pub fn __oxideav_entry(ctx: &mut $crate::RuntimeContext) { | |
| 534 | - let _ = $name; | |
| 535 | - $func(ctx); | |
| 536 | - } | |
| 537 | - }; | |
| 538 | -} | |
| 539 | - | |
| 540 | 405 | /// A [`Decoder`] over one of the family's own, converting the frames on the way |
| 541 | 406 | /// out. Codec shims are two lines with this: build the `ec_core` decoder, wrap. |
| 542 | 407 | pub struct EcDecoder { |