summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/xinevideowidget.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/xinevideowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp101
1 files changed, 36 insertions, 65 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,29 +1,29 @@
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,
@@ -171,8 +171,4 @@ QSize XineVideoWidget::videoSize() const
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 );
@@ -183,21 +179,11 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
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) {
@@ -215,27 +201,4 @@ void XineVideoWidget::paintEvent2 ( QPaintEvent * )
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;
@@ -248,5 +211,8 @@ void XineVideoWidget::paintEvent2 ( QPaintEvent * )
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:
@@ -291,9 +257,11 @@ void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl )
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;
@@ -316,12 +284,15 @@ void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl )
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