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 sample_format;
20mod subtitle;
21mod video;
22
23pub use adapter::Ffmpeg;
24pub use audio::{AudioDecodeError, FfmpegAudioStreamDecoder};
25pub use backend::Backend;
26pub use boundary::{
27  audio_packet_from_ffmpeg, empty_audio_frame, empty_subtitle_frame, empty_video_frame,
28  from_av_pixel_format, is_hardware_pix_fmt, subtitle_packet_from_ffmpeg, try_empty_audio_frame,
29  try_empty_subtitle_frame, try_empty_video_frame, video_packet_from_ffmpeg,
30};
31pub use buffer::FfmpegBuffer;
32pub use channel_layout::{
33  audio_channel_layout_from_ffmpeg, audio_channel_order_kind_from_ffmpeg,
34  channel_layout_kind_from_ffmpeg,
35};
36pub use codec_id::CodecId;
37pub use decoder::VideoDecoder;
38pub use error::{Error, Result};
39pub use frame::Frame;
40pub use sample_format::SampleFormat;
41pub use subtitle::{FfmpegSubtitleStreamDecoder, SubtitleDecodeError};
42pub use video::{FfmpegVideoStreamDecoder, VideoDecodeError};
43
44/// Compressed video packet pre-parameterized with this crate's
45/// extras and refcounted buffer — the type
46/// [`FfmpegVideoStreamDecoder`] consumes via
47/// [`mediadecode::decoder::VideoStreamDecoder::send_packet`].
48pub type VideoPacket = mediadecode::packet::VideoPacket<extras::VideoPacketExtra, FfmpegBuffer>;
49
50/// Compressed audio packet pre-parameterized with this crate's extras
51/// and refcounted buffer.
52pub type AudioPacket = mediadecode::packet::AudioPacket<extras::AudioPacketExtra, FfmpegBuffer>;
53
54/// Compressed subtitle packet pre-parameterized with this crate's
55/// extras and refcounted buffer.
56pub type SubtitlePacket =
57  mediadecode::packet::SubtitlePacket<extras::SubtitlePacketExtra, FfmpegBuffer>;
58
59/// Decoded video frame pre-parameterized with this crate's pixel
60/// format / extras / refcounted buffer.
61pub type VideoFrame =
62  mediadecode::frame::VideoFrame<mediadecode::PixelFormat, extras::VideoFrameExtra, FfmpegBuffer>;
63
64/// Decoded audio frame pre-parameterized with this crate's sample
65/// format / channel layout / extras / refcounted buffer.
66pub type AudioFrame = mediadecode::frame::AudioFrame<
67  SampleFormat,
68  mediadecode::channel::AudioChannelLayout,
69  extras::AudioFrameExtra,
70  FfmpegBuffer,
71>;
72
73/// Decoded subtitle frame pre-parameterized with this crate's
74/// extras / refcounted buffer.
75pub type SubtitleFrame =
76  mediadecode::frame::SubtitleFrame<extras::SubtitleFrameExtra, FfmpegBuffer>;