<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 8 mai 2019 06 h 56, Stefan Persson <<a href="mailto:johli392@student.liu.se">johli392@student.liu.se</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks for the help!<br>
<br>
>You can then implement allocation query to advertise video meta, or replace<br>
the tee/appsink with a pad probe. Just ping again if you need more details<br>
about this alternative.<br>
<br>
I'm investigating the pad probe but got stuck trying to read the raw pixel<br>
data from the video buffer.<br>
<br>
My pipeline is the following:<br>
tcpserversrc ! tsdemux ! h264parse ! avdec_h264 ! videoconvert !<br>
autovideosink name=sink<br>
<br>
I attach the pad probe with:<br>
GstPad *pad = gst_element_get_static_pad(ctx->sink, "sink");<br>
gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, (GstPadProbeCallback)<br>
gst_probe_callback, ctx, NULL);<br>
<br>
The callback is:<br>
static GstPadProbeReturn gst_probe_callback(GstPad *pad, GstPadProbeInfo<br>
*info, GstContext *ctx) {<br>
  GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);<br>
  GstMapInfo map;<br>
  gst_buffer_map(buffer, &map, GST_MAP_READ);<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Check your return value here if you are fan of memory safe code.</div><div dir="auto"><br></div><div dir="auto">For video frames, it's recommended to use GstVideoFrame wrapper to map/unmap. </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">
  int offset = 0;<br>
  while (offset < map.size && offset < 20000) {<br>
    /* Data is in map.data? */<br>
    /* *(map.data + offset) /*<br>
    /* This is random (and often just 0). </blockquote></div></div><div dir="auto"><br></div><div dir="auto">0 could be valid, and a video image can look random.</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">*/<br>
  }<br>
}<br>
<br>
Since the platform is Android the autovideosink surface is an Android<br>
Surface object received from the Java side via JNI/NDK and configured with <br>
gst_video_overlay_set_window_handle. Video playback works fine. It's just<br>
the pixel data that is strange (or undefined?)<br>
<br>
What step am I missing or doing wrong?<br>
<br>
Best Regards<br>
Stefan<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://gstreamer-devel.966125.n4.nabble.com/" rel="noreferrer noreferrer" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/</a><br>
_______________________________________________<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>