summaryrefslogtreecommitdiff
authorsandman <sandman>2002-08-01 21:18:11 (UTC)
committer sandman <sandman>2002-08-01 21:18:11 (UTC)
commit54eb82d90a4ee254c0abb6d33937e76aeb32ddf1 (patch) (side-by-side diff)
treee9628916c721262232efc3314a8ccd29613a7189
parentc80b2060a6f051f16690db4b8f0ccbc7dde84ec5 (diff)
downloadopie-54eb82d90a4ee254c0abb6d33937e76aeb32ddf1.zip
opie-54eb82d90a4ee254c0abb6d33937e76aeb32ddf1.tar.gz
opie-54eb82d90a4ee254c0abb6d33937e76aeb32ddf1.tar.bz2
video in qvfb works now with 0/90/180/270° rotation
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c2
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp25
3 files changed, 22 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index ac5cdd5..5ae6c21 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -184,22 +184,22 @@ bool Lib::isScaling() {
}
void Lib::xine_event_handler( void* user_data, xine_event_t* t ) {
((Lib*)user_data)->handleXineEvent( t );
}
void Lib::xine_display_frame( void* user_data, uint8_t *frame,
int width, int height, int bytes ) {
- printf("display x frame");
+// printf("display x frame");
((Lib*)user_data)->drawFrame( frame, width, height, bytes );
- printf("displayed x frame\n");
+// printf("displayed x frame\n");
}
void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
if (!m_video ) {
qWarning("not showing video now");
return;
}
- qWarning("called draw frame %d %d", width, height);
+// qWarning("called draw frame %d %d", width, height);
QSize size = m_wid->size();
int xoffset = (size.width() - width) / 2;
int yoffset = (size.height() - height) / 2;
int linestep = qt_screen->linestep();
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index 63d5752..3a18a40 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -11,12 +11,14 @@
#include <xine/configfile.h>
#include <pthread.h>
#include "alphablend.h"
#include "yuv2rgb.h"
+#define printf(x,...)
+
/* the caller for our event draw handler */
typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
int width, int height,int bytes );
typedef struct null_driver_s null_driver_t;
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index e46c4df..8e8f139 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -52,12 +52,16 @@ static inline void memcpy_rev ( void *dst, void *src, size_t len )
}
static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step )
{
len >>= 1;
while ( len-- ) {
+// *((char *) dst ) = *((char *) src + 1);
+// *((char *) dst + 1) = *((char *) src );
+// ((char *) dst ) += 2;
+
*((short int *) dst )++ = *((short int *) src );
((char *) src ) += step;
}
}
static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t step )
@@ -66,12 +70,16 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st
((char *) src ) += ( len * step );
while ( len-- ) {
((char *) src ) -= step;
*((short int *) dst )++ = *((short int *) src );
+
+// *((char *) dst ) = *((char *) src + 1);
+// *((char *) dst + 1) = *((char *) src );
+// ((char *) dst ) += 2;
}
}
XineVideoWidget::XineVideoWidget( int width,
int height,
@@ -98,41 +106,41 @@ void XineVideoWidget::clear ( )
m_buff = 0;
repaint ( false );
}
void XineVideoWidget::paintEvent ( QPaintEvent * )
{
- qWarning( "painting" );
+ qWarning( "painting <<<" );
if ( m_buff == 0 ) {
QPainter p ( this );
p. fillRect ( rect ( ), black );
p. drawImage ( 0, 0, *m_image );
qWarning ( "logo\n" );
}
else {
- qWarning ( "paintevent\n" );
+// qWarning ( "paintevent\n" );
QArray <QRect> qt_bug_workaround_clip_rects;
{
QDirectPainter dp ( this );
+ int rot = dp. transformOrientation ( );
+
uchar *fb = dp. frameBuffer ( );
uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame;
QRect framerect = QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( ));
qt_bug_workaround_clip_rects. resize ( dp. numRects ( ));
for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) {
const QRect &clip = dp. rect ( i );
qt_bug_workaround_clip_rects [i] = clip;
- int rot = dp. transformOrientation ( );
-
if ( rot == 0 || rot == 180 ) {
uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb );
uchar *src = frame + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame );
if ( rot == 180 )
src += (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame );
@@ -173,13 +181,13 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
}
else { // rot == 90 || rot == 270
uchar *dst = fb + ( clip. y ( ) * m_bytes_per_pixel ) + ( clip. x ( ) * m_bytes_per_line_fb );
uchar *src = frame + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame );
if ( rot == 270 )
- src += (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame );
+ src += (( framerect. height ( ) - 1 ) * m_bytes_per_pixel );
uint leftfill = 0;
uint framefill = 0;
uint rightfill = 0;
uint clipwidth = clip. height ( ) * m_bytes_per_pixel;
@@ -197,22 +205,22 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
else {
if ( leftfill )
memset ( dst, 0, leftfill );
if ( framefill ) {
if ( rot == 90 )
- memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame );
- else
memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame );
+ else
+ memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame );
}
if ( rightfill )
memset ( dst + leftfill + framefill, 0, rightfill );
}
dst += m_bytes_per_line_fb;
- src += ( rot == 90 ? +1 : -1 ); // m_bytes_per_line_frame : -m_bytes_per_line_frame );
+ src += ( rot == 270 ? -m_bytes_per_pixel : m_bytes_per_pixel );
}
}
}
}
{
// QVFB hack by MArtin Jones
@@ -220,12 +228,13 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) );
}
}
}
+ qWarning( "painting >>>" );
}
int XineVideoWidget::height ( ) const
{
return m_image-> height ( );
}