Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 0ea85dd..69ff492 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -1,80 +1,90 @@ | |||
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 "frame.h" | 8 | #include "frame.h" |
9 | #include "lib.h" | 9 | #include "lib.h" |
10 | 10 | ||
11 | 11 | ||
12 | extern "C" { | 12 | extern "C" { |
13 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); | 13 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); |
14 | int null_is_showing_video( vo_driver_t* self ); | ||
15 | void null_set_show_video( vo_driver_t* self, int show ); | ||
16 | int null_is_fullscreen( vo_driver_t* self ); | ||
17 | void null_set_fullscreen( vo_driver_t* self, int screen ); | ||
18 | int null_is_scaling( vo_driver_t* self ); | ||
19 | void null_set_scaling( vo_driver_t* self, int scale ); | ||
20 | |||
14 | } | 21 | } |
15 | 22 | ||
16 | using namespace XINE; | 23 | using namespace XINE; |
17 | 24 | ||
18 | Lib::Lib() { | 25 | Lib::Lib() { |
19 | printf("Lib"); | 26 | printf("Lib"); |
20 | QCString str( getenv("HOME") ); | 27 | QCString str( getenv("HOME") ); |
21 | str += "/Settings/opiexine.cf"; | 28 | str += "/Settings/opiexine.cf"; |
22 | // get the configuration | 29 | // get the configuration |
23 | m_config = xine_config_file_init( str.data() ); | 30 | m_config = xine_config_file_init( str.data() ); |
24 | 31 | ||
25 | // allocate oss for sound | 32 | // allocate oss for sound |
26 | // and fb for framebuffer | 33 | // and fb for framebuffer |
27 | m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; | 34 | m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; |
28 | if (m_audioOutput == NULL ) | 35 | if (m_audioOutput == NULL ) |
29 | printf("Failure\n"); | 36 | printf("Failure\n"); |
30 | else | 37 | else |
31 | printf("Success\n"); | 38 | printf("Success\n"); |
32 | 39 | ||
33 | 40 | ||
34 | // test code | 41 | // test code |
35 | m_videoOutput = xine_load_video_output_plugin(m_config, "fb", | 42 | m_videoOutput = xine_load_video_output_plugin(m_config, "fb", |
36 | VISUAL_TYPE_FB, | 43 | VISUAL_TYPE_FB, |
37 | 0 ); | 44 | 0 ); |
38 | 45 | ||
39 | char** files = xine_list_video_output_plugins(3); | 46 | char** files = xine_list_video_output_plugins(3); |
40 | char* out; | 47 | char* out; |
41 | int i = 0; | 48 | int i = 0; |
42 | while ( ( out = files[i] ) != 0 ) { | 49 | while ( ( out = files[i] ) != 0 ) { |
43 | printf("Audio %s\n", out ); | 50 | printf("Audio %s\n", out ); |
44 | i++; | 51 | i++; |
45 | } | 52 | } |
46 | // m_xine = xine_init( m_videoOutput, | 53 | // m_xine = xine_init( m_videoOutput, |
47 | // m_audioOutput, | 54 | // m_audioOutput, |
48 | // m_config ); | 55 | // m_config ); |
49 | // test loading | 56 | // test loading |
50 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 57 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
51 | m_xine = xine_init( m_videoOutput, | 58 | m_xine = xine_init( m_videoOutput, |
52 | m_audioOutput, m_config ); | 59 | m_audioOutput, m_config ); |
60 | // install the event handler | ||
61 | xine_register_event_listener( m_xine, xine_event_handler, this ); | ||
53 | } | 62 | } |
54 | 63 | ||
55 | Lib::~Lib() { | 64 | Lib::~Lib() { |
56 | delete m_config; | 65 | delete m_config; |
66 | xine_remove_event_listener( m_xine, xine_event_handler ); | ||
57 | xine_exit( m_xine ); | 67 | xine_exit( m_xine ); |
58 | delete m_videoOutput; | 68 | delete m_videoOutput; |
59 | //delete m_audioOutput; | 69 | //delete m_audioOutput; |
60 | 70 | ||
61 | } | 71 | } |
62 | 72 | ||
63 | QCString Lib::version() { | 73 | QCString Lib::version() { |
64 | QCString str( xine_get_str_version() ); | 74 | QCString str( xine_get_str_version() ); |
65 | return str; | 75 | return str; |
66 | }; | 76 | }; |
67 | 77 | ||
68 | int Lib::majorVersion() { | 78 | int Lib::majorVersion() { |
69 | return xine_get_major_version(); | 79 | return xine_get_major_version(); |
70 | } | 80 | } |
71 | int Lib::minorVersion() { | 81 | int Lib::minorVersion() { |
72 | return xine_get_minor_version(); | 82 | return xine_get_minor_version(); |
73 | }; | 83 | }; |
74 | 84 | ||
75 | int Lib::subVersion() { | 85 | int Lib::subVersion() { |
76 | return xine_get_sub_version(); | 86 | return xine_get_sub_version(); |
77 | } | 87 | } |
78 | int Lib::play( const QString& fileName, | 88 | int Lib::play( const QString& fileName, |
79 | int startPos, | 89 | int startPos, |
80 | int start_time ) { | 90 | int start_time ) { |
@@ -95,25 +105,49 @@ void Lib::setSpeed( int speed ) { | |||
95 | xine_set_speed( m_xine, speed ); | 105 | xine_set_speed( m_xine, speed ); |
96 | } | 106 | } |
97 | int Lib::status(){ | 107 | int Lib::status(){ |
98 | return xine_get_status( m_xine ); | 108 | return xine_get_status( m_xine ); |
99 | } | 109 | } |
100 | int Lib::currentPosition(){ | 110 | int Lib::currentPosition(){ |
101 | return xine_get_current_position( m_xine ); | 111 | return xine_get_current_position( m_xine ); |
102 | } | 112 | } |
103 | int Lib::currentTime() { | 113 | int Lib::currentTime() { |
104 | return xine_get_current_time( m_xine ); | 114 | return xine_get_current_time( m_xine ); |
105 | }; | 115 | }; |
106 | int Lib::length() { | 116 | int Lib::length() { |
107 | return xine_get_stream_length( m_xine ); | 117 | return xine_get_stream_length( m_xine ); |
108 | } | 118 | } |
109 | bool Lib::isSeekable() { | 119 | bool Lib::isSeekable() { |
110 | return xine_is_stream_seekable(m_xine); | 120 | return xine_is_stream_seekable(m_xine); |
111 | } | 121 | } |
112 | Frame Lib::currentFrame() { | 122 | Frame Lib::currentFrame() { |
113 | Frame frame; | 123 | Frame frame; |
114 | return frame; | 124 | return frame; |
115 | }; | 125 | }; |
116 | int Lib::error() { | 126 | int Lib::error() { |
117 | return xine_get_error( m_xine ); | 127 | return xine_get_error( m_xine ); |
118 | }; | 128 | }; |
119 | 129 | void Lib::handleXineEvent( xine_event_t* t ) { | |
130 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) | ||
131 | emit stopped(); | ||
132 | } | ||
133 | void Lib::setShowVideo( bool video ) { | ||
134 | ::null_set_show_video( m_videoOutput, video ); | ||
135 | } | ||
136 | bool Lib::isShowingVideo() { | ||
137 | return ::null_is_showing_video( m_videoOutput ); | ||
138 | } | ||
139 | void Lib::showVideoFullScreen( bool fullScreen ) { | ||
140 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | ||
141 | } | ||
142 | bool Lib::isVideoFullScreen() { | ||
143 | return ::null_is_fullscreen( m_videoOutput ); | ||
144 | } | ||
145 | void Lib::setScaling( bool scale ) { | ||
146 | ::null_set_scaling( m_videoOutput, scale ); | ||
147 | } | ||
148 | bool Lib::isScaling() { | ||
149 | return ::null_is_scaling( m_videoOutput ); | ||
150 | } | ||
151 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | ||
152 | ((Lib*)user_data)->handleXineEvent( t ); | ||
153 | } | ||