wxMediaCtrl does not work

627 views
Skip to first unread message

Satz Klauer

unread,
May 13, 2013, 4:02:02 AM5/13/13
to wx-users
Its usage should be quite simple but I fail miserably when I try to
use wxMediaCtrl. That's what I have:

//construction of the control with loaded-event
mpWindow::mpWindow(wxWindow *parent,wxSize size,struct instData *data)
:wxMediaCtrl(parent,wxID_ANY,wxEmptyString,wxPoint(0,0),size)
{
Connect(GetId(),wxEVT_MEDIA_LOADED,wxMediaEventHandler(mpWindow::OnMediaLoaded));
...
}

void mpWindow::OnMediaLoaded(wxMediaEvent& /*evt*/)
{
...
}

Later I call Load(path) which a valid "path" to my video file. Load()
returns true but the OnMediaEvent never happens. Also calling Play()
afterwards returns true but nothing is played.

Any ideas what could be wrong/how I could find out what is missing?

Thanks!

Vadim Zeitlin

unread,
May 13, 2013, 7:06:19 AM5/13/13
to wx-u...@googlegroups.com
On Mon, 13 May 2013 10:02:02 +0200 Satz Klauer wrote:

SK> Its usage should be quite simple but I fail miserably when I try to
SK> use wxMediaCtrl.

Under which platform do you use it? Does the sample work for you?
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

stevec...@gmail.com

unread,
May 13, 2013, 7:15:29 AM5/13/13
to wx-u...@googlegroups.com
Hi Satz,


> Its usage should be quite simple but I fail miserably when I try to
> use wxMediaCtrl.

You don't say what version or what operating system you are using. It would
also be useful to know what backend you are using.

However, it is fair to say that error reporting could be better. If you
specify which player to use (see below) it would reduce the number of
unknowns you are playing with.

I use it daily on Linux and less frequently on Windows. Have you tried to
compile the sample mediaplayer?

Regards

Steve.

# wxMEDIABACKEND_DIRECTSHOW Use ActiveMovie/DirectShow. Requires
wxUSE_DIRECTSHOW to be enabled, requires linkage with the static library
strmiids.lib, and is available on Windows Only.
# wxMEDIABACKEND_QUICKTIME Use QuickTime. Windows and Mac Only. NOTE:
On Mac Systems lower than OSX 10.2 this defaults to emulating window
positioning and suffers from several bugs, including not working correctly
embedded in a wxNotebook.
# wxMEDIABACKEND_MCI Use Media Command Interface. Windows Only.
# wxMEDIABACKEND_GSTREAMER Use GStreamer. Unix Only. Has installation
dependencies.
# wxMEDIABACKEND_WMP10 Windows Media Player 9 or 10
# wxMEDIABACKEND_REALPLAYER Realplayer
# Blank Allow to choose own player


Satz Klauer

unread,
May 13, 2013, 7:36:39 AM5/13/13
to wx-users
> However, it is fair to say that error reporting could be better.

When I'm doing something wrong my code should be enough - that's why I
did not gave more information, I simply assumed it is my fault.

On Mon, May 13, 2013 at 1:15 PM, <stevec...@gmail.com> wrote:
> You don't say what version or what operating system you are using. It would
> also be useful to know what backend you are using.

I tried it on Linux and Windows but for Linux I'm not 100% sure if all
required GStreamer-plug-ins are available. Backend is just the default
that wxMediaCtrl chooses and wxwidgets is the latest stable
2.8.x-release. So nothing exotic here.

I haven't tried the mediaplayer sample until now but will do that...

stevec...@gmail.com

unread,
May 13, 2013, 8:13:19 AM5/13/13
to wx-u...@googlegroups.com
> However, it is fair to say that error reporting could be better.

> When I'm doing something wrong my code should be enough - that's why I
> did not gave more information, I simply assumed it is my fault.

It may still be your fault, but it may be an installation fault :)

> I tried it on Linux and Windows but for Linux I'm not 100% sure if all
> required GStreamer-plug-ins are available. Backend is just the default
> that wxMediaCtrl chooses and wxwidgets is the latest stable
> 2.8.x-release. So nothing exotic here.

OK, it definitely works on Linux wxWidgets 2.8.12.

I have quite a lot of GStreamer modules installed, but I'm pretty sure these
are the mandatory ones. (Vadim?)

apt-get -y install libgstreamer0.10-dev
apt-get -y install libgstreamer-plugins-base0.10-dev

It's also a good idea to install these:

apt-get -y install libgconf2-dev libgtk2.0-dev

It can also go appear to go wrong if you have the wrong $parent or you use
the wrong Sizer->Add command.

From recollection, make sure you use wxEXPAND and ->Show(1);

On Windows, because you have several choices, why don't you just specify the
backend, that way you can also check the player and media file
independently.

Good luck,

Steve.




Stefano Mtangoo

unread,
May 20, 2013, 3:28:16 AM5/20/13
to wx-users


On May 20, 1:15 am, Patrick Maher <patr...@maher1.net> wrote:
> I've learned by experience that if the specified media file doesn't
> exist, wxMediaCtrl still returns True for Load and Play but nothing
Docs says "Returns false if loading fails. "
So if you confirm it with sample then file a bug.
BTW I find wxFileExists helpful before I load file

> happens. It doesn't give you any indication that the reason why nothing is
> happening is that the specified file doesn't exist (or, what comes to the
> same thing, it isn't at the location you specified). So now, when
> wxMediaCtrl seems not to work, I check that I really did specify the
> correct location.
>
> Patrick

Satz Klauer

unread,
Aug 16, 2013, 1:27:10 AM8/16/13
to wx-u...@googlegroups.com
This thread regarding the not working wxMediaCtrl is quite old but now I had some time to dig deeper into it.

Meanwhile I found the wxMediaCtrl code in mediaplayer sample is exactly the same like in my application. wxEVT_MEDIA_LOADED also does not work in mediaplayer sample, so it is the same behaviour like in my program.

But there is one difference: wxMediaCtrl->Play() calls GetAM()->Run() in mediactrl_am.cpp. In mediaplayer sample this function returns S_OK while in my application it comes back with an error code 856325. The used macro SUCCEEDED() does not check for this because it is !=0.

So: any ideas what this returned code 856325 could mean?

And: my piece of wxMediaCtrl code is located within an external DLL that is loaded dynamically and not within the main application itself, so that's another difference to the sample.

Vadim Zeitlin

unread,
Aug 16, 2013, 6:35:51 AM8/16/13
to wx-u...@googlegroups.com
On Thu, 15 Aug 2013 22:27:10 -0700 (PDT) Satz Klauer wrote:

SK> Meanwhile I found the wxMediaCtrl code in mediaplayer sample is exactly the
SK> same like in my application. wxEVT_MEDIA_LOADED also does not work in
SK> mediaplayer sample, so it is the same behaviour like in my program.
SK>
SK> But there is one difference: wxMediaCtrl->Play() calls GetAM()->Run() in
SK> mediactrl_am.cpp. In mediaplayer sample this function returns S_OK while in
SK> my application it comes back with an error code 856325. The used macro
SK> SUCCEEDED() does not check for this because it is !=0.
SK>
SK> So: any ideas what this returned code 856325 could mean?

FWIW it's not one of the standard Windows error codes.

SK> And: my piece of wxMediaCtrl code is located within an external DLL that is
SK> loaded dynamically and not within the main application itself, so that's
SK> another difference to the sample.

I don't see how could this matter but maybe I'm missing something... COM
should still be initialized by wxWidgets even if you use it from a DLL and
this is the only relevant thing I can think about.

Regards,

pbou...@labocom.com

unread,
Feb 6, 2014, 9:25:19 AM2/6/14
to wx-u...@googlegroups.com, satzk...@googlemail.com
Hello Vadim,
I have a crash of my app with the message "DirectShow Error" on the function wxMediaCtrl::Load(filename)
since i upgrade wxWidgets to version 2.8.12
Before, i was on version 2.6 and my app don't crah : playing wav et mp3 file ...
The compiler used is Borland Builder 5.
The OS used is Windows7
Then, i wanted to compile mediaplayer sample to verify ...
The sample compile et execute until i open a file from the menu.
Then it crash ...

What's app doc ?
Thank you
Pierre

Igor Korot

unread,
Feb 7, 2014, 4:23:38 AM2/7/14
to wx-u...@googlegroups.com
Hi, Pierre,
3.0.0 is out.
Can you try with the latest release?

Also it would be nice to have a backtrace of the crash...

Thank you.

>
> What's app doc ?
> Thank you
> Pierre
>
> --
> Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
>
> To unsubscribe, send email to wx-users+u...@googlegroups.com
> or visit http://groups.google.com/group/wx-users

pbou...@labocom.com

unread,
Feb 10, 2014, 3:19:40 AM2/10/14
to wx-u...@googlegroups.com
Hello Igor,


    3.0.0 is out.
    Can you try with the latest release?

I don't speak about a 3.0.0 version ... ?


    Also it would be nice to have a backtrace of the crash...

I am confused ... it is not a crash.
but the function 'Load' of wxMediaCtrl class, used to load a media file, return false.
By step to step in debug mode, i recompose the function's call :

bool wxMediaCtrl::Load(const wxString& fileName)
bool wxAMMediaBackend::Load(const wxString& fileName)
bool wxAMMediaBackend::DoLoad(const wxString& location)

here a call is execute :
HRESULT hr = GetP()->Open( wxBasicString(location).Get() );
and a DirectShow Error is send because :
if(FAILED(hr))

Regards and thank you,
Pierre

Igor Korot

unread,
Feb 10, 2014, 3:51:14 AM2/10/14
to wx-u...@googlegroups.com
Hi, Pier,

On Mon, Feb 10, 2014 at 12:19 AM, <pbou...@labocom.com> wrote:
Hello Igor,


    3.0.0 is out.
    Can you try with the latest release?

I don't speak about a 3.0.0 version ... ?
 
Apparently you don't.
Quoting:
 
"
I have a crash of my app with the message "DirectShow Error" on the function wxMediaCtrl::Load(filename)
since i upgrade wxWidgets to version 2.8.12
"
 
    Also it would be nice to have a backtrace of the crash...
 
Again, from the quote above:
"
I have a crash....
"
 
Thank you.
 

I am confused ... it is not a crash.
but the function 'Load' of wxMediaCtrl class, used to load a media file, return false.
By step to step in debug mode, i recompose the function's call :

bool wxMediaCtrl::Load(const wxString& fileName)
bool wxAMMediaBackend::Load(const wxString& fileName)
bool wxAMMediaBackend::DoLoad(const wxString& location)

here a call is execute :
HRESULT hr = GetP()->Open( wxBasicString(location).Get() );
and a DirectShow Error is send because :
if(FAILED(hr))

Regards and thank you,
Pierre

pbou...@labocom.com

unread,
Feb 10, 2014, 10:02:01 AM2/10/14
to wx-u...@googlegroups.com
Hello Igor,
I am desoled for my poor english ...
but like i say it, it'is not a crash. My app don't stop
but the function Load of MediaCtrl return false
while it return true with the old version  2.6 of wxWidgets.
and the media (wav file) is never played.
Regards
Pierre

Igor Korot

unread,
Feb 10, 2014, 2:12:55 PM2/10/14
to wx-u...@googlegroups.com
Pierre,

On Mon, Feb 10, 2014 at 7:02 AM, <pbou...@labocom.com> wrote:
Hello Igor,

I am desoled for my poor english ...
but like i say it, it'is not a crash. My app don't stop
but the function Load of MediaCtrl return false
while it return true with the old version  2.6 of wxWidgets.
and the media (wav file) is never played.
Regards
Pierre
 
Did you try with 3.0 or even wxWidgets TRUNK?
 
Thank you.

pbou...@labocom.com

unread,
Feb 11, 2014, 3:10:31 AM2/11/14
to wx-u...@googlegroups.com
Igor,
No, i would like my app work with 2.8 ...
What are the benefits of 3.0 version ?
wxMediaCtrl will work correctly ?
Thank you
Pierre

Igor Korot

unread,
Feb 11, 2014, 3:41:04 AM2/11/14
to wx-u...@googlegroups.com
Pierre,

On Tue, Feb 11, 2014 at 12:10 AM, <pbou...@labocom.com> wrote:
Igor,
No, i would like my app work with 2.8 ...
What are the benefits of 3.0 version ?
 
Problem is nobody will look at 2.8 since 3.0 is out and the cycle is actually very close to 3.0.1.
So if you program, or even the sample, will not work with 3.0, someone might look at it and fix it.
It's been a long time since 2.8 was out...
 
Also it will help to narrow down the problem. If it didn't work with 2.8, but started working with 3.0
then you can upgrade without any major issues. All you will need to do is to fix some compilation
problems and retest.
 
BTW, what is you operating system? And did you try to compile the media sample?
 
I think you said you were using Borland compiler, right? Which means you are on Windows.
Did the OS got any updates? Did you install anything that might interfere with the normal processing
of that file? Can you open a player (WIndows Media Player, Real Player or any other) and play
this file successfully?
 
You can find the sample in the samples/directory...

pbou...@labocom.com

unread,
Feb 11, 2014, 7:17:10 AM2/11/14
to wx-u...@googlegroups.com
Igor,
I just download wxWidgets 3.0.0 : wxMSW-3.0.0-Setup.exe
After installing it, i tried to compile it in the directory /build/msw
make -f makefile.bcc
and some errors occurs :

        bcc32 -q -c -P- -obcc_mswud\wxtiff_tif_dirread.obj -tWR -IC:\PROGRA~2\Bo
rland\CBUILD~1\Bin\..\include -v   -Od -tWM -DNDEBUG -I..\..\src\zlib   -I..\..\
src\jpeg -I..\..\src\tiff\libtiff -w-8004 -w-8012 -w-8057 -w-8060   -w-8066 -a8
-g0  ..\..\src\tiff\libtiff\tif_dirread.c
..\..\src\tiff\libtiff\tif_dirread.c:
Erreur E2377 ..\..\src\tiff\libtiff\tif_dirread.c 3205: ) manquante dans l'instr
uction If dans la fonction TIFFReadDirEntryCheckRangeLongLong8
Erreur E2054 ..\..\src\tiff\libtiff\tif_dirread.c 3207: else mal placÚ dans la f
onction TIFFReadDirEntryCheckRangeLongLong8
Erreur E2293 ..\..\src\tiff\libtiff\tif_dirread.c 3214: ) attendue dans la fonct
ion TIFFReadDirEntryCheckRangeLongSlong8
Erreur E2054 ..\..\src\tiff\libtiff\tif_dirread.c 3216: else mal placÚ dans la f
onction TIFFReadDirEntryCheckRangeLongSlong8
Erreur E2377 ..\..\src\tiff\libtiff\tif_dirread.c 3297: ) manquante dans l'instr
uction If dans la fonction TIFFReadDirEntryCheckRangeSlong8Long8
Erreur E2054 ..\..\src\tiff\libtiff\tif_dirread.c 3299: else mal placÚ dans la f
onction TIFFReadDirEntryCheckRangeSlong8Long8
*** 6 erreurs dans la compilation ***
** error 1 ** deleting bcc_mswud\wxtiff_tif_dirread.obj
C:\wxWidgets-3.0.0\build\msw>

My OS is Windows 7 (update inactive)

My compiler is Borland C++ Builder 5 (make 5.2) :

C:\wxWidgets-3.0.0\build\msw>make
MAKE Version 5.2  Copyright (c) 1987, 2000 Borland

C:\Users\pb>bcc32
Borland C++ 5.5 pour Win32 Copyright (c) 1993, 2000 Borland
Syntaxe : BCC32 [options] fichier[s]  * = défaut; -x- = commutateur x désactivé
  -3      Instructions 80386              -4      Instructions 80486
  -5      Instructions Pentium            -6      Instructions Pentium Pro
  -Ax     Désactiver extensions           -B      Compiler via l'assembleur
  -C      Autoriser comment. imbriqués    -Dxxx   Définir la macro
  -Exxx   Nom assembleur secondaire       -Hxxx   Utiliser en-têtes précompilés
  -Ixxx   Répertoire fichiers Include     -K      char unsigned par défaut
  -Lxxx   Répertoire bibliothèques        -M      Créer fichier map de liaison
  -N      Vérifier débordement de pile    -Ox     Optimisations
  -P      Forcer compilation C++          -R      Produire infos navigateur
  -RT   * Générer RTTI                    -S      Produire sortie assembleur
  -Txxx   Définir option assembleur       -Uxxx   Supprimer définition de macro
  -Vx     Contrôle de table virtuelle     -X      Supprimer la sortie autodep.
  -aN     Aligner sur N octets            -b    * Traiter enums comme integers
  -c      Compiler seulement              -d      Fusionner chaînes dupliquées
  -exxx   Nom fichier exécutable          -fxx    Options en virgule flottante
  -gN     Arrêter après N avertissements  -iN     Longueur max. identificateur
  -jN      Arrêter après N erreurs        -k    * Cadre de pile standard
  -lx     Définir option du lieur         -nxxx   Répertoire fichier de sortie
  -oxxx   Nom fichier objet               -p      Appels Pascal
  -tWxxx  Créer une application Windows   -u    * Souligner les externs
  -v      Débogage source                 -wxxx   Contrôle avertissements
  -xxxx   Gestion des exceptions          -y      Information numéros de ligne
  -zxxx   Définir noms de segment

Regards
Pierre


Vadim Zeitlin

unread,
Feb 11, 2014, 11:51:46 AM2/11/14
to wx-u...@googlegroups.com
On Tue, 11 Feb 2014 04:17:10 -0800 (PST) wrote:

> and some errors occurs :
>
> bcc32 -q -c -P- -obcc_mswud\wxtiff_tif_dirread.obj -tWR
> -IC:\PROGRA~2\Bo
> rland\CBUILD~1\Bin\..\include -v -Od -tWM -DNDEBUG -I..\..\src\zlib
> -I..\..\
> src\jpeg -I..\..\src\tiff\libtiff -w-8004 -w-8012 -w-8057 -w-8060 -w-8066
> -a8
> -g0 ..\..\src\tiff\libtiff\tif_dirread.c
> ..\..\src\tiff\libtiff\tif_dirread.c:
> Erreur E2377 ..\..\src\tiff\libtiff\tif_dirread.c 3205: ) manquante
...
> My compiler is Borland C++ Builder 5 (make 5.2) :

I'm afraid nobody bothered to check compilation of wxWidgets 3.0
pre-releases with this compiler and so it doesn't work (here the problem
seems to be that it doesn't support "LL" suffix on TIFF_UINT32_MAX constant
defined just above, but this is probably not the last problem you're going
to have).

If you can fix compilation with it, it would be nice and would help other
users of this compiler.

Igor Korot

unread,
Feb 11, 2014, 2:08:08 PM2/11/14
to wx-u...@googlegroups.com
Pierre,

Unfortunately not everybody here speaks French. ;-)
Now this error is better be forwarded to wx-dev.
 
Or better yet, report this error to the libtiff developers....
 
Coming back to you problem: can you compile the library with libtiff turned off?
 
Unfortunately, I don't have Borland compiler, so please check with the wxWidgets build instructions....
 
Or post on wx-dev for further instructions and about this error.
 
Thank you
 

pbou...@labocom.com

unread,
Feb 12, 2014, 2:08:11 AM2/12/14
to wx-u...@googlegroups.com
Hi Vadim,
I'am Ok with you when you say this compiler is out of date.
We start programing our app (Mivisu) nearly 1995 with borland c++ 5.02 compiler et we continue to use it because it's working very well in mode console.
For IHM, we start with Borland C++ Builder 3 ... to 5 ... in VCL ... then wxWidgets 2.6
Include headers of our libraries is completely Borland structure.
One day, i try to compile with VisualC++ ... I abandoned, the structures are different, too much work...
I go and look of the highly-rated of Mingw ...
Reply all
Reply to author
Forward
0 new messages