Re: Fetching GstBuffer Flags in GStreamer1



On 24.12.2014 02:31, Timm Murray wrote:
After a little more investigation into the C code, 
GST_BUFFER_FLAG_IS_SET calls into GstMiniObject to check the flags. 
There is a mini_object() method on GstBuffer, so I gave this a try:

if(! ($data_buf->mini_object->flags & 'flag_delta_unit') ) { 
$is_key_frame = 1; }

That leaves me with the error "Could not get field 'dispose' at ... "
with the line number pointing to the 'if' statement above.

I don't even get to the "dispose" field; I get a segfault
early on when trying to access the "copy" field in the "mini_object"
field. Since GstMiniObject doesn't seem to have a GType anymore,
Glib::Object::Introspection's generic struct converter kicks in, and
chokes on the non-introspectable function pointer field "copy" which it
mistakes for holding a Perl variable.

(The struct conversion code assumes that void pointer fields are used to
hold user data, so they read and write raw Perl values into them. This
hack is to support implementing GtkTreeModel. Unfortunately, in the
introspection data, the non-introspectable field "copy" seems to be
indistinguishable from a void pointer field.)

I don't currently see a quick way to fix this.

I agree with Emmanuele that a dedicated flags API would be best.

On 30.12.2014 16:16, Timm Murray wrote:
What I'd like to do is support this interface:

if( $data_buf->flag_is_set( 'flag-delta-unit' ) ) { ... }

For that to work, there needs to be a way to convert that string back
into the GstBufferFlag enum value from whence it came.  Is there an
easy way to do that?

That's not currently possible from pure Perl, but could be supported.
(Along the lines of Glib::Object::Introspection->convert_sv_to_enum and
convert_enum_to_sv.)

But how do you actually retrieve the flags of a buffer?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]