author | sandman <sandman> | 2002-08-03 23:58:20 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-08-03 23:58:20 (UTC) |
commit | 0cecd08dba036f39e414e34a2b7c070008ee3884 (patch) (unidiff) | |
tree | c187c9308f0553b1d5d9cd59093bcc3c11740665 /noncore/multimedia/opieplayer2/xinevideowidget.cpp | |
parent | 8fb605fdfbbcbc654f567efcb59f02ec0d26228a (diff) | |
download | opie-0cecd08dba036f39e414e34a2b7c070008ee3884.zip opie-0cecd08dba036f39e414e34a2b7c070008ee3884.tar.gz opie-0cecd08dba036f39e414e34a2b7c070008ee3884.tar.bz2 |
Added support for fullscreen playback
Diffstat (limited to 'noncore/multimedia/opieplayer2/xinevideowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 91 |
1 files changed, 64 insertions, 27 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 4b69044..98446a0 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp | |||
@@ -40,2 +40,3 @@ | |||
40 | #include <qsize.h> | 40 | #include <qsize.h> |
41 | #include <qapplication.h> | ||
41 | 42 | ||
@@ -45,2 +46,3 @@ | |||
45 | 46 | ||
47 | |||
46 | static inline void memcpy_rev ( void *dst, void *src, size_t len ) | 48 | static inline void memcpy_rev ( void *dst, void *src, size_t len ) |
@@ -76,17 +78,15 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st | |||
76 | 78 | ||
77 | XineVideoWidget::XineVideoWidget( int width, | 79 | XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) |
78 | int height, | ||
79 | QWidget* parent, | ||
80 | const char* name ) | ||
81 | : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) | 80 | : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) |
82 | { | 81 | { |
83 | m_image = new QImage ( width, height, qt_screen-> depth ( )); | ||
84 | m_buff = 0; | ||
85 | setBackgroundMode ( NoBackground ); | 82 | setBackgroundMode ( NoBackground ); |
86 | /* QImage image = Resource::loadImage("SoundPlayer"); | ||
87 | image = image.smoothScale( width, height ); | ||
88 | 83 | ||
89 | m_image = new QImage( image );*/ | 84 | m_image = 0; |
85 | m_buff = 0; | ||
86 | m_bytes_per_line_fb = qt_screen-> linestep ( ); | ||
87 | m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; | ||
88 | m_rotation = 0; | ||
90 | } | 89 | } |
91 | 90 | ||
91 | |||
92 | XineVideoWidget::~XineVideoWidget ( ) | 92 | XineVideoWidget::~XineVideoWidget ( ) |
@@ -108,2 +108,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
108 | p. fillRect ( rect ( ), black ); | 108 | p. fillRect ( rect ( ), black ); |
109 | if ( m_image ) | ||
109 | p. drawImage ( 0, 0, *m_image ); | 110 | p. drawImage ( 0, 0, *m_image ); |
@@ -119,3 +120,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
119 | 120 | ||
120 | int rot = dp. transformOrientation ( ); | 121 | int rot = dp. transformOrientation ( ) + m_rotation; |
121 | 122 | ||
@@ -199,11 +200,2 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
199 | 200 | ||
200 | int XineVideoWidget::height ( ) const | ||
201 | { | ||
202 | return m_image-> height ( ); | ||
203 | } | ||
204 | |||
205 | int XineVideoWidget::width ( ) const | ||
206 | { | ||
207 | return m_image-> width ( ); | ||
208 | } | ||
209 | 201 | ||
@@ -215,14 +207,19 @@ void XineVideoWidget::setImage ( QImage* image ) | |||
215 | 207 | ||
216 | void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, | 208 | void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl ) |
217 | int xoffsetXBytes, int width, | ||
218 | int height, int linestep, int bytes, int bpp ) | ||
219 | { | 209 | { |
210 | bool rot90 = (( -m_rotation ) & 1 ); | ||
211 | |||
212 | if ( rot90 ) { | ||
213 | int d = w; | ||
214 | w = h; | ||
215 | h = d; | ||
216 | } | ||
220 | 217 | ||
221 | m_lastframe = m_thisframe; | 218 | m_lastframe = m_thisframe; |
222 | m_thisframe. setRect ( xoffsetXBytes, yoffsetXLine, width, height ); | 219 | m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); |
223 | 220 | ||
224 | m_buff = image; | 221 | //qDebug ( "Frame: %d,%d - %dx%d", ( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); |
225 | m_bytes_per_line_fb = linestep; | 222 | |
226 | m_bytes_per_line_frame = bytes; | 223 | m_buff = img; |
227 | m_bytes_per_pixel = bpp; | 224 | m_bytes_per_line_frame = bpl; |
228 | 225 | ||
@@ -230 +227,41 @@ void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, | |||
230 | } | 227 | } |
228 | |||
229 | void XineVideoWidget::resizeEvent ( QResizeEvent * ) | ||
230 | { | ||
231 | QSize s = size ( ); | ||
232 | bool fs = ( s == qApp-> desktop ( )-> size ( )); | ||
233 | |||
234 | m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0; | ||
235 | |||
236 | if ( fs && qt_screen-> isTransformed ( )) { | ||
237 | s = qt_screen-> mapToDevice ( s ); | ||
238 | } | ||
239 | |||
240 | //qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation ); | ||
241 | |||
242 | emit videoResized ( s ); | ||
243 | } | ||
244 | |||
245 | |||
246 | void XineVideoWidget::mousePressEvent ( QMouseEvent *me ) | ||
247 | { | ||
248 | QWidget *p = parentWidget ( ); | ||
249 | |||
250 | if ( p ) { | ||
251 | QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); | ||
252 | |||
253 | QApplication::sendEvent ( p, &pme ); | ||
254 | } | ||
255 | } | ||
256 | |||
257 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent *me ) | ||
258 | { | ||
259 | QWidget *p = parentWidget ( ); | ||
260 | |||
261 | if ( p ) { | ||
262 | QMouseEvent pme ( QEvent::MouseButtonRelease, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); | ||
263 | |||
264 | QApplication::sendEvent ( p, &pme ); | ||
265 | } | ||
266 | } | ||
267 | |||