File indexing completed on 2024-04-14 04:49:16

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2006 Alexander Kern <alex.kern@gmx.de>
0003 
0004     based on example for Phonon Architecture, Matthias Kretz <kretz@kde.org>
0005 
0006     This library is free software; you can redistribute it and/or
0007     modify it under the terms of the GNU Library General Public
0008     License version 2 as published by the Free Software Foundation.
0009 
0010     This library is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013     Library General Public License for more details.
0014 
0015     You should have received a copy of the GNU Library General Public License
0016     along with this library; see the file COPYING.LIB.  If not, write to
0017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018     Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef __AUDIO_PHONON_H__
0022 #define __AUDIO_PHONON_H__
0023 
0024 #include <QByteArray>
0025 #include <QTimer>
0026 #include <QWaitCondition>
0027 #include <QMutex>
0028 
0029 #include <Phonon/AbstractMediaStream>
0030 
0031 namespace Phonon { class MediaObject; }
0032 
0033 class LibWMPcmPlayer : public Phonon::AbstractMediaStream {
0034     Q_OBJECT
0035 
0036 public:
0037     LibWMPcmPlayer();
0038     ~LibWMPcmPlayer();
0039 
0040     QByteArray wavHeader() const;
0041     void setNextBuffer(struct cdda_block *blk);
0042 
0043 public Q_SLOTS:
0044     void playBuffer(struct cdda_block *blk);
0045     void pause(void);
0046     void stop(void);
0047     void executeCmd(int cmd);
0048     void stateChanged( Phonon::State newstate, Phonon::State oldstate );
0049 
0050 protected:
0051     void reset();
0052     void needData();
0053 
0054 Q_SIGNALS:
0055     void cmdChanged(int cmd);
0056     void nextBuffer(struct cdda_block *blk);
0057 
0058 private:
0059     Phonon::MediaObject* m_media;
0060     unsigned char m_cmd;
0061     struct cdda_block *m_blk;
0062     QWaitCondition m_readyToPlay;
0063     QMutex m_mutex;
0064 };
0065 
0066 #endif /* __AUDIO_PHONON_H__ */