1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
use ffi::*; use util::*; use ::Caps; pub type VideoInfo = GstVideoInfo; impl VideoInfo{ #[inline] pub fn format_info(&self) -> &GstVideoFormatInfo{ unsafe{ &(*self.finfo) } } #[inline] pub fn format(&self) -> GstVideoFormat{ self.format_info().format } #[inline] pub fn format_name(&self) -> String{ unsafe{ from_c_str!(self.format_info().name).to_string() } } #[inline] pub fn is_yuv(&self) -> bool{ self.format_info().flags & GST_VIDEO_FORMAT_FLAG_YUV == GST_VIDEO_FORMAT_FLAG_YUV } #[inline] pub fn is_rgb(&self) -> bool{ self.format_info().flags & GST_VIDEO_FORMAT_FLAG_RGB == GST_VIDEO_FORMAT_FLAG_RGB } #[inline] pub fn is_gray(&self) -> bool{ self.format_info().flags & GST_VIDEO_FORMAT_FLAG_GRAY == GST_VIDEO_FORMAT_FLAG_GRAY } #[inline] pub fn has_alpha(&self) -> bool{ self.format_info().flags & GST_VIDEO_FORMAT_FLAG_ALPHA == GST_VIDEO_FORMAT_FLAG_ALPHA } #[inline] pub fn interlace_mode(&self) -> GstVideoInterlaceMode{ self.interlace_mode } #[inline] pub fn is_interlaced(&self) -> bool{ self.interlace_mode != GST_VIDEO_INTERLACE_MODE_PROGRESSIVE } #[inline] pub fn flags(&self) -> GstVideoFlags{ self.flags } #[inline] pub fn width(&self) -> i32{ self.width } #[inline] pub fn height(&self) -> i32{ self.height } #[inline] pub fn size(&self) -> u64{ self.size as u64 } #[inline] pub fn views(&self) -> i32{ self.views } #[inline] pub fn par_n(&self) -> i32{ self.par_n } #[inline] pub fn par_d(&self) -> i32{ self.par_d } #[inline] pub fn fps_n(&self) -> i32{ self.fps_n } #[inline] pub fn fps_d(&self) -> i32{ self.fps_d } #[inline] pub fn n_planes(&self) -> u32{ self.format_info().n_planes } #[inline] pub fn plane_stride(&self, p: usize) -> i32{ self.stride[p] } #[inline] pub fn plane_offset(&self, p: usize) -> u64{ self.offset[p] as u64 } pub fn to_caps(&self) -> Option<::Caps>{ unsafe{ Caps::new(gst_video_info_to_caps(mem::transmute(self))) } } } impl PartialEq for VideoInfo{ fn eq(&self, other: &VideoInfo) -> bool{ unsafe{ gst_video_info_is_equal(mem::transmute(self), mem::transmute(other)) != 0 } } } impl Eq for VideoInfo{}