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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
/*
generic output class
Copyright (C) 1999 Martin Vogt
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation.
For more information look at the file COPYRIGHT in this package
*/
#ifndef __OUTPUTSTREAM_H
#define __OUTPUTSTREAM_H
#include "../util/timeStamp.h"
#include "pluginInfo.h"
#include "../util/render/pictureArray.h"
#include "../util/abstract/abs_thread.h"
#include <kdemacros.h>
#define _OUTPUT_WAIT_METHOD_BLOCK 1
#define _OUTPUT_WAIT_METHOD_POLL 2
#define _OUTPUT_WAIT_METHOD_CALLBACK 3
#define _STREAM_MASK_IS_INIT 1
#define _STREAM_MASK_IS_EOF 2
#define _STREAM_MASK_IS_DATA 4
#define _STREAM_MASK_ALL 1+2+4
#define _STREAMTYPE_AUDIO 1
#define _STREAMTYPE_VIDEO 2
/**
Outputstream. A nice base class. Mostly obvious methods,
except PictureArray.
write your picture into this structure
and then put it on the surface with the unlock call.
*/
/**
life of stream states:
--------------
method flag additional calls
construct audioInit()
destruct audioInit()
audioInit isInit=false
isEof=false
isData=false
audioSetup isInit=true
audioFlush isEof=true
audioPlay isData=true
Note: after a call of streamInit we have an "invalid" state
obviously there is no stream where eof==false but
and has not been initialised.
another invalid state is audioInit->audioPlay
*/
class KDE_EXPORT OutputStream {
int audioState;
int videoState;
abs_thread_mutex_t stateChangeMut;
abs_thread_cond_t stateChangeCond;
public:
OutputStream();
virtual ~OutputStream();
// Audio Stream handling
virtual int audioInit();
virtual int audioSetup(int freq,int stereo,int sign,int big,int sampleSize);
virtual int audioPlay(TimeStamp* startStamp,
TimeStamp* endStamp,char *buffer, int size);
virtual void audioFlush();
// Audio device "/dev/dsp" handling
virtual void audioClose();
virtual void audioOpen();
// hack: FIX it
virtual int getPreferredDeliverSize();
// stream State handling
// we return the tqmask which triggerd (by "AND")
// or the current polled tqmask when method is POLL
// Note: you can only wait for "true" signals
virtual int waitStreamState(int method,int tqmask,int streamType);
// Video Output
virtual int videoInit();
virtual int openWindow(int width, int height,const char *title);
virtual int x11WindowId();
virtual void closeWindow();
virtual void flushWindow();
// get the current surfaces to draw into
virtual PictureArray* lockPictureArray();
virtual void unlockPictureArray(PictureArray* pictureArray);
// maybe not needed:
virtual int getFrameusec();
virtual int getOutputInit();
virtual void setOutputInit(int lInit);
// Info Output
virtual void writeInfo(class PluginInfo* pluginInfo);
// config Output
virtual void config(const char* key,
const char* value,void* user_data);
private:
void initStream();
protected:
// sometimes useful, but use with care
void sendSignal(int signal,int value,int streamType);
};
#endif
|