summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-07 21:09:42 (UTC)
committer harlekin <harlekin>2002-08-07 21:09:42 (UTC)
commit03876e28ae6ae7819cf17c33a81ec69c4d93cdfd (patch) (unidiff)
tree92ff6de6537dd8ca68afa73556d935d239a630b9
parentc80f0885bf402b6dd4ea637ad1b7d8b3ebd69300 (diff)
downloadopie-03876e28ae6ae7819cf17c33a81ec69c4d93cdfd.zip
opie-03876e28ae6ae7819cf17c33a81ec69c4d93cdfd.tar.gz
opie-03876e28ae6ae7819cf17c33a81ec69c4d93cdfd.tar.bz2
set opiexine.cf if not present
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp44
-rw-r--r--noncore/multimedia/opieplayer2/lib.h33
2 files changed, 75 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 00c534a..3b20873 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,106 +1,148 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
1 33
2#include <stdio.h> 34#include <stdio.h>
3#include <stdlib.h> 35#include <stdlib.h>
4//#include <qpe/qpeapplication.h>
5#include <qimage.h> 36#include <qimage.h>
37#include <qtextstream.h>
6#include <qpe/resource.h> 38#include <qpe/resource.h>
7 39
8#include <qfile.h> 40#include <qfile.h>
9 41
10#include <qgfx_qws.h> 42#include <qgfx_qws.h>
11#include <qdirectpainter_qws.h> 43#include <qdirectpainter_qws.h>
12 44
13#include "xinevideowidget.h" 45#include "xinevideowidget.h"
14#include "frame.h" 46#include "frame.h"
15#include "lib.h" 47#include "lib.h"
16 48
17typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
18 int width, int height,int bytes ); 50 int width, int height,int bytes );
19 51
20extern "C" { 52extern "C" {
21 vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); 53 vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video);
22 int null_is_showing_video( vo_driver_t* self ); 54 int null_is_showing_video( vo_driver_t* self );
23 void null_set_show_video( vo_driver_t* self, int show ); 55 void null_set_show_video( vo_driver_t* self, int show );
24 int null_is_fullscreen( vo_driver_t* self ); 56 int null_is_fullscreen( vo_driver_t* self );
25 void null_set_fullscreen( vo_driver_t* self, int screen ); 57 void null_set_fullscreen( vo_driver_t* self, int screen );
26 int null_is_scaling( vo_driver_t* self ); 58 int null_is_scaling( vo_driver_t* self );
27 void null_set_scaling( vo_driver_t* self, int scale ); 59 void null_set_scaling( vo_driver_t* self, int scale );
28 void null_set_gui_width( vo_driver_t* self, int width ); 60 void null_set_gui_width( vo_driver_t* self, int width );
29 void null_set_gui_height( vo_driver_t* self, int height ); 61 void null_set_gui_height( vo_driver_t* self, int height );
30 void null_set_mode( vo_driver_t* self, int depth, int rgb ); 62 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); 63 void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data);
32} 64}
33 65
34using namespace XINE; 66using namespace XINE;
35 67
36Lib::Lib(XineVideoWidget* widget) { 68Lib::Lib(XineVideoWidget* widget) {
37 m_video = false; 69 m_video = false;
38 m_wid = widget; 70 m_wid = widget;
39 printf("Lib"); 71 printf("Lib");
40 QCString str( getenv("HOME") ); 72 QCString str( getenv("HOME") );
41 str += "/Settings/opiexine.cf"; 73 str += "/Settings/opiexine.cf";
42 // get the configuration 74 // get the configuration
75
76 // not really OO, should be an extra class, later
77 if ( !QFile(str).exists() ) {
78 QFile f(str);
79 f.open(IO_WriteOnly);
80 QTextStream ts( &f );
81 ts << "misc.memcpy_method:glibc";
82 f.close();
83 }
84
43 m_config = xine_config_file_init( str.data() ); 85 m_config = xine_config_file_init( str.data() );
44 86
45 // allocate oss for sound 87 // allocate oss for sound
46 // and fb for framebuffer 88 // and fb for framebuffer
47 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; 89 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ;
48 if (m_audioOutput == NULL ) 90 if (m_audioOutput == NULL )
49 printf("Failure\n"); 91 printf("Failure\n");
50 else 92 else
51 printf("Success\n"); 93 printf("Success\n");
52 94
53 95
54 // test code 96 // test code
55/* m_videoOutput = xine_load_video_output_plugin(m_config, "fb", 97/* m_videoOutput = xine_load_video_output_plugin(m_config, "fb",
56 VISUAL_TYPE_FB, 98 VISUAL_TYPE_FB,
57 0 ); 99 0 );
58*/ 100*/
59 101
60 char** files = xine_list_video_output_plugins(3); 102 char** files = xine_list_video_output_plugins(3);
61 char* out; 103 char* out;
62 int i = 0; 104 int i = 0;
63 while ( ( out = files[i] ) != 0 ) { 105 while ( ( out = files[i] ) != 0 ) {
64 printf("Video %s\n", out ); 106 printf("Video %s\n", out );
65 i++; 107 i++;
66 } 108 }
67// m_xine = xine_init( m_videoOutput, 109// m_xine = xine_init( m_videoOutput,
68// m_audioOutput, 110// m_audioOutput,
69// m_config ); 111// m_config );
70 // test loading 112 // test loading
71 m_videoOutput = ::init_video_out_plugin( m_config, NULL ); 113 m_videoOutput = ::init_video_out_plugin( m_config, NULL );
72 if (m_wid != 0 ) { 114 if (m_wid != 0 ) {
73 printf("!0\n" ); 115 printf("!0\n" );
74 resize ( m_wid-> size ( )); 116 resize ( m_wid-> size ( ));
75 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 117 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
76 m_wid-> setImage ( new QImage ( Resource::loadImage(""))); 118 m_wid-> setImage ( new QImage ( Resource::loadImage("")));
77 m_wid->repaint(); 119 m_wid->repaint();
78 } 120 }
79 null_display_handler( m_videoOutput, 121 null_display_handler( m_videoOutput,
80 xine_display_frame, 122 xine_display_frame,
81 this ); 123 this );
82 124
83 m_xine = xine_init( m_videoOutput, 125 m_xine = xine_init( m_videoOutput,
84 m_audioOutput, m_config ); 126 m_audioOutput, m_config );
85 // install the event handler 127 // install the event handler
86 xine_register_event_listener( m_xine, xine_event_handler, this ); 128 xine_register_event_listener( m_xine, xine_event_handler, this );
87} 129}
88 130
89Lib::~Lib() { 131Lib::~Lib() {
90 delete m_config; 132 delete m_config;
91 xine_remove_event_listener( m_xine, xine_event_handler ); 133 xine_remove_event_listener( m_xine, xine_event_handler );
92 xine_exit( m_xine ); 134 xine_exit( m_xine );
93 delete m_videoOutput; 135 delete m_videoOutput;
94 //delete m_audioOutput; 136 //delete m_audioOutput;
95 137
96} 138}
97 139
98void Lib::resize ( const QSize &s ) 140void Lib::resize ( const QSize &s )
99{ 141{
100 if ( s. width ( ) && s. height ( )) { 142 if ( s. width ( ) && s. height ( )) {
101 ::null_set_gui_width( m_videoOutput, s. width() ); 143 ::null_set_gui_width( m_videoOutput, s. width() );
102 ::null_set_gui_height(m_videoOutput, s. height() ); 144 ::null_set_gui_height(m_videoOutput, s. height() );
103 } 145 }
104} 146}
105 147
106QCString Lib::version() { 148QCString Lib::version() {
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index a15f362..abd8c65 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -1,65 +1,96 @@
1 1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
2 33
3#ifndef ZECKEXINELIB_H 34#ifndef ZECKEXINELIB_H
4#define ZECKEXINELIB_H 35#define ZECKEXINELIB_H
5 36
6#include <qcstring.h> 37#include <qcstring.h>
7#include <qstring.h> 38#include <qstring.h>
8#include <qobject.h> 39#include <qobject.h>
9 40
10#include <xine.h> 41#include <xine.h>
11 42
12class XineVideoWidget; 43class XineVideoWidget;
13 44
14namespace XINE { 45namespace XINE {
15 46
16 /** 47 /**
17 * Lib wrapps the simple interface 48 * Lib wrapps the simple interface
18 * of libxine for easy every day use 49 * of libxine for easy every day use
19 * This will become a full C++ Wrapper 50 * This will become a full C++ Wrapper
20 * It supports playing, pausing, info, 51 * It supports playing, pausing, info,
21 * stooping, seeking. 52 * stooping, seeking.
22 */ 53 */
23 class Frame; 54 class Frame;
24 class Lib : public QObject { 55 class Lib : public QObject {
25 Q_OBJECT 56 Q_OBJECT
26 public: 57 public:
27 Lib(XineVideoWidget* = 0); 58 Lib(XineVideoWidget* = 0);
28 ~Lib(); 59 ~Lib();
29 QCString version(); 60 QCString version();
30 int majorVersion()/*const*/; 61 int majorVersion()/*const*/;
31 int minorVersion()/*const*/; 62 int minorVersion()/*const*/;
32 int subVersion()/*const*/; 63 int subVersion()/*const*/;
33 64
34 65
35 void resize ( const QSize &s ); 66 void resize ( const QSize &s );
36 67
37 int play( const QString& fileName, 68 int play( const QString& fileName,
38 int startPos = 0, 69 int startPos = 0,
39 int start_time = 0 ); 70 int start_time = 0 );
40 void stop() /*const*/; 71 void stop() /*const*/;
41 void pause()/*const*/; 72 void pause()/*const*/;
42 73
43 int speed() /*const*/; 74 int speed() /*const*/;
44 void setSpeed( int speed = SPEED_PAUSE ); 75 void setSpeed( int speed = SPEED_PAUSE );
45 76
46 int status() /*const*/; 77 int status() /*const*/;
47 78
48 int currentPosition()/*const*/; 79 int currentPosition()/*const*/;
49 //in seconds 80 //in seconds
50 int currentTime()/*const*/; 81 int currentTime()/*const*/;
51 int length() /*const*/; 82 int length() /*const*/;
52 83
53 bool isSeekable()/*const*/; 84 bool isSeekable()/*const*/;
54 85
55 /** 86 /**
56 * Whether or not to show video output 87 * Whether or not to show video output
57 */ 88 */
58 void setShowVideo(bool video); 89 void setShowVideo(bool video);
59 90
60 /** 91 /**
61 * is we show video 92 * is we show video
62 */ 93 */
63 bool isShowingVideo() /*const*/; 94 bool isShowingVideo() /*const*/;
64 95
65 /** 96 /**