Disable xv output in wxMediaCtrl

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.
User avatar
Azrael
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Aug 05, 2017 2:44 pm
Location: Italy

Re: Disable xv output in wxMediaCtrl

Post by Azrael »

Code: Select all

azrael@Azrael:~/wxWidgets-3.1.0/buildgtk$ cd samples/mediaplayer
azrael@Azrael:~/wxWidgets-3.1.0/buildgtk/samples/mediaplayer$ make
/home/azrael/wxWidgets-3.1.0/buildgtk/bk-deps g++ -c -o mediaplayer_mediaplayer.o -D__WXGTK__      -I../../../samples/mediaplayer -DWXUSINGDLL -I../../../samples/mediaplayer/../../samples -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wno-deprecated-declarations  -D_FILE_OFFSET_BITS=64 -I/home/azrael/wxWidgets-3.1.0/buildgtk/lib/wx/include/gtk3-unicode-3.1 -I../../../include -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircore -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DWX_PRECOMP -pthread -ggdb -O0 -pthread -I/usr/include/gtk-3.0/unix-print -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircore -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fvisibility=hidden -fvisibility-inlines-hidden ../../../samples/mediaplayer/mediaplayer.cpp
g++ -o mediaplayer  mediaplayer_mediaplayer.o    -L/home/azrael/wxWidgets-3.1.0/buildgtk/lib  -Wl,-rpath,/home/azrael/wxWidgets-3.1.0/buildgtk/lib -pthread     -lwx_gtk3u_media-3.1 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0 -lwx_gtk3u_core-3.1  -lwx_baseu-3.1    -lwxtiff-3.1 -lwxjpeg-3.1   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lgthread-2.0 -pthread -lglib-2.0 -lX11 -lXxf86vm -lSM -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lpng -lz  -lwxregexu-3.1  -pthread   -Wl,--version-script,/home/azrael/wxWidgets-3.1.0/buildgtk/version-script -lz -ldl -lm  -lz -ldl -lm
This is what I got.
Is it normal? I don't usually compile from terminal.

I don't know if it's important but I noticed (too late) that in this line

Code: Select all

../configure --enable-debug --enable-debug_gdb --enable-mediactrl
I added a parameter

Code: Select all

 --with-gtk 
because I had the install file right next to your answer. Is it a problem?
If it is I will just do everything again
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Disable xv output in wxMediaCtrl

Post by ONEEYEMAN »

Hi,
No, that should be fine.
Now just run the sample with the mp3 you tried to play and see if it plays.

Thank you.
User avatar
Azrael
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Aug 05, 2017 2:44 pm
Location: Italy

Re: Disable xv output in wxMediaCtrl

Post by Azrael »

Actually it doesn't play.. I still get the same error. But why ? :-k
Last edited by Azrael on Sun Aug 27, 2017 8:45 pm, edited 1 time in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Disable xv output in wxMediaCtrl

Post by ONEEYEMAN »

Hi,
Install gdb from Ubuntu repository. Something like "sudo apt-get gdb".
Try to run it like this from the Terminal:

Code: Select all

gdb media <your_file>.mp3
After you get the gdb prompt type:

Code: Select all

b mediaplayer.cpp:1037
to set a breakpoint on the file mediaplayer.cpp line 1037. This line in wx 3.1 indicates loading the file.

Now you type

Code: Select all

run
When the execution stops, you type "s" to step into the function or "n" to execute the line.

See if you can hit the line which is at fault inside wxWidgets or in a sample.

Thank you.
User avatar
Azrael
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Aug 05, 2017 2:44 pm
Location: Italy

Re: Disable xv output in wxMediaCtrl

Post by Azrael »

Hi,
Sorry for replying so late. I tried to do what you suggested me yesterday.
At some point I arrived with the execution in this file:
https://github.com/wxWidgets/wxWidgets/ ... iactrl.cpp

at this point in particular (lines 1099-1123) :

Code: Select all

    // Setup video sink - first try gconf, then auto, then xvimage and
    // then finally plain ximage
    GstElement* videosink;
#if !GST_CHECK_VERSION(1,0,0)
    videosink = gst_element_factory_make ("gconfvideosink", "video-sink");
    if( !TryVideoSink(videosink) )
    {
#endif
        videosink = gst_element_factory_make ("autovideosink", "video-sink");
        if( !TryVideoSink(videosink) )
        {
            videosink = gst_element_factory_make ("xvimagesink", "video-sink");
            if( !TryVideoSink(videosink) )
            {
                // finally, do a final fallback to ximagesink
                videosink =
                    gst_element_factory_make ("ximagesink", "video-sink");
                if( !TryVideoSink(videosink) )
                {
                    g_object_unref(audiosink);
                    wxLogSysError(wxT("Could not find a suitable video sink"));
                    return false;
                }
            }
        }
As you can see it's about the video output. First it checks for xvimagesink and later for ximagesink. In gstreamer1.0 I have both of them.
I didn't understand what was wrong so I tried this:

Code: Select all

gst-launch-1.0 videotestsrc ! videoconvert ! xvimagesink
This was the output:

Code: Select all

Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: 
Could not initialise Xv output
Additional debug info:
xvimagesink.c(1760): gst_xv_image_sink_open (): 
/GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
No Xv Port available
Setting pipeline to NULL ...
Freeing pipeline ...
It seems like I'm missing "xv port" . That's why it couldn't initialize the xv output even though I used gstreamer1.0 and wxWidgets 3.1.0.
The problem is that in mediactrl.cpp the program finds xvimagesink first , checks for xv port, doesn't find it and throws that error. It just stops there and never checks for ximagesink (which works if I try

Code: Select all

gst-launch-1.0 videotestsrc ! videoconvert ! ximagesink
)

I have 3 options at this point:
  • 1. Solve the xv port problem by downloading the drivers (?)
    2. Modifying wxWidgets sources
    3. Creating a new backend for wxMediaCtrl almost identical to gstreamer backend but switching the order of xv/ x imagesink
Which is the best solution in your opinion ?
Thank you
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Disable xv output in wxMediaCtrl

Post by ONEEYEMAN »

Hi,
I'd say it's 1 and 2 in this order.
It would be nice if wxWidgets media library at least give the nice output - either as message box or in the log.
But the main problem (1) still needs to be solved.

Thank you.
User avatar
Azrael
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Aug 05, 2017 2:44 pm
Location: Italy

Re: Disable xv output in wxMediaCtrl

Post by Azrael »

Hi,
I modified the sources and it works! I mean, now the mediaplayer sample plays .mp3 files.

Because it works I decided to install the library with modified sources.
I followed the these instructions :https://github.com/wxWidgets/wxWidgets/ ... nstall.txt. There are similar with the ones you suggested me a few days ago.
However, now my project doesn't find the library. It did find it with the library downloaded from the repository but not with the one I compiled by myself.
Do I need to add something? I feel like I've installed the library in a non-standard path but I'm not sure because I didn't specify anything in "make install" command.

Thank you

P.S. I don't know if it's relevant or not but my project uses cmake , in particular it uses FindwxWidgets.cmake ( a file provided by CLion, my IDE ) to locate the library. It creates some variables that I use later to include the library in the project.
And..I didn't forget about the main problem being "no available xv port" . I'll solve it later because it seems a little bit more complicated than what I had imagined.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Disable xv output in wxMediaCtrl

Post by ONEEYEMAN »

Hi,
If the sample works now, could you please open a ticket at trac.wxwidgets.org.
Attach the mp3 you tried which didn't play, the patch to the library which fixes the problem.

In the ticket description tell:

- OS you are using
- GTK version you are building against (by default GTK2), but the report needs the full version.
- GStreamer version (once again the full version)
- which plugins are required to be installed on the system to successfully play the file on the GStreamer (not the sample; person who might try it most likely won't have all this).

Also if you modified the sample in any way attach the patch to the sample with your modifications.

This way the next release of the library will contain the fix and you won't need to supply the modified (non-standard) library.

Thank you.
User avatar
Azrael
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Aug 05, 2017 2:44 pm
Location: Italy

Re: Disable xv output in wxMediaCtrl

Post by Azrael »

Hi,
You helped me, it's the least I can do. It could help other people as well.

But are you sure about it ? I mean, the problem was with my computer in the first place and I only modified the sources by switching the order in which the program checks for xvimagesink and ximagesink. From what I read online it looks like xvimagesink is better than plain ximagesink. In my opinion it makes sense for it to be checked first.

If you really think it's okay then I'll do it. It's not a problem for me.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Disable xv output in wxMediaCtrl

Post by ONEEYEMAN »

Hi,
You patch will not be applied blindly - people will review it. Hopefully even people who does use wxMediaCTrl themselves.
So, yes, please create a new ticket.

If you still have those sites you checked, you can add them as a reference in the bug description to simplify the code review. Otherwise - just submit as it is.

wx core development team prefer the patches to the library rather than description of what you changed. So just create a patch to the sources, register at trac (if you never did - keep in mind those 2 rules: 1. don't use spaces in the name selection and 2. it requires approval from the trac maintainers) and submit a ticket.

It will definitely help someone else. There are not too many people that does use wxMediaCtrl, but some does.

Thank you.
User avatar
Azrael
Knows some wx things
Knows some wx things
Posts: 37
Joined: Sat Aug 05, 2017 2:44 pm
Location: Italy

Re: Disable xv output in wxMediaCtrl

Post by Azrael »

Hi,
I will create a ticket then.
Thank you for your help !
Post Reply