summaryrefslogtreecommitdiff
authoralwin <alwin>2005-04-11 21:53:59 (UTC)
committer alwin <alwin>2005-04-11 21:53:59 (UTC)
commitdf382ea245959ed4d27012358e24c4c95767270f (patch) (unidiff)
treec1d71289d9773461692c8c181fef3b27e402eb0d
parent840e44417402bbc6048ca5e8ff3dd6be966e753f (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp101
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.h42
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,31 +1,31 @@
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
@@ -169,37 +169,23 @@ QSize XineVideoWidget::videoSize() const
169} 169}
170 170
171void XineVideoWidget::paintEvent ( QPaintEvent * ) 171void 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
183void XineVideoWidget::paintEvent2 ( QPaintEvent * ) 179void 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();
@@ -213,31 +199,8 @@ void XineVideoWidget::paintEvent2 ( QPaintEvent * )
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
@@ -246,9 +209,12 @@ void XineVideoWidget::paintEvent2 ( QPaintEvent * )
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;
@@ -289,13 +255,15 @@ void XineVideoWidget::setLogo ( QImage* logo )
289void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) 255void 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) {
@@ -314,16 +282,19 @@ void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl )
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
323void XineVideoWidget::resizeEvent ( QResizeEvent * ) 290void 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
329void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) 300void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ )
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,32 +1,32 @@
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