Re: Fetching GstBuffer Flags in GStreamer1

Well, it's fetched through the macro GST_BUFFER_FLAGS.  There seems to be different implementations for GStreamer 1.0 and 0.10.  The 1.0 version passes it along to GST_MINI_OBJECT_FLAGS.  0.10 has its own flags field.

Either way, probably want to call the macro rather than drilling down the internals.

On Mon, Jan 5, 2015 at 10:40 AM, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
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

But how do you actually retrieve the flags of a buffer?
gtk-perl-list mailing list
gtk-perl-list gnome org

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