-rw-r--r-- | noncore/multimedia/opieplayer2/frame.cpp | 51 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/frame.h | 45 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 112 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 60 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mainTest.cpp | 15 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/zeckeplayer.pro | 10 |
6 files changed, 293 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/frame.cpp b/noncore/multimedia/opieplayer2/frame.cpp new file mode 100644 index 0000000..3a3e418 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/frame.cpp | |||
@@ -0,0 +1,51 @@ | |||
1 | |||
2 | #include "frame.h" | ||
3 | |||
4 | using namespace XINE; | ||
5 | |||
6 | Frame::Frame() { | ||
7 | m_height = 0; | ||
8 | m_width = 0; | ||
9 | m_ratioCode = 0; | ||
10 | m_format = 0; | ||
11 | m_u = 0; | ||
12 | m_y = 0; | ||
13 | m_v = 0; | ||
14 | } | ||
15 | Frame::Frame( int *width, int* height, | ||
16 | int *ratio_code, int *format, | ||
17 | uint8_t **y, uint8_t **u, | ||
18 | uint8_t **v ) { | ||
19 | m_width = width; | ||
20 | m_height = height; | ||
21 | m_ratioCode = ratio_code ; | ||
22 | m_format = format; | ||
23 | m_y = y; | ||
24 | m_u = u; | ||
25 | m_v = v; | ||
26 | } | ||
27 | Frame::~Frame() { | ||
28 | |||
29 | |||
30 | } | ||
31 | void Frame::setHeight( int* height ) { | ||
32 | m_height = height; | ||
33 | } | ||
34 | void Frame::setWidth( int* width ) { | ||
35 | m_width = width; | ||
36 | } | ||
37 | void Frame::setRatioCode( int* ratio ) { | ||
38 | m_ratioCode = ratio; | ||
39 | } | ||
40 | void Frame::setFormat( int* format ) { | ||
41 | m_format = format; | ||
42 | } | ||
43 | void Frame::setU( uint8_t** u ) { | ||
44 | m_u = u; | ||
45 | } | ||
46 | void Frame::setY( uint8_t** y ) { | ||
47 | m_y = y; | ||
48 | } | ||
49 | void Frame::setV( uint8_t** v ) { | ||
50 | m_v = v; | ||
51 | } | ||
diff --git a/noncore/multimedia/opieplayer2/frame.h b/noncore/multimedia/opieplayer2/frame.h new file mode 100644 index 0000000..0ce7feb --- a/dev/null +++ b/noncore/multimedia/opieplayer2/frame.h | |||
@@ -0,0 +1,45 @@ | |||
1 | |||
2 | #ifndef XINELIBFRAME_H | ||
3 | #define XINELIBFRAME_H | ||
4 | |||
5 | #include <xine.h> | ||
6 | |||
7 | namespace XINE { | ||
8 | class Frame { | ||
9 | public: | ||
10 | Frame(); | ||
11 | Frame( int *width, int* height, | ||
12 | int *ratio_code, int *format, | ||
13 | uint8_t **y, uint8_t **u, | ||
14 | uint8_t **v ); | ||
15 | ~Frame(); | ||
16 | int* width() { return m_width; }; | ||
17 | int* height() { return m_height; }; | ||
18 | |||
19 | int* ratioCode() { return m_ratioCode; }; | ||
20 | int* format() { return m_format; }; | ||
21 | uint8_t ** y() { return m_y; }; | ||
22 | uint8_t ** u() { return m_u; }; | ||
23 | uint8_t ** v() { return m_v; }; | ||
24 | |||
25 | void setHeight( int* ); | ||
26 | void setWidth( int* ); | ||
27 | void setRatioCode(int *); | ||
28 | void setFormat( int* ); | ||
29 | void setU( uint8_t** ); | ||
30 | void setY( uint8_t** ); | ||
31 | void setV( uint8_t** ); | ||
32 | |||
33 | private: | ||
34 | friend class Lib; | ||
35 | int* m_height; | ||
36 | int* m_width; | ||
37 | int* m_ratioCode; | ||
38 | int* m_format; | ||
39 | uint8_t** m_u; | ||
40 | uint8_t** m_y; | ||
41 | uint8_t** m_v; | ||
42 | }; | ||
43 | }; | ||
44 | |||
45 | #endif | ||
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 | |||
14 | using namespace XINE; | ||
15 | |||
16 | Lib::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 | |||
49 | Lib::~Lib() { | ||
50 | delete m_config; | ||
51 | xine_exit( m_xine ); | ||
52 | delete m_videoOutput; | ||
53 | //delete m_audioOutput; | ||
54 | |||
55 | } | ||
56 | |||
57 | QCString Lib::version() { | ||
58 | QCString str( xine_get_str_version() ); | ||
59 | return str; | ||
60 | }; | ||
61 | |||
62 | int Lib::majorVersion() { | ||
63 | return xine_get_major_version(); | ||
64 | } | ||
65 | int Lib::minorVersion() { | ||
66 | return xine_get_minor_version(); | ||
67 | }; | ||
68 | int Lib::subVersion() { | ||
69 | return xine_get_sub_version(); | ||
70 | } | ||
71 | int 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 | } | ||
78 | void Lib::stop() { | ||
79 | xine_stop(m_xine ); | ||
80 | } | ||
81 | void Lib::pause(){ | ||
82 | xine_set_speed( m_xine, SPEED_PAUSE ); | ||
83 | } | ||
84 | int Lib::speed() { | ||
85 | return xine_get_speed( m_xine ); | ||
86 | } | ||
87 | void Lib::setSpeed( int speed ) { | ||
88 | xine_set_speed( m_xine, speed ); | ||
89 | } | ||
90 | int Lib::status(){ | ||
91 | return xine_get_status( m_xine ); | ||
92 | } | ||
93 | int Lib::currentPosition(){ | ||
94 | return xine_get_current_position( m_xine ); | ||
95 | } | ||
96 | int Lib::currentTime() { | ||
97 | return xine_get_current_time( m_xine ); | ||
98 | }; | ||
99 | int Lib::length() { | ||
100 | return xine_get_stream_length( m_xine ); | ||
101 | } | ||
102 | bool Lib::isSeekable() { | ||
103 | return xine_is_stream_seekable(m_xine); | ||
104 | } | ||
105 | Frame Lib::currentFrame() { | ||
106 | Frame frame; | ||
107 | return frame; | ||
108 | }; | ||
109 | int Lib::error() { | ||
110 | return xine_get_error( m_xine ); | ||
111 | }; | ||
112 | |||
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h new file mode 100644 index 0000000..d9dc931 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -0,0 +1,60 @@ | |||
1 | |||
2 | |||
3 | #ifndef ZECKEXINELIB_H | ||
4 | #define ZECKEXINELIB_H | ||
5 | |||
6 | #include <qcstring.h> | ||
7 | #include <qstring.h> | ||
8 | #include <xine.h> | ||
9 | |||
10 | namespace XINE { | ||
11 | |||
12 | /** | ||
13 | * Lib wrapps the simple interface | ||
14 | * of libxine for easy every day use | ||
15 | * This will become a full C++ Wrapper | ||
16 | * It supports playing, pausing, info, | ||
17 | * stooping, seeking. | ||
18 | */ | ||
19 | class Frame; | ||
20 | class Lib { | ||
21 | public: | ||
22 | Lib(); | ||
23 | ~Lib(); | ||
24 | QCString version(); | ||
25 | int majorVersion()/*const*/; | ||
26 | int minorVersion()/*const*/; | ||
27 | int subVersion()/*const*/; | ||
28 | |||
29 | |||
30 | int play( const QString& fileName, | ||
31 | int startPos = 0, | ||
32 | int start_time = 0 ); | ||
33 | void stop() /*const*/; | ||
34 | void pause()/*const*/; | ||
35 | |||
36 | int speed() /*const*/; | ||
37 | void setSpeed( int speed = SPEED_PAUSE ); | ||
38 | |||
39 | int status() /*const*/; | ||
40 | |||
41 | int currentPosition()/*const*/; | ||
42 | //in seconds | ||
43 | int currentTime()/*const*/; | ||
44 | int length() /*const*/; | ||
45 | |||
46 | bool isSeekable()/*const*/; | ||
47 | |||
48 | Frame currentFrame()/*const*/; | ||
49 | int error() /*const*/; | ||
50 | private: | ||
51 | xine_t *m_xine; | ||
52 | config_values_t *m_config; | ||
53 | vo_driver_t *m_videoOutput; | ||
54 | ao_driver_t* m_audioOutput; | ||
55 | |||
56 | }; | ||
57 | }; | ||
58 | |||
59 | |||
60 | #endif | ||
diff --git a/noncore/multimedia/opieplayer2/mainTest.cpp b/noncore/multimedia/opieplayer2/mainTest.cpp new file mode 100644 index 0000000..f130c51 --- a/dev/null +++ b/noncore/multimedia/opieplayer2/mainTest.cpp | |||
@@ -0,0 +1,15 @@ | |||
1 | |||
2 | #include <stdlib.h> | ||
3 | #include <stdio.h> | ||
4 | |||
5 | #include "xinelib.h" | ||
6 | |||
7 | int main( int argc, char *argv[] ) { | ||
8 | printf("FixME\n"); | ||
9 | //return 0; | ||
10 | XINE::Lib lib; | ||
11 | QString str = QString::fromLatin1( argv[1] ); | ||
12 | lib.play( str ); | ||
13 | for (;;); | ||
14 | return 0; | ||
15 | } | ||
diff --git a/noncore/multimedia/opieplayer2/zeckeplayer.pro b/noncore/multimedia/opieplayer2/zeckeplayer.pro new file mode 100644 index 0000000..e63713f --- a/dev/null +++ b/noncore/multimedia/opieplayer2/zeckeplayer.pro | |||
@@ -0,0 +1,10 @@ | |||
1 | TEMPLATE= app | ||
2 | DESTDIR = . | ||
3 | #CONFIG = qt warn_on debug | ||
4 | CONFIG = qt warn_on release | ||
5 | HEADERS = frame.h lib.h | ||
6 | SOURCES = frame.cpp lib.cpp main.cpp | ||
7 | INCLUDEPATH+= $(OPIEDIR)/include /usr/locale/include | ||
8 | DEPENDPATH+= $(OPIEDIR)/include /usr/locale/include | ||
9 | LIBS += -lxine -lxineutils | ||
10 | TARGET = zeckeplayer \ No newline at end of file | ||