Re: Fetching GstBuffer Flags in GStreamer1



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.

The original GStreamer module has a little xs code to help with the flags on GstBuffer.  That might be the way to go for GStreamer1, too, but I'd like to see if we can do this in Perl first.

Thanks,
Timm

On Tue, Dec 23, 2014 at 8:55 AM, Timm Murray <tmurray wumpus-cave net> wrote:
I have an application that sends a video stream to a client over a custom protocol. When the client first connects, we need to wait until the next keyframe so the client can decode it sensibly.  Alternatively, the client could read a flag in the protocol and wait for a keyframe on its end.  Either way, we need to check the GstBuffer flags for a keyframe.

The C code to do this would be:

if(!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
    // it's a keyframe
}

GstBufferFlags is itself an enum.  The issue is that GST_BUFFER_FLAG_IS_SET() is itself a C macro rather than a straight function.  So is GST_BUFFER_FLAGS().  There doesn't seem to be any other mechanisim in GstBuffer for checking the flags.  I'm not sure how the introspection bindings would have picked up the macros.

Thanks,
Timm



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