author | alwin <alwin> | 2005-04-11 21:53:59 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-04-11 21:53:59 (UTC) |
commit | df382ea245959ed4d27012358e24c4c95767270f (patch) (unidiff) | |
tree | c1d71289d9773461692c8c181fef3b27e402eb0d | |
parent | 840e44417402bbc6048ca5e8ff3dd6be966e753f (diff) | |
download | opie-df382ea245959ed4d27012358e24c4c95767270f.zip opie-df382ea245959ed4d27012358e24c4c95767270f.tar.gz opie-df382ea245959ed4d27012358e24c4c95767270f.tar.bz2 |
next stage of bug hunting
seems that errors/problems in pure display are fixed. removed all qpaint
stuff may invoked in xine-thread (evil,evil!) - I think it isn't needed
there.
so I deactivated the mutex this moment
-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,33 +1,33 @@ | |||
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 | ||
@@ -167,41 +167,27 @@ QSize XineVideoWidget::videoSize() const | |||
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; |
@@ -211,46 +197,26 @@ void XineVideoWidget::paintEvent2 ( QPaintEvent * ) | |||
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: |
@@ -287,17 +253,19 @@ void XineVideoWidget::setLogo ( QImage* 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 | } |
@@ -312,20 +280,23 @@ void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) | |||
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(); |
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,34 +1,34 @@ | |||
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 | ||