Phonon problem in Windows 7 with code compiled in XP - c++

I have some code compiled using Visual Studio 2010 (C++), with Qt for the GUI and Phonon to show some videos.
I compile and run the code in a Windows XP machine and everything works fine. The videos and controls are shown correctly, and the same in other Windows XP machines. But at the moment that I try to use a Windows 7 machine, the video is not shown. Phonon controls are loaded, I can adjust the size of the Phonon VideoWidget but nothing is shown. I am using the SetFile method to indicate the file location and I have also tried (of course, with no luck) with setCurrentSource in the MediaObject (it works, though, in Windows XP).
I have tried different locations of files (absolute/relative) but nothing seems to work. Also, in XP when a video is not found an alert message is shown while in Windows 7 there is no error message, but also no video is shown. If I try to open the videos with other players, they work fine (I tried also with videos with different formats).
Any idea on what can be wrong? Is there something that I am missing with Phonon and Windows 7? Thanks!

When deploying your application to a different computer, make sure you don't forget to copy the Phonon backend. Not just the DLL contained in it (the ds backend for me), but also the directory itself.
That is
-Application Directory
¦-myexe.exe
¦-phonon_backend
¦-phonon_ds94.dll
Furthermore the Phonon backend on Windows (and Mac I think) makes use of the QtOpenGL module. So don't forget to copy this either. It can go inside the application directory.
In any case you could help yourself out a bit by adding a small bit of code that shows (perhaps writes to a file) which mimetypes are available. If it doesn't spit out anything, there is a problem with your backend. (Well, that of your application...)
This is what I had to do when I used Phonon to play video inside my application. Since I only quickly added this some time ago to my application, I'm not 100% sure that this is the only (or even the proper) way to do this, so anyone who has different insights feel free to comment on this.

Related

No QAudioDeviceInfo::availableDevices on Windows

I'm using Visual Studio 2015 Community to make a Qt-based GUI in C++ which includes a microphone input. I'm testing the microphone part, and am looping through QAudioDeviceInfo::AvailableDevices(QAudio::Mode::AudioInput) (and AudioOutput for that matter) and nothing is coming up. I've checked that my project includes QtMultimedia, and I definitely have audio devices on this computer. I'm stuck with an existing compiled Qt (since this application is plugging into another project), but I've verified that the Qt install has the QtMultimedia and the Windows audio plugins. The Qt version is 5.9.3.
The only thing I can think of is that the project isn't including the right plugin, but I don't know how to change that.
The issue was that I needed to run "windeployqt" on the built executable to get all of the plugins into the right place. I'm curious why it didn't work without that, but that's a VS + Qt plugin problem, not a Qt problem.

OpenCV ffmpeg DLL not loaded when running app on Windows 7, works on 8 and 10

I need to maintain a desktop app written in C++, using Qt and OpenCV for some video processing. As far as I understood, the decoding part of OpenCV is delegated to ffmpeg in a separate DLL for licensing reasons.
The development environment is on Windows 10, using QT Creator and MSVC12 64-bit as compiler. OpenCV version is 3.0, the official distribution. Here, everything runs fine, I am able to decode a video using VideoCapture::open().
Issues arise when I try to run the application in a standalone fashion with all the required DLLs in the same folder as the .exe file. All cases below are 64-bit OSes.
On a Windows 10 computer, not the same as the developement machine and no developer libraries present, the video decoding works fine. I have tested on a Windows 8 machine as well, no issues so far.
On Windows 7, the things get tricky. The same video files that successfully load during the previous tests are not recognized by the app at all i.e. the isOpened call on VideoCapture returns false. For further testing, I stripped the opencv_ffmpeg300_64.dll file to narrow down the issue on Windows 10 and 8; as expected, without this DLL the app is no more able to open the same video files.
It seems that the DLL is simply not recognized on Windows 7.
Edit: Further investigation using Process Explorer clearly shows that the aforementioned DLL is not loaded when the app runs on Windows 7.
Is there something specific about how Windows 7 manages the DLL path resolution and eventual security measures? Seems normal that the first search location is the same folder as the executable, which is the case here.
I have tried to trace using WinApiOverride32, with no results.
More specifically, the error data opencv_ffmpeg.dll can be caused by the following reasons:
Erroneous or corrupted registry entries for opencv_ffmpeg.dll
The virus or malware that damaged the opencv_ffmpeg.dll file.
Hardware failure, for example, a low-quality hard disk that caused
corrupted file opencv_ffmpeg.dll.
Another program changed the required version of opencv_ffmpeg.dll.
Another program maliciously or by mistake deleted the file
opencv_ffmpeg.dll.
Another program deleted opencv_ffmpeg.dll.
Building and Installing OpenCV with Extra Modules on Windows 7 64-bit
Auto-answer...
By upgrading to OpenCV 3.1 on that project some months ago, the issue was fixed. Can be some remainder of a bug in previous versions of the library

Deploying Qt Qml App to Windows shows me a blank window

After suffer with a lot of problems trying to deploy a Qt/Qml app to Windows 8, as I described in this question: Deploying Qt Qml app to Windows 8 shows me a blank window
I could make it work copying the Qt5Widgets.dll... but it was only working in my own development machine (installing it there, but yet my own machine).
Then I tried to install it in another machine (a VM running Windows 7).. and at first I got error of missing platform plugin... ok, I copied qwindows.dll to appDir/platforms, and it seems to resolved this problem.
But then I got another missing dlls errors (the ones related to VS2010), then I installed the Visual Studio 2010 redistributable package... ok, now the app starts, but with a blank window :(
The qml files and everything are in a resources file, so it should be in the binary.
And I've no idea where to go from there to find this issue.
Any idea what can I do? The weird thing is that it was installed fine in my own development machine.
And my conclusion is that deployment of Qt in OS X is much easier.
I've solved the problem with these steps:
check your qml files path. For example default generated code is the following:
QtQuick2ApplicationViewer viewer;
viewer.setMainQmlFile(QStringLiteral("qml/test/main.qml"));
So qmls should be in "qml/test" folder
check the missing dlls:
download VmMap tool from Windows Sysinternals suite (http://technet.microsoft.com/en-us/sysinternals/dd535533)
compile and run your app in qt creator to get it working like it should
run VmMap and open your running app's process.
sort the lower window by 'Details' - so you'll see all loaded DLLs sorted by path.
copy the missing dlls. It should work now!
I've had also a lot of trouble deploying Qml apps with a blank window too.
In general this site gives useful hints:
https://qt-project.org/doc/qt-5.1/qtdoc/deployment-windows.html
The blank window issue was caused be two different things in my case:
The relative path to the qml files were not correct. I've solved this by storing the qml files in a resource file and then calling them from there.
It seems to be a problem if the application is located on a network drive. I haven't found a solution for that except copying the application to a local folder.
In general I think deploying is a big big pain :-/

Qt Deployment - QGraphicsView not displaying on other machines

So I've been making a program for my company using Qt 4.8.4 (required). When deploying the project to a different machine, the program runs fine (I included Qtgui4.dll and Qtcore4.dll). However, when trying to view a print preview image using QGraphicsView, no other machine will show it. I even tried installing Qt 4.8.4 on the other machine and building it there to no avail. I use MSVC to compile and have installed Visual Studio on the new machine as well. I also include the imageformats folder when deploying the .exe to other machines.
I am at a loss here. I've researched this for days. I don't understand why it runs perfectly fine on my machine but will not run on others even when I replicate the development environment.
I have attached a picture of it actually working.
On all other machines, the preview image shows blank/white. However, I noticed that the image is built and that it will print. It just will not preview.
I know I haven't included any code but I won't be able to include much as it's for my company. But I have included what I could related to the QGraphicsView.
// Create a handle for the graphics view; fix bug where preview would disappear
// on first view; winId() creates the winId; Needed to initialize first
ui->graphicsView->winId();
/************************************/
if (preview)
preview(ui->graphicsView->winId(), &err);
No solution was found on my end. I finished the application with the stipulation that the OS could not be XP.

Crash on Windows 7 but running on XP

i've written a small application using c++, Qt and Visual Studio 2010. It's working on Windows XP (32bit) but it crashes on Windows 7 (64 bit) right after start-up. I see a "The program has stopped working..." error. Do I have to recompile the application for Windows 7? And is it possible to get more information why it crashes?
Thanks
In general you wouldn't have to recompile for windows 7, but it depends on your application which you haven't provided details of.
The easiest way to find out is either debug it in windows 7 or put more error handling in, so that it lets you know what has gone wrong, or where it has gone wrong
I agree with what martiert said, also, if you are using some external elements, images. sound files, video files, etc ... be sure of the file location asd this was a problem for me when I was presenting my graduation project, I moved the whole solution from a directory to another and it crashed because it was reading a not found directory ... so be sure of the links of the images, videos, sounds etc ...
You might have to recompile for Windows 7/64bit. It might not even work after a recompile, since Windows 7 is not XP, and a program written for 32 bit might not work for 64. Often one don't have to recompile, but sometimes one have to, and some times a program which works on XP won't work on Windows 7.