gst_video_overlay_set_window_handle from GTK#

Sebastian Dröge sebastian at centricular.com
Sat Dec 26 02:25:17 PST 2015


On Fr, 2015-12-25 at 19:53 -0800, doon wrote:
> I trying to display video in GTK# using Gstreamer via P/Invoke(on
> Ubuntu). I tried to use many code samples but nothing is working.
> Here is one of them:
> GTK# code:
> 	[DllImport("libgstTestDLL.so", CharSet = CharSet.Ansi,
> CallingConvention =
> CallingConvention.Cdecl)]
> 	public extern static int play_file (StringBuilder path, IntPtr
> win);
> ...
> play_file (new StringBuilder ().Append
> ("file:///home/user/Downloads/test.mp4"), screen.GdkWindow.Handle);	
> 
> C code:
> void play_file(char* path, void* hwnd_ptr){
>         GdkWindow* gdkWin = (GdkWindow*)hwnd_ptr;
>         pipeline = gst_element_factory_make("playbin", "player");
>         g_object_set (G_OBJECT (pipeline), "uri", path, NULL);
>         gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(pipelin
> e),
> GDK_WINDOW_XID(gdkWin));
>         gst_element_set_state(pipeline, GST_STATE_PLAYING);
> }
> After executing play_file function my GTK# app just closes.
> How can I correctly use play_file in GTK# and what I need to execute
> from play_file function in C to display video in GTK# application? 

Here's an example using gstreamer-sharp:
http://cgit.freedesktop.org/gstreamer/gstreamer-sharp/tree/samples/BasicTutorial5.cs#n57

Try reproducing what that does with your code :)


Alternatively, how does the application "just close"? Some kind of
crash or assertion that is hit, any warnings on the terminal?

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20151226/e9832d1f/attachment.sig>


More information about the gstreamer-devel mailing list