author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 16 Apr 2010 15:50:13 +0300 | |
changeset 18 | 2f34d5167611 |
parent 3 | 41300fa6a67c |
permissions | -rw-r--r-- |
0 | 1 |
/* This file is part of the KDE project. |
2 |
||
3 |
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
||
5 |
This library is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Lesser General Public License as published by |
|
7 |
the Free Software Foundation, either version 2.1 or 3 of the License. |
|
8 |
||
9 |
This library is distributed in the hope that it will be useful, |
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
GNU Lesser General Public License for more details. |
|
13 |
||
14 |
You should have received a copy of the GNU Lesser General Public License |
|
15 |
along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef PHONON_IODEVICEREADER_H |
|
19 |
#define PHONON_IODEVICEREADER_H |
|
20 |
||
21 |
#include <phonon/mediasource.h> |
|
22 |
#include <phonon/streaminterface.h> |
|
23 |
||
24 |
QT_BEGIN_NAMESPACE |
|
25 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
|
0 | 28 |
namespace Phonon |
29 |
{ |
|
30 |
class MediaSource; |
|
31 |
namespace Gstreamer |
|
32 |
{ |
|
33 |
class StreamReader : public Phonon::StreamInterface |
|
34 |
{ |
|
35 |
public: |
|
36 |
||
37 |
StreamReader(const Phonon::MediaSource &source) |
|
38 |
: m_pos(0) |
|
39 |
, m_size(0) |
|
40 |
, m_seekable(false) |
|
41 |
{ |
|
42 |
connectToSource(source); |
|
43 |
} |
|
44 |
||
45 |
int currentBufferSize() const |
|
46 |
{ |
|
47 |
return m_buffer.size(); |
|
48 |
} |
|
49 |
||
50 |
void writeData(const QByteArray &data) { |
|
51 |
m_pos += data.size(); |
|
52 |
m_buffer += data; |
|
53 |
} |
|
54 |
||
55 |
void setCurrentPos(qint64 pos) |
|
56 |
{ |
|
57 |
m_pos = pos; |
|
58 |
seekStream(pos); |
|
59 |
m_buffer.clear(); |
|
60 |
} |
|
61 |
||
62 |
quint64 currentPos() const |
|
63 |
{ |
|
64 |
return m_pos; |
|
65 |
} |
|
66 |
||
67 |
bool read(quint64 offset, int length, char * buffer); |
|
68 |
||
69 |
void endOfData() {} |
|
70 |
||
71 |
void setStreamSize(qint64 newSize) { |
|
72 |
m_size = newSize; |
|
73 |
} |
|
74 |
||
75 |
qint64 streamSize() const { |
|
76 |
return m_size; |
|
77 |
} |
|
78 |
||
79 |
void setStreamSeekable(bool s) { |
|
80 |
m_seekable = s; |
|
81 |
} |
|
82 |
||
83 |
bool streamSeekable() const { |
|
84 |
return m_seekable; |
|
85 |
} |
|
86 |
||
87 |
private: |
|
88 |
QByteArray m_buffer; |
|
89 |
quint64 m_pos; |
|
90 |
quint64 m_size; |
|
91 |
bool m_seekable; |
|
92 |
}; |
|
93 |
} |
|
94 |
} |
|
95 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
|
0 | 98 |
QT_END_NAMESPACE |
99 |
||
100 |
#endif |