PDA

View Full Version : To make audio and video file player in Qt



merry
23rd January 2008, 05:47
Hi all

Working on Qt4.2 on my Intel MAC machine.

Working on a project in which I have to preview Audio and Video files.

I am having a list of audio and video files in a tree, when I click on an audio file the song should play and when I click on any viddeo file , video should display.

I dont have any Idea about this from where should I start making a audio and video player.

Thanx
merry

mchara
23rd January 2008, 06:47
Hi,
See QMovie - i've never used it but it may be good start. Probably you'll have to provide an imageReader plugin to support some formats encoding(see QMovie::supportedFormats() but i think there's no typical Video formats bu default rather animatable images such as gif).

There's also QSound class that should fit your requierments - it supports only WAVE except on MAC (manual says: NSSound is used. All formats that NSSound supports, including QuickTime formats, are supported by Qt/Mac.).

jpn
23rd January 2008, 07:23
In Qt 4.4 you will have a new multimedia framework called Phonon (http://phonon.kde.org/).

More info:

Trolltech and KDE Cooperate on Cross-Platform Multimedia Programming Framework (http://trolltech.com/company/newsroom/announcements/press.2007-12-11.2263733764/)
Qt 4.4 Sneak Preview (http://trolltech.com/products/qt/whatsnew/qt44-preview)

ashukla
23rd January 2008, 07:36
Take a look of this link;
http://www.qtcentre.org/forum/f-qt-programming-2/t-to-play-movie-in-qt-4-11411-post60619.html
Also, You can play this using with MPlayer or Media Player and use of QProcess.

merry
23rd January 2008, 08:56
Thanx 4 all the replies


In Qt 4.4 you will have a new multimedia framework called Phonon.

I am working on Qt4.2

but QMovie class supports only image formats not video formats, I want to play Video files like .AVI , .WMV etc

ashukla
23rd January 2008, 09:11
Thanx 4 all the replies



I am working on Qt4.2

but QMovie class supports only image formats not video formats, I want to play Video files like .AVI , .WMV etc
Dear Merry!
By the use of QProcess & MPlayer you can play audio/video (with control) of WAV and WMV file easily. I have played all the movie formats using above. See the suggestion in a concious manner before replying.

merry
23rd January 2008, 09:24
Thanks 4 the reply Anurag

I havent use these functions before, can I use this directly


QProcess *mp=new QProcess(0);

connect(mp, SIGNAL(finished(int)),this,SLOT(endPlayProcess())) ;

QString program = "mplayer";
QStringList arguments;
QString windowId=QString::number(winId());
QString ratio="";
ratio+="-monitoraspect "+QString::number(4)+":"+QString::number(3)+" ";
arguments<<"-vo"<<"gl2" <<"-wid" << windowId << "-slave" <<mediaPath[currentIndex] << "n";
mp->start(program,arguments);

regards
merry

ashukla
23rd January 2008, 09:45
I havent use these functions before, can I use this directly

first you must install the MPlayer or Media Player (if it's not exist in your system). After that you can use it. In MPlayer there is many control switches which can help you for controlling the audio & video. For thanking you can use thanks push button; a fast mechanism of Qt

merry
23rd January 2008, 10:08
Thanks 4 reply

"Media Player" is not in my system, But i had to make a software in which when a user clicks on the file(Audio/Video) in a QTreeWidget , then that item should be played.

If i use media player for this , then the file always play in this player , but if media player is not installed in users system, then the file will not play. Isnt it.

So i want to make my own Audio/Video player.

Regards
merry

ashukla
23rd January 2008, 10:30
If i use media player for this , then the file always play in this player , but if media player is not installed in users system, then the file will not play. Isnt it.
No, By the use of WindowId you can embedd any application in your widget. MPlayer provides its WindowId; but I cannot say more about Windows Media Player.

And the second way is that in QtWindows you can use ActiveQt Framework for embedding any application. Unfortunately, it is not available in X11 platform.

So i want to make my own Audio/Video player.
And It is very tough to make your own player because you must access different movies formats & play it. It is a work of 3 to 5 months of devoted multimedia programmer for only one format. I am working for SWF file format and facing the many problems.

merry
24th January 2008, 06:13
Hi


No, By the use of WindowId you can embedd any application in your widget. MPlayer provides its WindowId; but I cannot say more about Windows Media Player.

By the use of WindowId , i had embedded "QuickTime Player", its working , but number of times i play files , the number of times ,"Different QuickTime Player" opens ,

for every file there is a application

I want , when i stop the process, the application should also "Quit"., but dont hnow how to do that.

regards
merry

ashukla
24th January 2008, 06:31
Hi



By the use of WindowId , i had embedded "QuickTime Player", its working , but number of times i play files , the number of times ,"Different QuickTime Player" opens ,

for every file there is a application

I want , when i stop the process, the application should also "Quit"., but dont hnow how to do that.

regards
merry
You should use a signal slot mechanism for stoping the process and replaying for it. It is a tricky game for playing movie. Make some effort for that.