Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index eb57b67..00c534a 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -68,20 +68,15 @@ Lib::Lib(XineVideoWidget* widget) { | |||
68 | // m_audioOutput, | 68 | // m_audioOutput, |
69 | // m_config ); | 69 | // m_config ); |
70 | // test loading | 70 | // test loading |
71 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 71 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
72 | if (m_wid != 0 ) { | 72 | if (m_wid != 0 ) { |
73 | printf("!0\n" ); | 73 | printf("!0\n" ); |
74 | ::null_set_gui_width( m_videoOutput, m_wid->image()->width() ); | 74 | resize ( m_wid-> size ( )); |
75 | ::null_set_gui_height(m_videoOutput, m_wid->image()->height() ); | ||
76 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 75 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
77 | m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; | 76 | m_wid-> setImage ( new QImage ( Resource::loadImage(""))); |
78 | QImage image = Resource::loadImage(""); | ||
79 | image = image.smoothScale( m_wid->width(), m_wid->height() ); | ||
80 | QImage* img = new QImage( image ); | ||
81 | m_wid->setImage( img ); | ||
82 | m_wid->repaint(); | 77 | m_wid->repaint(); |
83 | } | 78 | } |
84 | null_display_handler( m_videoOutput, | 79 | null_display_handler( m_videoOutput, |
85 | xine_display_frame, | 80 | xine_display_frame, |
86 | this ); | 81 | this ); |
87 | 82 | ||
@@ -97,12 +92,20 @@ Lib::~Lib() { | |||
97 | xine_exit( m_xine ); | 92 | xine_exit( m_xine ); |
98 | delete m_videoOutput; | 93 | delete m_videoOutput; |
99 | //delete m_audioOutput; | 94 | //delete m_audioOutput; |
100 | 95 | ||
101 | } | 96 | } |
102 | 97 | ||
98 | void Lib::resize ( const QSize &s ) | ||
99 | { | ||
100 | if ( s. width ( ) && s. height ( )) { | ||
101 | ::null_set_gui_width( m_videoOutput, s. width() ); | ||
102 | ::null_set_gui_height(m_videoOutput, s. height() ); | ||
103 | } | ||
104 | } | ||
105 | |||
103 | QCString Lib::version() { | 106 | QCString Lib::version() { |
104 | QCString str( xine_get_str_version() ); | 107 | QCString str( xine_get_str_version() ); |
105 | return str; | 108 | return str; |
106 | }; | 109 | }; |
107 | 110 | ||
108 | int Lib::majorVersion() { | 111 | int Lib::majorVersion() { |
@@ -184,26 +187,20 @@ bool Lib::isScaling() { | |||
184 | } | 187 | } |
185 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | 188 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { |
186 | ((Lib*)user_data)->handleXineEvent( t ); | 189 | ((Lib*)user_data)->handleXineEvent( t ); |
187 | } | 190 | } |
188 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 191 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
189 | int width, int height, int bytes ) { | 192 | int width, int height, int bytes ) { |
190 | // printf("display x frame"); | 193 | |
191 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 194 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
192 | // printf("displayed x frame\n"); | ||
193 | } | 195 | } |
194 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 196 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
195 | if (!m_video ) { | 197 | if (!m_video ) { |
196 | qWarning("not showing video now"); | 198 | qWarning("not showing video now"); |
197 | return; | 199 | return; |
198 | } | 200 | } |
199 | // qWarning("called draw frame %d %d", width, height); | 201 | // qWarning("called draw frame %d %d", width, height); |
200 | 202 | ||
201 | QSize size = m_wid->size(); | 203 | m_wid->setImage( frame, width, height, bytes ); |
202 | int xoffset = (size.width() - width) / 2; | ||
203 | int yoffset = (size.height() - height) / 2; | ||
204 | int linestep = qt_screen->linestep(); | ||
205 | |||
206 | m_wid->setImage( frame, yoffset, xoffset, width, height, linestep, bytes, m_bytes_per_pixel ); | ||
207 | // m_wid->repaint(false); | 204 | // m_wid->repaint(false); |
208 | 205 | ||
209 | } | 206 | } |