Commit 679fa16a authored by Luca Barbato's avatar Luca Barbato Committed by Thomas Daede
Browse files

Reorder the exposed API

Everything goes in the `prelude` for ease of use.

The fundamental structures are exported in the root crate, the
rest is re-exported in modules to give a bit of structure.
parent 459a767c
// Encode the same tiny blank frame 30 times
use rav1e::*;
use rav1e::config::SpeedSettings;
fn main() {
let mut cfg = Config::default();
......
......@@ -10,7 +10,8 @@
use crate::muxer::{create_muxer, Muxer};
use crate::{ColorPrimaries, MatrixCoefficients, TransferCharacteristics};
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand, Shell};
use rav1e::*;
use rav1e::prelude::*;
use rav1e::version;
use scan_fmt::scan_fmt;
use std::fs::File;
......
use std::io;
use rav1e::*;
use rav1e::prelude::*;
pub mod y4m;
......
use std::io::Read;
use rav1e::Rational;
use crate::decoder::DecodeError;
use crate::decoder::Decoder;
use crate::decoder::VideoDetails;
use crate::ChromaSamplePosition;
use crate::ChromaSampling;
use crate::Frame;
use rav1e::*;
use rav1e::prelude::*;
impl Decoder for y4m::Decoder<'_, Box<dyn Read>> {
fn get_video_details(&self) -> VideoDetails {
......
......@@ -10,9 +10,9 @@
use crate::decoder::VideoDetails;
use std::io::Write;
use std::slice;
use rav1e::*;
use rav1e::prelude::*;
pub fn write_y4m_frame<T: Pixel>(y4m_enc: &mut y4m::Encoder<'_, Box<dyn Write>>, rec: &rav1e::Frame<T>, y4m_details: VideoDetails) {
pub fn write_y4m_frame<T: Pixel>(y4m_enc: &mut y4m::Encoder<'_, Box<dyn Write>>, rec: &Frame<T>, y4m_details: VideoDetails) {
let pitch_y = if y4m_details.bit_depth > 8 { y4m_details.width * 2 } else { y4m_details.width };
let chroma_sampling_period = y4m_details.chroma_sampling.sampling_period();
let (pitch_uv, height_uv) = (
......
......@@ -13,7 +13,7 @@ mod common;
mod decoder;
mod muxer;
use crate::common::*;
use rav1e::*;
use rav1e::prelude::*;
use std::io;
use std::io::Write;
......
......@@ -47,12 +47,50 @@ mod frame;
use crate::encoder::*;
pub use crate::api::*;
pub use crate::api::{Context, Config, Packet, EncoderStatus};
pub use crate::frame::Frame;
pub use crate::encoder::Tune;
pub use crate::partition::BlockSize;
pub use crate::util::{CastFromPrimitive, Pixel};
pub mod prelude {
pub use crate::api::*;
pub use crate::frame::Frame;
pub use crate::encoder::Tune;
pub use crate::partition::BlockSize;
pub use crate::util::{CastFromPrimitive, Pixel};
}
/// Basic data structures
pub mod data {
pub use crate::frame::Frame;
pub use crate::api::{
Packet, Point, Rational, FrameType, EncoderStatus
};
pub use crate::util::{CastFromPrimitive, Pixel};
}
/// Color model information
pub mod color {
pub use crate::api::{
ChromaSamplePosition,
ChromaSampling,
ColorPrimaries,
TransferCharacteristics,
PixelRange,
ContentLight,
ColorDescription,
MasteringDisplay,
MatrixCoefficients,
};
}
/// Encoder configuration and settings
pub mod config {
pub use crate::api::{
Config, EncoderConfig, SpeedSettings, PredictionModesSetting,
};
}
/// Version information
///
/// The information is recovered from `Cargo.toml` and `git describe`, when available.
......
......@@ -7,7 +7,9 @@
// Media Patent License 1.0 was not distributed with this source code in the
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
use super::*;
use crate::*;
use crate::color::ChromaSampling;
use crate::config::*;
use rand::{Rng, SeedableRng};
use rand_chacha::ChaChaRng;
use std::sync::Arc;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment