-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 101 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.h | 42 |
2 files changed, 57 insertions, 86 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 78ebe19..b27b8e1 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp | |||
@@ -1,333 +1,304 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "xinevideowidget.h" | 34 | #include "xinevideowidget.h" |
35 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
36 | 36 | ||
37 | #include <qimage.h> | 37 | #include <qimage.h> |
38 | #include <qdirectpainter_qws.h> | 38 | #include <qdirectpainter_qws.h> |
39 | #include <qgfx_qws.h> | 39 | #include <qgfx_qws.h> |
40 | #include <qsize.h> | 40 | #include <qsize.h> |
41 | #include <qapplication.h> | 41 | #include <qapplication.h> |
42 | 42 | ||
43 | #include <qpe/resource.h> | 43 | #include <qpe/resource.h> |
44 | 44 | ||
45 | #include <pthread.h> | 45 | #include <pthread.h> |
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | // 0 deg rot: copy a line from src to dst (use libc memcpy) | 49 | // 0 deg rot: copy a line from src to dst (use libc memcpy) |
50 | 50 | ||
51 | // 180 deg rot: copy a line from src to dst reversed | 51 | // 180 deg rot: copy a line from src to dst reversed |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * This code relies the len be a multiply of 16bit | 54 | * This code relies the len be a multiply of 16bit |
55 | */ | 55 | */ |
56 | static inline void memcpy_rev ( void *_dst, void *_src, size_t len ) | 56 | static inline void memcpy_rev ( void *_dst, void *_src, size_t len ) |
57 | { | 57 | { |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * move the source to the end | 60 | * move the source to the end |
61 | */ | 61 | */ |
62 | char *src_c = static_cast<char*>(_src) + len; | 62 | char *src_c = static_cast<char*>(_src) + len; |
63 | 63 | ||
64 | /* | 64 | /* |
65 | * as we copy by 16bit and not 8bit | 65 | * as we copy by 16bit and not 8bit |
66 | * devide the length by two | 66 | * devide the length by two |
67 | */ | 67 | */ |
68 | len >>= 1; | 68 | len >>= 1; |
69 | 69 | ||
70 | short int* dst = static_cast<short int*>( _dst ); | 70 | short int* dst = static_cast<short int*>( _dst ); |
71 | short int* src = reinterpret_cast<short int*>( src_c ); | 71 | short int* src = reinterpret_cast<short int*>( src_c ); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Increment dst after assigning | 74 | * Increment dst after assigning |
75 | * Decrement src before assigning becase we move backwards | 75 | * Decrement src before assigning becase we move backwards |
76 | */ | 76 | */ |
77 | while ( len-- ) | 77 | while ( len-- ) |
78 | *dst++ = *--src; | 78 | *dst++ = *--src; |
79 | 79 | ||
80 | } | 80 | } |
81 | 81 | ||
82 | // 90 deg rot: copy a column from src to dst | 82 | // 90 deg rot: copy a column from src to dst |
83 | 83 | ||
84 | static inline void memcpy_step ( void *_dst, void *_src, size_t len, size_t step ) | 84 | static inline void memcpy_step ( void *_dst, void *_src, size_t len, size_t step ) |
85 | { | 85 | { |
86 | short int *dst = static_cast<short int*>( _dst ); | 86 | short int *dst = static_cast<short int*>( _dst ); |
87 | short int *src = static_cast<short int*>( _src ); | 87 | short int *src = static_cast<short int*>( _src ); |
88 | 88 | ||
89 | len >>= 1; | 89 | len >>= 1; |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Copy 16bit from src to dst and move to the next address | 92 | * Copy 16bit from src to dst and move to the next address |
93 | */ | 93 | */ |
94 | while ( len-- ) { | 94 | while ( len-- ) { |
95 | *dst++ = *src; | 95 | *dst++ = *src; |
96 | src = reinterpret_cast<short int*>(reinterpret_cast<char*>(src)+step); | 96 | src = reinterpret_cast<short int*>(reinterpret_cast<char*>(src)+step); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | // 270 deg rot: copy a column from src to dst reversed | 100 | // 270 deg rot: copy a column from src to dst reversed |
101 | 101 | ||
102 | static inline void memcpy_step_rev ( void *_dst, void *_src, size_t len, size_t step ) | 102 | static inline void memcpy_step_rev ( void *_dst, void *_src, size_t len, size_t step ) |
103 | { | 103 | { |
104 | len >>= 1; | 104 | len >>= 1; |
105 | 105 | ||
106 | char *src_c = static_cast<char*>( _src ) + (len*step); | 106 | char *src_c = static_cast<char*>( _src ) + (len*step); |
107 | short int* dst = static_cast<short int*>( _dst ); | 107 | short int* dst = static_cast<short int*>( _dst ); |
108 | short int* src = reinterpret_cast<short int*>( src_c ); | 108 | short int* src = reinterpret_cast<short int*>( src_c ); |
109 | 109 | ||
110 | while ( len-- ) { | 110 | while ( len-- ) { |
111 | src_c -= step; | 111 | src_c -= step; |
112 | src = reinterpret_cast<short int*>( src_c ); | 112 | src = reinterpret_cast<short int*>( src_c ); |
113 | *dst++ = *src; | 113 | *dst++ = *src; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) | 118 | XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) |
119 | : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) | 119 | : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) |
120 | { | 120 | { |
121 | setBackgroundMode ( NoBackground ); | 121 | setBackgroundMode ( NoBackground ); |
122 | 122 | ||
123 | m_logo = 0; | 123 | m_logo = 0; |
124 | m_buff = 0; | 124 | m_buff = 0; |
125 | m_bytes_per_line_fb = qt_screen-> linestep ( ); | 125 | m_bytes_per_line_fb = qt_screen-> linestep ( ); |
126 | m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; | 126 | m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; |
127 | m_rotation = 0; | 127 | m_rotation = 0; |
128 | m_lastsize = 0; | 128 | m_lastsize = 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | XineVideoWidget::~XineVideoWidget ( ) | 132 | XineVideoWidget::~XineVideoWidget ( ) |
133 | { | 133 | { |
134 | ThreadUtil::AutoLock a(m_bufmutex); | 134 | ThreadUtil::AutoLock a(m_bufmutex); |
135 | if (m_buff) { | 135 | if (m_buff) { |
136 | delete[]m_buff; | 136 | delete[]m_buff; |
137 | m_lastsize=0; | 137 | m_lastsize=0; |
138 | m_buff = 0; | 138 | m_buff = 0; |
139 | } | 139 | } |
140 | if (m_logo) { | 140 | if (m_logo) { |
141 | delete m_logo; | 141 | delete m_logo; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | void XineVideoWidget::clear ( ) | 145 | void XineVideoWidget::clear ( ) |
146 | { | 146 | { |
147 | ThreadUtil::AutoLock a(m_bufmutex); | 147 | ThreadUtil::AutoLock a(m_bufmutex); |
148 | if (m_buff) { | 148 | if (m_buff) { |
149 | delete[]m_buff; | 149 | delete[]m_buff; |
150 | m_lastsize=0; | 150 | m_lastsize=0; |
151 | m_buff = 0; | 151 | m_buff = 0; |
152 | } | 152 | } |
153 | repaint ( false ); | 153 | repaint ( false ); |
154 | } | 154 | } |
155 | 155 | ||
156 | QSize XineVideoWidget::videoSize() const | 156 | QSize XineVideoWidget::videoSize() const |
157 | { | 157 | { |
158 | QSize s = size(); | 158 | QSize s = size(); |
159 | bool fs = ( s == qApp->desktop()->size() ); | 159 | bool fs = ( s == qApp->desktop()->size() ); |
160 | 160 | ||
161 | // if we are in fullscreen mode, do not rotate the video | 161 | // if we are in fullscreen mode, do not rotate the video |
162 | // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!) | 162 | // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!) |
163 | m_rotation = fs ? - qt_screen->transformOrientation() : 0; | 163 | m_rotation = fs ? - qt_screen->transformOrientation() : 0; |
164 | 164 | ||
165 | if ( fs && qt_screen->isTransformed() ) | 165 | if ( fs && qt_screen->isTransformed() ) |
166 | s = qt_screen->mapToDevice( s ); | 166 | s = qt_screen->mapToDevice( s ); |
167 | 167 | ||
168 | return s; | 168 | return s; |
169 | } | 169 | } |
170 | 170 | ||
171 | void XineVideoWidget::paintEvent ( QPaintEvent * ) | 171 | void XineVideoWidget::paintEvent ( QPaintEvent * ) |
172 | { | 172 | { |
173 | if (m_bufmutex.isLocked()) { | ||
174 | return; | ||
175 | } | ||
176 | ThreadUtil::AutoLock a(m_bufmutex); | ||
177 | QPainter p ( this ); | 173 | QPainter p ( this ); |
178 | p. fillRect ( rect (), black ); | 174 | p. fillRect ( rect (), black ); |
179 | if (m_logo) | 175 | if (m_logo) |
180 | p. drawImage ( 0, 0, *m_logo ); | 176 | p. drawImage ( 0, 0, *m_logo ); |
181 | } | 177 | } |
182 | 178 | ||
183 | void XineVideoWidget::paintEvent2 ( QPaintEvent * ) | 179 | void XineVideoWidget::paintEvent2 ( QPaintEvent * ) |
184 | { | 180 | { |
185 | ThreadUtil::AutoLock a(m_bufmutex); | ||
186 | QPainter p (this); | ||
187 | if ( m_buff == 0 ) { | 181 | if ( m_buff == 0 ) { |
188 | p. fillRect ( rect ( ), black ); | 182 | return; |
189 | if ( m_logo ) | ||
190 | p. drawImage ( 0, 0, *m_logo ); | ||
191 | } else if (m_lastsize){ | 183 | } else if (m_lastsize){ |
192 | // Qt needs to be notified which areas were really updated .. strange | ||
193 | QArray <QRect> qt_bug_workaround_clip_rects; | ||
194 | |||
195 | { | 184 | { |
196 | QDirectPainter dp ( this ); | 185 | QDirectPainter dp ( this ); |
197 | |||
198 | int rot = dp. transformOrientation ( ) + m_rotation; // device rotation + custom rotation | 186 | int rot = dp. transformOrientation ( ) + m_rotation; // device rotation + custom rotation |
199 | |||
200 | bool rot90 = (( -m_rotation ) & 1 ); | 187 | bool rot90 = (( -m_rotation ) & 1 ); |
201 | |||
202 | int _vw,_vh; | 188 | int _vw,_vh; |
203 | switch (rot90) { | 189 | switch (rot90) { |
204 | case true: | 190 | case true: |
205 | _vh = m_framesize.width(); | 191 | _vh = m_framesize.width(); |
206 | _vw = m_framesize.height(); | 192 | _vw = m_framesize.height(); |
207 | break; | 193 | break; |
208 | default: | 194 | default: |
209 | _vw = m_framesize.width(); | 195 | _vw = m_framesize.width(); |
210 | _vh = m_framesize.height(); | 196 | _vh = m_framesize.height(); |
211 | break; | 197 | break; |
212 | break; | 198 | break; |
213 | } | 199 | } |
214 | int middle_w = _vw/2; | 200 | int middle_w = _vw/2; |
215 | int middle_h = _vh/2; | 201 | int middle_h = _vh/2; |
216 | m_thisframe.setRect(width()/2-middle_w,height()/2-middle_h,_vw,_vh); | 202 | m_thisframe.setRect(width()/2-middle_w,height()/2-middle_h,_vw,_vh); |
217 | |||
218 | { | ||
219 | // is this stuff realy needed? it seems working without, too. | ||
220 | QRect topFill,rightFill,leftFill,downFill; | ||
221 | topFill. setRect(0,0 ,width(),m_thisframe.top()); | ||
222 | downFill.setCoords(0,m_thisframe.bottom(),width(),height()); | ||
223 | rightFill.setCoords(m_thisframe.right(),0,width(),height()); | ||
224 | leftFill.setCoords(0,0,m_thisframe.left(),height()); | ||
225 | |||
226 | if (topFill.isValid()) { | ||
227 | p.fillRect(topFill,black); | ||
228 | } | ||
229 | if (downFill.isValid()) { | ||
230 | p.fillRect(downFill,black); | ||
231 | } | ||
232 | if (rightFill.isValid()) { | ||
233 | p.fillRect(rightFill,black); | ||
234 | } | ||
235 | if (leftFill.isValid()) { | ||
236 | p.fillRect(leftFill,black); | ||
237 | } | ||
238 | |||
239 | } | ||
240 | uchar *fb = dp. frameBuffer ( ); | 203 | uchar *fb = dp. frameBuffer ( ); |
241 | uchar *frame = m_buff; | 204 | uchar *frame = m_buff; |
242 | 205 | ||
243 | // where is the video frame in fb coordinates | 206 | // where is the video frame in fb coordinates |
244 | QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), | 207 | QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), |
245 | qt_screen-> height ( ))); | 208 | qt_screen-> height ( ))); |
246 | 209 | ||
247 | uchar * src = frame; | 210 | uchar * src = frame; |
248 | uchar * dst = fb+framerect.y()*m_bytes_per_line_fb+framerect.x()*m_bytes_per_pixel; | 211 | uchar * dst = fb+framerect.y()*m_bytes_per_line_fb+framerect.x()*m_bytes_per_pixel; |
249 | 212 | ||
250 | for (int y=framerect.top();y<=framerect.bottom();++y) { | 213 | if (framerect.height()!=m_framesize.height()) { |
214 | odebug << "Hoehm: " << framerect.height() << " <-> " << m_framesize.height() << oendl; | ||
215 | } | ||
216 | for (int y = 0;y<framerect.height();++y) { | ||
251 | switch (rot) { | 217 | switch (rot) { |
252 | case 0: | 218 | case 0: |
253 | memcpy(dst,src,m_bytes_per_line_frame); | 219 | memcpy(dst,src,m_bytes_per_line_frame); |
254 | src+=m_bytes_per_line_frame; | 220 | src+=m_bytes_per_line_frame; |
255 | break; | 221 | break; |
256 | case 1: | 222 | case 1: |
257 | memcpy_step ( dst, src, m_thisframe.size().width(), m_bytes_per_line_frame ); | 223 | memcpy_step ( dst, src, m_thisframe.size().width(), m_bytes_per_line_frame ); |
258 | src -= m_bytes_per_pixel; | 224 | src -= m_bytes_per_pixel; |
259 | break; | 225 | break; |
260 | case 2: | 226 | case 2: |
261 | memcpy_rev ( dst, src, m_thisframe.size().width()); | 227 | memcpy_rev ( dst, src, m_thisframe.size().width()); |
262 | src-=m_bytes_per_line_frame; | 228 | src-=m_bytes_per_line_frame; |
263 | break; | 229 | break; |
264 | case 3: | 230 | case 3: |
265 | memcpy_step_rev ( dst, src, m_thisframe.size().width(), m_bytes_per_line_frame ); | 231 | memcpy_step_rev ( dst, src, m_thisframe.size().width(), m_bytes_per_line_frame ); |
266 | src += m_bytes_per_pixel; | 232 | src += m_bytes_per_pixel; |
267 | break; | 233 | break; |
268 | default: | 234 | default: |
269 | break; | 235 | break; |
270 | } | 236 | } |
271 | dst += m_bytes_per_line_fb; | 237 | dst += m_bytes_per_line_fb; |
272 | } | 238 | } |
273 | } | 239 | } |
274 | } | 240 | } |
275 | } | 241 | } |
276 | 242 | ||
277 | QImage *XineVideoWidget::logo ( ) const | 243 | QImage *XineVideoWidget::logo ( ) const |
278 | { | 244 | { |
279 | return m_logo; | 245 | return m_logo; |
280 | } | 246 | } |
281 | 247 | ||
282 | 248 | ||
283 | void XineVideoWidget::setLogo ( QImage* logo ) | 249 | void XineVideoWidget::setLogo ( QImage* logo ) |
284 | { | 250 | { |
285 | delete m_logo; | 251 | delete m_logo; |
286 | m_logo = logo; | 252 | m_logo = logo; |
287 | } | 253 | } |
288 | 254 | ||
289 | void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) | 255 | void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) |
290 | { | 256 | { |
291 | // mutex area for AutoLock | 257 | // mutex area for AutoLock |
292 | { | 258 | { |
293 | if (m_bufmutex.isLocked()||w>width()||h>height()) { | 259 | #if 0 |
294 | // no time to wait - drop frame | 260 | ThreadUtil::AutoLock a(m_bufmutex); |
261 | #endif | ||
262 | if (!isVisible()||w>width()||h>height()/*||m_bufmutex.isLocked()*/) { | ||
263 | //drop frame | ||
295 | return; | 264 | return; |
296 | } | 265 | } |
297 | ThreadUtil::AutoLock a(m_bufmutex); | ||
298 | bool rot90 = (( -m_rotation ) & 1 ); | 266 | bool rot90 = (( -m_rotation ) & 1 ); |
299 | int l = h*bpl; | 267 | int l = h*bpl; |
300 | if (l!=m_lastsize) { | 268 | if (l!=m_lastsize) { |
301 | if (m_buff) { | 269 | if (m_buff) { |
302 | delete[]m_buff; | 270 | delete[]m_buff; |
303 | } | 271 | } |
304 | if (l>0) { | 272 | if (l>0) { |
305 | m_buff = new uchar[l]; | 273 | m_buff = new uchar[l]; |
306 | odebug << "Point to: " << (unsigned long)m_buff << oendl; | 274 | odebug << "Point to: " << (unsigned long)m_buff << oendl; |
307 | m_lastsize=l; | 275 | m_lastsize=l; |
308 | } else { | 276 | } else { |
309 | m_buff = 0; | 277 | m_buff = 0; |
310 | } | 278 | } |
311 | } | 279 | } |
312 | m_lastsize = l; | 280 | m_lastsize = l; |
313 | m_framesize = QSize(w,h); | 281 | m_framesize = QSize(w,h); |
314 | if (m_buff && m_lastsize) { | 282 | if (m_buff && m_lastsize) { |
315 | memcpy(m_buff,img,m_lastsize); | 283 | memcpy(m_buff,img,m_lastsize); |
316 | } | 284 | } |
317 | m_bytes_per_line_frame = bpl; | 285 | m_bytes_per_line_frame = bpl; |
286 | if (m_buff) paintEvent2(0); | ||
318 | } // Release Mutex | 287 | } // Release Mutex |
319 | |||
320 | if (m_buff) paintEvent2(0); | ||
321 | } | 288 | } |
322 | 289 | ||
323 | void XineVideoWidget::resizeEvent ( QResizeEvent * ) | 290 | void XineVideoWidget::resizeEvent ( QResizeEvent * ) |
324 | { | 291 | { |
292 | #if 0 | ||
293 | ThreadUtil::AutoLock a(m_bufmutex); | ||
294 | #endif | ||
325 | emit videoResized( videoSize() ); | 295 | emit videoResized( videoSize() ); |
296 | odebug << "All resize done" << oendl; | ||
326 | } | 297 | } |
327 | 298 | ||
328 | 299 | ||
329 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) | 300 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) |
330 | { | 301 | { |
331 | emit clicked(); | 302 | emit clicked(); |
332 | } | 303 | } |
333 | 304 | ||
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.h b/noncore/multimedia/opieplayer2/xinevideowidget.h index eccff1a..a0ec5bc 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.h +++ b/noncore/multimedia/opieplayer2/xinevideowidget.h | |||
@@ -1,81 +1,81 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | This file is part of the Opie Project | 3 | This file is part of the Opie Project |
4 | 4 | ||
5 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 5 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
6 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 6 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
7 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 7 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
8 | =. | 8 | =. |
9 | .=l. | 9 | .=l. |
10 | .>+-= | 10 | .>+-= |
11 | _;:, .> :=|. This program is free software; you can | 11 | _;:, .> :=|. This program is free software; you can |
12 | .> <`_, > . <= redistribute it and/or modify it under | 12 | .> <`_, > . <= redistribute it and/or modify it under |
13 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 13 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
14 | .="- .-=="i, .._ License as published by the Free Software | 14 | .="- .-=="i, .._ License as published by the Free Software |
15 | - . .-<_> .<> Foundation; either version 2 of the License, | 15 | - . .-<_> .<> Foundation; either version 2 of the License, |
16 | ._= =} : or (at your option) any later version. | 16 | ._= =} : or (at your option) any later version. |
17 | .%`+i> _;_. | 17 | .%`+i> _;_. |
18 | .i_,=:_. -<s. This program is distributed in the hope that | 18 | .i_,=:_. -<s. This program is distributed in the hope that |
19 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 19 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
20 | : .. .:, . . . without even the implied warranty of | 20 | : .. .:, . . . without even the implied warranty of |
21 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 21 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
22 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 22 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
23 | ..}^=.= = ; Library General Public License for more | 23 | ..}^=.= = ; Library General Public License for more |
24 | ++= -. .` .: details. | 24 | ++= -. .` .: details. |
25 | : = ...= . :.=- | 25 | : = ...= . :.=- |
26 | -. .:....=;==+<; You should have received a copy of the GNU | 26 | -. .:....=;==+<; You should have received a copy of the GNU |
27 | -_. . . )=. = Library General Public License along with | 27 | -_. . . )=. = Library General Public License along with |
28 | -- :-=` this library; see the file COPYING.LIB. | 28 | -- :-=` this library; see the file COPYING.LIB. |
29 | If not, write to the Free Software Foundation, | 29 | If not, write to the Free Software Foundation, |
30 | Inc., 59 Temple Place - Suite 330, | 30 | Inc., 59 Temple Place - Suite 330, |
31 | Boston, MA 02111-1307, USA. | 31 | Boston, MA 02111-1307, USA. |
32 | 32 | ||
33 | */ | 33 | */ |
34 | 34 | ||
35 | 35 | ||
36 | #include <qwidget.h> | 36 | #include <qwidget.h> |
37 | 37 | ||
38 | #include "lib.h" | 38 | #include "lib.h" |
39 | 39 | ||
40 | class QImage; | 40 | class QImage; |
41 | 41 | ||
42 | 42 | ||
43 | class XineVideoWidget : public QWidget { | 43 | class XineVideoWidget : public QWidget { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | 45 | ||
46 | public: | 46 | public: |
47 | XineVideoWidget ( QWidget* parent, const char* name ); | 47 | XineVideoWidget ( QWidget* parent, const char* name ); |
48 | ~XineVideoWidget ( ); | 48 | ~XineVideoWidget ( ); |
49 | QImage *logo ( ) const; | 49 | QImage *logo ( ) const; |
50 | void setLogo ( QImage *image ); | 50 | void setLogo ( QImage *image ); |
51 | void setVideoFrame ( uchar *image, int width, int height, int linestep ); | 51 | void setVideoFrame ( uchar *image, int width, int height, int linestep ); |
52 | void clear ( ); | 52 | void clear ( ); |
53 | 53 | ||
54 | QSize videoSize() const; | 54 | QSize videoSize() const; |
55 | 55 | ||
56 | protected: | 56 | protected: |
57 | void paintEvent2( QPaintEvent *p ); | 57 | void paintEvent2( QPaintEvent *p ); |
58 | virtual void paintEvent(QPaintEvent*); | 58 | virtual void paintEvent(QPaintEvent*); |
59 | virtual void resizeEvent ( QResizeEvent *r ); | 59 | virtual void resizeEvent ( QResizeEvent *r ); |
60 | 60 | ||
61 | void mouseReleaseEvent ( QMouseEvent *e ); | 61 | void mouseReleaseEvent ( QMouseEvent *e ); |
62 | 62 | ||
63 | signals: | 63 | signals: |
64 | void clicked ( ); | 64 | void clicked ( ); |
65 | void videoResized ( const QSize &s ); | 65 | void videoResized ( const QSize &s ); |
66 | 66 | ||
67 | private: | 67 | private: |
68 | QRect m_lastframe; | 68 | QRect m_lastframe; |
69 | QRect m_thisframe; | 69 | QRect m_thisframe; |
70 | 70 | ||
71 | uchar *m_buff; | 71 | uchar *m_buff; |
72 | int m_bytes_per_line_fb; | 72 | int m_bytes_per_line_fb; |
73 | int m_bytes_per_line_frame; | 73 | int m_bytes_per_line_frame; |
74 | int m_bytes_per_pixel; | 74 | int m_bytes_per_pixel; |
75 | int m_lastsize; | 75 | int m_lastsize; |
76 | QSize m_framesize; | 76 | QSize m_framesize; |
77 | QImage *m_logo; | 77 | QImage *m_logo; |
78 | mutable int m_rotation; | 78 | mutable int m_rotation; |
79 | ThreadUtil::Mutex m_bufmutex; | 79 | ThreadUtil::Mutex m_bufmutex; |
80 | }; | 80 | }; |
81 | 81 | ||