mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
Get tag names from gstreamer-sys
This commit is contained in:
parent
61cc1aaea7
commit
0a0b82d1b2
4 changed files with 34 additions and 13 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -7,6 +7,7 @@ dependencies = [
|
|||
"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-sys 0.1.1 (git+https://github.com/sdroege/gstreamer-sys)",
|
||||
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-rational 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
|
|
@ -11,6 +11,7 @@ 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"] }
|
||||
glib = { version = "0.1.3", git = "https://github.com/gtk-rs/glib" }
|
||||
num-rational = { version = "0.1.38", default-features = false, features = [] }
|
||||
lazy_static = "0.2"
|
||||
|
||||
[features]
|
||||
v1_10 = ["gstreamer-sys/v1_10", "v1_8"]
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
extern crate libc;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
extern crate glib_sys as glib_ffi;
|
||||
extern crate gobject_sys as gobject_ffi;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
use std::fmt;
|
||||
use std::mem;
|
||||
use std::marker::PhantomData;
|
||||
use std::ffi::CStr;
|
||||
|
||||
use ffi;
|
||||
use glib;
|
||||
|
@ -38,20 +39,36 @@ macro_rules! impl_tag(
|
|||
};
|
||||
);
|
||||
|
||||
impl_tag!(Title, &'a str, "title");
|
||||
impl_tag!(Album, &'a str, "album");
|
||||
impl_tag!(Artist, &'a str, "artist");
|
||||
impl_tag!(AlbumArtist, &'a str, "album-artist");
|
||||
impl_tag!(Encoder, &'a str, "encoder");
|
||||
impl_tag!(AudioCodec, &'a str, "audio-codec");
|
||||
impl_tag!(VideoCodec, &'a str, "video-codec");
|
||||
impl_tag!(SubtitleCodec, &'a str, "subtitle-codec");
|
||||
impl_tag!(ContainerFormat, &'a str, "container-format");
|
||||
impl_tag!(Title, &'a str, *TAG_TITLE);
|
||||
impl_tag!(Album, &'a str, *TAG_ALBUM);
|
||||
impl_tag!(Artist, &'a str, *TAG_ARTIST);
|
||||
impl_tag!(AlbumArtist, &'a str, *TAG_ALBUM_ARTIST);
|
||||
impl_tag!(Encoder, &'a str, *TAG_ENCODER);
|
||||
impl_tag!(AudioCodec, &'a str, *TAG_AUDIO_CODEC);
|
||||
impl_tag!(VideoCodec, &'a str, *TAG_VIDEO_CODEC);
|
||||
impl_tag!(SubtitleCodec, &'a str, *TAG_SUBTITLE_CODEC);
|
||||
impl_tag!(ContainerFormat, &'a str, *TAG_CONTAINER_FORMAT);
|
||||
// TODO: Should ideally enforce this to be ISO-639
|
||||
impl_tag!(LanguageCode, &'a str, "language-code");
|
||||
impl_tag!(Duration, u64, "duration");
|
||||
impl_tag!(NominalBitrate, u32, "nominal-bitrate");
|
||||
impl_tag!(Image, Sample, "image");
|
||||
impl_tag!(LanguageCode, &'a str, *TAG_LANGUAGE_CODE);
|
||||
impl_tag!(Duration, u64, *TAG_DURATION);
|
||||
impl_tag!(NominalBitrate, u32, *TAG_NOMINAL_BITRATE);
|
||||
impl_tag!(Image, Sample, *TAG_IMAGE);
|
||||
|
||||
lazy_static!{
|
||||
pub static ref TAG_TITLE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_TITLE).to_str().unwrap() };
|
||||
pub static ref TAG_ALBUM: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM).to_str().unwrap() };
|
||||
pub static ref TAG_ARTIST: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ARTIST).to_str().unwrap() };
|
||||
pub static ref TAG_ALBUM_ARTIST: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ALBUM_ARTIST).to_str().unwrap() };
|
||||
pub static ref TAG_ENCODER: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_ENCODER).to_str().unwrap() };
|
||||
pub static ref TAG_AUDIO_CODEC: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_AUDIO_CODEC).to_str().unwrap() };
|
||||
pub static ref TAG_VIDEO_CODEC: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_VIDEO_CODEC).to_str().unwrap() };
|
||||
pub static ref TAG_SUBTITLE_CODEC: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_SUBTITLE_CODEC).to_str().unwrap() };
|
||||
pub static ref TAG_CONTAINER_FORMAT: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_CONTAINER_FORMAT).to_str().unwrap() };
|
||||
pub static ref TAG_LANGUAGE_CODE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_LANGUAGE_CODE).to_str().unwrap() };
|
||||
pub static ref TAG_DURATION: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_DURATION).to_str().unwrap() };
|
||||
pub static ref TAG_NOMINAL_BITRATE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_NOMINAL_BITRATE).to_str().unwrap() };
|
||||
pub static ref TAG_IMAGE: &'static str = unsafe { CStr::from_ptr(ffi::GST_TAG_IMAGE).to_str().unwrap() };
|
||||
}
|
||||
|
||||
pub type TagList = GstRc<TagListRef>;
|
||||
pub struct TagListRef(ffi::GstTagList);
|
||||
|
|
Loading…
Reference in a new issue