Print pointer value when formatting debug strings

This commit is contained in:
Thibault Saunier 2018-05-05 12:22:27 +02:00 committed by Sebastian Dröge
parent be646e78d9
commit 2962f186f7
5 changed files with 5 additions and 0 deletions

View file

@ -390,6 +390,7 @@ impl ToOwned for BufferRef {
impl fmt::Debug for BufferRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Buffer")
.field("ptr", unsafe { &self.as_ptr() } )
.field("pts", &self.get_pts().to_string())
.field("dts", &self.get_dts().to_string())
.field("duration", &self.get_duration().to_string())

View file

@ -117,6 +117,7 @@ impl fmt::Debug for BufferListRef {
.unwrap_or((::ClockTime::none(), ::ClockTime::none()));
f.debug_struct("BufferList")
.field("ptr", unsafe { &self.as_ptr() } )
.field("buffers", &self.len())
.field("pts", &pts.to_string())
.field("dts", &dts.to_string())

View file

@ -440,6 +440,7 @@ impl glib::types::StaticType for EventRef {
impl fmt::Debug for EventRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Event")
.field("ptr", unsafe { &self.as_ptr() } )
.field("type", &unsafe {
let type_ = ffi::gst_event_type_get_name((*self.as_ptr()).type_);
CStr::from_ptr(type_).to_str().unwrap()

View file

@ -357,6 +357,7 @@ impl glib::types::StaticType for MessageRef {
impl fmt::Debug for MessageRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Message")
.field("ptr", unsafe { &self.as_ptr() } )
.field("type", &unsafe {
let type_ = ffi::gst_message_type_get_name((*self.as_ptr()).type_);
CStr::from_ptr(type_).to_str().unwrap()

View file

@ -208,6 +208,7 @@ impl glib::types::StaticType for QueryRef {
impl fmt::Debug for QueryRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Query")
.field("ptr", unsafe { &self.as_ptr() })
.field("type", &unsafe {
let type_ = ffi::gst_query_type_get_name((*self.as_ptr()).type_);
CStr::from_ptr(type_).to_str().unwrap()