-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 65 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 542 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opieplayer2.pro | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 81 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.h | 13 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/zeckeplayer.pro | 2 |
10 files changed, 659 insertions, 76 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 3f2eea6..aa37cd7 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -1,154 +1,209 @@ | |||
1 | 1 | ||
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | //#include <qpe/qpeapplication.h> | 4 | //#include <qpe/qpeapplication.h> |
5 | #include <qimage.h> | ||
6 | #include <qpe/resource.h> | ||
5 | 7 | ||
6 | #include <qfile.h> | 8 | #include <qfile.h> |
7 | 9 | ||
10 | #include <qgfx_qws.h> | ||
11 | #include <qdirectpainter_qws.h> | ||
12 | |||
8 | #include "xinevideowidget.h" | 13 | #include "xinevideowidget.h" |
9 | #include "frame.h" | 14 | #include "frame.h" |
10 | #include "lib.h" | 15 | #include "lib.h" |
11 | 16 | ||
17 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | ||
18 | int width, int height,int bytes ); | ||
12 | 19 | ||
13 | extern "C" { | 20 | extern "C" { |
14 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); | 21 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); |
15 | int null_is_showing_video( vo_driver_t* self ); | 22 | int null_is_showing_video( vo_driver_t* self ); |
16 | void null_set_show_video( vo_driver_t* self, int show ); | 23 | void null_set_show_video( vo_driver_t* self, int show ); |
17 | int null_is_fullscreen( vo_driver_t* self ); | 24 | int null_is_fullscreen( vo_driver_t* self ); |
18 | void null_set_fullscreen( vo_driver_t* self, int screen ); | 25 | void null_set_fullscreen( vo_driver_t* self, int screen ); |
19 | int null_is_scaling( vo_driver_t* self ); | 26 | int null_is_scaling( vo_driver_t* self ); |
20 | void null_set_scaling( vo_driver_t* self, int scale ); | 27 | void null_set_scaling( vo_driver_t* self, int scale ); |
21 | 28 | void null_set_gui_width( vo_driver_t* self, int width ); | |
29 | void null_set_gui_height( vo_driver_t* self, int height ); | ||
30 | void null_set_mode( vo_driver_t* self, int depth, int rgb ); | ||
31 | void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data); | ||
22 | } | 32 | } |
23 | 33 | ||
24 | using namespace XINE; | 34 | using namespace XINE; |
25 | 35 | ||
26 | Lib::Lib(XineVideoWidget* /*widget*/) { | 36 | Lib::Lib(XineVideoWidget* widget) { |
37 | m_video = false; | ||
38 | m_wid = widget; | ||
27 | printf("Lib"); | 39 | printf("Lib"); |
28 | QCString str( getenv("HOME") ); | 40 | QCString str( getenv("HOME") ); |
29 | str += "/Settings/opiexine.cf"; | 41 | str += "/Settings/opiexine.cf"; |
30 | // get the configuration | 42 | // get the configuration |
31 | m_config = xine_config_file_init( str.data() ); | 43 | m_config = xine_config_file_init( str.data() ); |
32 | 44 | ||
33 | // allocate oss for sound | 45 | // allocate oss for sound |
34 | // and fb for framebuffer | 46 | // and fb for framebuffer |
35 | m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; | 47 | m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; |
36 | if (m_audioOutput == NULL ) | 48 | if (m_audioOutput == NULL ) |
37 | printf("Failure\n"); | 49 | printf("Failure\n"); |
38 | else | 50 | else |
39 | printf("Success\n"); | 51 | printf("Success\n"); |
40 | 52 | ||
41 | 53 | ||
42 | // test code | 54 | // test code |
43 | m_videoOutput = xine_load_video_output_plugin(m_config, "fb", | 55 | /* m_videoOutput = xine_load_video_output_plugin(m_config, "fb", |
44 | VISUAL_TYPE_FB, | 56 | VISUAL_TYPE_FB, |
45 | 0 ); | 57 | 0 ); |
58 | */ | ||
46 | 59 | ||
47 | char** files = xine_list_video_output_plugins(3); | 60 | char** files = xine_list_video_output_plugins(3); |
48 | char* out; | 61 | char* out; |
49 | int i = 0; | 62 | int i = 0; |
50 | while ( ( out = files[i] ) != 0 ) { | 63 | while ( ( out = files[i] ) != 0 ) { |
51 | printf("Audio %s\n", out ); | 64 | printf("Video %s\n", out ); |
52 | i++; | 65 | i++; |
53 | } | 66 | } |
54 | // m_xine = xine_init( m_videoOutput, | 67 | // m_xine = xine_init( m_videoOutput, |
55 | // m_audioOutput, | 68 | // m_audioOutput, |
56 | // m_config ); | 69 | // m_config ); |
57 | // test loading | 70 | // test loading |
58 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 71 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
72 | if (m_wid != 0 ) { | ||
73 | printf("!0\n" ); | ||
74 | ::null_set_gui_width( m_videoOutput, m_wid->image()->width() ); | ||
75 | ::null_set_gui_height(m_videoOutput, m_wid->image()->height() ); | ||
76 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | ||
77 | m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; | ||
78 | QImage image = Resource::loadImage("SoundPlayer"); | ||
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(); | ||
83 | } | ||
84 | null_display_handler( m_videoOutput, | ||
85 | xine_display_frame, | ||
86 | this ); | ||
87 | |||
59 | m_xine = xine_init( m_videoOutput, | 88 | m_xine = xine_init( m_videoOutput, |
60 | m_audioOutput, m_config ); | 89 | m_audioOutput, m_config ); |
61 | // install the event handler | 90 | // install the event handler |
62 | xine_register_event_listener( m_xine, xine_event_handler, this ); | 91 | xine_register_event_listener( m_xine, xine_event_handler, this ); |
63 | } | 92 | } |
64 | 93 | ||
65 | Lib::~Lib() { | 94 | Lib::~Lib() { |
66 | delete m_config; | 95 | delete m_config; |
67 | xine_remove_event_listener( m_xine, xine_event_handler ); | 96 | xine_remove_event_listener( m_xine, xine_event_handler ); |
68 | xine_exit( m_xine ); | 97 | xine_exit( m_xine ); |
69 | delete m_videoOutput; | 98 | delete m_videoOutput; |
70 | //delete m_audioOutput; | 99 | //delete m_audioOutput; |
71 | 100 | ||
72 | } | 101 | } |
73 | 102 | ||
74 | QCString Lib::version() { | 103 | QCString Lib::version() { |
75 | QCString str( xine_get_str_version() ); | 104 | QCString str( xine_get_str_version() ); |
76 | return str; | 105 | return str; |
77 | }; | 106 | }; |
78 | 107 | ||
79 | int Lib::majorVersion() { | 108 | int Lib::majorVersion() { |
80 | return xine_get_major_version(); | 109 | return xine_get_major_version(); |
81 | } | 110 | } |
82 | int Lib::minorVersion() { | 111 | int Lib::minorVersion() { |
83 | return xine_get_minor_version(); | 112 | return xine_get_minor_version(); |
84 | }; | 113 | }; |
85 | 114 | ||
86 | int Lib::subVersion() { | 115 | int Lib::subVersion() { |
87 | return xine_get_sub_version(); | 116 | return xine_get_sub_version(); |
88 | } | 117 | } |
89 | int Lib::play( const QString& fileName, | 118 | int Lib::play( const QString& fileName, |
90 | int startPos, | 119 | int startPos, |
91 | int start_time ) { | 120 | int start_time ) { |
92 | QString str = fileName; | 121 | QString str = fileName.stripWhiteSpace(); |
122 | //workaround OpiePlayer bug | ||
123 | if (str.right(1) == QString::fromLatin1("/") ) | ||
124 | str = str.mid( str.length() -1 ); | ||
93 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), | 125 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), |
94 | startPos, start_time); | 126 | startPos, start_time); |
95 | } | 127 | } |
96 | void Lib::stop() { | 128 | void Lib::stop() { |
97 | xine_stop(m_xine ); | 129 | xine_stop(m_xine ); |
98 | } | 130 | } |
99 | void Lib::pause(){ | 131 | void Lib::pause(){ |
100 | xine_set_speed( m_xine, SPEED_PAUSE ); | 132 | xine_set_speed( m_xine, SPEED_PAUSE ); |
101 | } | 133 | } |
102 | int Lib::speed() { | 134 | int Lib::speed() { |
103 | return xine_get_speed( m_xine ); | 135 | return xine_get_speed( m_xine ); |
104 | } | 136 | } |
105 | void Lib::setSpeed( int speed ) { | 137 | void Lib::setSpeed( int speed ) { |
106 | xine_set_speed( m_xine, speed ); | 138 | xine_set_speed( m_xine, speed ); |
107 | } | 139 | } |
108 | int Lib::status(){ | 140 | int Lib::status(){ |
109 | return xine_get_status( m_xine ); | 141 | return xine_get_status( m_xine ); |
110 | } | 142 | } |
111 | int Lib::currentPosition(){ | 143 | int Lib::currentPosition(){ |
112 | return xine_get_current_position( m_xine ); | 144 | return xine_get_current_position( m_xine ); |
113 | } | 145 | } |
114 | int Lib::currentTime() { | 146 | int Lib::currentTime() { |
115 | return xine_get_current_time( m_xine ); | 147 | return xine_get_current_time( m_xine ); |
116 | }; | 148 | }; |
117 | int Lib::length() { | 149 | int Lib::length() { |
118 | return xine_get_stream_length( m_xine ); | 150 | return xine_get_stream_length( m_xine ); |
119 | } | 151 | } |
120 | bool Lib::isSeekable() { | 152 | bool Lib::isSeekable() { |
121 | return xine_is_stream_seekable(m_xine); | 153 | return xine_is_stream_seekable(m_xine); |
122 | } | 154 | } |
123 | Frame Lib::currentFrame() { | 155 | Frame Lib::currentFrame() { |
124 | Frame frame; | 156 | Frame frame; |
125 | return frame; | 157 | return frame; |
126 | }; | 158 | }; |
127 | int Lib::error() { | 159 | int Lib::error() { |
128 | return xine_get_error( m_xine ); | 160 | return xine_get_error( m_xine ); |
129 | }; | 161 | }; |
130 | void Lib::handleXineEvent( xine_event_t* t ) { | 162 | void Lib::handleXineEvent( xine_event_t* t ) { |
131 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) | 163 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) |
132 | emit stopped(); | 164 | emit stopped(); |
133 | } | 165 | } |
134 | void Lib::setShowVideo( bool video ) { | 166 | void Lib::setShowVideo( bool video ) { |
167 | m_video = video; | ||
135 | ::null_set_show_video( m_videoOutput, video ); | 168 | ::null_set_show_video( m_videoOutput, video ); |
136 | } | 169 | } |
137 | bool Lib::isShowingVideo() { | 170 | bool Lib::isShowingVideo() { |
138 | return ::null_is_showing_video( m_videoOutput ); | 171 | return ::null_is_showing_video( m_videoOutput ); |
139 | } | 172 | } |
140 | void Lib::showVideoFullScreen( bool fullScreen ) { | 173 | void Lib::showVideoFullScreen( bool fullScreen ) { |
141 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | 174 | ::null_set_fullscreen( m_videoOutput, fullScreen ); |
142 | } | 175 | } |
143 | bool Lib::isVideoFullScreen() { | 176 | bool Lib::isVideoFullScreen() { |
144 | return ::null_is_fullscreen( m_videoOutput ); | 177 | return ::null_is_fullscreen( m_videoOutput ); |
145 | } | 178 | } |
146 | void Lib::setScaling( bool scale ) { | 179 | void Lib::setScaling( bool scale ) { |
147 | ::null_set_scaling( m_videoOutput, scale ); | 180 | ::null_set_scaling( m_videoOutput, scale ); |
148 | } | 181 | } |
149 | bool Lib::isScaling() { | 182 | bool Lib::isScaling() { |
150 | return ::null_is_scaling( m_videoOutput ); | 183 | return ::null_is_scaling( m_videoOutput ); |
151 | } | 184 | } |
152 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | 185 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { |
153 | ((Lib*)user_data)->handleXineEvent( t ); | 186 | ((Lib*)user_data)->handleXineEvent( t ); |
154 | } | 187 | } |
188 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | ||
189 | int width, int height, int bytes ) { | ||
190 | printf("display x frame"); | ||
191 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); | ||
192 | printf("displayed x frame\n"); | ||
193 | } | ||
194 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | ||
195 | if (!m_video ) { | ||
196 | qWarning("not showing video now"); | ||
197 | return; | ||
198 | } | ||
199 | qWarning("called draw frame %d %d", width, height); | ||
200 | |||
201 | QSize size = m_wid->size(); | ||
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(); | ||
208 | |||
209 | } | ||
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 1d0d3af..d568a32 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -71,37 +71,43 @@ namespace XINE { | |||
71 | bool isVideoFullScreen()/*const*/ ; | 71 | bool isVideoFullScreen()/*const*/ ; |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * | 74 | * |
75 | */ | 75 | */ |
76 | bool isScaling(); | 76 | bool isScaling(); |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * | 79 | * |
80 | */ | 80 | */ |
81 | void setScaling( bool ); | 81 | void setScaling( bool ); |
82 | /** | 82 | /** |
83 | * test | 83 | * test |
84 | */ | 84 | */ |
85 | Frame currentFrame()/*const*/; | 85 | Frame currentFrame()/*const*/; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * Returns the error code | 88 | * Returns the error code |
89 | */ | 89 | */ |
90 | int error() /*const*/; | 90 | int error() /*const*/; |
91 | 91 | ||
92 | signals: | 92 | signals: |
93 | void stopped(); | 93 | void stopped(); |
94 | private: | 94 | private: |
95 | int m_bytes_per_pixel; | ||
96 | bool m_video:1; | ||
97 | XineVideoWidget *m_wid; | ||
95 | xine_t *m_xine; | 98 | xine_t *m_xine; |
96 | config_values_t *m_config; | 99 | config_values_t *m_config; |
97 | vo_driver_t *m_videoOutput; | 100 | vo_driver_t *m_videoOutput; |
98 | ao_driver_t* m_audioOutput; | 101 | ao_driver_t* m_audioOutput; |
99 | 102 | ||
100 | void handleXineEvent( xine_event_t* t ); | 103 | void handleXineEvent( xine_event_t* t ); |
104 | void drawFrame( uint8_t* frame, int width, int height, int bytes ); | ||
101 | // C -> C++ bridge for the event system | 105 | // C -> C++ bridge for the event system |
102 | static void xine_event_handler( void* user_data, xine_event_t* t); | 106 | static void xine_event_handler( void* user_data, xine_event_t* t); |
107 | static void xine_display_frame( void* user_data, uint8_t* frame , | ||
108 | int width, int height, int bytes ); | ||
103 | }; | 109 | }; |
104 | }; | 110 | }; |
105 | 111 | ||
106 | 112 | ||
107 | #endif | 113 | #endif |
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index 8badb7b..e50d7b5 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c | |||
@@ -1,240 +1,666 @@ | |||
1 | 1 | ||
2 | /*#include <xine.h>*/ | 2 | /*#include <xine.h>*/ |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <stdio.h> | 4 | #include <stdio.h> |
5 | 5 | ||
6 | #include <math.h> | ||
7 | |||
6 | #include <xine/video_out.h> | 8 | #include <xine/video_out.h> |
7 | #include <xine/xine_internal.h> | 9 | #include <xine/xine_internal.h> |
8 | #include <xine/xineutils.h> | 10 | #include <xine/xineutils.h> |
9 | #include <xine/configfile.h> | 11 | #include <xine/configfile.h> |
10 | 12 | ||
13 | #include <pthread.h> | ||
14 | #include "alphablend.h" | ||
15 | #include "yuv2rgb.h" | ||
16 | |||
17 | /* the caller for our event draw handler */ | ||
18 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | ||
19 | int width, int height,int bytes ); | ||
20 | |||
11 | typedef struct null_driver_s null_driver_t; | 21 | typedef struct null_driver_s null_driver_t; |
12 | 22 | ||
13 | struct null_driver_s { | 23 | struct null_driver_s { |
14 | vo_driver_t vo_driver; | 24 | vo_driver_t vo_driver; |
15 | uint32_t m_capabilities; | 25 | uint32_t m_capabilities; |
16 | int m_show_video; | 26 | int m_show_video; |
17 | int m_video_fullscreen; | 27 | int m_video_fullscreen; |
18 | int m_is_scaling; | 28 | int m_is_scaling; |
29 | int depth, bpp, bytes_per_pixel; | ||
30 | int yuv2rgb_mode; | ||
31 | int yuv2rgb_swap; | ||
32 | int zuv2rgb_gamma; | ||
33 | uint8_t *yuv2rgb_cmap; | ||
34 | yuv2rgb_factory_t *yuv2rgb_factory; | ||
35 | vo_overlay_t *overlay; | ||
36 | int user_ratio; | ||
37 | double output_scale_factor; | ||
38 | int last_frame_output_width; | ||
39 | int last_frame_output_height; | ||
40 | int gui_width; | ||
41 | int gui_height; | ||
42 | int gui_changed; | ||
43 | double display_ratio; | ||
44 | void* caller; | ||
45 | display_xine_frame_t frameDis; | ||
46 | |||
47 | |||
19 | }; | 48 | }; |
20 | typedef struct opie_frame_s opie_frame_t; | 49 | typedef struct opie_frame_s opie_frame_t; |
21 | struct opie_frame_s { | 50 | struct opie_frame_s { |
22 | vo_frame_t frame; | 51 | vo_frame_t frame; |
23 | char* name; | 52 | char* name; |
24 | int version; | 53 | int version; |
25 | int m_width; | 54 | int width; |
26 | int m_height; | 55 | int height; |
27 | int m_ratio_code; | 56 | int ratio_code; |
28 | int format; | 57 | int format; |
29 | int flags; | 58 | int flags; |
30 | int user_ratio; | 59 | int user_ratio; |
31 | 60 | ||
61 | double ratio_factor; | ||
32 | int ideal_width; | 62 | int ideal_width; |
33 | int ideal_height; | 63 | int ideal_height; |
34 | int output_width, output_height; | 64 | int output_width, output_height; |
35 | uint8_t *chunk[3]; | 65 | uint8_t *chunk[3]; |
66 | |||
67 | yuv2rgb_t *yuv2rgb; | ||
36 | uint8_t *rgb_dst; | 68 | uint8_t *rgb_dst; |
37 | int yuv_stride; | 69 | int yuv_stride; |
38 | int stripe_height, stripe_inc; | 70 | int stripe_height, stripe_inc; |
39 | 71 | ||
40 | int bytes_per_line; | 72 | int bytes_per_line; |
41 | uint8_t *data; | 73 | uint8_t *data; |
42 | 74 | ||
43 | 75 | int show_video; | |
44 | null_driver_t *output; | 76 | null_driver_t *output; |
45 | }; | 77 | }; |
46 | 78 | ||
47 | static uint32_t null_get_capabilities(vo_driver_t *self ){ | 79 | static uint32_t null_get_capabilities(vo_driver_t *self ){ |
48 | null_driver_t* this = (null_driver_t*)self; | 80 | null_driver_t* this = (null_driver_t*)self; |
49 | printf("capabilities\n"); | 81 | printf("capabilities\n"); |
50 | return this->m_capabilities; | 82 | return this->m_capabilities; |
51 | } | 83 | } |
52 | 84 | ||
85 | static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { | ||
86 | opie_frame_t *frame = (opie_frame_t *) vo_img ; | ||
87 | printf("frame copy\n"); | ||
88 | if(!frame->show_video ){ printf("no video\n"); return; } // no video | ||
89 | |||
90 | if (frame->format == IMGFMT_YV12) { | ||
91 | frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, | ||
92 | src[0], src[1], src[2]); | ||
93 | } else { | ||
94 | |||
95 | frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, | ||
96 | src[0]); | ||
97 | |||
98 | } | ||
99 | |||
100 | frame->rgb_dst += frame->stripe_inc; | ||
101 | printf("returning\n"); | ||
102 | } | ||
103 | |||
104 | static void null_frame_field (vo_frame_t *vo_img, int which_field) { | ||
105 | |||
106 | opie_frame_t *frame = (opie_frame_t *) vo_img ; | ||
107 | printf("field\n\n"); | ||
108 | |||
109 | switch (which_field) { | ||
110 | case VO_TOP_FIELD: | ||
111 | frame->rgb_dst = (uint8_t *)frame->data; | ||
112 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; | ||
113 | break; | ||
114 | case VO_BOTTOM_FIELD: | ||
115 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; | ||
116 | frame->stripe_inc = 2*frame->stripe_height * frame->bytes_per_line; | ||
117 | break; | ||
118 | case VO_BOTH_FIELDS: | ||
119 | frame->rgb_dst = (uint8_t *)frame->data; | ||
120 | break; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | |||
53 | /* take care of the frame*/ | 125 | /* take care of the frame*/ |
54 | static void null_frame_dispose( vo_frame_t* vo_img){ | 126 | static void null_frame_dispose( vo_frame_t* vo_img){ |
55 | opie_frame_t* frame = (opie_frame_t*)vo_img; | 127 | opie_frame_t* frame = (opie_frame_t*)vo_img; |
56 | printf("frame_dispose\n"); | 128 | printf("frame_dispose\n"); |
129 | if( frame->data ) | ||
130 | free( frame->data ); | ||
57 | free (frame); | 131 | free (frame); |
58 | } | 132 | } |
59 | static void null_frame_field( vo_frame_t* frame, int inti ){ | ||
60 | printf("frame_field\n"); | ||
61 | /* not needed */ | ||
62 | } | ||
63 | 133 | ||
64 | /* end take care of frames*/ | 134 | /* end take care of frames*/ |
65 | 135 | ||
66 | static vo_frame_t* null_alloc_frame( vo_driver_t* self ){ | 136 | static vo_frame_t* null_alloc_frame( vo_driver_t* self ){ |
67 | null_driver_t* this = (null_driver_t*)self; | 137 | null_driver_t* this = (null_driver_t*)self; |
68 | opie_frame_t* frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); | 138 | opie_frame_t* frame; |
139 | frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) ); | ||
140 | |||
69 | memset( frame, 0, sizeof( opie_frame_t) ); | 141 | memset( frame, 0, sizeof( opie_frame_t) ); |
142 | pthread_mutex_init (&frame->frame.mutex, NULL); | ||
143 | |||
70 | printf("alloc_frame\n"); | 144 | printf("alloc_frame\n"); |
71 | frame->name = "opie\0"; | 145 | frame->name = "opie\0"; |
72 | frame->version = 1; | 146 | frame->version = 1; |
73 | frame->output = this; | 147 | frame->output = this; |
74 | 148 | frame->show_video = this->m_show_video; | |
75 | /* initialize the frame*/ | 149 | /* initialize the frame*/ |
76 | frame->frame.driver = self; | 150 | frame->frame.driver = self; |
77 | /*frame.frame.free = null_frame_free;*/ | 151 | /*frame.frame.free = null_frame_free;*/ |
78 | frame->frame.copy = NULL; | 152 | frame->frame.copy = null_frame_copy; |
79 | frame->frame.field = null_frame_field; | 153 | frame->frame.field = null_frame_field; |
80 | frame->frame.dispose = null_frame_dispose; | 154 | frame->frame.dispose = null_frame_dispose; |
81 | 155 | frame->yuv2rgb = 0; | |
156 | /* | ||
157 | * colorspace converter for this frame | ||
158 | */ | ||
159 | frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); | ||
160 | |||
82 | 161 | ||
83 | return (vo_frame_t*) frame; | 162 | return (vo_frame_t*) frame; |
84 | } | 163 | } |
164 | |||
165 | // size specific | ||
166 | static void null_compute_ideal_size (null_driver_t *this, opie_frame_t *frame) { | ||
167 | |||
168 | if (!this->m_is_scaling || !this->m_show_video) { | ||
169 | printf("Not scaling\n"); | ||
170 | frame->ideal_width = frame->width; | ||
171 | frame->ideal_height = frame->height; | ||
172 | frame->ratio_factor = 1.0; | ||
173 | |||
174 | } else { | ||
175 | |||
176 | double image_ratio, desired_ratio, corr_factor; | ||
177 | |||
178 | image_ratio = (double) frame->width / (double) frame->height; | ||
179 | |||
180 | switch (frame->user_ratio) { | ||
181 | case ASPECT_AUTO: | ||
182 | switch (frame->ratio_code) { | ||
183 | case XINE_ASPECT_RATIO_ANAMORPHIC: /* anamorphic */ | ||
184 | desired_ratio = 16.0 /9.0; | ||
185 | break; | ||
186 | case XINE_ASPECT_RATIO_211_1: /* 2.11:1 */ | ||
187 | desired_ratio = 2.11/1.0; | ||
188 | break; | ||
189 | case XINE_ASPECT_RATIO_SQUARE: /* square pels */ | ||
190 | case XINE_ASPECT_RATIO_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */ | ||
191 | desired_ratio = image_ratio; | ||
192 | break; | ||
193 | case 0: /* forbidden -> 4:3 */ | ||
194 | printf ("video_out_fb: invalid ratio, using 4:3\n"); | ||
195 | default: | ||
196 | printf ("video_out_fb: unknown aspect ratio (%d) in stream => using 4:3\n", | ||
197 | frame->ratio_code); | ||
198 | case XINE_ASPECT_RATIO_4_3: /* 4:3 */ | ||
199 | desired_ratio = 4.0 / 3.0; | ||
200 | break; | ||
201 | } | ||
202 | break; | ||
203 | case ASPECT_ANAMORPHIC: | ||
204 | desired_ratio = 16.0 / 9.0; | ||
205 | break; | ||
206 | case ASPECT_DVB: | ||
207 | desired_ratio = 2.0 / 1.0; | ||
208 | break; | ||
209 | case ASPECT_SQUARE: | ||
210 | desired_ratio = image_ratio; | ||
211 | break; | ||
212 | case ASPECT_FULL: | ||
213 | default: | ||
214 | desired_ratio = 4.0 / 3.0; | ||
215 | } | ||
216 | |||
217 | frame->ratio_factor = this->display_ratio * desired_ratio; | ||
218 | |||
219 | corr_factor = frame->ratio_factor / image_ratio ; | ||
220 | |||
221 | if (fabs(corr_factor - 1.0) < 0.005) { | ||
222 | frame->ideal_width = frame->width; | ||
223 | frame->ideal_height = frame->height; | ||
224 | |||
225 | } else { | ||
226 | |||
227 | if (corr_factor >= 1.0) { | ||
228 | frame->ideal_width = frame->width * corr_factor + 0.5; | ||
229 | frame->ideal_height = frame->height; | ||
230 | } else { | ||
231 | frame->ideal_width = frame->width; | ||
232 | frame->ideal_height = frame->height / corr_factor + 0.5; | ||
233 | } | ||
234 | |||
235 | } | ||
236 | } | ||
237 | printf("return from helper\n"); | ||
238 | } | ||
239 | |||
240 | static void null_compute_rgb_size (null_driver_t *this, opie_frame_t *frame) { | ||
241 | |||
242 | double x_factor, y_factor; | ||
243 | |||
244 | /* | ||
245 | * make the frame fit into the given destination area | ||
246 | */ | ||
247 | |||
248 | x_factor = (double) this->gui_width / (double) frame->ideal_width; | ||
249 | y_factor = (double) this->gui_height / (double) frame->ideal_height; | ||
250 | |||
251 | if ( x_factor < y_factor ) { | ||
252 | frame->output_width = (double) frame->ideal_width * x_factor ; | ||
253 | frame->output_height = (double) frame->ideal_height * x_factor ; | ||
254 | } else { | ||
255 | frame->output_width = (double) frame->ideal_width * y_factor ; | ||
256 | frame->output_height = (double) frame->ideal_height * y_factor ; | ||
257 | } | ||
258 | |||
259 | #define LOG 1 | ||
260 | #ifdef LOG | ||
261 | printf("video_out_fb: frame source %d x %d => screen output %d x %d%s\n", | ||
262 | frame->width, frame->height, | ||
263 | frame->output_width, frame->output_height, | ||
264 | ( frame->width != frame->output_width | ||
265 | || frame->height != frame->output_height | ||
266 | ? ", software scaling" | ||
267 | : "" ) | ||
268 | ); | ||
269 | #endif | ||
270 | } | ||
271 | |||
272 | |||
273 | // size specific | ||
274 | |||
275 | |||
85 | static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, | 276 | static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img, |
86 | uint32_t width, uint32_t height, | 277 | uint32_t width, uint32_t height, |
87 | int ratio_code, int format, int flags ){ | 278 | int ratio_code, int format, int flags ){ |
88 | null_driver_t* this = (null_driver_t*) self; | 279 | null_driver_t* this = (null_driver_t*) self; |
89 | opie_frame_t* frame = (opie_frame_t*)img; | 280 | opie_frame_t* frame = (opie_frame_t*)img; |
90 | /* not needed now */ | 281 | /* not needed now */ |
91 | printf("update_frame_format\n"); | 282 | printf("update_frame_format\n"); |
92 | printf("al crash aye?\n"); | 283 | printf("al crash aye?\n"); |
93 | 284 | ||
94 | if(frame->chunk[0] ){ | 285 | flags &= VO_BOTH_FIELDS; |
95 | free( frame->chunk[0] ); | 286 | |
96 | frame->chunk[0] = NULL; | 287 | /* find out if we need to adapt this frame */ |
97 | } | 288 | |
98 | if(frame->chunk[1] ){ | 289 | if ((width != frame->width) |
99 | free ( frame->chunk[1] ); | 290 | || (height != frame->height) |
100 | frame->chunk[1] = NULL; | 291 | || (ratio_code != frame->ratio_code) |
101 | } | 292 | || (flags != frame->flags) |
102 | if(frame->chunk[2] ){ | 293 | || (format != frame->format) |
103 | free ( frame->chunk[2] ); | 294 | || (this->user_ratio != frame->user_ratio) |
104 | frame->chunk[2] = NULL; | 295 | || this->gui_changed ) { |
105 | } | 296 | |
297 | frame->width = width; | ||
298 | frame->height = height; | ||
299 | frame->ratio_code = ratio_code; | ||
300 | frame->flags = flags; | ||
301 | frame->format = format; | ||
302 | frame->user_ratio = this->user_ratio; | ||
303 | this->gui_changed = 0; | ||
304 | frame->show_video = this->m_show_video; | ||
305 | |||
306 | |||
307 | null_compute_ideal_size (this, frame); | ||
308 | null_compute_rgb_size (this, frame); | ||
309 | |||
310 | /* | ||
311 | * (re-) allocate | ||
312 | */ | ||
313 | if( frame->data ) { | ||
314 | if(frame->chunk[0] ){ | ||
315 | free( frame->chunk[0] ); | ||
316 | frame->chunk[0] = NULL; | ||
317 | } | ||
318 | if(frame->chunk[1] ){ | ||
319 | free ( frame->chunk[1] ); | ||
320 | frame->chunk[1] = NULL; | ||
321 | } | ||
322 | if(frame->chunk[2] ){ | ||
323 | free ( frame->chunk[2] ); | ||
324 | frame->chunk[2] = NULL; | ||
325 | } | ||
326 | free ( frame->data ); | ||
327 | } | ||
328 | printf("after freeing\n"); | ||
329 | frame->data = xine_xmalloc (frame->output_width * frame->output_height * | ||
330 | this->bytes_per_pixel ); | ||
106 | 331 | ||
332 | if( format == IMGFMT_YV12 ) { | ||
333 | int image_size = width * height; /* cast ouch*/ | ||
334 | frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, | ||
335 | (void **)&frame->chunk[0] ); | ||
336 | frame->frame.base[1] = xine_xmalloc_aligned(16, image_size, | ||
337 | (void **)&frame->chunk[1] ); | ||
338 | frame->frame.base[2] = xine_xmalloc_aligned(16, image_size, | ||
339 | (void **)&frame->chunk[2] ); | ||
340 | }else{ | ||
341 | int image_size = width * height; /* cast ouch*/ | ||
342 | frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, | ||
343 | (void **)&frame->chunk[0] ); | ||
344 | frame->chunk[1] = NULL; | ||
345 | frame->chunk[2] = NULL; | ||
346 | } | ||
107 | 347 | ||
108 | if( format == IMGFMT_YV12 ) { | 348 | frame->format = format; |
109 | int image_size = width * height; /* cast ouch*/ | 349 | frame->width = width; |
110 | frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, | 350 | frame->height = height; |
111 | (void **)&frame->chunk[0] ); | 351 | |
112 | frame->frame.base[1] = xine_xmalloc_aligned(16, image_size, | 352 | frame->stripe_height = 16 * frame->output_height / frame->height; |
113 | (void **)&frame->chunk[1] ); | 353 | frame->bytes_per_line = frame->output_width * this->bytes_per_pixel; |
114 | frame->frame.base[2] = xine_xmalloc_aligned(16, image_size, | 354 | |
115 | (void **)&frame->chunk[2] ); | 355 | /* |
116 | }else{ | 356 | * set up colorspace converter |
117 | int image_size = width * height; /* cast ouch*/ | 357 | */ |
118 | frame->frame.base[0] = xine_xmalloc_aligned(16, image_size, | 358 | if(this->m_show_video ){ |
119 | (void **)&frame->chunk[0] ); | 359 | printf("showing video\n"); |
120 | frame->chunk[1] = NULL; | 360 | |
121 | frame->chunk[2] = NULL; | 361 | switch (flags) { |
362 | case VO_TOP_FIELD: | ||
363 | case VO_BOTTOM_FIELD: | ||
364 | frame->yuv2rgb->configure (frame->yuv2rgb, | ||
365 | frame->width, | ||
366 | 16, | ||
367 | frame->width*2, | ||
368 | frame->width, | ||
369 | frame->output_width, | ||
370 | frame->stripe_height, | ||
371 | frame->bytes_per_line*2); | ||
372 | frame->yuv_stride = frame->bytes_per_line*2; | ||
373 | break; | ||
374 | case VO_BOTH_FIELDS: | ||
375 | frame->yuv2rgb->configure (frame->yuv2rgb, | ||
376 | frame->width, | ||
377 | 16, | ||
378 | frame->width, | ||
379 | frame->width/2, | ||
380 | frame->output_width, | ||
381 | frame->stripe_height, | ||
382 | frame->bytes_per_line); | ||
383 | frame->yuv_stride = frame->bytes_per_line; | ||
384 | break; | ||
385 | } | ||
386 | } | ||
122 | } | 387 | } |
388 | printf("after gui changed\n"); | ||
389 | /* | ||
390 | * reset dest pointers | ||
391 | */ | ||
123 | 392 | ||
393 | if (frame->data) { | ||
394 | switch (flags) { | ||
395 | case VO_TOP_FIELD: | ||
396 | frame->rgb_dst = (uint8_t *)frame->data; | ||
397 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; | ||
398 | break; | ||
399 | case VO_BOTTOM_FIELD: | ||
400 | frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; | ||
401 | frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; | ||
402 | break; | ||
403 | case VO_BOTH_FIELDS: | ||
404 | frame->rgb_dst = (uint8_t *)frame->data; | ||
405 | frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; | ||
406 | break; | ||
407 | } | ||
408 | } | ||
409 | printf("done\n"); | ||
124 | } | 410 | } |
125 | static void null_display_frame( vo_driver_t* self, vo_frame_t *frame ){ | 411 | static void null_display_frame( vo_driver_t* self, vo_frame_t *frame_gen ){ |
412 | null_driver_t* this = (null_driver_t*) self; | ||
413 | opie_frame_t* frame = (opie_frame_t*)frame_gen; | ||
414 | display_xine_frame_t display = this->frameDis; | ||
415 | |||
126 | printf("display frame\n"); | 416 | printf("display frame\n"); |
417 | // if( this->m_show_video ) { // return if not displaying | ||
418 | printf("calling home aye\n" ); | ||
419 | if( display != NULL ) { | ||
420 | (*display)(this->caller, frame->data, | ||
421 | frame->output_width, frame->output_height, | ||
422 | this->bytes_per_pixel ); | ||
423 | printf("display done hope you enyoyed the frame"); | ||
424 | } | ||
425 | // } | ||
426 | |||
427 | frame->frame.displayed (&frame->frame); | ||
127 | } | 428 | } |
128 | static void null_overlay_blend( vo_driver_t* self, vo_frame_t* frame, | 429 | |
129 | vo_overlay_t* overlay ){ | 430 | |
130 | /* sure */ | 431 | // blending related |
432 | |||
433 | |||
434 | static void null_overlay_clut_yuv2rgb(null_driver_t *this, vo_overlay_t *overlay, | ||
435 | opie_frame_t *frame) { | ||
436 | int i; | ||
437 | clut_t* clut = (clut_t*) overlay->color; | ||
438 | if (!overlay->rgb_clut) { | ||
439 | for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { | ||
440 | *((uint32_t *)&clut[i]) = | ||
441 | frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, | ||
442 | clut[i].y, clut[i].cb, clut[i].cr); | ||
443 | } | ||
444 | overlay->rgb_clut++; | ||
445 | } | ||
446 | if (!overlay->clip_rgb_clut) { | ||
447 | clut = (clut_t*) overlay->clip_color; | ||
448 | for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { | ||
449 | *((uint32_t *)&clut[i]) = | ||
450 | frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, | ||
451 | clut[i].y, clut[i].cb, clut[i].cr); | ||
452 | } | ||
453 | overlay->clip_rgb_clut++; | ||
454 | } | ||
455 | } | ||
456 | |||
457 | static void null_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { | ||
458 | null_driver_t *this = (null_driver_t *) this_gen; | ||
459 | opie_frame_t *frame = (opie_frame_t *) frame_gen; | ||
460 | |||
461 | printf("overlay blend\n"); | ||
462 | if(!this->m_show_video || frame->output_width == 0 || frame->output_height== 0) | ||
463 | return; | ||
464 | |||
465 | /* Alpha Blend here */ | ||
466 | if (overlay->rle) { | ||
467 | if( !overlay->rgb_clut || !overlay->clip_rgb_clut) | ||
468 | null_overlay_clut_yuv2rgb(this,overlay,frame); | ||
469 | |||
470 | switch(this->bpp) { | ||
471 | case 16: | ||
472 | blend_rgb16( (uint8_t *)frame->data, overlay, | ||
473 | frame->output_width, frame->output_height, | ||
474 | frame->width, frame->height); | ||
475 | break; | ||
476 | case 24: | ||
477 | blend_rgb24( (uint8_t *)frame->data, overlay, | ||
478 | frame->output_width, frame->output_height, | ||
479 | frame->width, frame->height); | ||
480 | break; | ||
481 | case 32: | ||
482 | blend_rgb32( (uint8_t *)frame->data, overlay, | ||
483 | frame->output_width, frame->output_height, | ||
484 | frame->width, frame->height); | ||
485 | break; | ||
486 | default: | ||
487 | /* It should never get here */ | ||
488 | break; | ||
489 | } | ||
490 | } | ||
131 | } | 491 | } |
492 | |||
493 | |||
132 | static int null_get_property( vo_driver_t* self, | 494 | static int null_get_property( vo_driver_t* self, |
133 | int property ){ | 495 | int property ){ |
134 | printf("property get]n"); | 496 | printf("property get\n"); |
135 | return 0; | 497 | return 0; |
136 | } | 498 | } |
137 | static int null_set_property( vo_driver_t* self, | 499 | static int null_set_property( vo_driver_t* self, |
138 | int property, | 500 | int property, |
139 | int value ){ | 501 | int value ){ |
140 | printf("set property\n"); | 502 | printf("set property\n"); |
141 | return value; | 503 | return value; |
142 | } | 504 | } |
143 | static void null_get_property_min_max( vo_driver_t* self, | 505 | static void null_get_property_min_max( vo_driver_t* self, |
144 | int property, int *min, | 506 | int property, int *min, |
145 | int *max ){ | 507 | int *max ){ |
146 | printf("min max\n"); | 508 | printf("min max\n"); |
147 | *max = 0; | 509 | *max = 0; |
148 | *min = 0; | 510 | *min = 0; |
149 | } | 511 | } |
150 | static int null_gui_data_exchange( vo_driver_t* self, | 512 | static int null_gui_data_exchange( vo_driver_t* self, |
151 | int data_type, | 513 | int data_type, |
152 | void *data ){ | 514 | void *data ){ |
153 | return 0; | 515 | return 0; |
154 | } | 516 | } |
155 | static void null_exit( vo_driver_t* self ){ | 517 | static void null_exit( vo_driver_t* self ){ |
156 | null_driver_t* this = (null_driver_t*)self; | 518 | null_driver_t* this = (null_driver_t*)self; |
157 | free ( this ); | 519 | free ( this ); |
158 | } | 520 | } |
159 | static int null_redraw_needed( vo_driver_t* self ){ | 521 | static int null_redraw_needed( vo_driver_t* self ){ |
160 | return 0; | 522 | return 0; |
161 | } | 523 | } |
162 | 524 | ||
163 | 525 | ||
164 | vo_driver_t* init_video_out_plugin( config_values_t* conf, | 526 | vo_driver_t* init_video_out_plugin( config_values_t* conf, |
165 | void* video ){ | 527 | void* video ){ |
166 | null_driver_t *vo; | 528 | null_driver_t *vo; |
167 | vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); | 529 | vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); |
530 | |||
531 | /* memset? */ | ||
532 | memset(vo,0, sizeof(null_driver_t ) ); | ||
168 | vo->m_show_video = 0; // false | 533 | vo->m_show_video = 0; // false |
169 | vo->m_video_fullscreen = 0; | 534 | vo->m_video_fullscreen = 0; |
170 | vo->m_is_scaling = 0; | 535 | vo->m_is_scaling = 0; |
171 | /* memset? */ | 536 | vo->user_ratio = ASPECT_AUTO; |
537 | vo->display_ratio = 1.0; | ||
538 | vo->gui_width = 200; | ||
539 | vo->gui_height = 150; | ||
540 | vo->frameDis = NULL; | ||
172 | 541 | ||
173 | /* install callback handlers*/ | 542 | /* install callback handlers*/ |
174 | vo->vo_driver.get_capabilities = null_get_capabilities; | 543 | vo->vo_driver.get_capabilities = null_get_capabilities; |
175 | vo->vo_driver.alloc_frame = null_alloc_frame; | 544 | vo->vo_driver.alloc_frame = null_alloc_frame; |
176 | vo->vo_driver.update_frame_format = null_update_frame_format; | 545 | vo->vo_driver.update_frame_format = null_update_frame_format; |
177 | vo->vo_driver.display_frame = null_display_frame; | 546 | vo->vo_driver.display_frame = null_display_frame; |
178 | vo->vo_driver.overlay_blend = null_overlay_blend; | 547 | vo->vo_driver.overlay_blend = null_overlay_blend; |
179 | vo->vo_driver.get_property = null_get_property; | 548 | vo->vo_driver.get_property = null_get_property; |
180 | vo->vo_driver.set_property = null_set_property; | 549 | vo->vo_driver.set_property = null_set_property; |
181 | vo->vo_driver.get_property_min_max = null_get_property_min_max; | 550 | vo->vo_driver.get_property_min_max = null_get_property_min_max; |
182 | vo->vo_driver.gui_data_exchange = null_gui_data_exchange; | 551 | vo->vo_driver.gui_data_exchange = null_gui_data_exchange; |
183 | vo->vo_driver.exit = null_exit; | 552 | vo->vo_driver.exit = null_exit; |
184 | vo->vo_driver.redraw_needed = null_redraw_needed; | 553 | vo->vo_driver.redraw_needed = null_redraw_needed; |
185 | 554 | ||
186 | 555 | ||
187 | /* capabilities */ | 556 | /* capabilities */ |
188 | vo->m_capabilities = /*VO_CAP_COPIES_IMAGE |*/ VO_CAP_YV12 | VO_CAP_BRIGHTNESS; | 557 | vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; |
558 | vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, | ||
559 | vo->yuv2rgb_cmap); | ||
189 | printf("done initialisation\n"); | 560 | printf("done initialisation\n"); |
190 | return (vo_driver_t*) vo; | 561 | return (vo_driver_t*) vo; |
191 | } | 562 | } |
192 | 563 | ||
193 | static vo_info_t vo_info_null = { | 564 | static vo_info_t vo_info_null = { |
194 | 5, | 565 | 5, |
195 | "null plugin", | 566 | "null plugin", |
196 | NULL, | 567 | NULL, |
197 | VISUAL_TYPE_FB, | 568 | VISUAL_TYPE_FB, |
198 | 5 | 569 | 5 |
199 | }; | 570 | }; |
200 | 571 | ||
201 | vo_info_t *get_video_out_plugin_info(){ | 572 | vo_info_t *get_video_out_plugin_info(){ |
202 | vo_info_null.description = _("xine video output plugin using null device"); | 573 | vo_info_null.description = _("xine video output plugin using null device"); |
203 | return &vo_info_null; | 574 | return &vo_info_null; |
204 | } | 575 | } |
205 | 576 | ||
206 | /* this is special for this device */ | 577 | /* this is special for this device */ |
207 | /** | 578 | /** |
208 | * We know that we will be controled by the XINE LIB++ | 579 | * We know that we will be controled by the XINE LIB++ |
209 | */ | 580 | */ |
210 | 581 | ||
211 | /** | 582 | /** |
212 | * | 583 | * |
213 | */ | 584 | */ |
214 | int null_is_showing_video( vo_driver_t* self ){ | 585 | int null_is_showing_video( vo_driver_t* self ){ |
215 | null_driver_t* this = (null_driver_t*)self; | 586 | null_driver_t* this = (null_driver_t*)self; |
216 | return this->m_show_video; | 587 | return this->m_show_video; |
217 | } | 588 | } |
218 | void null_set_show_video( vo_driver_t* self, int show ) { | 589 | void null_set_show_video( vo_driver_t* self, int show ) { |
219 | ((null_driver_t*)self)->m_show_video = show; | 590 | ((null_driver_t*)self)->m_show_video = show; |
220 | } | 591 | } |
221 | 592 | ||
222 | int null_is_fullscreen( vo_driver_t* self ){ | 593 | int null_is_fullscreen( vo_driver_t* self ){ |
223 | return ((null_driver_t*)self)->m_video_fullscreen; | 594 | return ((null_driver_t*)self)->m_video_fullscreen; |
224 | } | 595 | } |
225 | void null_set_fullscreen( vo_driver_t* self, int screen ){ | 596 | void null_set_fullscreen( vo_driver_t* self, int screen ){ |
226 | ((null_driver_t*)self)->m_video_fullscreen = screen; | 597 | ((null_driver_t*)self)->m_video_fullscreen = screen; |
227 | } | 598 | } |
228 | int null_is_scaling( vo_driver_t* self ){ | 599 | int null_is_scaling( vo_driver_t* self ){ |
229 | return ((null_driver_t*)self)->m_is_scaling; | 600 | return ((null_driver_t*)self)->m_is_scaling; |
230 | } | 601 | } |
231 | void null_set_scaling( vo_driver_t* self, int scale ){ | 602 | void null_set_scaling( vo_driver_t* self, int scale ){ |
232 | ((null_driver_t*)self)->m_is_scaling = scale; | 603 | ((null_driver_t*)self)->m_is_scaling = scale; |
233 | } | 604 | } |
234 | 605 | ||
235 | void null_set_gui_width( vo_driver_t* self, int width ){ | 606 | void null_set_gui_width( vo_driver_t* self, int width ){ |
236 | 607 | ((null_driver_t*)self)->gui_width = width; | |
237 | } | 608 | } |
238 | void null_set_gui_height( vo_driver_t* self, int height ){ | 609 | void null_set_gui_height( vo_driver_t* self, int height ){ |
239 | 610 | ((null_driver_t*)self)->gui_height = height; | |
611 | } | ||
612 | void null_set_mode( vo_driver_t* self, int depth, int rgb ){ | ||
613 | null_driver_t* this = (null_driver_t*)self; | ||
614 | |||
615 | this->bytes_per_pixel = (depth + 7 ) / 8; | ||
616 | this->bpp = this->bytes_per_pixel * 8; | ||
617 | this->depth = depth; | ||
618 | printf("depth %d %d\n", depth, this->bpp); | ||
619 | printf("pixeltype %d\n", rgb ); | ||
620 | switch ( this->depth ){ | ||
621 | case 32: | ||
622 | if( rgb == 0 ) | ||
623 | this->yuv2rgb_mode = MODE_32_RGB; | ||
624 | else | ||
625 | this->yuv2rgb_mode = MODE_32_BGR; | ||
626 | case 24: | ||
627 | if( this->bpp == 32 ) { | ||
628 | if(rgb == 0 ) | ||
629 | this->yuv2rgb_mode = MODE_32_RGB; | ||
630 | else | ||
631 | this->yuv2rgb_mode = MODE_32_BGR; | ||
632 | }else{ | ||
633 | if( rgb == 0 ) | ||
634 | this->yuv2rgb_mode = MODE_24_RGB; | ||
635 | else | ||
636 | this->yuv2rgb_mode = MODE_24_BGR; | ||
637 | }; | ||
638 | break; | ||
639 | case 16: | ||
640 | if( rgb == 0 ) | ||
641 | this->yuv2rgb_mode = MODE_16_RGB; | ||
642 | else | ||
643 | this->yuv2rgb_mode = MODE_16_BGR; | ||
644 | break; | ||
645 | case 15: | ||
646 | if( rgb == 0 ) | ||
647 | this->yuv2rgb_mode = MODE_15_RGB; | ||
648 | else | ||
649 | this->yuv2rgb_mode = MODE_15_BGR; | ||
650 | break; | ||
651 | case 8: | ||
652 | if( rgb == 0 ) | ||
653 | this->yuv2rgb_mode = MODE_8_RGB; | ||
654 | else | ||
655 | this->yuv2rgb_mode = MODE_8_BGR; | ||
656 | break; | ||
657 | }; | ||
658 | //free(this->yuv2rgb_factory ); | ||
659 | // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap, | ||
660 | // this->yuv2rgb_cmap); | ||
661 | }; | ||
662 | void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data) { | ||
663 | null_driver_t* this = (null_driver_t*) self; | ||
664 | this->caller = user_data; | ||
665 | this->frameDis = t; | ||
240 | } | 666 | } |
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index a2cb987..448dd34 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro | |||
@@ -1,19 +1,21 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | #release | 3 | #release |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ | 5 | HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ |
6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ | 6 | videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ |
7 | frame.h lib.h xinevideowidget.h | 7 | frame.h lib.h xinevideowidget.h \ |
8 | alphablend.h yuv2rgb.h | ||
8 | SOURCES = main.cpp \ | 9 | SOURCES = main.cpp \ |
9 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ | 10 | playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ |
10 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ | 11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ |
11 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp | 12 | frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp \ |
13 | alphablend.c yuv2rgb.c yuv2rgb_mlib.c yuv2rgb_mmx.c | ||
12 | TARGET = opieplayer2 | 14 | TARGET = opieplayer2 |
13 | INCLUDEPATH += $(OPIEDIR)/include | 15 | INCLUDEPATH += $(OPIEDIR)/include |
14 | DEPENDPATH += $(OPIEDIR)/include | 16 | DEPENDPATH += $(OPIEDIR)/include |
15 | LIBS += -lqpe -lpthread -lopie -lxine -lxineutils | 17 | LIBS += -lqpe -lpthread -lopie -lxine -lxineutils |
16 | 18 | ||
17 | INCLUDEPATH += $(OPIEDIR)/include | 19 | INCLUDEPATH += $(OPIEDIR)/include |
18 | DEPENDPATH += $(OPIEDIR)/include | 20 | DEPENDPATH += $(OPIEDIR)/include |
19 | 21 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 8fdb3d3..d3898a0 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -267,69 +267,70 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | |||
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | void VideoWidget::makeVisible() { | 271 | void VideoWidget::makeVisible() { |
272 | if ( mediaPlayerState->fullscreen() ) { | 272 | if ( mediaPlayerState->fullscreen() ) { |
273 | setBackgroundMode( QWidget::NoBackground ); | 273 | setBackgroundMode( QWidget::NoBackground ); |
274 | showFullScreen(); | 274 | showFullScreen(); |
275 | resize( qApp->desktop()->size() ); | 275 | resize( qApp->desktop()->size() ); |
276 | slider->hide(); | 276 | slider->hide(); |
277 | } else { | 277 | } else { |
278 | setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); | 278 | setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); |
279 | showNormal(); | 279 | showNormal(); |
280 | showMaximized(); | 280 | showMaximized(); |
281 | slider->show(); | 281 | slider->show(); |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | void VideoWidget::paintEvent( QPaintEvent * ) { | 286 | void VideoWidget::paintEvent( QPaintEvent * ) { |
287 | QPainter p( this ); | 287 | QPainter p( this ); |
288 | 288 | ||
289 | if ( mediaPlayerState->fullscreen() ) { | 289 | if ( mediaPlayerState->fullscreen() ) { |
290 | // Clear the background | 290 | // Clear the background |
291 | p.setBrush( QBrush( Qt::black ) ); | 291 | // p.setBrush( QBrush( Qt::black ) ); |
292 | p.drawRect( rect() ); | 292 | //p.drawRect( rect() ); |
293 | 293 | ||
294 | } else { | 294 | } else { |
295 | // draw border | 295 | // draw border |
296 | qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL ); | 296 | qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL ); |
297 | 297 | ||
298 | // Clear the movie screen first | 298 | // Clear the movie screen first |
299 | p.setBrush( QBrush( Qt::black ) ); | 299 | // p.setBrush( QBrush( Qt::black ) ); |
300 | p.drawRect( 9, 20, 220, 160 ); | 300 | // p.drawRect( 9, 20, 220, 160 ); |
301 | 301 | ||
302 | // draw current frame (centrally positioned from scaling to maintain aspect ratio) | 302 | // draw current frame (centrally positioned from scaling to maintain aspect ratio) |
303 | //p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); | 303 | //p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); |
304 | 304 | ||
305 | // draw the buttons | 305 | // draw the buttons |
306 | for ( int i = 0; i < numButtons; i++ ) { | 306 | for ( int i = 0; i < numButtons; i++ ) { |
307 | paintButton( &p, i ); | 307 | paintButton( &p, i ); |
308 | } | 308 | } |
309 | 309 | ||
310 | // draw the slider | 310 | // draw the slider |
311 | slider->repaint( TRUE ); | 311 | slider->repaint( TRUE ); |
312 | //videoFrame->repaint( TRUE ); | ||
312 | } | 313 | } |
313 | } | 314 | } |
314 | 315 | ||
315 | 316 | ||
316 | void VideoWidget::closeEvent( QCloseEvent* ) { | 317 | void VideoWidget::closeEvent( QCloseEvent* ) { |
317 | mediaPlayerState->setList(); | 318 | mediaPlayerState->setList(); |
318 | } | 319 | } |
319 | 320 | ||
320 | 321 | ||
321 | bool VideoWidget::playVideo() { | 322 | bool VideoWidget::playVideo() { |
322 | bool result = FALSE; | 323 | bool result = FALSE; |
323 | 324 | ||
324 | int stream = 0; | 325 | int stream = 0; |
325 | 326 | ||
326 | int sw = 240; | 327 | int sw = 240; |
327 | int sh = 320; | 328 | int sh = 320; |
328 | int dd = QPixmap::defaultDepth(); | 329 | int dd = QPixmap::defaultDepth(); |
329 | int w = height(); | 330 | int w = height(); |
330 | int h = width(); | 331 | int h = width(); |
331 | 332 | ||
332 | return true; | 333 | return true; |
333 | } | 334 | } |
334 | 335 | ||
335 | 336 | ||
@@ -361,24 +362,27 @@ void VideoWidget::keyReleaseEvent( QKeyEvent *e) | |||
361 | break; | 362 | break; |
362 | case Key_Down: | 363 | case Key_Down: |
363 | // toggleButton(6); | 364 | // toggleButton(6); |
364 | // emit lessClicked(); | 365 | // emit lessClicked(); |
365 | // emit lessReleased(); | 366 | // emit lessReleased(); |
366 | // toggleButton(6); | 367 | // toggleButton(6); |
367 | break; | 368 | break; |
368 | case Key_Up: | 369 | case Key_Up: |
369 | // toggleButton(5); | 370 | // toggleButton(5); |
370 | // emit moreClicked(); | 371 | // emit moreClicked(); |
371 | // emit moreReleased(); | 372 | // emit moreReleased(); |
372 | // toggleButton(5); | 373 | // toggleButton(5); |
373 | break; | 374 | break; |
374 | case Key_Right: | 375 | case Key_Right: |
375 | mediaPlayerState->setNext(); | 376 | mediaPlayerState->setNext(); |
376 | break; | 377 | break; |
377 | case Key_Left: | 378 | case Key_Left: |
378 | mediaPlayerState->setPrev(); | 379 | mediaPlayerState->setPrev(); |
379 | break; | 380 | break; |
380 | case Key_Escape: | 381 | case Key_Escape: |
381 | break; | 382 | break; |
382 | 383 | ||
383 | }; | 384 | }; |
384 | } | 385 | } |
386 | XineVideoWidget* VideoWidget::vidWidget() { | ||
387 | return videoFrame; | ||
388 | } | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 9ab91ac..8f98889 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -36,49 +36,49 @@ | |||
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include "xinevideowidget.h" | 38 | #include "xinevideowidget.h" |
39 | 39 | ||
40 | class QPixmap; | 40 | class QPixmap; |
41 | class QSlider; | 41 | class QSlider; |
42 | 42 | ||
43 | enum VideoButtons { | 43 | enum VideoButtons { |
44 | VideoPrevious, | 44 | VideoPrevious, |
45 | VideoStop, | 45 | VideoStop, |
46 | VideoPlay, | 46 | VideoPlay, |
47 | VideoPause, | 47 | VideoPause, |
48 | VideoNext, | 48 | VideoNext, |
49 | VideoPlayList, | 49 | VideoPlayList, |
50 | VideoFullscreen | 50 | VideoFullscreen |
51 | }; | 51 | }; |
52 | 52 | ||
53 | class VideoWidget : public QWidget { | 53 | class VideoWidget : public QWidget { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | public: | 55 | public: |
56 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 56 | VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
57 | ~VideoWidget(); | 57 | ~VideoWidget(); |
58 | 58 | ||
59 | bool playVideo(); | 59 | bool playVideo(); |
60 | 60 | XineVideoWidget* vidWidget(); | |
61 | public slots: | 61 | public slots: |
62 | void updateSlider( long, long ); | 62 | void updateSlider( long, long ); |
63 | void sliderPressed( ); | 63 | void sliderPressed( ); |
64 | void sliderReleased( ); | 64 | void sliderReleased( ); |
65 | void setPaused( bool b) { setToggleButton( VideoPause, b ); } | 65 | void setPaused( bool b) { setToggleButton( VideoPause, b ); } |
66 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } | 66 | void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } |
67 | void setFullscreen( bool b ) { setToggleButton( VideoFullscreen, b ); } | 67 | void setFullscreen( bool b ) { setToggleButton( VideoFullscreen, b ); } |
68 | void makeVisible(); | 68 | void makeVisible(); |
69 | void setPosition( long ); | 69 | void setPosition( long ); |
70 | void setLength( long ); | 70 | void setLength( long ); |
71 | void setView( char ); | 71 | void setView( char ); |
72 | 72 | ||
73 | signals: | 73 | signals: |
74 | void sliderMoved( long ); | 74 | void sliderMoved( long ); |
75 | 75 | ||
76 | protected: | 76 | protected: |
77 | void paintEvent( QPaintEvent *pe ); | 77 | void paintEvent( QPaintEvent *pe ); |
78 | void mouseMoveEvent( QMouseEvent *event ); | 78 | void mouseMoveEvent( QMouseEvent *event ); |
79 | void mousePressEvent( QMouseEvent *event ); | 79 | void mousePressEvent( QMouseEvent *event ); |
80 | void mouseReleaseEvent( QMouseEvent *event ); | 80 | void mouseReleaseEvent( QMouseEvent *event ); |
81 | void closeEvent( QCloseEvent *event ); | 81 | void closeEvent( QCloseEvent *event ); |
82 | void keyReleaseEvent( QKeyEvent *e); | 82 | void keyReleaseEvent( QKeyEvent *e); |
83 | 83 | ||
84 | private: | 84 | private: |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 893ac41..3be9fa4 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -14,55 +14,55 @@ | |||
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 | 34 | ||
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | #include "xinecontrol.h" | 36 | #include "xinecontrol.h" |
37 | #include "mediaplayerstate.h" | 37 | #include "mediaplayerstate.h" |
38 | 38 | #include "videowidget.h" | |
39 | 39 | ||
40 | extern MediaPlayerState *mediaPlayerState; | 40 | extern MediaPlayerState *mediaPlayerState; |
41 | 41 | extern VideoWidget *videoUI; | |
42 | XineControl::XineControl( QObject *parent, const char *name ) | 42 | XineControl::XineControl( QObject *parent, const char *name ) |
43 | : QObject( parent, name ) { | 43 | : QObject( parent, name ) { |
44 | libXine = new XINE::Lib(); | 44 | libXine = new XINE::Lib(videoUI->vidWidget() ); |
45 | 45 | ||
46 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); | 46 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); |
47 | connect( this, SIGNAL( positionChanged( int position ) ), mediaPlayerState, SLOT( updatePosition( long p ) ) ); | 47 | connect( this, SIGNAL( positionChanged( int position ) ), mediaPlayerState, SLOT( updatePosition( long p ) ) ); |
48 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 48 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
49 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 49 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
50 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 50 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
54 | XineControl::~XineControl() { | 54 | XineControl::~XineControl() { |
55 | delete libXine; | 55 | delete libXine; |
56 | } | 56 | } |
57 | 57 | ||
58 | void XineControl::play( const QString& fileName ) { | 58 | void XineControl::play( const QString& fileName ) { |
59 | libXine->play( fileName ); | 59 | libXine->play( fileName ); |
60 | mediaPlayerState->setPlaying( true ); | 60 | mediaPlayerState->setPlaying( true ); |
61 | // default to audio view until we know how to handle video | 61 | // default to audio view until we know how to handle video |
62 | // MediaDetect mdetect; | 62 | // MediaDetect mdetect; |
63 | char whichGui = mdetect.videoOrAudio( fileName ); | 63 | char whichGui = mdetect.videoOrAudio( fileName ); |
64 | if (whichGui == 'f') { | 64 | if (whichGui == 'f') { |
65 | qDebug("Nicht erkannter Dateityp"); | 65 | qDebug("Nicht erkannter Dateityp"); |
66 | return; | 66 | return; |
67 | } | 67 | } |
68 | 68 | ||
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index e02ee7c..d665f16 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp | |||
@@ -1,53 +1,130 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | This file is part of the Opie Project | 3 | This file is part of the Opie Project |
4 | 4 | ||
5 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 5 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
6 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 6 | Copyright (c) 2002 LJP <> |
7 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 7 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
8 | =. | 8 | =. |
9 | .=l. | 9 | .=l. |
10 | .>+-= | 10 | .>+-= |
11 | _;:, .> :=|. This program is free software; you can | 11 | _;:, .> :=|. This program is free software; you can |
12 | .> <`_, > . <= redistribute it and/or modify it under | 12 | .> <`_, > . <= redistribute it and/or modify it under |
13 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 13 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
14 | .="- .-=="i, .._ License as published by the Free Software | 14 | .="- .-=="i, .._ License as published by the Free Software |
15 | - . .-<_> .<> Foundation; either version 2 of the License, | 15 | - . .-<_> .<> Foundation; either version 2 of the License, |
16 | ._= =} : or (at your option) any later version. | 16 | ._= =} : or (at your option) any later version. |
17 | .%`+i> _;_. | 17 | .%`+i> _;_. |
18 | .i_,=:_. -<s. This program is distributed in the hope that | 18 | .i_,=:_. -<s. This program is distributed in the hope that |
19 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 19 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
20 | : .. .:, . . . without even the implied warranty of | 20 | : .. .:, . . . without even the implied warranty of |
21 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 21 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
22 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 22 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
23 | ..}^=.= = ; Library General Public License for more | 23 | ..}^=.= = ; Library General Public License for more |
24 | ++= -. .` .: details. | 24 | ++= -. .` .: details. |
25 | : = ...= . :.=- | 25 | : = ...= . :.=- |
26 | -. .:....=;==+<; You should have received a copy of the GNU | 26 | -. .:....=;==+<; You should have received a copy of the GNU |
27 | -_. . . )=. = Library General Public License along with | 27 | -_. . . )=. = Library General Public License along with |
28 | -- :-=` this library; see the file COPYING.LIB. | 28 | -- :-=` this library; see the file COPYING.LIB. |
29 | If not, write to the Free Software Foundation, | 29 | If not, write to the Free Software Foundation, |
30 | Inc., 59 Temple Place - Suite 330, | 30 | Inc., 59 Temple Place - Suite 330, |
31 | Boston, MA 02111-1307, USA. | 31 | Boston, MA 02111-1307, USA. |
32 | 32 | ||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <qimage.h> | 35 | #include <qimage.h> |
36 | #include <qpainter.h> | ||
36 | #include <qgfx_qws.h> | 37 | #include <qgfx_qws.h> |
38 | #include <qdirectpainter_qws.h> | ||
39 | #include <qsize.h> | ||
40 | |||
41 | #include <qpe/resource.h> | ||
37 | 42 | ||
38 | #include "xinevideowidget.h" | 43 | #include "xinevideowidget.h" |
39 | 44 | ||
40 | XineVideoWidget::XineVideoWidget( int width, | 45 | XineVideoWidget::XineVideoWidget( int width, |
41 | int height, | 46 | int height, |
42 | QWidget* parent, | 47 | QWidget* parent, |
43 | const char* name ) | 48 | const char* name ) |
44 | : QWidget( parent, name ) | 49 | : QWidget( parent, name ) |
45 | { | 50 | { |
46 | m_image = new QImage( width, height, qt_screen->depth() ); | 51 | m_image = new QImage( width, height, qt_screen->depth() ); |
52 | m_buff = 0; | ||
53 | setBackgroundMode( NoBackground); | ||
54 | /* QImage image = Resource::loadImage("SoundPlayer"); | ||
55 | image = image.smoothScale( width, height ); | ||
56 | |||
57 | m_image = new QImage( image );*/ | ||
47 | } | 58 | } |
48 | XineVideoWidget::~XineVideoWidget() { | 59 | XineVideoWidget::~XineVideoWidget() { |
49 | delete m_image; | 60 | delete m_image; |
50 | } | 61 | } |
62 | void XineVideoWidget::clear() { | ||
63 | m_buff = 0; | ||
64 | repaint(); | ||
65 | } | ||
51 | void XineVideoWidget::paintEvent( QPaintEvent* e ) { | 66 | void XineVideoWidget::paintEvent( QPaintEvent* e ) { |
52 | QWidget::paintEvent( e ); | 67 | qWarning("painting"); |
68 | QPainter p(this ); | ||
69 | p.setBrush( QBrush( Qt::black ) ); | ||
70 | p.drawRect( rect() ); | ||
71 | if (m_buff == 0 ) | ||
72 | p.drawImage( 0, 0, *m_image ); | ||
73 | else { | ||
74 | qWarning("paitnevent\n"); | ||
75 | |||
76 | QDirectPainter dp( this ); | ||
77 | uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep + | ||
78 | (m_xOff + dp.xOffset() ) * m_bytes_per_pixel; | ||
79 | uchar* frame = m_buff; | ||
80 | for(int y = 0; y < m_Height; y++ ) { | ||
81 | memcpy( dst, frame, m_bytes ); | ||
82 | frame += m_bytes; | ||
83 | dst += linestep; | ||
84 | } | ||
85 | // QVFB hack by MArtin Jones | ||
86 | // QPainter dp2(this); | ||
87 | // dp2.fillRect( rect(), QBrush( NoBrush ) ); | ||
88 | } | ||
89 | // QWidget::paintEvent( e ); | ||
90 | } | ||
91 | int XineVideoWidget::height() const{ | ||
92 | return m_image->height(); | ||
93 | } | ||
94 | int XineVideoWidget::width() const{ | ||
95 | return m_image->width(); | ||
96 | } | ||
97 | void XineVideoWidget::setImage( QImage* image ) { | ||
98 | delete m_image; | ||
99 | m_image = image; | ||
100 | } | ||
101 | void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, | ||
102 | int xoffsetXBytes, int width, | ||
103 | int height, int linestep, int bytes, int bpp ) { | ||
104 | /* if (m_buff != 0 ) | ||
105 | free(m_buff ); | ||
106 | */ | ||
107 | m_buff = image; | ||
108 | m_yOff = yoffsetXLine; | ||
109 | m_xOff = xoffsetXBytes; | ||
110 | m_Width = width; | ||
111 | m_Height = height; | ||
112 | this->linestep = linestep; | ||
113 | m_bytes = bytes; | ||
114 | m_bytes_per_pixel = bpp; | ||
115 | //// | ||
116 | qWarning("width %d %d", width, height ); | ||
117 | /* QDirectPainter dp( this ); | ||
118 | uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep + | ||
119 | (m_xOff + dp.xOffset() ) * m_bytes_per_pixel; | ||
120 | uchar* frame = m_buff; | ||
121 | for(int y = 0; y < m_Height; y++ ) { | ||
122 | memcpy( dst, frame, m_bytes ); | ||
123 | frame += m_bytes; | ||
124 | dst += linestep; | ||
125 | } | ||
126 | // QVFB hack | ||
127 | QPainter dp2(this); | ||
128 | dp2.fillRect( rect(), QBrush( NoBrush ) ); | ||
129 | */ | ||
53 | } | 130 | } |
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.h b/noncore/multimedia/opieplayer2/xinevideowidget.h index 46bb98b..b670fa0 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.h +++ b/noncore/multimedia/opieplayer2/xinevideowidget.h | |||
@@ -21,31 +21,44 @@ | |||
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 | 34 | ||
35 | 35 | ||
36 | #include <qwidget.h> | 36 | #include <qwidget.h> |
37 | 37 | ||
38 | class QImage; | 38 | class QImage; |
39 | class XineVideoWidget : public QWidget { | 39 | class XineVideoWidget : public QWidget { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | XineVideoWidget( int width, int height, QWidget* parent, const char* name ); | 42 | XineVideoWidget( int width, int height, QWidget* parent, const char* name ); |
43 | ~XineVideoWidget(); | 43 | ~XineVideoWidget(); |
44 | QImage *image() { return m_image; }; | 44 | QImage *image() { return m_image; }; |
45 | void setImage( QImage* image ); | ||
46 | void setImage( uchar* image, int yoffsetXLine, int xoffsetXBytes, | ||
47 | int width, int height, int linestep, int bytes, int bpp); | ||
48 | int width() const; | ||
49 | int height() const; | ||
50 | void clear() ; | ||
45 | protected: | 51 | protected: |
46 | void paintEvent( QPaintEvent* p ); | 52 | void paintEvent( QPaintEvent* p ); |
47 | private: | 53 | private: |
54 | int m_wid; | ||
55 | int m_height; | ||
56 | int m_yOff, m_xOff; | ||
57 | uchar* m_buff; | ||
58 | int m_Width, m_Height, linestep; | ||
59 | int m_bytes; | ||
60 | int m_bytes_per_pixel; | ||
48 | QImage* m_image; | 61 | QImage* m_image; |
49 | 62 | ||
50 | }; | 63 | }; |
51 | 64 | ||
diff --git a/noncore/multimedia/opieplayer2/zeckeplayer.pro b/noncore/multimedia/opieplayer2/zeckeplayer.pro index a1683e2..18ee623 100644 --- a/noncore/multimedia/opieplayer2/zeckeplayer.pro +++ b/noncore/multimedia/opieplayer2/zeckeplayer.pro | |||
@@ -1,10 +1,10 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | DESTDIR = . | 2 | DESTDIR = . |
3 | #CONFIG = qt warn_on debug | 3 | #CONFIG = qt warn_on debug |
4 | CONFIG = qt warn_on release | 4 | CONFIG = qt warn_on release |
5 | HEADERS = frame.h lib.h | 5 | HEADERS = frame.h lib.h |
6 | SOURCES = nullvideo.o frame.cpp lib.cpp mainTest.cpp | 6 | SOURCES = alphablend.c yuv2rgb.c nullvideo.o frame.cpp lib.cpp mainTest.cpp |
7 | INCLUDEPATH+= $(OPIEDIR)/include /opt/QtPalmtop/include | 7 | INCLUDEPATH+= $(OPIEDIR)/include /opt/QtPalmtop/include |
8 | DEPENDPATH+= $(OPIEDIR)/include /opt/QtPalmtop/include | 8 | DEPENDPATH+= $(OPIEDIR)/include /opt/QtPalmtop/include |
9 | LIBS += -L/opt/QtPalmtop/lib -lxine -lxineutils | 9 | LIBS += -L/opt/QtPalmtop/lib -lxine -lxineutils |
10 | TARGET = zeckeplayer \ No newline at end of file | 10 | TARGET = zeckeplayer \ No newline at end of file |