+
+ //2
+ m_player = gst_element_factory_make ("playbin", "play");
+
+ //3
+ if (!m_player)
+ return false;
+
+ //4
+ g_signal_connect (m_player, "eos", G_CALLBACK (OnFinish), this);
+ g_signal_connect (m_player, "error", G_CALLBACK (OnError), this);
+
+ //5
+ GstElement* overlay = NULL;
+ GstElement* videosink;
+
+#if defined(__WXGTK__) && wxUSE_DYNLIB_CLASS
+
+ //use gnome-specific gstreamer extensions
+ //if synthisis (?) file not found, it
+ //spits out a warning and uses ximagesink
+ wxDynamicLibrary gstgconf;
+ if(gstgconf.Load(gstgconf.CanonicalizeName(wxT("gstgconf-0.8"))))
+ {
+ typedef GstElement* (*LPgst_gconf_get_default_video_sink) (void);
+ LPgst_gconf_get_default_video_sink pGst_gconf_get_default_video_sink =
+ (LPgst_gconf_get_default_video_sink)
+ gstgconf.GetSymbol(wxT("gst_gconf_get_default_video_sink"));
+
+ if (pGst_gconf_get_default_video_sink)
+ {
+ videosink = (*pGst_gconf_get_default_video_sink) ();
+ wxASSERT( GST_IS_BIN(videosink) );
+ overlay = gst_bin_get_by_interface (GST_BIN (videosink),
+ GST_TYPE_X_OVERLAY);
+ }
+
+ gstgconf.Detach();
+ }
+
+ if ( ! GST_IS_X_OVERLAY(overlay) )
+ {
+#endif
+ wxLogDebug(wxT("Could not load Gnome preferences, reverting to xvimagesink for video for gstreamer"));
+ videosink = gst_element_factory_make ("xvimagesink", "videosink");
+ if ( !GST_IS_OBJECT(videosink) )
+ videosink = gst_element_factory_make ("ximagesink", "videosink");
+
+ overlay = videosink;
+
+ wxASSERT( GST_IS_X_OVERLAY(overlay) );
+ if ( ! GST_IS_X_OVERLAY(overlay) )
+ return false;
+#if defined(__WXGTK__) && wxUSE_DYNLIB_CLASS
+ }
+#endif
+
+ g_object_set (G_OBJECT (m_player),
+ "video-sink", videosink,
+// "audio-sink", m_audiosink,
+ NULL);
+
+ //6
+ wxString locstring = location.BuildUnescapedURI();
+ wxASSERT(gst_uri_protocol_is_valid("file"));
+ wxASSERT(gst_uri_is_valid(locstring.mb_str()));
+
+ g_object_set (G_OBJECT (m_player), "uri", (const char*)locstring.mb_str(), NULL);
+
+ //7
+#ifdef __WXGTK__
+ if(!GTK_WIDGET_REALIZED(m_ctrl->m_wxwindow))
+ {
+ //Not realized yet - set to connect at realization time
+ gtk_signal_connect( GTK_OBJECT(m_ctrl->m_wxwindow),
+ "realize",
+ GTK_SIGNAL_FUNC(wxGStreamerMediaBackend::OnGTKRealize),
+ (gpointer) this );
+ }
+ else
+ {
+ wxYield(); //see realize callback...
+ GdkWindow *window = GTK_PIZZA(m_ctrl->m_wxwindow)->bin_window;
+ wxASSERT(window);
+#endif