Commit 3a50ca61 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Add initial libgstvideo bindings

Only VideoFormat and VideoFormatInfo and related API for now.

https://github.com/sdroege/gstreamer-rs/issues/5
parent 21c41730
[root]
name = "gstreamer-audio"
name = "gstreamer-video"
version = "0.1.0"
dependencies = [
"array-init 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gstreamer 0.1.0",
"gstreamer-audio-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-video-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"rustdoc-stripper 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
......@@ -284,6 +283,22 @@ dependencies = [
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-audio"
version = "0.1.0"
dependencies = [
"array-init 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.1.3 (git+https://github.com/gtk-rs/glib)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gstreamer 0.1.0",
"gstreamer-audio-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"rustdoc-stripper 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-audio-sys"
version = "0.1.1"
......@@ -338,6 +353,20 @@ dependencies = [
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gstreamer-video-sys"
version = "0.1.1"
source = "git+https://github.com/sdroege/gstreamer-sys#252abbaeda64a3fdd8ccab291297500e3cdf6499"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gobject-sys 0.3.4 (git+https://github.com/gtk-rs/sys)",
"gstreamer-base-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
"gstreamer-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gtk"
version = "0.1.3"
......@@ -631,6 +660,7 @@ dependencies = [
"checksum gstreamer-base-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gstreamer-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gstreamer-tag-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gstreamer-video-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)" = "<none>"
"checksum gtk 0.1.3 (git+https://github.com/gtk-rs/gtk)" = "<none>"
"checksum gtk-sys 0.3.4 (git+https://github.com/gtk-rs/sys)" = "<none>"
"checksum iovec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29d062ee61fccdf25be172e70f34c9f6efc597e1fb8f6526e8437b2046ab26be"
......
......@@ -4,5 +4,6 @@ members = [
"gstreamer",
"gstreamer-app",
"gstreamer-audio",
"gstreamer-video",
"examples",
]
[options]
girs_dir = "gir-files"
library = "GstVideo"
version = "1.0"
min_cfg_version = "1.8"
target_path = "gstreamer-video"
work_mode = "normal"
concurrency = "send+sync"
generate_safety_asserts = true
external_libraries = [
"GLib",
"GObject",
"Gst",
]
generate = [
"GstVideo.VideoFormat",
"GstVideo.VideoFormatFlags",
"GstVideo.VideoTileMode",
"GstVideo.VideoInterlaceMode",
"GstVideo.VideoFlags",
"GstVideo.VideoChromaSite",
]
manual = [
"GObject.Object",
"Gst.Object",
"GstVideo.VideoInfo",
"GstVideo.VideoFormatInfo",
"GstVideo.VideoColorimetry",
]
[[object]]
name = "Gst.Caps"
status = "manual"
ref_mode = "ref"
[package]
name = "gstreamer-video"
version = "0.1.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
categories = ["api-bindings", "multimedia"]
description = "Rust bindings for GStreamer Video library"
repository = "https://github.com/sdroege/gstreamer-rs"
license = "MIT/Apache-2.0"
documentation = "https://gstreamer.freedesktop.org"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
[dependencies]
bitflags = "0.9"
libc = "0.2"
glib-sys = { version = "0.3.4", git = "https://github.com/gtk-rs/sys" }
gobject-sys = { version = "0.3.4", git = "https://github.com/gtk-rs/sys" }
gstreamer-sys = { version = "0.1.1", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
gstreamer-video-sys = { version = "0.1.1", git = "https://github.com/sdroege/gstreamer-sys", features = ["v1_8"] }
glib = { version = "0.1.3", git = "https://github.com/gtk-rs/glib" }
gstreamer = { version = "0.1.0", path = "../gstreamer" }
[build-dependencies.rustdoc-stripper]
version = "0.1"
optional = true
[features]
v1_10 = ["gstreamer-sys/v1_10"]
v1_12 = ["gstreamer-sys/v1_12", "v1_10"]
embed-lgpl-docs = ["rustdoc-stripper"]
purge-lgpl-docs = ["rustdoc-stripper"]
default-features = []
fn main() {
manage_docs();
}
#[cfg(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))]
fn manage_docs() {
extern crate stripper_lib;
use std::io;
let path = "src";
let ignores: &[&str] = &[];
stripper_lib::loop_over_files(
path.as_ref(),
&mut |w, s| stripper_lib::strip_comments(w, s, &mut io::sink(), true),
&ignores,
false,
);
#[cfg(feature = "embed-lgpl-docs")]
{
let docs = include_str!("../docs/gstreamer-video/docs.md");
let mut infos = stripper_lib::parse_cmts(docs.lines(), true);
stripper_lib::loop_over_files(
path.as_ref(),
&mut |w, s| stripper_lib::regenerate_comments(w, s, &mut infos, true, true),
&ignores,
false,
);
}
}
#[cfg(not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")))]
fn manage_docs() {}
This diff is collapsed.
// This file was generated by gir (cf27827) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::Type;
use glib::StaticType;
use glib::value::{FromValue, FromValueOptional, SetValue, Value};
use gobject_ffi;
use glib::translate::*;
bitflags! {
pub struct VideoChromaSite: u32 {
const VIDEO_CHROMA_SITE_UNKNOWN = 0;
const VIDEO_CHROMA_SITE_NONE = 1;
const VIDEO_CHROMA_SITE_H_COSITED = 2;
const VIDEO_CHROMA_SITE_V_COSITED = 4;
const VIDEO_CHROMA_SITE_ALT_LINE = 8;
const VIDEO_CHROMA_SITE_COSITED = 6;
const VIDEO_CHROMA_SITE_JPEG = 1;
const VIDEO_CHROMA_SITE_MPEG2 = 2;
const VIDEO_CHROMA_SITE_DV = 14;
}
}
#[doc(hidden)]
impl ToGlib for VideoChromaSite {
type GlibType = ffi::GstVideoChromaSite;
fn to_glib(&self) -> ffi::GstVideoChromaSite {
ffi::GstVideoChromaSite::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVideoChromaSite> for VideoChromaSite {
fn from_glib(value: ffi::GstVideoChromaSite) -> VideoChromaSite {
skip_assert_initialized!();
VideoChromaSite::from_bits_truncate(value.bits())
}
}
impl StaticType for VideoChromaSite {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_video_chroma_site_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for VideoChromaSite {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for VideoChromaSite {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstVideoChromaSite::from_bits_truncate(
gobject_ffi::g_value_get_flags(value.to_glib_none().0),
))
}
}
impl SetValue for VideoChromaSite {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
bitflags! {
pub struct VideoFlags: u32 {
const VIDEO_FLAG_NONE = 0;
const VIDEO_FLAG_VARIABLE_FPS = 1;
const VIDEO_FLAG_PREMULTIPLIED_ALPHA = 2;
}
}
#[doc(hidden)]
impl ToGlib for VideoFlags {
type GlibType = ffi::GstVideoFlags;
fn to_glib(&self) -> ffi::GstVideoFlags {
ffi::GstVideoFlags::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVideoFlags> for VideoFlags {
fn from_glib(value: ffi::GstVideoFlags) -> VideoFlags {
skip_assert_initialized!();
VideoFlags::from_bits_truncate(value.bits())
}
}
impl StaticType for VideoFlags {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_video_flags_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for VideoFlags {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for VideoFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstVideoFlags::from_bits_truncate(
gobject_ffi::g_value_get_flags(value.to_glib_none().0),
))
}
}
impl SetValue for VideoFlags {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
bitflags! {
pub struct VideoFormatFlags: u32 {
const VIDEO_FORMAT_FLAG_YUV = 1;
const VIDEO_FORMAT_FLAG_RGB = 2;
const VIDEO_FORMAT_FLAG_GRAY = 4;
const VIDEO_FORMAT_FLAG_ALPHA = 8;
const VIDEO_FORMAT_FLAG_LE = 16;
const VIDEO_FORMAT_FLAG_PALETTE = 32;
const VIDEO_FORMAT_FLAG_COMPLEX = 64;
const VIDEO_FORMAT_FLAG_UNPACK = 128;
const VIDEO_FORMAT_FLAG_TILED = 256;
}
}
#[doc(hidden)]
impl ToGlib for VideoFormatFlags {
type GlibType = ffi::GstVideoFormatFlags;
fn to_glib(&self) -> ffi::GstVideoFormatFlags {
ffi::GstVideoFormatFlags::from_bits_truncate(self.bits())
}
}
#[doc(hidden)]
impl FromGlib<ffi::GstVideoFormatFlags> for VideoFormatFlags {
fn from_glib(value: ffi::GstVideoFormatFlags) -> VideoFormatFlags {
skip_assert_initialized!();
VideoFormatFlags::from_bits_truncate(value.bits())
}
}
impl StaticType for VideoFormatFlags {
fn static_type() -> Type {
unsafe { from_glib(ffi::gst_video_format_flags_get_type()) }
}
}
impl<'a> FromValueOptional<'a> for VideoFormatFlags {
unsafe fn from_value_optional(value: &Value) -> Option<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for VideoFormatFlags {
unsafe fn from_value(value: &Value) -> Self {
from_glib(ffi::GstVideoFormatFlags::from_bits_truncate(
gobject_ffi::g_value_get_flags(value.to_glib_none().0),
))
}
}
impl SetValue for VideoFormatFlags {
unsafe fn set_value(value: &mut Value, this: &Self) {
gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
}
}
// This file was generated by gir (cf27827) from gir-files (???)
// DO NOT EDIT
mod enums;
pub use self::enums::VideoFormat;
pub use self::enums::VideoInterlaceMode;
pub use self::enums::VideoTileMode;
mod flags;
pub use self::flags::VideoChromaSite;
pub use self::flags::VIDEO_CHROMA_SITE_UNKNOWN;
pub use self::flags::VIDEO_CHROMA_SITE_NONE;
pub use self::flags::VIDEO_CHROMA_SITE_H_COSITED;
pub use self::flags::VIDEO_CHROMA_SITE_V_COSITED;
pub use self::flags::VIDEO_CHROMA_SITE_ALT_LINE;
pub use self::flags::VIDEO_CHROMA_SITE_COSITED;
pub use self::flags::VIDEO_CHROMA_SITE_JPEG;
pub use self::flags::VIDEO_CHROMA_SITE_MPEG2;
pub use self::flags::VIDEO_CHROMA_SITE_DV;
pub use self::flags::VideoFlags;
pub use self::flags::VIDEO_FLAG_NONE;
pub use self::flags::VIDEO_FLAG_VARIABLE_FPS;
pub use self::flags::VIDEO_FLAG_PREMULTIPLIED_ALPHA;
pub use self::flags::VideoFormatFlags;
pub use self::flags::VIDEO_FORMAT_FLAG_YUV;
pub use self::flags::VIDEO_FORMAT_FLAG_RGB;
pub use self::flags::VIDEO_FORMAT_FLAG_GRAY;
pub use self::flags::VIDEO_FORMAT_FLAG_ALPHA;
pub use self::flags::VIDEO_FORMAT_FLAG_LE;
pub use self::flags::VIDEO_FORMAT_FLAG_PALETTE;
pub use self::flags::VIDEO_FORMAT_FLAG_COMPLEX;
pub use self::flags::VIDEO_FORMAT_FLAG_UNPACK;
pub use self::flags::VIDEO_FORMAT_FLAG_TILED;
#[doc(hidden)]
pub mod traits {}
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_use]
extern crate bitflags;
extern crate libc;
extern crate glib_sys as glib_ffi;
extern crate gobject_sys as gobject_ffi;
extern crate gstreamer_sys as gst_ffi;
extern crate gstreamer_video_sys as ffi;
extern crate gstreamer as gst;
#[macro_use]
extern crate glib;
macro_rules! assert_initialized_main_thread {
() => (
use gst_ffi;
assert_eq!(unsafe {gst_ffi::gst_is_initialized()}, ::glib_ffi::GTRUE)
)
}
macro_rules! skip_assert_initialized {
() => (
)
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
mod auto;
pub use auto::*;
pub use auto::traits::*;
mod video_format;
pub use video_format::*;
mod video_format_info;
pub use video_format_info::*;
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use std::ffi::CStr;
use std::fmt;
use std::str;
use glib::translate::{from_glib, FromGlib, ToGlib, ToGlibPtr};
#[derive(PartialEq, Eq, Debug)]
pub enum VideoEndianness {
Unknown,
LittleEndian = 1234,
BigEndian = 4321,
}
impl FromGlib<i32> for VideoEndianness {
fn from_glib(value: i32) -> Self {
match value {
1234 => VideoEndianness::LittleEndian,
4321 => VideoEndianness::BigEndian,
_ => VideoEndianness::Unknown,
}
}
}
impl ToGlib for VideoEndianness {
type GlibType = i32;
fn to_glib(&self) -> i32 {
match *self {
VideoEndianness::LittleEndian => 1234,
VideoEndianness::BigEndian => 4321,
_ => 0,
}
}
}
impl ::VideoFormat {
pub fn from_string(s: &str) -> ::VideoFormat {
unsafe { from_glib(ffi::gst_video_format_from_string(s.to_glib_none().0)) }
}
pub fn from_fourcc(fourcc: u32) -> ::VideoFormat {
unsafe { from_glib(ffi::gst_video_format_from_fourcc(fourcc)) }
}
pub fn from_masks(
depth: u32,
bpp: u32,
endianness: ::VideoEndianness,
red_mask: u32,
blue_mask: u32,
green_mask: u32,
alpha_mask: u32,
) -> ::VideoFormat {
unsafe {
from_glib(ffi::gst_video_format_from_masks(
depth as i32,
bpp as i32,
endianness.to_glib(),
red_mask,
blue_mask,
green_mask,
alpha_mask,
))
}
}
pub fn to_string(&self) -> &'static str {
unsafe {
CStr::from_ptr(ffi::gst_video_format_to_string(self.to_glib()))
.to_str()
.unwrap()
}
}
}
impl str::FromStr for ::VideoFormat {
type Err = ();
fn from_str(s: &str) -> Result<Self, ()> {
let format = Self::from_string(s);
if format == ::VideoFormat::Unknown {
Err(())
} else {
Ok(format)
}
}
}
impl fmt::Display for ::VideoFormat {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
f.write_str(self.to_string())
}
}
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use ffi;
use std::ffi::CStr;
use std::fmt;
use std::str;
use glib;
use glib::translate::{from_glib, ToGlib};
pub struct VideoFormatInfo(&'static ffi::GstVideoFormatInfo);
impl VideoFormatInfo {
pub fn from_format(format: ::VideoFormat) -> VideoFormatInfo {
unsafe {
let info = ffi::gst_video_format_get_info(format.to_glib());
assert!(!info.is_null());
VideoFormatInfo(&*info)
}
}
pub fn format(&self) -> ::VideoFormat {
from_glib(self.0.format)
}
pub fn name(&self) -> &'static str {
unsafe { CStr::from_ptr(self.0.name).to_str().unwrap() }
}
pub fn description(&self) -> &'static str {
unsafe { CStr::from_ptr(self.0.description).to_str().unwrap() }
}
pub fn flags(&self) -> ::VideoFormatFlags {
from_glib(self.0.flags)
}
pub fn bits(&self) -> u32 {
self.0.bits
}
pub fn n_components(&self) -> u32 {
self.0.n_components
}
pub fn shift(&self) -> &[u32] {
&self.0.shift[0..(self.0.n_components as usize)]
}
pub fn depth(&self) -> &[u32] {
&self.0.depth[0..(self.0.n_components as usize)]
}
pub fn pixel_stride(&self) -> &[i32] {
&self.0.pixel_stride[0..(self.0.n_components as usize)]
}
pub fn n_planes(&self) -> u32 {
self.0.n_planes
}
pub fn plane(&self) -> &[u32] {
&self.0.plane[0..(self.0.n_components as usize)]
}
pub fn poffset(&self) -> &[u32] {
&self.0.poffset[0..(self.0.n_components as usize)]
}
pub fn w_sub(&self) -> &[u32] {
&self.0.w_sub[0..(self.0.n_components as usize)]
}
pub fn h_sub(&self) -> &[u32] {
&self.0.h_sub[0..(self.0.n_components as usize)]
}
pub fn tile_mode(&self) -> ::VideoTileMode {
from_glib(self.0.tile_mode)
}
pub fn tile_ws(&self) -> u32 {
self.0.tile_ws
}
pub fn tile_hs(&self) -> u32 {
self.0.tile_hs
}
pub fn unpack_format(&self) -> ::VideoFormat {
from_glib(self.0.unpack_format)
}
pub fn pack_lines(&self) -> i32 {
self.0.pack_lines
}
pub fn has_alpha(&self) -> bool {
self.0.flags.contains(ffi::GST_VIDEO_FORMAT_FLAG_ALPHA)
}
pub fn has_palette(&self) -> bool {
self.0.flags.contains(ffi::GST_VIDEO_FORMAT_FLAG_PALETTE)
}
pub fn is_complex(&self) -> bool {
self.0.flags.contains(ffi::GST_VIDEO_FORMAT_FLAG_COMPLEX)
}
pub fn is_gray(&self) -> bool {
self.0.flags.contains(ffi::GST_VIDEO_FORMAT_FLAG_GRAY)
}
pub fn is_le(&self) -> bool {
self.0.flags.contains(ffi::GST_VIDEO_FORMAT_FLAG_LE)
}
pub fn is_rgb(&self) -> bool {
self.0.flags.contains(ffi::GST_VIDEO_FORMAT_FLAG_RGB)
}
pub fn is_tiled(&self) -> bool {
self.0.flags.contains(ffi::GST_VIDEO_FORMAT_FLAG_TILED)
}
pub fn is_yuv(&self) -> bool {
self.0.flags.contains(ffi::GST_VIDEO_FORMAT_FLAG_YUV)
}
pub fn scale_width(&self, component: u8, width: u32) -> u32 {
(-((-(width as i64)) >> self.w_sub()[component as usize])) as u32
}
pub fn scale_height(&self, component: u8, height: u32) -> u32 {
(-((-(height as i64)) >> self.h_sub()[component as usize])) as u32
}
// TODO: pack/unpack
}
unsafe impl Sync for VideoFormatInfo {}
unsafe impl Send for VideoFormatInfo {}
impl PartialEq for VideoFormatInfo {
fn eq(&self, other: &Self) -> bool {
self.format() == other.format()
}
}
impl Eq for VideoFormatInfo {}
impl fmt::Debug for VideoFormatInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
f.write_str(self.name())
}
}
impl fmt::Display for VideoFormatInfo {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
f.write_str(self.name())
}
}
impl str::FromStr for ::VideoFormatInfo {
type Err = ();
fn from_str(s: &str) -> Result<Self, ()> {
let format = s.parse()?;
Ok(VideoFormatInfo::from_format(format))
}
}