Skip to main content

mediadecode_ffmpeg/
lib.rs

1#![doc = include_str!("../README.md")]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3#![cfg_attr(docsrs, allow(unused_attributes))]
4#![deny(missing_docs)]
5
6mod adapter;
7mod audio;
8mod backend;
9pub mod boundary;
10mod buffer;
11pub mod channel_layout;
12mod codec_id;
13pub mod convert;
14mod decoder;
15mod error;
16pub mod extras;
17mod ffi;
18mod frame;
19mod pixdesc;
20mod sample_format;
21mod subtitle;
22mod video;
23
24pub use adapter::Ffmpeg;
25pub use audio::{AudioDecodeError, FfmpegAudioStreamDecoder};
26pub use backend::Backend;
27pub use boundary::{
28  audio_packet_from_ffmpeg, empty_audio_frame, empty_subtitle_frame, empty_video_frame,
29  from_av_pixel_format, is_hardware_pix_fmt, subtitle_packet_from_ffmpeg, try_empty_audio_frame,
30  try_empty_subtitle_frame, try_empty_video_frame, video_packet_from_ffmpeg,
31};
32pub use buffer::FfmpegBuffer;
33pub use channel_layout::{
34  audio_channel_layout_from_ffmpeg, audio_channel_order_kind_from_ffmpeg,
35  channel_layout_kind_from_ffmpeg,
36};
37pub use codec_id::CodecId;
38pub use decoder::VideoDecoder;
39pub use error::{Error, Result};
40pub use frame::Frame;
41pub use sample_format::SampleFormat;
42pub use subtitle::{FfmpegSubtitleStreamDecoder, SubtitleDecodeError};
43pub use video::{FfmpegVideoStreamDecoder, VideoDecodeError};
44
45/// Compressed video packet pre-parameterized with this crate's
46/// extras and refcounted buffer — the type
47/// [`FfmpegVideoStreamDecoder`] consumes via
48/// [`mediadecode::decoder::VideoStreamDecoder::send_packet`].
49pub type VideoPacket = mediadecode::packet::VideoPacket<extras::VideoPacketExtra, FfmpegBuffer>;
50
51/// Compressed audio packet pre-parameterized with this crate's extras
52/// and refcounted buffer.
53pub type AudioPacket = mediadecode::packet::AudioPacket<extras::AudioPacketExtra, FfmpegBuffer>;
54
55/// Compressed subtitle packet pre-parameterized with this crate's
56/// extras and refcounted buffer.
57pub type SubtitlePacket =
58  mediadecode::packet::SubtitlePacket<extras::SubtitlePacketExtra, FfmpegBuffer>;
59
60/// Decoded video frame pre-parameterized with this crate's pixel
61/// format / extras / refcounted buffer.
62pub type VideoFrame =
63  mediadecode::frame::VideoFrame<mediadecode::PixelFormat, extras::VideoFrameExtra, FfmpegBuffer>;
64
65/// Decoded audio frame pre-parameterized with this crate's sample
66/// format / channel layout / extras / refcounted buffer.
67pub type AudioFrame = mediadecode::frame::AudioFrame<
68  SampleFormat,
69  mediadecode::channel::AudioChannelLayout,
70  extras::AudioFrameExtra,
71  FfmpegBuffer,
72>;
73
74/// Decoded subtitle frame pre-parameterized with this crate's
75/// extras / refcounted buffer.
76pub type SubtitleFrame =
77  mediadecode::frame::SubtitleFrame<extras::SubtitleFrameExtra, FfmpegBuffer>;