Thanks, Emmanuele.  I'm getting around to adding this as an extension to
GStreamer1::Buffer.

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?

Thanks,
Timm

On Wed, Dec 24, 2014 at 4:36 AM, Emmanuele Bassi <eba...@gmail.com> wrote:

> hi Timm;
>
> I think this case requires an API addition to GStreamer, instead of trying
> to work around it in Perl. GstBuffer should get a get_flags() method to
> replace the macro - as macros have always been fairly unfriendly to
> language bindings.
>
> you should file a bug against GStreamer.
>
> ciao,
>  Emmanuele.
>
>
> On Wednesday, December 24, 2014, Timm Murray <tmur...@wumpus-cave.net>
> 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.
>>
>> 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 <tmur...@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
>>>
>>
>>
>
> --
> http://www.bassi.io
> [@] ebassi [@gmail.com]
>
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to