I'm developing music player for Symbians and need to play raw audio data (PCM) from phone memory.
I tried QAudioOutput, which works fine (through Qbuffer - iherits QIODevice), but it is too much low-level API and therefore not suitable for me. So I found Phonon and QMediaPlayer.
I can't get Phonon to work neither on my phone nor on Windows. However, on Windows i can play files but not QBuffers... strange.
However, now I want to use QMediaPlayer but havent found a way to play raw data from memory. There is only QUrl constructor of QMediaContent.
Is there any option how to play on QMediaPlayer from QBuffer, QDataStream, QByteArray... anything from memory?
Any suggestions would be great, thanks :).
On desktop I'm using plain GStreamer (without phonon layer) to play from memory. Phonon backends doesn't handle well media from memory (QIODevice). From Qt docs:
Warning: On Windows, we only support QIODevices containing the avi, mp3, or mpg formats. Use the constructor that takes a file name to open files (the Qt backend does not use a QFile internally).
Related
Currently i'm using opencv (have an option to use QT as well) to play a video file (player) in full screen mode. My requirement is when i'm playing videofile-1 there could a request to play video file-2 and i need to switch to video file-2 seamlessly. Is it possible to do this in opencv or QT ? I know we can do this using RTSP or HTTP streaming.
OpenCV uses cv2.VideoCapture() to read from videofile and cv2.imshow() to project image/video to display. What are you doing between those you it is your choice, so answering your question I guess it's possible.
I am busy with writing a program that is able to view an IP camera and also have a playback option available.
To realize this i have been looking to record the feed that i now have running in my program using the Qmediaplayer.
From what i understand it is not possible to use Qmediarecorder to record this feed. All the examples that use Qmediarecorder use the Qcamera class.
Is there a way to record a stream from an IP camera (mjpeg, h.264 ) with the Qmediarecorder or any other QT tool ?
If not ? what is a good library to use for this kind of application?
libvlc may be the library you can looking for, there is also a c++ - qt wrapper that simplifies the usage of library in c++ and qt : vlc-qt library :https://vlc-qt.tano.si/ . record and playback availability of library of vlc player is present in this wrapper
I am really new to Qt development as well as audio codecs. I recently found a way to play mp3 sound using QSound. I want to play it in my qt project using QAudioOutput, but there is no mp3 codec in QAudioDeviceInfo::supportedCodecs().
I tried install mp3 codec but it is still not listed in QAudioDeviceInfo::supportedCodecs(). How can I add a codec to QAudioDeviceInfo::supportedCodecs()?
By definition QAudioDeviceInfo provides an interface to query audio devices and their functionality. Which means any codec returned by QAudioDeviceInfo::supportedCodecs() is a codec format the device is able to play directly, and will be probably be raw audio format like pcm. On the other hand mp3 need to go through a software decoder first, so It will not be in this list.
Take a look at the Media Player example for a reference. It should be able to play mp3 and other formats. The project should be available in the Qt source or installation directory in your machine, either under the folder demo or examples.
It seems from the source that it does lot more than just barely playing audio. So focus on the constructor of the class Player as well as the method Player::addToPlaylist()
ps :I speak in conditional tense because I am more familiar with Qt 4 than Qt 5.
EDIT:
As long as windows media player cannot play mp3, you will not have full mp3 support in your Qt app, and the Player example I gave you will not work either. Download some codecs in your system till Windows media player can play mp3.
I compiled taglib 1.8 using Mingw succesfully, then i integrated it into a Qt project.
The purpuse is to remove ID3 Tag from mp3 files.
This code :
void MainWindow::removeTagFromFile(QByteArray &fileContent)
{
TagLib::ByteVector byteVector(fileContent.constData());
TagLib::ID3v2::FrameFactory *frame = TagLib::ID3v2::FrameFactory::instance();
TagLib::IOStream *vectorStream = new TagLib::ByteVectorStream(byteVector);
TagLib::MPEG::File file(vectorStream, frame);
file.strip();
file.save();
}
Compile and works fine on XP.
Compile and doesn't work as expected on Windows 7.
Taking the ".exe compiled on XP" to seven do not solve the problem.
is it weird ? i'm afraid that this is a bug in Taglib, does it make sense ?
Any idea or an explanation is welcome,
Thanks in advance.
You can download the project here
I'm writing a tutorial in french about details of compilation and integration into a Qt project, i'll write one in english if there is interested people.
Well, finally it's not question of XP or Seven, it's about codecs installed on your computer.
There is a simple solution, you don't need to remove ID3 Tag from mp3 files to get them readable by Phonon, you need just to install K-Lite Codecs.
Explanation :
Phonon backend use DirectShow on Windows to read mp3 files.
The K-Lite Codec Pack is a collection of DirectShow filters, VFW/ACM codecs, and tools. Codecs and DirectShow filters are needed for encoding and decoding audio and video formats.
installing K-Lite solve the problem of Phonon with some mp3 files.
I hope this will save someone out there who suffer from phonon with mp3 files on windows.
I need to play sounds under Qt with control of volume and panning. QSound doesn't do it, phonon may be too much for only this so I thought I'd try the native api.
eeermm, in Mac I have no idea, is there some simple interface to invoke on c++? (I've seen all this NSSound stuff but I am not familar with Objective C and I am not sure if it's possible to mix code (under QtCreator)) my idea would be to a module with simple native api calls to system features not found on Qt.
Thanks!
Qt AudioEngine in Qt5 will do this.
If you're using Qt4, making a single 'Objective-C++' file (extension .mm) which can be called from Qt, but makes NSFoo calls, is easy and works well. The header file should be plain C++, and everything will work together.