<div dir="ltr"><div>What OS? What version of GStreamer?<br><br></div>Enable logging (export GST_DEBUG=*:3 or something) and do some digging. Something must be failing.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Mar 6, 2014 at 6:07 AM, kj192 <span dir="ltr"><<a href="mailto:elte.kissjanos@gmail.com" target="_blank">elte.kissjanos@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Everyone,<br>
<br>
I would like to have help from You. I (try to) use gstreamer to play video<br>
in SDL 2. Here is the code of my function where I want to update<br>
SDL_Texture:<br>
<br>
static GstFlowReturn on_buffer (GstAppSink * sink, gpointer user_data)<br>
{<br>
  GstBuffer* sample = gst_app_sink_pull_buffer(sink);<br>
  GstCaps* caps = gst_buffer_get_caps (sample);<br>
  if (!caps) g_print ("could not get snapshot format\n");<br>
  GstStructure* s = gst_caps_get_structure (caps, 0);<br>
  gint width, height;<br>
  int res = gst_structure_get_int (s, "width", &width)  |<br>
gst_structure_get_int (s, "height", &height);<br>
  if (!res) g_print ("could not get snapshot dimension\n");<br>
  //printf("caps struct=%s\n", gst_caps_to_string(caps));<br>
<br>
  SDL_Rect r{0, 0, width, height};<br>
  SDL_Texture *tex = SDL_CreateTexture(RENDER, SDL_PIXELFORMAT_IYUV,<br>
SDL_TEXTUREACCESS_STREAMING, width, height);<br>
<br>
  if (SDL_UpdateTexture(tex, &r,GST_BUFFER_DATA(sample),(width*4)) == 0)<br>
  {<br>
      printf("ok texture update\n");<br>
  }<br>
  else<br>
  {<br>
       printf("SDL_textureupdate failed: %s\n", SDL_GetError());<br>
  }<br>
<br>
  if ( SDL_RenderCopyEx(RENDER, tex, NULL, &r,ROTATION,NULL,SDL_FLIP_NONE)<br>
== 0)<br>
  {<br>
      printf("ok rendercopy \n");<br>
  }<br>
  else<br>
  {<br>
       printf("SDL_ rendercopy failed: %s\n", SDL_GetError());<br>
  }<br>
<br>
  SDL_RenderPresent(RENDER);<br>
  gst_buffer_unref(sample);<br>
  SDL_DestroyTexture(tex);<br>
  sleep(0.5);<br>
  return GST_FLOW_OK;<br>
}<br>
<br>
I don't have any error, but there is nothing in my screen. The Gstreamer<br>
Appsink seems to be working, because the video what I play is 2 seconds<br>
30FPS and the on_buffer callback is being called 60 times.<br>
<br>
complete code <<a href="http://pastebin.com/8SXhZZw2" target="_blank">http://pastebin.com/8SXhZZw2</a>><br>
<br>
Looking forward to your answers kj192<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/Read-frame-from-Gstreamer-buffer-to-SDL-Texture-tp4665787.html" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/Read-frame-from-Gstreamer-buffer-to-SDL-Texture-tp4665787.html</a><br>

Sent from the GStreamer-devel mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div><br></div>