<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">Le lun. 18 févr. 2019 17 h 13, Wudo Balmus <<a href="mailto:wudo.balmus@gmail.com">wudo.balmus@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello,<br>I'm trying to understand the example for appsrc element described in the official tutorial:<br><br><a href="https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html" target="_blank" rel="noreferrer">https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html</a><br><br>We specify caps like that:<br><br> g_object_set (G_OBJECT (appsrc), "caps",<br> gst_caps_new_simple ("video/x-raw",<br> "format", G_TYPE_STRING, "RGB16",<br> "width", G_TYPE_INT, 384,<br> "height", G_TYPE_INT, 288,<br> "framerate", GST_TYPE_FRACTION, 0, 1,<br> NULL), NULL);<br><br>Then, when need-data function is called, there is created a GstBuffer of size:<br><br>size = 385 * 288 * 2;<br><br>filled with some color and pushed to appsrc.<br><br>Two questions:<br><br>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.<br></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">385 is a typo, all the rest of the code uses 384. But as this will do overallocation it should not cause any issue, would be nice to open an issue against gst-docs, as this is confusing.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">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.</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">2 is the number of bytes per pixels for the chosen format. So width*height*bps = size. Note though that in GStreamer you will have to round up the width to a multiple of 2.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"> I tried also to modify duration, to make it 1fps, but still doesn't work.</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The frame duration would also need to be set on buffers along with valid timestamp.</div><div dir="auto"></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br>Best regards,<br>Wudo<br></div></div></div>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></blockquote></div></div></div>