Understanding the example with appsrc

Wudo Balmus wudo.balmus at gmail.com
Mon Feb 18 22:52:50 UTC 2019


It looks like that the component *2 is because in RGB16 1pixel is 2 bytes,
so the 384*288 pixmap requires 384*288*2 bytes. Still wondering why there
is 385, not 384.

pon., 18 lut 2019 o 22:10 Wudo Balmus <wudo.balmus at gmail.com> napisaƂ(a):

> Hello,
> I'm trying to understand the example for appsrc element described in the
> official tutorial:
>
>
> https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html
>
> We specify caps like that:
>
>  g_object_set (G_OBJECT (appsrc), "caps",
>         gst_caps_new_simple ("video/x-raw",
>                      "format", G_TYPE_STRING, "RGB16",
>                      "width", G_TYPE_INT, 384,
>                      "height", G_TYPE_INT, 288,
>                      "framerate", GST_TYPE_FRACTION, 0, 1,
>                      NULL), NULL);
>
> Then, when need-data function is called, there is created a GstBuffer of
> size:
>
> size = 385 * 288 * 2;
>
> filled with some color and pushed to appsrc.
>
> Two questions:
>
> 1. Why there is component 385, not 384 in the size of the buffer? In caps
> there was specified that the width is 384, but in the size of the buffer
> 385 appeared.
> 2. Why the size is multiplied by 2? Cannot we just send 1 frame? I tried
> to remove the *2 component, but then the background becomes a different
> colour than expected.
> I tried also to modify duration, to make it 1fps, but still doesn't work.
>
> Best regards,
> Wudo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190218/9b2f2890/attachment.html>


More information about the gstreamer-devel mailing list