qtmobility/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayerservice.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
child 15 1f895d8a5b2b
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
    59 #include <qmediaplaylist.h>
    59 #include <qmediaplaylist.h>
    60 
    60 
    61 S60MediaPlayerService::S60MediaPlayerService(QObject *parent)
    61 S60MediaPlayerService::S60MediaPlayerService(QObject *parent)
    62     : QMediaService(parent)
    62     : QMediaService(parent)
    63     , m_control(NULL)
    63     , m_control(NULL)
    64     , m_mediaRecognizer(NULL)
    64 //  FIXME  , m_videoOutput(NULL)
    65     , m_videoOutput(NULL)
       
    66     , m_videoPlayerSession(NULL)
    65     , m_videoPlayerSession(NULL)
    67     , m_audioPlayerSession(NULL)
    66     , m_audioPlayerSession(NULL)
    68     , m_metaData(NULL)
    67     , m_metaData(NULL)
    69     , m_videoWidget(NULL) 
    68     , m_videoWidget(NULL) 
    70     , m_videoWindow(NULL)
    69     , m_videoWindow(NULL)
    71     , m_videoRenderer(NULL)
    70     , m_videoRenderer(NULL)
    72     , m_audioEndpointSelector(NULL)
    71     , m_audioEndpointSelector(NULL)
    73 { 
    72 { 
    74     m_control = new S60MediaPlayerControl(*this, this);
    73     m_control = new S60MediaPlayerControl(*this, this);
    75     m_mediaRecognizer = new S60MediaRecognizer(this);  
       
    76     m_metaData = new S60MediaMetaDataProvider(*this);
    74     m_metaData = new S60MediaMetaDataProvider(*this);
    77     m_audioEndpointSelector = new S60MediaPlayerAudioEndpointSelector(m_control, this);
    75     m_audioEndpointSelector = new S60MediaPlayerAudioEndpointSelector(m_control, this);
    78 }
    76 }
    79 
    77 
    80 S60MediaPlayerService::~S60MediaPlayerService()
    78 S60MediaPlayerService::~S60MediaPlayerService()
    81 {
    79 {
    82     delete m_videoWidget;
    80     delete m_videoWidget;
    83     delete m_videoRenderer;
    81     delete m_videoRenderer;
    84     delete m_videoWindow;
    82     delete m_videoWindow;
    85     delete m_videoOutput;
    83 // FIXME    delete m_videoOutput;
    86 }
    84 }
    87 
    85 
    88 QMediaControl *S60MediaPlayerService::control(const char *name) const
    86 QMediaControl *S60MediaPlayerService::requestControl(const char *name)
    89 {
    87 {
    90     if (qstrcmp(name, QMediaPlayerControl_iid) == 0)
    88     if (qstrcmp(name, QMediaPlayerControl_iid) == 0)
    91         return m_control;
    89         return m_control;
    92 
    90 
    93     if (qstrcmp(name, QMetaDataControl_iid) == 0) {
    91     if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) {
    94         return m_metaData;
    92         return m_metaData;
    95     }
    93     }
    96 
    94 
    97     if (qstrcmp(name, QVideoOutputControl_iid) == 0) {
    95 //FIXME    if (qstrcmp(name, QVideoOutputControl_iid) == 0) {
    98         if (!m_videoOutput) {
    96 //        if (!m_videoOutput) {
    99             m_videoOutput = new S60VideoOutputControl;
    97 //            m_videoOutput = new S60VideoOutputControl;
   100             connect(m_videoOutput, SIGNAL(outputChanged(QVideoOutputControl::Output)),
    98 //            connect(m_videoOutput, SIGNAL(outputChanged(QVideoOutputControl::Output)),
   101                     this, SLOT(videoOutputChanged(QVideoOutputControl::Output)));
    99 //                    this, SLOT(videoOutputChanged(QVideoOutputControl::Output)));
   102             m_videoOutput->setAvailableOutputs(QList<QVideoOutputControl::Output>() 
   100 //        }
   103 //                        << QVideoOutputControl::RendererOutput
   101 //        return m_videoOutput;
   104 //                        << QVideoOutputControl::WindowOutput
   102 //    }
   105                         << QVideoOutputControl::WidgetOutput);
       
   106             
       
   107         }
       
   108         return m_videoOutput;
       
   109     }
       
   110 
   103 
   111     if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
   104     if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
   112         if (!m_videoWidget)
   105         if (!m_videoWidget)
   113             m_videoWidget = new S60VideoWidgetControl;
   106             m_videoWidget = new S60VideoWidgetControl;
   114         return m_videoWidget;
   107         return m_videoWidget;
   132 
   125 
   133     return 0;
   126     return 0;
   134 
   127 
   135 }
   128 }
   136 
   129 
       
   130 void S60MediaPlayerService::releaseControl(QMediaControl *control)
       
   131 {
       
   132     Q_UNUSED(control)
       
   133 }
       
   134 
       
   135 /*FIXME
   137 void S60MediaPlayerService::videoOutputChanged(QVideoOutputControl::Output output)
   136 void S60MediaPlayerService::videoOutputChanged(QVideoOutputControl::Output output)
   138 {
   137 {
   139     switch (output) {
   138     switch (output) {
   140     case QVideoOutputControl::NoOutput:
   139     case QVideoOutputControl::NoOutput:
   141         m_control->setVideoOutput(0);
   140         m_control->setVideoOutput(0);
   154     default:
   153     default:
   155         qWarning("Invalid video output selection");
   154         qWarning("Invalid video output selection");
   156         break;
   155         break;
   157     }
   156     }
   158 }
   157 }
   159 
   158 */
   160 S60MediaPlayerSession* S60MediaPlayerService::PlayerSession()
   159 S60MediaPlayerSession* S60MediaPlayerService::PlayerSession()
   161 {
   160 {
   162     QUrl url = m_control->media().canonicalUrl();
   161     QUrl url = m_control->media().canonicalUrl();
   163   
   162   
   164     if (url.isEmpty() == true) {
   163     if (url.isEmpty() == true) {
   165         return NULL;
   164         return NULL;
   166     }
   165     }
   167     
   166 
   168     S60MediaRecognizer::MediaType mediaType = m_mediaRecognizer->IdentifyMediaType(url);
   167     S60MediaRecognizer *m_mediaRecognizer = new S60MediaRecognizer(this);
   169     
   168     S60MediaRecognizer::MediaType mediaType = m_mediaRecognizer->mediaType(url);
       
   169 
   170     switch (mediaType) {
   170     switch (mediaType) {
   171     	case S60MediaRecognizer::Video:
   171     	case S60MediaRecognizer::Video:
   172     	case S60MediaRecognizer::Url:
   172     	case S60MediaRecognizer::Url:
   173             return VideoPlayerSession();
   173             return VideoPlayerSession();
   174     	case S60MediaRecognizer::Audio:
   174     	case S60MediaRecognizer::Audio: