I want to play ogg file on mac using Qt 5.6. Below is the application code I wrote to test.

Qt Code:
  1. #include "mainwindow.h"
  2.  
  3. Widget::Widget(QWidget *parent)
  4. : QWidget(parent)
  5. {
  6. m_player = new QMediaPlayer(this);
  7. connect(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(onMediaStatusChanged()));
  8. connect(m_player, SIGNAL(positionChanged(qint64)), this, SLOT(onProgressed(qint64)));
  9. m_player->setMedia(QMediaContent(QUrl::fromLocalFile("/Users/koragg/Downloads/IntheMoon.ogg")));
  10. m_player->play();
  11. }
  12.  
  13. Widget::~Widget()
  14. {
  15.  
  16. }
  17.  
  18. void Widget::onProgressed(qint64 pos)
  19. {
  20. qDebug()<<"Position is:"<<pos;
  21. }
  22.  
  23. void Widget::onMediaStatusChanged()
  24. {
  25. qDebug()<<"Media Status Changed:" << m_player->mediaStatus() << " " << m_player->error();
  26. }
To copy to clipboard, switch view to plain text mode 


Here is the output I am getting.

Position is: 0
Media Status Changed: QMediaPlayer::LoadingMedia QMediaPlayer::NoError
Media Status Changed: QMediaPlayer::InvalidMedia QMediaPlayer::FormatError


Same code is working fine on windows (except the file path of course) for all formats(wav, aiff).
Other formats are being played on mac also. Problem is only with the ogg format. Can somebody help me with that?