author | zecke <zecke> | 2002-07-10 15:38:28 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-07-10 15:38:28 (UTC) |
commit | 0439137e4c18ad7d10002e2da6bea20b57ae1dec (patch) (unidiff) | |
tree | efa27e6218d0f94c513a82521fdea591b4eff18a | |
parent | 5f0da29ff2f22c017d0aec7b6f1f493120b84f8c (diff) | |
download | opie-0439137e4c18ad7d10002e2da6bea20b57ae1dec.zip opie-0439137e4c18ad7d10002e2da6bea20b57ae1dec.tar.gz opie-0439137e4c18ad7d10002e2da6bea20b57ae1dec.tar.bz2 |
Update the c'tor
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 69ff492..3f2eea6 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -1,121 +1,122 @@ | |||
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 | 5 | ||
6 | #include <qfile.h> | 6 | #include <qfile.h> |
7 | 7 | ||
8 | #include "xinevideowidget.h" | ||
8 | #include "frame.h" | 9 | #include "frame.h" |
9 | #include "lib.h" | 10 | #include "lib.h" |
10 | 11 | ||
11 | 12 | ||
12 | extern "C" { | 13 | extern "C" { |
13 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); | 14 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); |
14 | int null_is_showing_video( vo_driver_t* self ); | 15 | int null_is_showing_video( vo_driver_t* self ); |
15 | void null_set_show_video( vo_driver_t* self, int show ); | 16 | void null_set_show_video( vo_driver_t* self, int show ); |
16 | int null_is_fullscreen( vo_driver_t* self ); | 17 | int null_is_fullscreen( vo_driver_t* self ); |
17 | void null_set_fullscreen( vo_driver_t* self, int screen ); | 18 | void null_set_fullscreen( vo_driver_t* self, int screen ); |
18 | int null_is_scaling( vo_driver_t* self ); | 19 | int null_is_scaling( vo_driver_t* self ); |
19 | void null_set_scaling( vo_driver_t* self, int scale ); | 20 | void null_set_scaling( vo_driver_t* self, int scale ); |
20 | 21 | ||
21 | } | 22 | } |
22 | 23 | ||
23 | using namespace XINE; | 24 | using namespace XINE; |
24 | 25 | ||
25 | Lib::Lib() { | 26 | Lib::Lib(XineVideoWidget* /*widget*/) { |
26 | printf("Lib"); | 27 | printf("Lib"); |
27 | QCString str( getenv("HOME") ); | 28 | QCString str( getenv("HOME") ); |
28 | str += "/Settings/opiexine.cf"; | 29 | str += "/Settings/opiexine.cf"; |
29 | // get the configuration | 30 | // get the configuration |
30 | m_config = xine_config_file_init( str.data() ); | 31 | m_config = xine_config_file_init( str.data() ); |
31 | 32 | ||
32 | // allocate oss for sound | 33 | // allocate oss for sound |
33 | // and fb for framebuffer | 34 | // and fb for framebuffer |
34 | m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; | 35 | m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; |
35 | if (m_audioOutput == NULL ) | 36 | if (m_audioOutput == NULL ) |
36 | printf("Failure\n"); | 37 | printf("Failure\n"); |
37 | else | 38 | else |
38 | printf("Success\n"); | 39 | printf("Success\n"); |
39 | 40 | ||
40 | 41 | ||
41 | // test code | 42 | // test code |
42 | m_videoOutput = xine_load_video_output_plugin(m_config, "fb", | 43 | m_videoOutput = xine_load_video_output_plugin(m_config, "fb", |
43 | VISUAL_TYPE_FB, | 44 | VISUAL_TYPE_FB, |
44 | 0 ); | 45 | 0 ); |
45 | 46 | ||
46 | char** files = xine_list_video_output_plugins(3); | 47 | char** files = xine_list_video_output_plugins(3); |
47 | char* out; | 48 | char* out; |
48 | int i = 0; | 49 | int i = 0; |
49 | while ( ( out = files[i] ) != 0 ) { | 50 | while ( ( out = files[i] ) != 0 ) { |
50 | printf("Audio %s\n", out ); | 51 | printf("Audio %s\n", out ); |
51 | i++; | 52 | i++; |
52 | } | 53 | } |
53 | // m_xine = xine_init( m_videoOutput, | 54 | // m_xine = xine_init( m_videoOutput, |
54 | // m_audioOutput, | 55 | // m_audioOutput, |
55 | // m_config ); | 56 | // m_config ); |
56 | // test loading | 57 | // test loading |
57 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 58 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
58 | m_xine = xine_init( m_videoOutput, | 59 | m_xine = xine_init( m_videoOutput, |
59 | m_audioOutput, m_config ); | 60 | m_audioOutput, m_config ); |
60 | // install the event handler | 61 | // install the event handler |
61 | xine_register_event_listener( m_xine, xine_event_handler, this ); | 62 | xine_register_event_listener( m_xine, xine_event_handler, this ); |
62 | } | 63 | } |
63 | 64 | ||
64 | Lib::~Lib() { | 65 | Lib::~Lib() { |
65 | delete m_config; | 66 | delete m_config; |
66 | xine_remove_event_listener( m_xine, xine_event_handler ); | 67 | xine_remove_event_listener( m_xine, xine_event_handler ); |
67 | xine_exit( m_xine ); | 68 | xine_exit( m_xine ); |
68 | delete m_videoOutput; | 69 | delete m_videoOutput; |
69 | //delete m_audioOutput; | 70 | //delete m_audioOutput; |
70 | 71 | ||
71 | } | 72 | } |
72 | 73 | ||
73 | QCString Lib::version() { | 74 | QCString Lib::version() { |
74 | QCString str( xine_get_str_version() ); | 75 | QCString str( xine_get_str_version() ); |
75 | return str; | 76 | return str; |
76 | }; | 77 | }; |
77 | 78 | ||
78 | int Lib::majorVersion() { | 79 | int Lib::majorVersion() { |
79 | return xine_get_major_version(); | 80 | return xine_get_major_version(); |
80 | } | 81 | } |
81 | int Lib::minorVersion() { | 82 | int Lib::minorVersion() { |
82 | return xine_get_minor_version(); | 83 | return xine_get_minor_version(); |
83 | }; | 84 | }; |
84 | 85 | ||
85 | int Lib::subVersion() { | 86 | int Lib::subVersion() { |
86 | return xine_get_sub_version(); | 87 | return xine_get_sub_version(); |
87 | } | 88 | } |
88 | int Lib::play( const QString& fileName, | 89 | int Lib::play( const QString& fileName, |
89 | int startPos, | 90 | int startPos, |
90 | int start_time ) { | 91 | int start_time ) { |
91 | QString str = fileName; | 92 | QString str = fileName; |
92 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), | 93 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), |
93 | startPos, start_time); | 94 | startPos, start_time); |
94 | } | 95 | } |
95 | void Lib::stop() { | 96 | void Lib::stop() { |
96 | xine_stop(m_xine ); | 97 | xine_stop(m_xine ); |
97 | } | 98 | } |
98 | void Lib::pause(){ | 99 | void Lib::pause(){ |
99 | xine_set_speed( m_xine, SPEED_PAUSE ); | 100 | xine_set_speed( m_xine, SPEED_PAUSE ); |
100 | } | 101 | } |
101 | int Lib::speed() { | 102 | int Lib::speed() { |
102 | return xine_get_speed( m_xine ); | 103 | return xine_get_speed( m_xine ); |
103 | } | 104 | } |
104 | void Lib::setSpeed( int speed ) { | 105 | void Lib::setSpeed( int speed ) { |
105 | xine_set_speed( m_xine, speed ); | 106 | xine_set_speed( m_xine, speed ); |
106 | } | 107 | } |
107 | int Lib::status(){ | 108 | int Lib::status(){ |
108 | return xine_get_status( m_xine ); | 109 | return xine_get_status( m_xine ); |
109 | } | 110 | } |
110 | int Lib::currentPosition(){ | 111 | int Lib::currentPosition(){ |
111 | return xine_get_current_position( m_xine ); | 112 | return xine_get_current_position( m_xine ); |
112 | } | 113 | } |
113 | int Lib::currentTime() { | 114 | int Lib::currentTime() { |
114 | return xine_get_current_time( m_xine ); | 115 | return xine_get_current_time( m_xine ); |
115 | }; | 116 | }; |
116 | int Lib::length() { | 117 | int Lib::length() { |
117 | return xine_get_stream_length( m_xine ); | 118 | return xine_get_stream_length( m_xine ); |
118 | } | 119 | } |
119 | bool Lib::isSeekable() { | 120 | bool Lib::isSeekable() { |
120 | return xine_is_stream_seekable(m_xine); | 121 | return xine_is_stream_seekable(m_xine); |
121 | } | 122 | } |
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 00a1248..1d0d3af 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -1,105 +1,107 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef ZECKEXINELIB_H | 3 | #ifndef ZECKEXINELIB_H |
4 | #define ZECKEXINELIB_H | 4 | #define ZECKEXINELIB_H |
5 | 5 | ||
6 | #include <qcstring.h> | 6 | #include <qcstring.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qobject.h> | 8 | #include <qobject.h> |
9 | 9 | ||
10 | #include <xine.h> | 10 | #include <xine.h> |
11 | 11 | ||
12 | class XineVideoWidget; | ||
13 | |||
12 | namespace XINE { | 14 | namespace XINE { |
13 | 15 | ||
14 | /** | 16 | /** |
15 | * Lib wrapps the simple interface | 17 | * Lib wrapps the simple interface |
16 | * of libxine for easy every day use | 18 | * of libxine for easy every day use |
17 | * This will become a full C++ Wrapper | 19 | * This will become a full C++ Wrapper |
18 | * It supports playing, pausing, info, | 20 | * It supports playing, pausing, info, |
19 | * stooping, seeking. | 21 | * stooping, seeking. |
20 | */ | 22 | */ |
21 | class Frame; | 23 | class Frame; |
22 | class Lib : public QObject { | 24 | class Lib : public QObject { |
23 | Q_OBJECT | 25 | Q_OBJECT |
24 | public: | 26 | public: |
25 | Lib(); | 27 | Lib(XineVideoWidget* = 0); |
26 | ~Lib(); | 28 | ~Lib(); |
27 | QCString version(); | 29 | QCString version(); |
28 | int majorVersion()/*const*/; | 30 | int majorVersion()/*const*/; |
29 | int minorVersion()/*const*/; | 31 | int minorVersion()/*const*/; |
30 | int subVersion()/*const*/; | 32 | int subVersion()/*const*/; |
31 | 33 | ||
32 | 34 | ||
33 | int play( const QString& fileName, | 35 | int play( const QString& fileName, |
34 | int startPos = 0, | 36 | int startPos = 0, |
35 | int start_time = 0 ); | 37 | int start_time = 0 ); |
36 | void stop() /*const*/; | 38 | void stop() /*const*/; |
37 | void pause()/*const*/; | 39 | void pause()/*const*/; |
38 | 40 | ||
39 | int speed() /*const*/; | 41 | int speed() /*const*/; |
40 | void setSpeed( int speed = SPEED_PAUSE ); | 42 | void setSpeed( int speed = SPEED_PAUSE ); |
41 | 43 | ||
42 | int status() /*const*/; | 44 | int status() /*const*/; |
43 | 45 | ||
44 | int currentPosition()/*const*/; | 46 | int currentPosition()/*const*/; |
45 | //in seconds | 47 | //in seconds |
46 | int currentTime()/*const*/; | 48 | int currentTime()/*const*/; |
47 | int length() /*const*/; | 49 | int length() /*const*/; |
48 | 50 | ||
49 | bool isSeekable()/*const*/; | 51 | bool isSeekable()/*const*/; |
50 | 52 | ||
51 | /** | 53 | /** |
52 | * Whether or not to show video output | 54 | * Whether or not to show video output |
53 | */ | 55 | */ |
54 | void setShowVideo(bool video); | 56 | void setShowVideo(bool video); |
55 | 57 | ||
56 | /** | 58 | /** |
57 | * is we show video | 59 | * is we show video |
58 | */ | 60 | */ |
59 | bool isShowingVideo() /*const*/; | 61 | bool isShowingVideo() /*const*/; |
60 | 62 | ||
61 | /** | 63 | /** |
62 | * | 64 | * |
63 | */ | 65 | */ |
64 | void showVideoFullScreen( bool fullScreen ); | 66 | void showVideoFullScreen( bool fullScreen ); |
65 | 67 | ||
66 | /** | 68 | /** |
67 | * | 69 | * |
68 | */ | 70 | */ |
69 | bool isVideoFullScreen()/*const*/ ; | 71 | bool isVideoFullScreen()/*const*/ ; |
70 | 72 | ||
71 | /** | 73 | /** |
72 | * | 74 | * |
73 | */ | 75 | */ |
74 | bool isScaling(); | 76 | bool isScaling(); |
75 | 77 | ||
76 | /** | 78 | /** |
77 | * | 79 | * |
78 | */ | 80 | */ |
79 | void setScaling( bool ); | 81 | void setScaling( bool ); |
80 | /** | 82 | /** |
81 | * test | 83 | * test |
82 | */ | 84 | */ |
83 | Frame currentFrame()/*const*/; | 85 | Frame currentFrame()/*const*/; |
84 | 86 | ||
85 | /** | 87 | /** |
86 | * Returns the error code | 88 | * Returns the error code |
87 | */ | 89 | */ |
88 | int error() /*const*/; | 90 | int error() /*const*/; |
89 | 91 | ||
90 | signals: | 92 | signals: |
91 | void stopped(); | 93 | void stopped(); |
92 | private: | 94 | private: |
93 | xine_t *m_xine; | 95 | xine_t *m_xine; |
94 | config_values_t *m_config; | 96 | config_values_t *m_config; |
95 | vo_driver_t *m_videoOutput; | 97 | vo_driver_t *m_videoOutput; |
96 | ao_driver_t* m_audioOutput; | 98 | ao_driver_t* m_audioOutput; |
97 | 99 | ||
98 | void handleXineEvent( xine_event_t* t ); | 100 | void handleXineEvent( xine_event_t* t ); |
99 | // C -> C++ bridge for the event system | 101 | // C -> C++ bridge for the event system |
100 | static void xine_event_handler( void* user_data, xine_event_t* t); | 102 | static void xine_event_handler( void* user_data, xine_event_t* t); |
101 | }; | 103 | }; |
102 | }; | 104 | }; |
103 | 105 | ||
104 | 106 | ||
105 | #endif | 107 | #endif |