summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-05 23:28:06 (UTC)
committer simon <simon>2002-12-05 23:28:06 (UTC)
commit8a1c4b4b84d8a8de87bb6adb4df3f09961854633 (patch) (unidiff)
tree2399c784b4d5e87c8bb834389837870353b4a43f
parent15d4d1f2fc8b37d30694acc5765a822718af6c13 (diff)
downloadopie-8a1c4b4b84d8a8de87bb6adb4df3f09961854633.zip
opie-8a1c4b4b84d8a8de87bb6adb4df3f09961854633.tar.gz
opie-8a1c4b4b84d8a8de87bb6adb4df3f09961854633.tar.bz2
- adapted to xine CVS HEAD
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c62
2 files changed, 37 insertions, 32 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 96bdb21..4a96408 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,199 +1,200 @@
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 LJP <> 5 Copyright (c) 2002 LJP <>
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
32*/ 32*/
33 33
34#include <stdio.h> 34#include <stdio.h>
35#include <stdlib.h> 35#include <stdlib.h>
36#include <qimage.h> 36#include <qimage.h>
37#include <qtextstream.h> 37#include <qtextstream.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39 39
40#include <qfile.h> 40#include <qfile.h>
41 41
42#include <qgfx_qws.h> 42#include <qgfx_qws.h>
43#include <qdirectpainter_qws.h> 43#include <qdirectpainter_qws.h>
44 44
45#include <assert.h> 45#include <assert.h>
46 46
47#include "xinevideowidget.h" 47#include "xinevideowidget.h"
48#include "frame.h" 48#include "frame.h"
49#include "lib.h" 49#include "lib.h"
50 50
51
51typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 52typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
52 int width, int height,int bytes ); 53 int width, int height,int bytes );
53 54
54extern "C" { 55extern "C" {
55 xine_vo_driver_t* init_video_out_plugin( xine_cfg_entry_t* conf, void* video); 56 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * );
56 int null_is_showing_video( const xine_vo_driver_t* self ); 57 int null_is_showing_video( const xine_vo_driver_t* self );
57 void null_set_show_video( const xine_vo_driver_t* self, int show ); 58 void null_set_show_video( const xine_vo_driver_t* self, int show );
58 int null_is_fullscreen( const xine_vo_driver_t* self ); 59 int null_is_fullscreen( const xine_vo_driver_t* self );
59 void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); 60 void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
60 int null_is_scaling( const xine_vo_driver_t* self ); 61 int null_is_scaling( const xine_vo_driver_t* self );
61 void null_set_scaling( const xine_vo_driver_t* self, int scale ); 62 void null_set_scaling( const xine_vo_driver_t* self, int scale );
62 void null_set_gui_width( const xine_vo_driver_t* self, int width ); 63 void null_set_gui_width( const xine_vo_driver_t* self, int width );
63 void null_set_gui_height( const xine_vo_driver_t* self, int height ); 64 void null_set_gui_height( const xine_vo_driver_t* self, int height );
64 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 65 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
65 void null_set_videoGamma( const xine_vo_driver_t* self , int value ); 66 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
66 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 67 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
67} 68}
68 69
69using namespace XINE; 70using namespace XINE;
70 71
71Lib::Lib( XineVideoWidget* widget ) { 72Lib::Lib( XineVideoWidget* widget ) {
72 m_video = false; 73 m_video = false;
73 m_wid = widget; 74 m_wid = widget;
74 printf("Lib"); 75 printf("Lib");
75 QCString str( getenv("HOME") ); 76 QCString str( getenv("HOME") );
76 str += "/Settings/opiexine.cf"; 77 str += "/Settings/opiexine.cf";
77 // get the configuration 78 // get the configuration
78 79
79 // not really OO, should be an extra class, later 80 // not really OO, should be an extra class, later
80 if ( !QFile(str).exists() ) { 81 if ( !QFile(str).exists() ) {
81 QFile f(str); 82 QFile f(str);
82 f.open(IO_WriteOnly); 83 f.open(IO_WriteOnly);
83 QTextStream ts( &f ); 84 QTextStream ts( &f );
84 ts << "misc.memcpy_method:glibc\n"; 85 ts << "misc.memcpy_method:glibc\n";
85 f.close(); 86 f.close();
86 } 87 }
87 88
88 m_xine = xine_new( ); 89 m_xine = xine_new( );
89 90
90 xine_config_load( m_xine, str.data() ); 91 xine_config_load( m_xine, str.data() );
91 92
92 xine_init( m_xine ); 93 xine_init( m_xine );
93 94
94 // allocate oss for sound 95 // allocate oss for sound
95 // and fb for framebuffer 96 // and fb for framebuffer
96 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 97 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
97 m_videoOutput = ::init_video_out_plugin( m_config, NULL ); 98 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
98 99
99 100
100//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 101//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
101 102
102 103
103 null_display_handler( m_videoOutput, xine_display_frame, this ); 104// null_display_handler( m_videoOutput, xine_display_frame, this );
104 105
105 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 106 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
106 107
107 if (m_wid != 0 ) { 108 if (m_wid != 0 ) {
108 printf( "!0\n" ); 109 printf( "!0\n" );
109 resize ( m_wid-> size ( ) ); 110 resize ( m_wid-> size ( ) );
110 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 111 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
111 112
112 m_wid->repaint(); 113 m_wid->repaint();
113 } 114 }
114 115
115 m_queue = xine_event_new_queue (m_stream); 116 m_queue = xine_event_new_queue (m_stream);
116 117
117 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 118 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
118} 119}
119 120
120Lib::~Lib() { 121Lib::~Lib() {
121// free( m_config ); 122// free( m_config );
122 xine_exit( m_xine ); 123 xine_exit( m_xine );
123 /* FIXME either free or delete but valgrind bitches against both */ 124 /* FIXME either free or delete but valgrind bitches against both */
124 //free( m_videoOutput ); 125 //free( m_videoOutput );
125 //delete m_audioOutput; 126 //delete m_audioOutput;
126} 127}
127 128
128void Lib::resize ( const QSize &s ) { 129void Lib::resize ( const QSize &s ) {
129 if ( s. width ( ) && s. height ( ) ) { 130 if ( s. width ( ) && s. height ( ) ) {
130 ::null_set_gui_width( m_videoOutput, s. width() ); 131 ::null_set_gui_width( m_videoOutput, s. width() );
131 ::null_set_gui_height( m_videoOutput, s. height() ); 132 ::null_set_gui_height( m_videoOutput, s. height() );
132 } 133 }
133} 134}
134 135
135int Lib::majorVersion() { 136int Lib::majorVersion() {
136 int major, minor, sub; 137 int major, minor, sub;
137 xine_get_version ( &major, &minor, &sub ); 138 xine_get_version ( &major, &minor, &sub );
138 return major; 139 return major;
139} 140}
140 141
141int Lib::minorVersion() { 142int Lib::minorVersion() {
142 int major, minor, sub; 143 int major, minor, sub;
143 xine_get_version ( &major, &minor, &sub ); 144 xine_get_version ( &major, &minor, &sub );
144 return minor; 145 return minor;
145} 146}
146 147
147int Lib::subVersion() { 148int Lib::subVersion() {
148 int major, minor, sub; 149 int major, minor, sub;
149 xine_get_version ( &major, &minor, &sub ); 150 xine_get_version ( &major, &minor, &sub );
150 return sub; 151 return sub;
151} 152}
152 153
153int Lib::play( const QString& fileName, int startPos, int start_time ) { 154int Lib::play( const QString& fileName, int startPos, int start_time ) {
154 QString str = fileName.stripWhiteSpace(); 155 QString str = fileName.stripWhiteSpace();
155 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { 156 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
156 return 0; 157 return 0;
157 } 158 }
158 return xine_play( m_stream, startPos, start_time); 159 return xine_play( m_stream, startPos, start_time);
159} 160}
160 161
161void Lib::stop() { 162void Lib::stop() {
162 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 163 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
163 xine_stop( m_stream ); 164 xine_stop( m_stream );
164} 165}
165 166
166void Lib::pause() { 167void Lib::pause() {
167 xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); 168 xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE );
168} 169}
169 170
170int Lib::speed() const { 171int Lib::speed() const {
171 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 172 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
172} 173}
173 174
174void Lib::setSpeed( int speed ) { 175void Lib::setSpeed( int speed ) {
175 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 176 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
176} 177}
177 178
178int Lib::status() const { 179int Lib::status() const {
179 return xine_get_status( m_stream ); 180 return xine_get_status( m_stream );
180} 181}
181 182
182int Lib::currentPosition() const { 183int Lib::currentPosition() const {
183 int pos, time, length; 184 int pos, time, length;
184 xine_get_pos_length( m_stream, &pos, &time, &length ); 185 xine_get_pos_length( m_stream, &pos, &time, &length );
185 return pos; 186 return pos;
186} 187}
187 188
188int Lib::currentTime() const { 189int Lib::currentTime() const {
189 int pos, time, length; 190 int pos, time, length;
190 xine_get_pos_length( m_stream, &pos, &time, &length ); 191 xine_get_pos_length( m_stream, &pos, &time, &length );
191 return time/1000; 192 return time/1000;
192} 193}
193 194
194int Lib::length() const { 195int Lib::length() const {
195 int pos, time, length; 196 int pos, time, length;
196 xine_get_pos_length( m_stream, &pos, &time, &length ); 197 xine_get_pos_length( m_stream, &pos, &time, &length );
197 return length/1000; 198 return length/1000;
198} 199}
199 200
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index 9c285a0..1ebb854 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -1,610 +1,614 @@
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 LJP <> 5 Copyright (c) 2002 LJP <>
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
32*/ 32*/
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35#include <stdio.h> 35#include <stdio.h>
36 36
37#include <math.h> 37#include <math.h>
38 38
39#include <xine.h> 39#include <xine.h>
40#include <xine/video_out.h> 40#include <xine/video_out.h>
41#include <xine/xine_internal.h> 41#include <xine/xine_internal.h>
42#include <xine/xineutils.h> 42#include <xine/xineutils.h>
43#include <xine/vo_scale.h> 43#include <xine/vo_scale.h>
44 44
45#include <pthread.h> 45#include <pthread.h>
46#include "alphablend.h" 46#include "alphablend.h"
47#include "yuv2rgb.h" 47#include "yuv2rgb.h"
48 48
49#define printf(x,...) 49#define printf(x,...)
50 50
51/* 51/*
52#define LOG 52#define LOG
53*/ 53*/
54 54
55/* the caller for our event draw handler */ 55/* the caller for our event draw handler */
56typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 56typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
57 int width, int height,int bytes ); 57 int width, int height,int bytes );
58 58
59typedef struct null_driver_s null_driver_t; 59typedef struct null_driver_s null_driver_t;
60 60
61struct null_driver_s { 61struct null_driver_s {
62 xine_vo_driver_t vo_driver; 62 vo_driver_t vo_driver;
63 63
64 uint32_t m_capabilities; 64 uint32_t m_capabilities;
65 int m_show_video; 65 int m_show_video;
66 int m_video_fullscreen; 66 int m_video_fullscreen;
67 int m_is_scaling; 67 int m_is_scaling;
68 68
69 int depth, bpp, bytes_per_pixel; 69 int depth, bpp, bytes_per_pixel;
70 int yuv2rgb_mode; 70 int yuv2rgb_mode;
71 int yuv2rgb_swap; 71 int yuv2rgb_swap;
72 int yuv2rgb_gamma; 72 int yuv2rgb_gamma;
73 uint8_t *yuv2rgb_cmap; 73 uint8_t *yuv2rgb_cmap;
74 yuv2rgb_factory_t *yuv2rgb_factory; 74 yuv2rgb_factory_t *yuv2rgb_factory;
75 75
76 vo_overlay_t *overlay; 76 vo_overlay_t *overlay;
77 vo_scale_t sc; 77 vo_scale_t sc;
78 78
79 int gui_width; 79 int gui_width;
80 int gui_height; 80 int gui_height;
81 int gui_changed; 81 int gui_changed;
82 82
83 double display_ratio; 83 double display_ratio;
84 void* caller; 84 void* caller;
85 display_xine_frame_t frameDis; 85 display_xine_frame_t frameDis;
86}; 86};
87 87
88typedef struct opie_frame_s opie_frame_t; 88typedef struct opie_frame_s opie_frame_t;
89struct opie_frame_s { 89struct opie_frame_s {
90 vo_frame_t frame; 90 vo_frame_t frame;
91 91
92 int format; 92 int format;
93 int flags; 93 int flags;
94 94
95 vo_scale_t sc; 95 vo_scale_t sc;
96 96
97 uint8_t *chunk[3]; 97 uint8_t *chunk[3];
98 98
99 uint8_t *data; /* rgb */ 99 uint8_t *data; /* rgb */
100 int bytes_per_line; 100 int bytes_per_line;
101 101
102 yuv2rgb_t *yuv2rgb; 102 yuv2rgb_t *yuv2rgb;
103 uint8_t *rgb_dst; 103 uint8_t *rgb_dst;
104 int yuv_stride; 104 int yuv_stride;
105 int stripe_height, stripe_inc; 105 int stripe_height, stripe_inc;
106 106
107 null_driver_t *output; 107 null_driver_t *output;
108}; 108};
109 109
110static uint32_t null_get_capabilities( xine_vo_driver_t *self ){ 110static uint32_t null_get_capabilities( vo_driver_t *self ){
111 null_driver_t* this = (null_driver_t*)self; 111 null_driver_t* this = (null_driver_t*)self;
112 return this->m_capabilities; 112 return this->m_capabilities;
113} 113}
114 114
115static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { 115static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) {
116 opie_frame_t *frame = (opie_frame_t *) vo_img ; 116 opie_frame_t *frame = (opie_frame_t *) vo_img ;
117 117
118 if (!frame->output->m_show_video) { 118 if (!frame->output->m_show_video) {
119 /* printf("nullvideo: no video\n"); */ 119 /* printf("nullvideo: no video\n"); */
120 return; 120 return;
121 } 121 }
122 122
123 if (frame->format == XINE_IMGFMT_YV12) { 123 if (frame->format == XINE_IMGFMT_YV12) {
124 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, 124 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst,
125 src[0], src[1], src[2]); 125 src[0], src[1], src[2]);
126 } else { 126 } else {
127 127
128 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, 128 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst,
129 src[0]); 129 src[0]);
130 } 130 }
131 131
132 frame->rgb_dst += frame->stripe_inc; 132 frame->rgb_dst += frame->stripe_inc;
133} 133}
134 134
135static void null_frame_field (vo_frame_t *vo_img, int which_field) { 135static void null_frame_field (vo_frame_t *vo_img, int which_field) {
136 136
137 opie_frame_t *frame = (opie_frame_t *) vo_img ; 137 opie_frame_t *frame = (opie_frame_t *) vo_img ;
138 138
139 switch (which_field) { 139 switch (which_field) {
140 case VO_TOP_FIELD: 140 case VO_TOP_FIELD:
141 frame->rgb_dst = (uint8_t *)frame->data; 141 frame->rgb_dst = (uint8_t *)frame->data;
142 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; 142 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line;
143 break; 143 break;
144 case VO_BOTTOM_FIELD: 144 case VO_BOTTOM_FIELD:
145 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 145 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
146 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; 146 frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line;
147 break; 147 break;
148 case VO_BOTH_FIELDS: 148 case VO_BOTH_FIELDS:
149 frame->rgb_dst = (uint8_t *)frame->data; 149 frame->rgb_dst = (uint8_t *)frame->data;
150 break; 150 break;
151 } 151 }
152} 152}
153 153
154 154
155/* take care of the frame*/ 155/* take care of the frame*/
156static void null_frame_dispose( vo_frame_t* vo_img){ 156static void null_frame_dispose( vo_frame_t* vo_img){
157 opie_frame_t* frame = (opie_frame_t*)vo_img; 157 opie_frame_t* frame = (opie_frame_t*)vo_img;
158 158
159 if (frame->data) 159 if (frame->data)
160 free( frame->data ); 160 free( frame->data );
161 free (frame); 161 free (frame);
162} 162}
163 163
164/* end take care of frames*/ 164/* end take care of frames*/
165 165
166static vo_frame_t* null_alloc_frame( xine_vo_driver_t* self ){ 166static vo_frame_t* null_alloc_frame( vo_driver_t* self ){
167 167
168 null_driver_t* this = (null_driver_t*)self; 168 null_driver_t* this = (null_driver_t*)self;
169 opie_frame_t* frame; 169 opie_frame_t* frame;
170 170
171#ifdef LOG 171#ifdef LOG
172 fprintf (stderr, "nullvideo: alloc_frame\n"); 172 fprintf (stderr, "nullvideo: alloc_frame\n");
173#endif 173#endif
174 174
175 frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); 175 frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) );
176 176
177 memset( frame, 0, sizeof( opie_frame_t) ); 177 memset( frame, 0, sizeof( opie_frame_t) );
178 memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t)); 178 memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t));
179 179
180 pthread_mutex_init (&frame->frame.mutex, NULL); 180 pthread_mutex_init (&frame->frame.mutex, NULL);
181 181
182 frame->output = this; 182 frame->output = this;
183 183
184 /* initialize the frame*/ 184 /* initialize the frame*/
185 frame->frame.driver = self; 185 frame->frame.driver = self;
186 frame->frame.copy = null_frame_copy; 186 frame->frame.copy = null_frame_copy;
187 frame->frame.field = null_frame_field; 187 frame->frame.field = null_frame_field;
188 frame->frame.dispose = null_frame_dispose; 188 frame->frame.dispose = null_frame_dispose;
189 189
190 /* 190 /*
191 * colorspace converter for this frame 191 * colorspace converter for this frame
192 */ 192 */
193 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); 193 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory);
194 194
195 return (vo_frame_t*) frame; 195 return (vo_frame_t*) frame;
196} 196}
197 197
198static void null_update_frame_format( xine_vo_driver_t* self, vo_frame_t* img, 198static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
199 uint32_t width, uint32_t height, 199 uint32_t width, uint32_t height,
200 int ratio_code, int format, int flags ){ 200 int ratio_code, int format, int flags ){
201 null_driver_t* this = (null_driver_t*) self; 201 null_driver_t* this = (null_driver_t*) self;
202 opie_frame_t* frame = (opie_frame_t*)img; 202 opie_frame_t* frame = (opie_frame_t*)img;
203 /* not needed now */ 203 /* not needed now */
204 204
205#ifdef LOG 205#ifdef LOG
206 fprintf (stderr, "nullvideo: update_frame_format\n"); 206 fprintf (stderr, "nullvideo: update_frame_format\n");
207#endif 207#endif
208 208
209 flags &= VO_BOTH_FIELDS; 209 flags &= VO_BOTH_FIELDS;
210 210
211 /* find out if we need to adapt this frame */ 211 /* find out if we need to adapt this frame */
212 212
213 if ((width != frame->sc.delivered_width) 213 if ((width != frame->sc.delivered_width)
214 || (height != frame->sc.delivered_height) 214 || (height != frame->sc.delivered_height)
215 || (ratio_code != frame->sc.delivered_ratio_code) 215 || (ratio_code != frame->sc.delivered_ratio_code)
216 || (flags != frame->flags) 216 || (flags != frame->flags)
217 || (format != frame->format) 217 || (format != frame->format)
218 || (this->sc.user_ratio != frame->sc.user_ratio) 218 || (this->sc.user_ratio != frame->sc.user_ratio)
219 || (this->gui_width != frame->sc.gui_width) 219 || (this->gui_width != frame->sc.gui_width)
220 || (this->gui_height != frame->sc.gui_height)) { 220 || (this->gui_height != frame->sc.gui_height)) {
221 221
222 frame->sc.delivered_width = width; 222 frame->sc.delivered_width = width;
223 frame->sc.delivered_height = height; 223 frame->sc.delivered_height = height;
224 frame->sc.delivered_ratio_code = ratio_code; 224 frame->sc.delivered_ratio_code = ratio_code;
225 frame->flags = flags; 225 frame->flags = flags;
226 frame->format = format; 226 frame->format = format;
227 frame->sc.user_ratio = this->sc.user_ratio; 227 frame->sc.user_ratio = this->sc.user_ratio;
228 frame->sc.gui_width = this->gui_width; 228 frame->sc.gui_width = this->gui_width;
229 frame->sc.gui_height = this->gui_height; 229 frame->sc.gui_height = this->gui_height;
230 frame->sc.gui_pixel_aspect = 1.0; 230 frame->sc.gui_pixel_aspect = 1.0;
231 231
232 vo_scale_compute_ideal_size ( &frame->sc ); 232 vo_scale_compute_ideal_size ( &frame->sc );
233 vo_scale_compute_output_size( &frame->sc ); 233 vo_scale_compute_output_size( &frame->sc );
234 234
235#ifdef LOG 235#ifdef LOG
236 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n", 236 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n",
237 frame->sc.gui_width, frame->sc.gui_height, 237 frame->sc.gui_width, frame->sc.gui_height,
238 frame->sc.delivered_width, frame->sc.delivered_height, 238 frame->sc.delivered_width, frame->sc.delivered_height,
239 frame->sc.output_width, frame->sc.output_height); 239 frame->sc.output_width, frame->sc.output_height);
240#endif 240#endif
241 241
242 /* 242 /*
243 * (re-) allocate 243 * (re-) allocate
244 */ 244 */
245 if( frame->data ) { 245 if( frame->data ) {
246 if( frame->chunk[0] ){ 246 if( frame->chunk[0] ){
247 free( frame->chunk[0] ); 247 free( frame->chunk[0] );
248 frame->chunk[0] = NULL; 248 frame->chunk[0] = NULL;
249 } 249 }
250 if( frame->chunk[1] ){ 250 if( frame->chunk[1] ){
251 free ( frame->chunk[1] ); 251 free ( frame->chunk[1] );
252 frame->chunk[1] = NULL; 252 frame->chunk[1] = NULL;
253 } 253 }
254 if( frame->chunk[2] ){ 254 if( frame->chunk[2] ){
255 free ( frame->chunk[2] ); 255 free ( frame->chunk[2] );
256 frame->chunk[2] = NULL; 256 frame->chunk[2] = NULL;
257 } 257 }
258 free ( frame->data ); 258 free ( frame->data );
259 } 259 }
260 260
261 frame->data = xine_xmalloc (frame->sc.output_width 261 frame->data = xine_xmalloc (frame->sc.output_width
262 * frame->sc.output_height 262 * frame->sc.output_height
263 * this->bytes_per_pixel ); 263 * this->bytes_per_pixel );
264 264
265 if( format == XINE_IMGFMT_YV12 ) { 265 if( format == XINE_IMGFMT_YV12 ) {
266 frame->frame.pitches[0] = 8*((width + 7) / 8); 266 frame->frame.pitches[0] = 8*((width + 7) / 8);
267 frame->frame.pitches[1] = 8*((width + 15) / 16); 267 frame->frame.pitches[1] = 8*((width + 15) / 16);
268 frame->frame.pitches[2] = 8*((width + 15) / 16); 268 frame->frame.pitches[2] = 8*((width + 15) / 16);
269 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]); 269 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]);
270 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]); 270 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]);
271 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]); 271 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]);
272 272
273 }else{ 273 }else{
274 frame->frame.pitches[0] = 8*((width + 3) / 4); 274 frame->frame.pitches[0] = 8*((width + 3) / 4);
275 275
276 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height, 276 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,
277 (void **)&frame->chunk[0]); 277 (void **)&frame->chunk[0]);
278 frame->chunk[1] = NULL; 278 frame->chunk[1] = NULL;
279 frame->chunk[2] = NULL; 279 frame->chunk[2] = NULL;
280 } 280 }
281 281
282 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height; 282 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height;
283 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel; 283 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel;
284 284
285 /* 285 /*
286 * set up colorspace converter 286 * set up colorspace converter
287 */ 287 */
288 288
289 switch (flags) { 289 switch (flags) {
290 case VO_TOP_FIELD: 290 case VO_TOP_FIELD:
291 case VO_BOTTOM_FIELD: 291 case VO_BOTTOM_FIELD:
292 frame->yuv2rgb->configure (frame->yuv2rgb, 292 frame->yuv2rgb->configure (frame->yuv2rgb,
293 frame->sc.delivered_width, 293 frame->sc.delivered_width,
294 16, 294 16,
295 2*frame->frame.pitches[0], 295 2*frame->frame.pitches[0],
296 2*frame->frame.pitches[1], 296 2*frame->frame.pitches[1],
297 frame->sc.output_width, 297 frame->sc.output_width,
298 frame->stripe_height, 298 frame->stripe_height,
299 frame->bytes_per_line*2); 299 frame->bytes_per_line*2);
300 frame->yuv_stride = frame->bytes_per_line*2; 300 frame->yuv_stride = frame->bytes_per_line*2;
301 break; 301 break;
302 case VO_BOTH_FIELDS: 302 case VO_BOTH_FIELDS:
303 frame->yuv2rgb->configure (frame->yuv2rgb, 303 frame->yuv2rgb->configure (frame->yuv2rgb,
304 frame->sc.delivered_width, 304 frame->sc.delivered_width,
305 16, 305 16,
306 frame->frame.pitches[0], 306 frame->frame.pitches[0],
307 frame->frame.pitches[1], 307 frame->frame.pitches[1],
308 frame->sc.output_width, 308 frame->sc.output_width,
309 frame->stripe_height, 309 frame->stripe_height,
310 frame->bytes_per_line); 310 frame->bytes_per_line);
311 frame->yuv_stride = frame->bytes_per_line; 311 frame->yuv_stride = frame->bytes_per_line;
312 break; 312 break;
313 } 313 }
314#ifdef LOG 314#ifdef LOG
315 fprintf (stderr, "nullvideo: colorspace converter configured.\n"); 315 fprintf (stderr, "nullvideo: colorspace converter configured.\n");
316#endif 316#endif
317 } 317 }
318 318
319 /* 319 /*
320 * reset dest pointers 320 * reset dest pointers
321 */ 321 */
322 322
323 if (frame->data) { 323 if (frame->data) {
324 switch (flags) { 324 switch (flags) {
325 case VO_TOP_FIELD: 325 case VO_TOP_FIELD:
326 frame->rgb_dst = (uint8_t *)frame->data; 326 frame->rgb_dst = (uint8_t *)frame->data;
327 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 327 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
328 break; 328 break;
329 case VO_BOTTOM_FIELD: 329 case VO_BOTTOM_FIELD:
330 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 330 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
331 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 331 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
332 break; 332 break;
333 case VO_BOTH_FIELDS: 333 case VO_BOTH_FIELDS:
334 frame->rgb_dst = (uint8_t *)frame->data; 334 frame->rgb_dst = (uint8_t *)frame->data;
335 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; 335 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line;
336 break; 336 break;
337 } 337 }
338 } 338 }
339} 339}
340 340
341static void null_display_frame( xine_vo_driver_t* self, vo_frame_t *frame_gen ){ 341static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){
342 null_driver_t* this = (null_driver_t*) self; 342 null_driver_t* this = (null_driver_t*) self;
343 opie_frame_t* frame = (opie_frame_t*)frame_gen; 343 opie_frame_t* frame = (opie_frame_t*)frame_gen;
344 display_xine_frame_t display = this->frameDis; 344 display_xine_frame_t display = this->frameDis;
345 345
346 if (!this->m_show_video) 346 if (!this->m_show_video)
347 return; 347 return;
348 348
349 if( display != NULL ) { 349 if( display != NULL ) {
350 (*display)(this->caller, frame->data, 350 (*display)(this->caller, frame->data,
351 frame->sc.output_width, frame->sc.output_height, 351 frame->sc.output_width, frame->sc.output_height,
352 frame->bytes_per_line ); 352 frame->bytes_per_line );
353 } 353 }
354 354
355 frame->frame.displayed (&frame->frame); 355 frame->frame.displayed (&frame->frame);
356} 356}
357 357
358 358
359/* blending related */ 359/* blending related */
360static void null_overlay_clut_yuv2rgb (null_driver_t *this, 360static void null_overlay_clut_yuv2rgb (null_driver_t *this,
361 vo_overlay_t *overlay, 361 vo_overlay_t *overlay,
362 opie_frame_t *frame) { 362 opie_frame_t *frame) {
363 int i; 363 int i;
364 clut_t* clut = (clut_t*) overlay->color; 364 clut_t* clut = (clut_t*) overlay->color;
365 if (!overlay->rgb_clut) { 365 if (!overlay->rgb_clut) {
366 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 366 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
367 *((uint32_t *)&clut[i]) = 367 *((uint32_t *)&clut[i]) =
368 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, 368 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb,
369 clut[i].y, clut[i].cb, clut[i].cr); 369 clut[i].y, clut[i].cb, clut[i].cr);
370 } 370 }
371 overlay->rgb_clut++; 371 overlay->rgb_clut++;
372 } 372 }
373 if (!overlay->clip_rgb_clut) { 373 if (!overlay->clip_rgb_clut) {
374 clut = (clut_t*) overlay->clip_color; 374 clut = (clut_t*) overlay->clip_color;
375 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 375 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
376 *((uint32_t *)&clut[i]) = 376 *((uint32_t *)&clut[i]) =
377 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, 377 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb,
378 clut[i].y, clut[i].cb, clut[i].cr); 378 clut[i].y, clut[i].cb, clut[i].cr);
379 } 379 }
380 overlay->clip_rgb_clut++; 380 overlay->clip_rgb_clut++;
381 } 381 }
382} 382}
383 383
384static void null_overlay_blend ( xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { 384static void null_overlay_blend ( vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) {
385 null_driver_t *this = (null_driver_t *) this_gen; 385 null_driver_t *this = (null_driver_t *) this_gen;
386 opie_frame_t *frame = (opie_frame_t *) frame_gen; 386 opie_frame_t *frame = (opie_frame_t *) frame_gen;
387 387
388 if(!this->m_show_video || frame->sc.output_width == 0 388 if(!this->m_show_video || frame->sc.output_width == 0
389 || frame->sc.output_height== 0) 389 || frame->sc.output_height== 0)
390 return; 390 return;
391 391
392 /* Alpha Blend here */ 392 /* Alpha Blend here */
393 if (overlay->rle) { 393 if (overlay->rle) {
394 if( !overlay->rgb_clut || !overlay->clip_rgb_clut) 394 if( !overlay->rgb_clut || !overlay->clip_rgb_clut)
395 null_overlay_clut_yuv2rgb(this,overlay,frame); 395 null_overlay_clut_yuv2rgb(this,overlay,frame);
396 396
397 switch(this->bpp) { 397 switch(this->bpp) {
398 case 16: 398 case 16:
399 blend_rgb16( (uint8_t *)frame->data, overlay, 399 blend_rgb16( (uint8_t *)frame->data, overlay,
400 frame->sc.output_width, frame->sc.output_height, 400 frame->sc.output_width, frame->sc.output_height,
401 frame->sc.delivered_width, frame->sc.delivered_height); 401 frame->sc.delivered_width, frame->sc.delivered_height);
402 break; 402 break;
403 case 24: 403 case 24:
404 blend_rgb24( (uint8_t *)frame->data, overlay, 404 blend_rgb24( (uint8_t *)frame->data, overlay,
405 frame->sc.output_width, frame->sc.output_height, 405 frame->sc.output_width, frame->sc.output_height,
406 frame->sc.delivered_width, frame->sc.delivered_height); 406 frame->sc.delivered_width, frame->sc.delivered_height);
407 break; 407 break;
408 case 32: 408 case 32:
409 blend_rgb32( (uint8_t *)frame->data, overlay, 409 blend_rgb32( (uint8_t *)frame->data, overlay,
410 frame->sc.output_width, frame->sc.output_height, 410 frame->sc.output_width, frame->sc.output_height,
411 frame->sc.delivered_width, frame->sc.delivered_height); 411 frame->sc.delivered_width, frame->sc.delivered_height);
412 break; 412 break;
413 default: 413 default:
414 /* It should never get here */ 414 /* It should never get here */
415 break; 415 break;
416 } 416 }
417 } 417 }
418} 418}
419 419
420 420
421static int null_get_property( xine_vo_driver_t* self, 421static int null_get_property( vo_driver_t* self,
422 int property ){ 422 int property ){
423 return 0; 423 return 0;
424} 424}
425static int null_set_property( xine_vo_driver_t* self, 425static int null_set_property( vo_driver_t* self,
426 int property, 426 int property,
427 int value ){ 427 int value ){
428 return value; 428 return value;
429} 429}
430static void null_get_property_min_max( xine_vo_driver_t* self, 430static void null_get_property_min_max( vo_driver_t* self,
431 int property, int *min, 431 int property, int *min,
432 int *max ){ 432 int *max ){
433 *max = 0; 433 *max = 0;
434 *min = 0; 434 *min = 0;
435} 435}
436static int null_gui_data_exchange( xine_vo_driver_t* self, 436static int null_gui_data_exchange( vo_driver_t* self,
437 int data_type, 437 int data_type,
438 void *data ){ 438 void *data ){
439 return 0; 439 return 0;
440} 440}
441 441
442static void null_dispose ( xine_vo_driver_t* self ){ 442static void null_dispose ( vo_driver_t* self ){
443 null_driver_t* this = (null_driver_t*)self; 443 null_driver_t* this = (null_driver_t*)self;
444 free ( this ); 444 free ( this );
445} 445}
446static int null_redraw_needed( xine_vo_driver_t* self ){ 446static int null_redraw_needed( vo_driver_t* self ){
447 return 0; 447 return 0;
448} 448}
449 449
450 450
451xine_vo_driver_t* init_video_out_plugin( config_values_t* conf, 451xine_vo_driver_t* init_video_out_plugin( xine_t *xine,
452 void* video ){ 452 void* video, display_xine_frame_t frameDisplayFunc, void *userData ){
453 null_driver_t *vo; 453 null_driver_t *vo;
454 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); 454 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) );
455 455
456 /* memset? */ 456 /* memset? */
457 memset(vo,0, sizeof(null_driver_t ) ); 457 memset(vo,0, sizeof(null_driver_t ) );
458 458
459 vo_scale_init (&vo->sc, 0, 0); 459 vo_scale_init (&vo->sc, 0, 0, xine->config);
460 460
461 vo->sc.gui_pixel_aspect = 1.0; 461 vo->sc.gui_pixel_aspect = 1.0;
462 462
463 vo->m_show_video = 0; // false 463 vo->m_show_video = 0; // false
464 vo->m_video_fullscreen = 0; 464 vo->m_video_fullscreen = 0;
465 vo->m_is_scaling = 0; 465 vo->m_is_scaling = 0;
466 vo->display_ratio = 1.0; 466 vo->display_ratio = 1.0;
467 vo->gui_width = 16; 467 vo->gui_width = 16;
468 vo->gui_height = 8; 468 vo->gui_height = 8;
469 vo->frameDis = NULL; 469 vo->frameDis = NULL;
470 470
471 /* install callback handlers*/ 471 /* install callback handlers*/
472 vo->vo_driver.get_capabilities = null_get_capabilities; 472 vo->vo_driver.get_capabilities = null_get_capabilities;
473 vo->vo_driver.alloc_frame = null_alloc_frame; 473 vo->vo_driver.alloc_frame = null_alloc_frame;
474 vo->vo_driver.update_frame_format = null_update_frame_format; 474 vo->vo_driver.update_frame_format = null_update_frame_format;
475 vo->vo_driver.display_frame = null_display_frame; 475 vo->vo_driver.display_frame = null_display_frame;
476 vo->vo_driver.overlay_blend = null_overlay_blend; 476 vo->vo_driver.overlay_blend = null_overlay_blend;
477 vo->vo_driver.get_property = null_get_property; 477 vo->vo_driver.get_property = null_get_property;
478 vo->vo_driver.set_property = null_set_property; 478 vo->vo_driver.set_property = null_set_property;
479 vo->vo_driver.get_property_min_max = null_get_property_min_max; 479 vo->vo_driver.get_property_min_max = null_get_property_min_max;
480 vo->vo_driver.gui_data_exchange = null_gui_data_exchange; 480 vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
481 vo->vo_driver.dispose = null_dispose; 481 vo->vo_driver.dispose = null_dispose;
482 vo->vo_driver.redraw_needed = null_redraw_needed; 482 vo->vo_driver.redraw_needed = null_redraw_needed;
483 483
484 484
485 /* capabilities */ 485 /* capabilities */
486 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; 486 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12;
487 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, 487 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap,
488 vo->yuv2rgb_cmap); 488 vo->yuv2rgb_cmap);
489 489
490 return ( xine_vo_driver_t*) vo; 490 vo->caller = userData;
491 vo->frameDis = frameDisplayFunc;
492
493 /* return ( vo_driver_t*) vo; */
494 return vo_new_port( xine, ( vo_driver_t* )vo );
491} 495}
492 496
493#if 0 497#if 0
494static vo_info_t vo_info_null = { 498static vo_info_t vo_info_null = {
495 5, 499 5,
496 XINE_VISUAL_TYPE_FB 500 XINE_VISUAL_TYPE_FB
497}; 501};
498 502
499vo_info_t *get_video_out_plugin_info(){ 503vo_info_t *get_video_out_plugin_info(){
500 vo_info_null.description = ("xine video output plugin using null device"); 504 vo_info_null.description = ("xine video output plugin using null device");
501 return &vo_info_null; 505 return &vo_info_null;
502} 506}
503 507
504#endif 508#endif
505 509
506/* this is special for this device */ 510/* this is special for this device */
507/** 511/**
508 * We know that we will be controled by the XINE LIB++ 512 * We know that we will be controled by the XINE LIB++
509 */ 513 */
510 514
511/** 515/**
512 * 516 *
513 */ 517 */
514int null_is_showing_video( xine_vo_driver_t* self ){ 518int null_is_showing_video( xine_vo_driver_t* self ){
515 null_driver_t* this = (null_driver_t*)self; 519 null_driver_t* this = (null_driver_t*)self->driver;
516 return this->m_show_video; 520 return this->m_show_video;
517} 521}
518void null_set_show_video( xine_vo_driver_t* self, int show ) { 522void null_set_show_video( xine_vo_driver_t* self, int show ) {
519 ((null_driver_t*)self)->m_show_video = show; 523 ((null_driver_t*)self->driver)->m_show_video = show;
520} 524}
521 525
522int null_is_fullscreen( xine_vo_driver_t* self ){ 526int null_is_fullscreen( xine_vo_driver_t* self ){
523 return ((null_driver_t*)self)->m_video_fullscreen; 527 return ((null_driver_t*)self->driver)->m_video_fullscreen;
524} 528}
525void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ 529void null_set_fullscreen( xine_vo_driver_t* self, int screen ){
526 ((null_driver_t*)self)->m_video_fullscreen = screen; 530 ((null_driver_t*)self->driver)->m_video_fullscreen = screen;
527} 531}
528int null_is_scaling( xine_vo_driver_t* self ){ 532int null_is_scaling( xine_vo_driver_t* self ){
529 return ((null_driver_t*)self)->m_is_scaling; 533 return ((null_driver_t*)self->driver)->m_is_scaling;
530} 534}
531 535
532void null_set_videoGamma( xine_vo_driver_t* self , int value ) { 536void null_set_videoGamma( xine_vo_driver_t* self , int value ) {
533 ((null_driver_t*) self) ->yuv2rgb_gamma = value; 537 ((null_driver_t*) self->driver) ->yuv2rgb_gamma = value;
534 ((null_driver_t*) self) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value ); 538 ((null_driver_t*) self->driver) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value );
535} 539}
536 540
537void null_set_scaling( xine_vo_driver_t* self, int scale ) { 541void null_set_scaling( xine_vo_driver_t* self, int scale ) {
538 ((null_driver_t*)self)->m_is_scaling = scale; 542 ((null_driver_t*)self->driver)->m_is_scaling = scale;
539} 543}
540 544
541void null_set_gui_width( xine_vo_driver_t* self, int width ) { 545void null_set_gui_width( xine_vo_driver_t* self, int width ) {
542 ((null_driver_t*)self)->gui_width = width; 546 ((null_driver_t*)self->driver)->gui_width = width;
543} 547}
544void null_set_gui_height( xine_vo_driver_t* self, int height ) { 548void null_set_gui_height( xine_vo_driver_t* self, int height ) {
545 ((null_driver_t*)self)->gui_height = height; 549 ((null_driver_t*)self->driver)->gui_height = height;
546} 550}
547 551
548 552
549void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) { 553void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) {
550 null_driver_t* this = (null_driver_t*)self; 554 null_driver_t* this = (null_driver_t*)self->driver;
551 555
552 this->bytes_per_pixel = (depth + 7 ) / 8; 556 this->bytes_per_pixel = (depth + 7 ) / 8;
553 this->bpp = this->bytes_per_pixel * 8; 557 this->bpp = this->bytes_per_pixel * 8;
554 this->depth = depth; 558 this->depth = depth;
555 printf("depth %d %d\n", depth, this->bpp); 559 printf("depth %d %d\n", depth, this->bpp);
556 printf("pixeltype %d\n", rgb ); 560 printf("pixeltype %d\n", rgb );
557 switch ( this->depth ) { 561 switch ( this->depth ) {
558 case 32: 562 case 32:
559 if( rgb == 0 ) 563 if( rgb == 0 )
560 this->yuv2rgb_mode = MODE_32_RGB; 564 this->yuv2rgb_mode = MODE_32_RGB;
561 else 565 else
562 this->yuv2rgb_mode = MODE_32_BGR; 566 this->yuv2rgb_mode = MODE_32_BGR;
563 case 24: 567 case 24:
564 if( this->bpp == 32 ) { 568 if( this->bpp == 32 ) {
565 if( rgb == 0 ) { 569 if( rgb == 0 ) {
566 this->yuv2rgb_mode = MODE_32_RGB; 570 this->yuv2rgb_mode = MODE_32_RGB;
567 } else { 571 } else {
568 this->yuv2rgb_mode = MODE_32_BGR; 572 this->yuv2rgb_mode = MODE_32_BGR;
569 } 573 }
570 }else{ 574 }else{
571 if( rgb == 0 ) 575 if( rgb == 0 )
572 this->yuv2rgb_mode = MODE_24_RGB; 576 this->yuv2rgb_mode = MODE_24_RGB;
573 else 577 else
574 this->yuv2rgb_mode = MODE_24_BGR; 578 this->yuv2rgb_mode = MODE_24_BGR;
575 }; 579 };
576 break; 580 break;
577 case 16: 581 case 16:
578 if( rgb == 0 ) { 582 if( rgb == 0 ) {
579 this->yuv2rgb_mode = MODE_16_RGB; 583 this->yuv2rgb_mode = MODE_16_RGB;
580 } else { 584 } else {
581 this->yuv2rgb_mode = MODE_16_BGR; 585 this->yuv2rgb_mode = MODE_16_BGR;
582 } 586 }
583 break; 587 break;
584 case 15: 588 case 15:
585 if( rgb == 0 ) { 589 if( rgb == 0 ) {
586 this->yuv2rgb_mode = MODE_15_RGB; 590 this->yuv2rgb_mode = MODE_15_RGB;
587 } else { 591 } else {
588 this->yuv2rgb_mode = MODE_15_BGR; 592 this->yuv2rgb_mode = MODE_15_BGR;
589 } 593 }
590 break; 594 break;
591 case 8: 595 case 8:
592 if( rgb == 0 ) { 596 if( rgb == 0 ) {
593 this->yuv2rgb_mode = MODE_8_RGB; 597 this->yuv2rgb_mode = MODE_8_RGB;
594 } else { 598 } else {
595 this->yuv2rgb_mode = MODE_8_BGR; 599 this->yuv2rgb_mode = MODE_8_BGR;
596 } 600 }
597 break; 601 break;
598 }; 602 };
599 //free(this->yuv2rgb_factory ); 603 //free(this->yuv2rgb_factory );
600 // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap, 604 // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap,
601 // this->yuv2rgb_cmap); 605 // this->yuv2rgb_cmap);
602}; 606};
603 607
604void null_display_handler( xine_vo_driver_t* self, display_xine_frame_t t, 608void null_display_handler( xine_vo_driver_t* self, display_xine_frame_t t,
605 void* user_data ) { 609 void* user_data ) {
606 null_driver_t* this = (null_driver_t*) self; 610 null_driver_t* this = (null_driver_t*) self->driver;
607 this->caller = user_data; 611 this->caller = user_data;
608 this->frameDis = t; 612 this->frameDis = t;
609} 613}
610 614