<div dir="ltr">Hi all again,<div><br></div><div>Looking inside GES I have found a reference implementation ges_pipeline_save_thumbnail [1]. I will use it to fix some memory leaks in my <span style="font-size:13px">snippet.</span></div><div><br></div><div>[1] <a href="https://github.com/GStreamer/gst-editing-services/blob/e1f6b9fefba6ae735b7045e982015b13660bf812/ges/ges-pipeline.c#L1234" target="_blank">https://github.com/<wbr>GStreamer/gst-editing-<wbr>services/blob/<wbr>e1f6b9fefba6ae735b7045e982015b<wbr>13660bf812/ges/ges-pipeline.c#<wbr>L1234</a></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-18 23:22 GMT+02:00 Ruben Gonzalez <span dir="ltr"><<a href="mailto:rubenrua@teltek.es" target="_blank">rubenrua@teltek.es</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all<div><br></div><div>I have written a simple snippet in C to take a snapshot from running pipeline and test gst_video_convert_sample [1]. IMHO take snapshot should be a must inside GStreamer and a function like gst_video_write_sample_to_file would be a good idea.<br></div><div><br></div><div>Looking inside gst_video_convert_sample and gst_play_sink_convert_sample, coding gst_video_write_sample_to_file should be easy using a filesink. If these feature is useful for the community, let me know it and I could try to do it.<br></div><div><div><br><div>[1] <a href="https://github.com/rubenrua/GstreamerCodeSnippets/blob/master/C/takepic.c" target="_blank">https://github.com/rubenrua/Gs<wbr>treamerCodeSnippets/blob/maste<wbr>r/C/takepic.c</a><br></div></div></div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">2016-08-17 12:47 GMT+02:00 Macjon <span dir="ltr"><<a href="mailto:jonah.hulselmans@flowpilots.com" target="_blank">jonah.hulselmans@flowpilots.c<wbr>om</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've got a peace of code that works. I removed the tee from my pipeline. And<br>
now I have the following objective-c code:<br>
<br>
-(UIImage*) takeSnapshot<br>
{<br>
GstSample *videobuffer = NULL;<br>
GstCaps *caps;<br>
gint width, height;<br>
GstMapInfo map;<br>
<br>
g_object_get(G_OBJECT(video_si<wbr>nk), "last-sample", &videobuffer, NULL);<br>
<br>
if (videobuffer)<br>
{<br>
caps = gst_sample_get_caps(videobuffe<wbr>r);<br>
<br>
if (!caps) {<br>
return NULL;<br>
}<br>
<br>
GstStructure *s = gst_caps_get_structure(caps, 0);<br>
/* we need to get the final caps on the buffer to get the size */<br>
gboolean res;<br>
res = gst_structure_get_int (s, "width", &width);<br>
res |= gst_structure_get_int (s, "height", &height);<br>
if (!res) {<br>
return NULL;<br>
}<br>
<br>
GstBuffer *snapbuffer = gst_sample_get_buffer(videobuf<wbr>fer);<br>
if (snapbuffer && gst_buffer_map (snapbuffer, &map, GST_MAP_READ))<br>
{<br>
CGDataProviderRef provider = CGDataProviderCreateWithData(N<wbr>ULL,<br>
map.data,<br>
height *<br>
width * 4,<br>
NULL);<br>
<br>
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();<br>
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;<br>
CGColorRenderingIntent renderingIntent =<br>
kCGRenderingIntentDefault;<br>
<br>
CGImageRef imageRef = CGImageCreate(width,<br>
height,<br>
8,<br>
4 * 8,<br>
width * 4,<br>
colorSpaceRef,<br>
bitmapInfo,<br>
provider,<br>
NULL,<br>
NO,<br>
renderingIntent);<br>
<br>
UIImage *uiImage = [UIImage imageWithCGImage:imageRef];<br>
CGColorSpaceRelease(colorSpace<wbr>Ref);<br>
CGImageRelease(imageRef);<br>
<br>
return uiImage;<br>
}<br>
<br>
return NULL;<br>
}<br>
<br>
return NULL;<br>
}<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/Take-snapshot-from-running-pipeline-in-gstreamer-with-iOS-tp4678410p4679126.html" rel="noreferrer" target="_blank">http://gstreamer-devel.966125.<wbr>n4.nabble.com/Take-snapshot-fr<wbr>om-running-pipeline-in-gstream<wbr>er-with-iOS-tp4678410p4679126.<wbr>html</a><br>
<div><div>Sent from the GStreamer-devel mailing list archive at Nabble.com.<br>
______________________________<wbr>_________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesk<wbr>top.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/gstreamer-dev<wbr>el</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Best regards/Un Saludo<br><br>Ruben Gonzalez Gonzalez<br>TELTEK Video Research<br><a href="http://teltek.es/" target="_blank">http://teltek.es/</a><br><br><br><font size="1"><i>La información contenida en este mensaje y/o archivo(s) adjunto(s) es confidencial/privilegiada y está destinada a ser leída sólo por la(s) persona(s) a la(s) que va dirigida. Si usted lee este mensaje y no es el destinatario señalado, el empleado o el agente responsable de entregar el mensaje al destinatario, o ha recibido esta comunicación por error, le informamos que está totalmente prohibida, y puede ser ilegal, cualquier divulgación, distribución o reproducción de esta comunicación, y le rogamos que nos lo notifique inmediatamente y nos devuelva el mensaje original a la dirección arriba mencionada. Gracias.<br><br>The </i><i>information contained in this message and/or attached file(s) is confidential/privileged and is intended to be read only by the person(s) to whom it is directed. If you are reading this message and you are not the indicated recipient, or the employee or agent responsible for delivering the message to the addressee, or you have received this communication by mistake, please be aware that </i><i><i>any dissemination, distribution or reproduction of this communication is</i> strictly prohibited and may be illegal. Please notify us immediately and return the original message to the aforementioned address. Thank you.</i></font></div></div></div></div>
</span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Best regards/Un Saludo<br><br>Ruben Gonzalez Gonzalez<br>TELTEK Video Research<br><a href="http://teltek.es/" target="_blank">http://teltek.es/</a><br><br><br><font size="1"><i>La información contenida en este mensaje y/o archivo(s) adjunto(s) es confidencial/privilegiada y está destinada a ser leída sólo por la(s) persona(s) a la(s) que va dirigida. Si usted lee este mensaje y no es el destinatario señalado, el empleado o el agente responsable de entregar el mensaje al destinatario, o ha recibido esta comunicación por error, le informamos que está totalmente prohibida, y puede ser ilegal, cualquier divulgación, distribución o reproducción de esta comunicación, y le rogamos que nos lo notifique inmediatamente y nos devuelva el mensaje original a la dirección arriba mencionada. Gracias.<br><br>The </i><i>information contained in this message and/or attached file(s) is confidential/privileged and is intended to be read only by the person(s) to whom it is directed. If you are reading this message and you are not the indicated recipient, or the employee or agent responsible for delivering the message to the addressee, or you have received this communication by mistake, please be aware that </i><i><i>any dissemination, distribution or reproduction of this communication is</i> strictly prohibited and may be illegal. Please notify us immediately and return the original message to the aforementioned address. Thank you.</i></font></div></div></div></div>
</div></div>