summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/lib.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp112
1 files changed, 112 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
new file mode 100644
index 0000000..ecaeeea
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -0,0 +1,112 @@
1
2#include <stdio.h>
3#include <stdlib.h>
4//#include <qpe/qpeapplication.h>
5
6#include <qfile.h>
7
8#include "frame.h"
9#include "xinelib.h"
10
11
12
13
14using namespace XINE;
15
16Lib::Lib() {
17 printf("Lib");
18 QCString str( getenv("HOME") );
19 str += "/Settings/opiexine.cf";
20 // get the configuration
21 m_config = xine_config_file_init( str.data() );
22
23 // allocate oss for sound
24 // and fb for framebuffer
25 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ;
26 if (m_audioOutput == NULL )
27 printf("Failure\n");
28 else
29 printf("Success\n");
30
31
32 // test code
33 m_videoOutput = xine_load_video_output_plugin(m_config, "fb",
34 VISUAL_TYPE_FB,
35 0 );
36
37 char** files = xine_list_video_output_plugins(3);
38 char* out;
39 int i = 0;
40 while ( ( out = files[i] ) != 0 ) {
41 printf("Audio %s\n", out );
42 i++;
43 }
44 m_xine = xine_init( m_videoOutput,
45 m_audioOutput,
46 m_config );
47}
48
49Lib::~Lib() {
50 delete m_config;
51 xine_exit( m_xine );
52 delete m_videoOutput;
53 //delete m_audioOutput;
54
55}
56
57QCString Lib::version() {
58 QCString str( xine_get_str_version() );
59 return str;
60};
61
62int Lib::majorVersion() {
63 return xine_get_major_version();
64}
65int Lib::minorVersion() {
66 return xine_get_minor_version();
67};
68int Lib::subVersion() {
69 return xine_get_sub_version();
70}
71int Lib::play( const QString& fileName,
72 int startPos,
73 int start_time ) {
74 QString str = fileName;
75 return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(),
76 startPos, start_time);
77}
78void Lib::stop() {
79 xine_stop(m_xine );
80}
81void Lib::pause(){
82 xine_set_speed( m_xine, SPEED_PAUSE );
83}
84int Lib::speed() {
85 return xine_get_speed( m_xine );
86}
87void Lib::setSpeed( int speed ) {
88 xine_set_speed( m_xine, speed );
89}
90int Lib::status(){
91 return xine_get_status( m_xine );
92}
93int Lib::currentPosition(){
94 return xine_get_current_position( m_xine );
95}
96int Lib::currentTime() {
97 return xine_get_current_time( m_xine );
98};
99int Lib::length() {
100 return xine_get_stream_length( m_xine );
101}
102bool Lib::isSeekable() {
103 return xine_is_stream_seekable(m_xine);
104}
105Frame Lib::currentFrame() {
106 Frame frame;
107 return frame;
108};
109int Lib::error() {
110 return xine_get_error( m_xine );
111};
112