}
}
-const CODEC_CAP_INTRAONLY:u32 = 0x0001;
-const CODEC_CAP_LOSSLESS:u32 = 0x0002;
-const CODEC_CAP_REORDER:u32 = 0x0004;
-const CODEC_CAP_HYBRID:u32 = 0x0008;
-const CODEC_CAP_SCALABLE:u32 = 0x0010;
+/// Codec capability flag for intra-only codecs.
+pub const CODEC_CAP_INTRAONLY:u32 = 0x0001;
+/// Codec capability flag for lossless codecs.
+pub const CODEC_CAP_LOSSLESS:u32 = 0x0002;
+/// Codec capability flag for codecs with frame reordering.
+pub const CODEC_CAP_REORDER:u32 = 0x0004;
+/// Codec capability flag for codecs that can be both lossy and lossless.
+pub const CODEC_CAP_HYBRID:u32 = 0x0008;
+/// Codec capability flag for codecs with scalability features.
+pub const CODEC_CAP_SCALABLE:u32 = 0x0010;
+/// Codec capability flag for codecs with complex frame reordering.
+pub const CODEC_CAP_COMPLEX_REORDER:u32 = 0x0020;
/// Codec description structure.
#[derive(Clone)]
CodecDescription{ name: $n, fname: $fn, ctype: CodecType::Audio,
caps: CODEC_CAP_LOSSLESS | CODEC_CAP_INTRAONLY }
});
+ (audio-hyb; $n:expr, $fn:expr) => ({
+ CodecDescription{ name: $n, fname: $fn, ctype: CodecType::Audio,
+ caps: CODEC_CAP_HYBRID }
+ });
}
/// Returns codec description for the provided codec short name if it is found.
None
}
-static CODEC_REGISTER: &'static [CodecDescription] = &[
+static CODEC_REGISTER: &[CodecDescription] = &[
desc!(audio-ll; "pcm", "PCM"),
+ desc!(audio; "alaw", "A-law PCM"),
+ desc!(audio; "ulaw", "mu-law PCM"),
desc!(video-im; "indeo1", "Intel Raw IF09"),
desc!(video-im; "indeo2", "Intel Indeo 2"),
desc!(video; "cinepak", "Cinepak"),
+ desc!(video; "msvideo1", "MS Video 1"),
+ desc!(video; "msrle", "MS RLE"),
+ desc!(audio; "ms-adpcm", "MS ADPCM"),
+ desc!(audio; "ima-adpcm-ms", "IMA ADPCM (MS variant)"),
+
+ desc!(video; "qt-smc", "Apple Graphics"),
+ desc!(video; "qt-rle", "Apple Animation"),
+ desc!(video; "apple-video", "Apple video"),
+ desc!(video; "sorenson-video", "Sorenson Video"),
+ desc!(video; "sorenson-video3", "Sorenson Video 3", CODEC_CAP_REORDER),
+ desc!(audio; "mace-3", "MACE 3:1"),
+ desc!(audio; "mace-6", "MACE 6:1"),
+ desc!(audio; "ima-adpcm-qt", "IMA ADPCM (Apple variant)"),
+ desc!(audio; "qdesign-music", "QDesign Music"),
+ desc!(audio; "qdesign-music2", "QDesign Music v2"),
+ desc!(audio; "qualcomm-purevoice", "Qualcomm PureVoice"),
+
desc!(video; "truemotion1", "TrueMotion 1"),
desc!(video-im; "truemotionrt", "TrueMotion RT"),
desc!(video; "truemotion2", "TrueMotion 2"),
desc!(audio; "bmv-audio", "BMV audio"),
desc!(video; "bmv3-video", "DW Noir BMV video"),
desc!(audio; "bmv3-audio", "DW Noir BMV audio"),
+ desc!(video; "fable-imax", "Fable IMAX video"),
+ desc!(video; "fst-video", "FutureVision video"),
+ desc!(audio; "fst-audio", "FutureVision audio"),
desc!(video; "midivid", "MidiVid"),
desc!(video; "midivid3", "MidiVid 3"),
desc!(video-ll; "midivid-ll", "MidiVid Lossless"),
desc!(video; "vmd-video", "VMD video"),
desc!(audio; "vmd-audio", "VMD audio"),
+ desc!(video; "vxvideo", "Actimagine Vx"),
+ desc!(audio; "vxaudio", "Actimagine Sx"),
desc!(video; "smacker-video", "Smacker video"),
desc!(audio; "smacker-audio", "Smacker audio"),
desc!(video; "vivo2", "VivoActive Video 2.0", CODEC_CAP_REORDER),
desc!(audio; "g723.1", "ITU G.723.1"),
desc!(audio; "siren", "Polycom Siren"),
+
+ desc!(audio-ll; "ape", "Monkey's Audio"),
+ desc!(audio-ll; "flac", "Free Lossless Audio Codec"),
+ desc!(audio-ll; "tta", "True Audio codec"),
+ desc!(audio-hyb; "wavpack", "WavPack"),
+
+ desc!(video; "h264", "ITU H.264", CODEC_CAP_COMPLEX_REORDER | CODEC_CAP_HYBRID),
];
-static AVI_VIDEO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
+static AVI_VIDEO_CODEC_REGISTER: &[(&[u8;4], &str)] = &[
+ (&[1, 0, 0, 0], "msrle"),
+ (&[2, 0, 0, 0], "msrle"),
+
+ (b"CRAM", "msvideo1"),
+ (b"MSVC", "msvideo1"),
+ (b"WHAM", "msvideo1"),
+
(b"IF09", "indeo1"),
(b"RT21", "indeo2"),
(b"IV31", "indeo3"),
(b"VP70", "vp7"),
];
-static WAV_CODEC_REGISTER: &'static [(u16, &str)] = &[
- (0x0000, "pcm"),
+static WAV_CODEC_REGISTER: &[(u16, &str)] = &[
+ (0x0000, "unknown"),
(0x0001, "pcm"),
+ (0x0002, "ms-adpcm"),
(0x0003, "pcm"),
+ (0x0011, "ima-adpcm-ms"),
(0x0061, "adpcm-dk4"),
(0x0062, "adpcm-dk3"),
(0x0401, "imc"),
(0x0501, "on2avc-501"),
];
-static MOV_VIDEO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
+static MOV_VIDEO_CODEC_REGISTER: &[(&[u8;4], &str)] = &[
(b"cvid", "cinepak"),
(b"jpeg", "jpeg"),
//(b"raw ", "raw"),
(b"mjpa", "mjpeg-a"),
(b"mjpb", "mjpeg-b"),
(b"svqi", "sorenson-video"),
+ (b"SVQ1", "sorenson-video"),
+ (b"svq3", "sorenson-video3"),
+ (b"SVQ3", "sorenson-video3"),
(b"IV31", "indeo3"),
(b"IV32", "indeo3"),
(b"VP30", "vp3"),
(b"VP31", "vp3"),
+
+ (b"avc1", "h264"),
];
-static MOV_AUDIO_CODEC_REGISTER: &'static [(&[u8;4], &str)] = &[
+static MOV_AUDIO_CODEC_REGISTER: &[(&[u8;4], &str)] = &[
(b"NONE", "pcm"),
(b"raw ", "pcm"),
(b"twos", "pcm"),
(b"QDM2", "qdesign-music2"),
(b"Qclp", "qualcomm-purevoice"),
//(b".mp3", "mpeg-layer3"),
+
+ (b"mp4a", "aac"),
];
/// Returns video codec short name for provided FOURCC (used in AVI format).
None
}
+/// Returns FOURCC (used in AVI format) for provided codec name.
+pub fn find_avi_fourcc(codecname: &str) -> Option<[u8; 4]> {
+ for (fourcc, name) in AVI_VIDEO_CODEC_REGISTER.iter() {
+ if *name == codecname { return Some(**fourcc); }
+ }
+ None
+}
+
/// Returns known audio codec short name for provided TWOCC (used in WAV and AVI format).
pub fn find_codec_from_wav_twocc(tcc: u16) -> Option<&'static str> {
for (twocc, name) in WAV_CODEC_REGISTER.iter() {
None
}
+/// Returns TWOCC (used in WAV and AVI format for provided codec name.
+pub fn find_wav_twocc(codecname: &str) -> Option<u16> {
+ for (twocc, name) in WAV_CODEC_REGISTER.iter() {
+ if *name == codecname { return Some(*twocc); }
+ }
+ None
+}
+
/// Returns video codec short name for provided FOURCC (used in MOV format).
pub fn find_codec_from_mov_video_fourcc(fcc: &[u8;4]) -> Option<&'static str> {
for (fourcc, name) in MOV_VIDEO_CODEC_REGISTER.iter() {