wxMediaCtrl Could not find a suitable video sink (error 0: Successo)

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Giorgio Cavinato
In need of some credit
In need of some credit
Posts: 1
Joined: Wed Nov 23, 2016 9:00 am

wxMediaCtrl Could not find a suitable video sink (error 0: Successo)

Post by Giorgio Cavinato » Wed Nov 23, 2016 9:32 am

Hi,
I am using wxWidgets 3.0.2 (Linux,unicode) with IDE code::blocks 16.01 on Debian jessie (8.0.6) , I have installed gstreamer 0.10 and all the relative packages, I make this small program to test the control:

Code: Select all

#ifndef VIDEOPANEL_H
#define VIDEOPANEL_H

#include "wx/wx.h"
#include <wx/panel.h>
#include "wx/mediactrl.h"
#include "wx/aui/aui.h"


class VideoPanel : public wxPanel
{
    public:
        VideoPanel(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
        virtual ~VideoPanel();

    protected:
    static const long ID_MEDIACTRL;
    private:

        void VideoOnLoaded(wxMediaEvent& event);
        void VideoOnPlay(wxMediaEvent& event);
        void VideoOnPause(wxMediaEvent& event);
        void VideoOnStop(wxMediaEvent& event);
        void VideoOnFinished(wxMediaEvent& event);
        wxBoxSizer* BoxSizer1;
        wxMediaCtrl* m_video;
};

#endif // VIDEOPANEL_H

Code: Select all

#include "VideoPanel.h"
const long VideoPanel::ID_MEDIACTRL= wxNewId();

VideoPanel::VideoPanel(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
    Create(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("id"));
    BoxSizer1 = new wxBoxSizer(wxVERTICAL);
    SetSizer(BoxSizer1);

    m_video= new wxMediaCtrl();
    m_video->Create(this, ID_MEDIACTRL, wxEmptyString,wxDefaultPosition, wxDefaultSize, 0,wxMEDIABACKEND_GSTREAMER);
    this->Connect(ID_MEDIACTRL,wxEVT_MEDIA_STOP,wxMediaEventHandler(VideoPanel::VideoOnStop));
    this->Connect(ID_MEDIACTRL,wxEVT_MEDIA_PAUSE,wxMediaEventHandler(VideoPanel::VideoOnPause));
    this->Connect(ID_MEDIACTRL,wxEVT_MEDIA_PLAY,wxMediaEventHandler(VideoPanel::VideoOnPlay));
    this->Connect(ID_MEDIACTRL,wxEVT_MEDIA_FINISHED,wxMediaEventHandler(VideoPanel::VideoOnFinished));
    this->Connect(ID_MEDIACTRL,wxEVT_MEDIA_LOADED,wxMediaEventHandler(VideoPanel::VideoOnLoaded));

    m_video->Load(wxT("press.mpg"));
    m_video->ShowPlayerControls();

    BoxSizer1->Add(m_video, wxSizerFlags().Left().Expand());
    SetSizer(BoxSizer1);
    BoxSizer1->Layout();

}

VideoPanel::~VideoPanel()
{
    
}
void VideoPanel::VideoOnLoaded(wxMediaEvent& WXUNUSED(evt))
{
    if( !m_video->Play() )
    {
            wxMessageBox(wxT("Couldn't play movie!"));
    }
}
void VideoPanel::VideoOnPause(wxMediaEvent& WXUNUSED(evt))
{
        wxMessageBox(wxT("Pause"));
}
void VideoPanel::VideoOnPlay(wxMediaEvent& WXUNUSED(evt))
{
        wxMessageBox(wxT("Play"));
}
void VideoPanel::VideoOnStop(wxMediaEvent& WXUNUSED(evt))
{
        wxMessageBox(wxT("Stop"));
}
void VideoPanel::VideoOnFinished(wxMediaEvent& WXUNUSED(evt))
{
       wxMessageBox(wxT("Finished"));
}
is compiled correctly,but when the control is create i receive this assert:
Could not find a suitable video sink (error 0: Success)

gst-launch and totem display correctly the video
gst-inspect show xvimagesink and ximagesink and i have installed libgconf2

where am I wrong?

Post Reply