1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/***************************************************************************
streaming-job.h - description
-------------------
begin : Sun Sept 3 2006
copyright : (C) 2006 by Martin Witte
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _KRADIO_STREAMING_JOB_H
#define _KRADIO_STREAMING_JOB_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "../../src/include/ringbuffer.h"
#include "../../src/include/soundformat.h"
#include "../../src/include/soundstreamclient_interfaces.h"
#include <tqobject.h>
#include <tdeio/jobclasses.h>
class StreamingJob : public TQObject
{
TQ_OBJECT
public:
StreamingJob();
StreamingJob(const TQString &_URL, const SoundFormat &_SoundFormat, size_t _bufferSize);
StreamingJob(const StreamingJob &c);
virtual ~StreamingJob();
const TQString &getURL() const { return m_URL; }
const SoundFormat &getSoundFormat() const { return m_SoundFormat; }
int getBufferSize() const { return m_BufferSize; }
void setURL(const TQString &);
void setSoundFormat(const SoundFormat &);
void setBufferSize(size_t buffer_size);
bool startPlayback();
bool stopPlayback();
bool startCapture(const SoundFormat &proposed_format,
SoundFormat &real_format,
bool force_format);
bool stopCapture();
void playData(const char *data, size_t size, size_t &consumed_size);
bool hasRecordedData() const;
void lockData(const char *&data, size_t &size, SoundMetaData &meta_data);
void removeData(size_t);
protected slots:
void slotReadData (TDEIO::Job *job, const TQByteArray &data);
void slotWriteData (TDEIO::Job *job, TQByteArray &data);
void slotIOJobResult (TDEIO::Job *job);
signals:
void logStreamError(const KURL &url, const TQString &s);
void logStreamWarning(const KURL &url, const TQString &s);
protected:
bool startGetJob();
bool startPutJob();
TQString m_URL;
SoundFormat m_SoundFormat;
size_t m_BufferSize;
RingBuffer m_Buffer;
unsigned m_OpenCounter;
TQ_UINT64 m_StreamPos;
time_t m_StartTime;
size_t m_SkipCount;
TDEIO::TransferJob *m_TDEIO_Job;
bool m_capturing;
};
#endif
|