#![doc = include_str!("../README.md")]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, allow(unused_attributes))]
#![deny(missing_docs)]
#![allow(clippy::type_complexity)]
mod adapter;
pub mod boundary;
#[doc(hidden)]
pub mod buffer;
mod carrier;
pub mod channel_layout;
mod codec_id;
mod container;
pub mod contracts;
pub mod convert;
pub mod error;
pub mod extras;
#[cfg(any(test, feature = "test-support"))]
mod fault_subprocess;
#[doc(hidden)]
pub mod ffi;
#[doc(hidden)]
pub mod footprint;
#[doc(hidden)]
pub mod frame;
pub mod limits;
#[doc(hidden)]
pub mod measured;
mod pixdesc;
#[doc(hidden)]
pub mod reader_guard;
#[cfg(feature = "resample")]
mod resampler;
mod sample_format;
#[doc(hidden)]
pub mod text;
pub mod ticket;
#[doc(hidden)]
pub mod view;
pub use adapter::Ffmpeg;
pub use boundary::{
MediaKind, PacketBuildError, SendPayloadTooLarge, SendSideDataTooLarge,
attachment_packet_from_ffmpeg, audio_packet_from_ffmpeg, audio_packet_from_ffmpeg_in,
data_packet_from_ffmpeg_in, empty_audio_frame, empty_owned_audio_frame,
empty_owned_subtitle_frame, empty_owned_video_frame, empty_subtitle_frame, empty_video_frame,
ffmpeg_packet_from_audio_packet, ffmpeg_packet_from_owned_audio_packet,
ffmpeg_packet_from_owned_subtitle_packet, ffmpeg_packet_from_owned_video_packet,
ffmpeg_packet_from_subtitle_packet, ffmpeg_packet_from_video_packet, from_av_pixel_format,
is_hardware_pix_fmt, owned_attachment_packet_from_ffmpeg, owned_audio_packet_from_ffmpeg_in,
owned_data_packet_from_ffmpeg_in, owned_subtitle_packet_from_ffmpeg_in,
owned_video_packet_from_ffmpeg_in, subtitle_packet_from_ffmpeg, subtitle_packet_from_ffmpeg_in,
try_clone_packet, video_packet_from_ffmpeg, video_packet_from_ffmpeg_in,
};
pub use buffer::{FfmpegBytes, PacketBufferError, TrustedPayload};
#[doc(hidden)]
pub use carrier::{BodyRoute, CarrierOps};
pub use carrier::{FfmpegCarrier, Owned, View};
pub use channel_layout::{
ChannelLayoutFault, channel_layout_description_from_ffmpeg, channel_layout_from_ffmpeg,
channel_order_from_ffmpeg,
};
pub use codec_id::CodecId;
pub use container::{ContainerFormat, DemuxerName, UnregisteredDemuxer};
pub use error::{
CrossingError, ParametersAlloc, ParametersChannelMap, ParametersCopy, ParametersError,
ParametersLayoutShape, ParametersMissing, ParametersOpaque, ParametersTooLarge,
};
pub use frame::Frame;
pub use limits::{
DEFAULT_MAX_ATTACHMENT_BYTES, DEFAULT_MAX_CHAPTERS, DEFAULT_MAX_CODEC_PARAMETER_BYTES,
DEFAULT_MAX_FRAME_BYTES, DEFAULT_MAX_IMAGE_INPUT_BYTES, DEFAULT_MAX_IMAGE_SIDE_DATA_BYTES,
DEFAULT_MAX_PACKET_BYTES, DEFAULT_MAX_PIXELS, DEFAULT_MAX_PROBE_BYTES, DEFAULT_MAX_STREAMS,
DEFAULT_MAX_TOTAL_ATTACHMENT_BYTES, DEFAULT_MAX_TOTAL_CHAPTER_TITLE_BYTES,
DEFAULT_MAX_TOTAL_CODEC_PARAMETER_BYTES, DEFAULT_MAX_TOTAL_STREAM_METADATA_BYTES, DecoderLimits,
DemuxLimits, FrameLimits, PacketLimits,
};
#[cfg(feature = "resample")]
#[cfg_attr(docsrs, doc(cfg(feature = "resample")))]
pub use resampler::{
CarrierResampler, OutputTooLarge, ResampleError, ResampleSpec, SpecEnd,
UnsupportedChannelCount as UnsupportedSpecChannelCount,
};
pub use sample_format::SampleFormat;
pub use ticket::{ChannelLayoutTicket, CodecTicket, CustomChannel, DolbyVisionConfig, Ratio};
pub use view::FfmpegBuffer;
#[cfg(feature = "resample")]
#[cfg_attr(docsrs, doc(cfg(feature = "resample")))]
pub type FfmpegResampler = resampler::CarrierResampler<View>;
#[cfg(feature = "resample")]
#[cfg_attr(docsrs, doc(cfg(feature = "resample")))]
pub type FfmpegOwnedResampler = resampler::CarrierResampler<Owned>;
#[cfg(feature = "test-support")]
#[cfg_attr(docsrs, doc(cfg(feature = "test-support")))]
#[doc(hidden)]
pub mod test_support {
pub use crate::{
fault_subprocess::{cap_ffmpeg_allocations, in_subprocess, uncap_ffmpeg_allocations},
ffi::{
CallbackState, declare_ceiling_declined_for_test, declare_frame_budget_declined_for_test,
},
};
}
pub type VideoPacket = mediaspine::packet::VideoPacket<extras::VideoPacketExtra, FfmpegBuffer>;
pub type AudioPacket = mediaspine::packet::AudioPacket<extras::AudioPacketExtra, FfmpegBuffer>;
pub type SubtitlePacket =
mediaspine::packet::SubtitlePacket<extras::SubtitlePacketExtra, FfmpegBuffer>;
pub type VideoFrame =
mediaspine::frame::VideoFrame<mediaspine::PixelFormat, extras::VideoFrameExtra, FfmpegBuffer>;
pub type AudioFrame = mediaspine::frame::AudioFrame<
SampleFormat,
mediaframe::audio::ChannelLayoutDescription,
extras::AudioFrameExtra,
FfmpegBuffer,
>;
pub type SubtitleFrame = mediaspine::frame::SubtitleFrame<extras::SubtitleFrameExtra, FfmpegBuffer>;
pub type ImageFrame =
mediaspine::frame::ImageFrame<mediaspine::PixelFormat, extras::ImageFrameExtra, FfmpegBuffer>;
pub type DataPacket = mediaspine::demuxer::DataPacket<extras::DataPacketExtra, FfmpegBuffer>;
pub type AttachmentPacket =
mediaspine::demuxer::AttachmentPacket<extras::AttachmentPacketExtra, FfmpegBuffer>;
pub type DemuxedPacket = mediaspine::demuxer::DemuxedPacket<Ffmpeg, FfmpegBuffer>;
pub type OwnedVideoPacket = mediaspine::packet::VideoPacket<extras::VideoPacketExtra, FfmpegBytes>;
pub type OwnedAudioPacket = mediaspine::packet::AudioPacket<extras::AudioPacketExtra, FfmpegBytes>;
pub type OwnedSubtitlePacket =
mediaspine::packet::SubtitlePacket<extras::SubtitlePacketExtra, FfmpegBytes>;
pub type OwnedDataPacket = mediaspine::demuxer::DataPacket<extras::DataPacketExtra, FfmpegBytes>;
pub type OwnedAttachmentPacket =
mediaspine::demuxer::AttachmentPacket<extras::AttachmentPacketExtra, FfmpegBytes>;
pub type OwnedDemuxedPacket = mediaspine::demuxer::DemuxedPacket<Ffmpeg, FfmpegBytes>;
pub type OwnedVideoFrame =
mediaspine::frame::VideoFrame<mediaspine::PixelFormat, extras::VideoFrameExtra, FfmpegBytes>;
pub type OwnedAudioFrame = mediaspine::frame::AudioFrame<
SampleFormat,
mediaframe::audio::ChannelLayoutDescription,
extras::AudioFrameExtra,
FfmpegBytes,
>;
pub type OwnedSubtitleFrame =
mediaspine::frame::SubtitleFrame<extras::SubtitleFrameExtra, FfmpegBytes>;
pub type OwnedImageFrame =
mediaspine::frame::ImageFrame<mediaspine::PixelFormat, extras::ImageFrameExtra, FfmpegBytes>;
pub type TrackInfo = mediaspine::demuxer::TrackInfo<Ffmpeg>;
pub type TrackParams = mediaspine::demuxer::TrackParams<Ffmpeg>;
pub type Chapter = mediaspine::demuxer::Chapter<Ffmpeg>;
#[cfg(all(test, feature = "resample"))]
#[track_caller]
pub(crate) fn accepted<E: core::fmt::Debug>(
status: core::result::Result<mediaspine::Sent, E>,
what: &str,
) {
assert_eq!(
status.unwrap_or_else(|e| panic!("{what}: {e:?}")),
mediaspine::Sent::Accepted,
"{what}: the session asked to be drained where the test expected room",
);
}