GError *err, gchar *debug,
gpointer data);
static void OnVideoCapsReady(GstPad* pad, GParamSpec* pspec, gpointer data);
GError *err, gchar *debug,
gpointer data);
static void OnVideoCapsReady(GstPad* pad, GParamSpec* pspec, gpointer data);
#ifdef __WXGTK__
static gint OnGTKRealize(GtkWidget* theWidget, wxGStreamerMediaBackend* be);
#endif
GstElement* m_player; //GStreamer media element
#ifdef __WXGTK__
static gint OnGTKRealize(GtkWidget* theWidget, wxGStreamerMediaBackend* be);
#endif
GstElement* m_player; //GStreamer media element
//---------------------------------------------------------------------------
// wxGStreamerMediaBackend Constructor
//---------------------------------------------------------------------------
// wxGStreamerMediaBackend Constructor
//---------------------------------------------------------------------------
// wxGStreamerMediaBackend Destructor
//
//---------------------------------------------------------------------------
// wxGStreamerMediaBackend Destructor
//
//---------------------------------------------------------------------------
wxGStreamerMediaBackend::~wxGStreamerMediaBackend()
{
//---------------------------------------------------------------------------
wxGStreamerMediaBackend::~wxGStreamerMediaBackend()
{
if (g_isIdle)
wxapp_install_idle_handler();
wxYield(); //FIXME: X Server gets an error if I don't do this or a messagebox beforehand?!?!??
if (g_isIdle)
wxapp_install_idle_handler();
wxYield(); //FIXME: X Server gets an error if I don't do this or a messagebox beforehand?!?!??
GstElement* videosink;
g_object_get (G_OBJECT (be->m_player), "video-sink", &videosink, NULL);
GstElement* videosink;
g_object_get (G_OBJECT (be->m_player), "video-sink", &videosink, NULL);
GstElement* overlay = gst_bin_get_by_interface (GST_BIN (videosink),
GST_TYPE_X_OVERLAY);
gst_x_overlay_set_xwindow_id( GST_X_OVERLAY(overlay),
GDK_WINDOW_XWINDOW( window )
);
GstElement* overlay = gst_bin_get_by_interface (GST_BIN (videosink),
GST_TYPE_X_OVERLAY);
gst_x_overlay_set_xwindow_id( GST_X_OVERLAY(overlay),
GDK_WINDOW_XWINDOW( window )
);
m_ctrl = ctrl;
return m_ctrl->wxControl::Create(parent, id, pos, size,
m_ctrl = ctrl;
return m_ctrl->wxControl::Create(parent, id, pos, size,
wxLogDebug(wxT("Adjusted video size: [%i,%i]"), be->m_videoSize.x, be->m_videoSize.y);
wxLogDebug(wxT("Adjusted video size: [%i,%i]"), be->m_videoSize.x, be->m_videoSize.y);
(const wxChar*)wxConvUTF8.cMB2WX(err->message),
(const wxChar*)wxConvUTF8.cMB2WX(debug)
)
(const wxChar*)wxConvUTF8.cMB2WX(err->message),
(const wxChar*)wxConvUTF8.cMB2WX(debug)
)
//---------------------------------------------------------------------------
bool wxGStreamerMediaBackend::Load(const wxString& fileName)
{
//---------------------------------------------------------------------------
bool wxGStreamerMediaBackend::Load(const wxString& fileName)
{
//---------------------------------------------------------------------------
void wxGStreamerMediaBackend::OnVideoCapsReady(GstPad* pad, GParamSpec* pspec, gpointer data)
{
//---------------------------------------------------------------------------
void wxGStreamerMediaBackend::OnVideoCapsReady(GstPad* pad, GParamSpec* pspec, gpointer data)
{
//4
g_signal_connect (m_player, "eos", G_CALLBACK (OnFinish), this);
g_signal_connect (m_player, "error", G_CALLBACK (OnError), this);
//4
g_signal_connect (m_player, "eos", G_CALLBACK (OnFinish), this);
g_signal_connect (m_player, "error", G_CALLBACK (OnError), this);
//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);
//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);
{
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);
}
{
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);
}
- 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;
+ 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;
#endif
g_object_set (G_OBJECT (m_player),
"video-sink", videosink,
// "audio-sink", m_audiosink,
#endif
g_object_set (G_OBJECT (m_player),
"video-sink", videosink,
// "audio-sink", m_audiosink,
wxASSERT(gst_uri_is_valid(locstring.mb_str()));
g_object_set (G_OBJECT (m_player), "uri", (const char*)locstring.mb_str(), NULL);
wxASSERT(gst_uri_is_valid(locstring.mb_str()));
g_object_set (G_OBJECT (m_player), "uri", (const char*)locstring.mb_str(), NULL);
gst_x_overlay_set_xwindow_id( GST_X_OVERLAY(overlay),
#ifdef __WXGTK__
GDK_WINDOW_XWINDOW( window )
gst_x_overlay_set_xwindow_id( GST_X_OVERLAY(overlay),
#ifdef __WXGTK__
GDK_WINDOW_XWINDOW( window )
- int nResult = gst_element_set_state (m_player, GST_STATE_PAUSED);
- if(nResult != GST_STATE_SUCCESS)
- {
- wxLogDebug(wxT("Could not set initial state to paused!"));
- return false;
- }
+ int nResult = gst_element_set_state (m_player, GST_STATE_PAUSED);
+ if(nResult != GST_STATE_SUCCESS)
+ {
+ wxLogDebug(wxT("Could not set initial state to paused!"));
+ return false;
+ }
const GList *list = NULL;
g_object_get (G_OBJECT (m_player), "stream-info", &list, NULL);
const GList *list = NULL;
g_object_get (G_OBJECT (m_player), "stream-info", &list, NULL);
//but a lot of old plugins still use "pad" :)
pspec = g_object_class_find_property (
G_OBJECT_GET_CLASS (info), "object");
//but a lot of old plugins still use "pad" :)
pspec = g_object_class_find_property (
G_OBJECT_GET_CLASS (info), "object");
if (!pspec)
g_object_get (info, "pad", &pad, NULL);
else
g_object_get (info, "object", &pad, NULL);
if (!pspec)
g_object_get (info, "pad", &pad, NULL);
else
g_object_get (info, "object", &pad, NULL);
wxMediaEvent theEvent(wxEVT_MEDIA_LOADED,
m_ctrl->GetId());
m_ctrl->AddPendingEvent(theEvent);
wxMediaEvent theEvent(wxEVT_MEDIA_LOADED,
m_ctrl->GetId());
m_ctrl->AddPendingEvent(theEvent);
//---------------------------------------------------------------------------
// wxGStreamerMediaBackend::GetPosition
//
//---------------------------------------------------------------------------
// wxGStreamerMediaBackend::GetPosition
//
// GStreamer playbin for the position and returns that
//
//TODO:
//TODO: In lue of the last big TODO, when you pause and seek gstreamer
// GStreamer playbin for the position and returns that
//
//TODO:
//TODO: In lue of the last big TODO, when you pause and seek gstreamer
//TODO: we have paused or not and keep track of the time after the pause
//TODO: and whenever the user seeks while paused
//TODO:
//TODO: we have paused or not and keep track of the time after the pause
//TODO: and whenever the user seeks while paused
//TODO:
if (!gst_element_query (m_player, GST_QUERY_POSITION, &fmtTime, &pos))
return 0;
return pos / GST_MSECOND ;
if (!gst_element_query (m_player, GST_QUERY_POSITION, &fmtTime, &pos))
return 0;
return pos / GST_MSECOND ;
// Note that GST_MSECOND is 1000000 (GStreamer uses nanoseconds - so
// there is 1000000 nanoseconds in a millisecond)
//
// Note that GST_MSECOND is 1000000 (GStreamer uses nanoseconds - so
// there is 1000000 nanoseconds in a millisecond)
//
//---------------------------------------------------------------------------
bool wxGStreamerMediaBackend::SetPosition(wxLongLong where)
{
//---------------------------------------------------------------------------
bool wxGStreamerMediaBackend::SetPosition(wxLongLong where)
{
// Returns our cached video size from Load/OnVideoCapsReady
//---------------------------------------------------------------------------
wxSize wxGStreamerMediaBackend::GetVideoSize() const
// Returns our cached video size from Load/OnVideoCapsReady
//---------------------------------------------------------------------------
wxSize wxGStreamerMediaBackend::GetVideoSize() const