<div dir="ltr"><div>Hi Sebastian,
<br><br>Thanks for your reply. The following is my GStreamer code.
<br><br><a href="http://paste.ofcode.org/3npqJKDwgavsxnGvL8ws5k" target="_top" rel="nofollow" link="external">http://paste.ofcode.org/3npqJKDwgavsxnGvL8ws5k</a><br><br><br>Basically,
 I follow the tutorial and does not modify a lot. And it could work well
 if I use SurfaceView and get Surface just like the tutorial does. 
<br><br>However, since I want to play video using Google cardboard SDK, I
 use an OpenGL ES engine on Android called Rajawali. It gives me a 
Surface which is created by a SurfaceTexture. If I use the Surface like 
this:
<br><br>SufaceTexture surfaceTexture; // Created by engine
<br>Surface surface = new Surface(surfaceTexture);
<br>nativeSurfaceInit(surface);
<br><br>In this case, it will draw the content on a new Context which is not rendered by the engine. 
<br>However, if I use Surface by Android MediaPlayer like this:
<br><br>SufaceTexture surfaceTexture; // Created by engine
<br>Surface surface = new Surface(surfaceTexture);
<br>MediaPlayer mp = MediaPlayer.create(mContext, R.raw.test);
<br>mp.setSurface(surface);
<br>mp.start();
<br><br>It will not create a new context and render on the current context so I can see the result.
<br>It seems glimagesink will create a new context to draw by default.
<br>Is it possible to do some operations to make glimagesink draw content on original context just like the MediaPlayer does?
<br><br>Thanks a lot for your help.
<br><br></div>p.s. If you get duplicates of this mail, I am sorry for that.<br><div><div><br>Best regards,
<br>Wei
</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-05-06 14:36 GMT+08:00 Sebastian Dröge-3 [via GStreamer-devel] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=4677364&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span>:<br><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        On Do, 2016-05-05 at 05:52 -0700, Wei Lee wrote:
<div><div><div class='shrinkable-quote'><br>> Hi everyone,
<br>> 
<br>> I am new to GStreamer. I am developing an Android app which could play video
<br>> using GStreamer. I have a SurfaceTexture to link with video sink on the
<br>> GStreamer side. First, I get a Surface from SurfaceTexture and pass it to
<br>> the native GStreamer codes just like  this tutorial
<br>>  
<br>> . The differences are that I use GStreamer 1.0 rather than 0.1 and I
<br>> modified my pipeline to 
<br>> 
<br>> "videotestsrc ! videoconvert ! glimagesink"
<br>> 
<br>> for simple testing. However, I cannot see the correct result. All I see is
<br>> all blank.
<br>> 
<br>> But if I link a Surface which is from a SurfaceView just like the tutorial,
<br>> I could see the result correctly.
<br>> Also, if I bind the Surface not with GStreamer codes but with Android
<br>> MediaPlayer object by setSurface() method of it, the result is fine too.
<br>> 
<br>> After using an OpenGL ES Debugger on Android, I found out that when I link
<br>> Surface with glimagesink , it will somehow trigger eglCreateContext() and
<br>> put data in that Context rather than the original one. I guess that is the
<br>> reason why I get blank view. All the data is drawn on a context which is
<br>> unseen.
<br>> 
<br>> Could anybody give me some hints to fix the problem ?
</div></div>Can you share your code? It's expected that glimagesink is using its
</div>own GL context for rendering into the surface and not any of the
<br>application contexts.
<br><br>You can find an example that works with 1.x here:
<br><a href="https://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/tree/gst-sdk/tutorials/android-tutorial-3" rel="nofollow" link="external" target="_blank">https://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/tree/gst-sdk/tutorials/android-tutorial-3</a><br><br>-- 
<br>Sebastian Dröge, Centricular Ltd · <a href="http://www.centricular.com" rel="nofollow" link="external" target="_blank">http://www.centricular.com</a><br><br>_______________________________________________
<br>gstreamer-devel mailing list
<br><a href="http:///user/SendEmail.jtp?type=node&node=4677359&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="nofollow" link="external" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br><div><br><img src="http://gstreamer-devel.966125.n4.nabble.com/images/icon_attachment.gif"> <b>signature.asc</b> (968 bytes) <a href="http://gstreamer-devel.966125.n4.nabble.com/attachment/4677359/0/signature.asc" rel="nofollow" link="external" target="_blank">Download Attachment</a></div>

        
        
        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://gstreamer-devel.966125.n4.nabble.com/Problem-when-binding-Android-Surface-to-glimagesink-tp4677346p4677359.html" target="_blank" rel="nofollow" link="external">http://gstreamer-devel.966125.n4.nabble.com/Problem-when-binding-Android-Surface-to-glimagesink-tp4677346p4677359.html</a>
        </div>
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from Problem when binding Android Surface to glimagesink, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>
                <a href="http://gstreamer-devel.966125.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></blockquote></div><br></div></div>


        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/Problem-when-binding-Android-Surface-to-glimagesink-tp4677346p4677364.html">Re: Problem when binding Android Surface to glimagesink</a><br/>
Sent from the <a href="http://gstreamer-devel.966125.n4.nabble.com/">GStreamer-devel mailing list archive</a> at Nabble.com.<br/>