-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 @@ + +#include "frame.h" + +using namespace XINE; + +Frame::Frame() { + m_height = 0; + m_width = 0; + m_ratioCode = 0; + m_format = 0; + m_u = 0; + m_y = 0; + m_v = 0; +} +Frame::Frame( int *width, int* height, + int *ratio_code, int *format, + uint8_t **y, uint8_t **u, + uint8_t **v ) { + m_width = width; + m_height = height; + m_ratioCode = ratio_code ; + m_format = format; + m_y = y; + m_u = u; + m_v = v; +} +Frame::~Frame() { + + +} +void Frame::setHeight( int* height ) { + m_height = height; +} +void Frame::setWidth( int* width ) { + m_width = width; +} +void Frame::setRatioCode( int* ratio ) { + m_ratioCode = ratio; +} +void Frame::setFormat( int* format ) { + m_format = format; +} +void Frame::setU( uint8_t** u ) { + m_u = u; +} +void Frame::setY( uint8_t** y ) { + m_y = y; +} +void Frame::setV( uint8_t** v ) { + m_v = v; +} 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 @@ + +#ifndef XINELIBFRAME_H +#define XINELIBFRAME_H + +#include <xine.h> + +namespace XINE { + class Frame { + public: + Frame(); + Frame( int *width, int* height, + int *ratio_code, int *format, + uint8_t **y, uint8_t **u, + uint8_t **v ); + ~Frame(); + int* width() { return m_width; }; + int* height() { return m_height; }; + + int* ratioCode() { return m_ratioCode; }; + int* format() { return m_format; }; + uint8_t ** y() { return m_y; }; + uint8_t ** u() { return m_u; }; + uint8_t ** v() { return m_v; }; + + void setHeight( int* ); + void setWidth( int* ); + void setRatioCode(int *); + void setFormat( int* ); + void setU( uint8_t** ); + void setY( uint8_t** ); + void setV( uint8_t** ); + + private: + friend class Lib; + int* m_height; + int* m_width; + int* m_ratioCode; + int* m_format; + uint8_t** m_u; + uint8_t** m_y; + uint8_t** m_v; + }; +}; + +#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 @@ + +#include <stdio.h> +#include <stdlib.h> +//#include <qpe/qpeapplication.h> + +#include <qfile.h> + +#include "frame.h" +#include "xinelib.h" + + + + +using namespace XINE; + +Lib::Lib() { + printf("Lib"); + QCString str( getenv("HOME") ); + str += "/Settings/opiexine.cf"; + // get the configuration + m_config = xine_config_file_init( str.data() ); + + // allocate oss for sound + // and fb for framebuffer + m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; + if (m_audioOutput == NULL ) + printf("Failure\n"); + else + printf("Success\n"); + + + // test code + m_videoOutput = xine_load_video_output_plugin(m_config, "fb", + VISUAL_TYPE_FB, + 0 ); + + char** files = xine_list_video_output_plugins(3); + char* out; + int i = 0; + while ( ( out = files[i] ) != 0 ) { + printf("Audio %s\n", out ); + i++; + } + m_xine = xine_init( m_videoOutput, + m_audioOutput, + m_config ); +} + +Lib::~Lib() { + delete m_config; + xine_exit( m_xine ); + delete m_videoOutput; + //delete m_audioOutput; + +} + +QCString Lib::version() { + QCString str( xine_get_str_version() ); + return str; +}; + +int Lib::majorVersion() { + return xine_get_major_version(); +} +int Lib::minorVersion() { + return xine_get_minor_version(); +}; +int Lib::subVersion() { + return xine_get_sub_version(); +} +int Lib::play( const QString& fileName, + int startPos, + int start_time ) { + QString str = fileName; + return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), + startPos, start_time); +} +void Lib::stop() { + xine_stop(m_xine ); +} +void Lib::pause(){ + xine_set_speed( m_xine, SPEED_PAUSE ); +} +int Lib::speed() { + return xine_get_speed( m_xine ); +} +void Lib::setSpeed( int speed ) { + xine_set_speed( m_xine, speed ); +} +int Lib::status(){ + return xine_get_status( m_xine ); +} +int Lib::currentPosition(){ + return xine_get_current_position( m_xine ); +} +int Lib::currentTime() { + return xine_get_current_time( m_xine ); +}; +int Lib::length() { + return xine_get_stream_length( m_xine ); +} +bool Lib::isSeekable() { + return xine_is_stream_seekable(m_xine); +} +Frame Lib::currentFrame() { + Frame frame; + return frame; +}; +int Lib::error() { + return xine_get_error( m_xine ); +}; + 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 @@ + + +#ifndef ZECKEXINELIB_H +#define ZECKEXINELIB_H + +#include <qcstring.h> +#include <qstring.h> +#include <xine.h> + +namespace XINE { + + /** + * Lib wrapps the simple interface + * of libxine for easy every day use + * This will become a full C++ Wrapper + * It supports playing, pausing, info, + * stooping, seeking. + */ + class Frame; + class Lib { + public: + Lib(); + ~Lib(); + QCString version(); + int majorVersion()/*const*/; + int minorVersion()/*const*/; + int subVersion()/*const*/; + + + int play( const QString& fileName, + int startPos = 0, + int start_time = 0 ); + void stop() /*const*/; + void pause()/*const*/; + + int speed() /*const*/; + void setSpeed( int speed = SPEED_PAUSE ); + + int status() /*const*/; + + int currentPosition()/*const*/; + //in seconds + int currentTime()/*const*/; + int length() /*const*/; + + bool isSeekable()/*const*/; + + Frame currentFrame()/*const*/; + int error() /*const*/; + private: + xine_t *m_xine; + config_values_t *m_config; + vo_driver_t *m_videoOutput; + ao_driver_t* m_audioOutput; + + }; +}; + + +#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 @@ + +#include <stdlib.h> +#include <stdio.h> + +#include "xinelib.h" + +int main( int argc, char *argv[] ) { + printf("FixME\n"); + //return 0; + XINE::Lib lib; + QString str = QString::fromLatin1( argv[1] ); + lib.play( str ); + for (;;); + return 0; +} 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 @@ +TEMPLATE = app +DESTDIR = . +#CONFIG = qt warn_on debug +CONFIG = qt warn_on release +HEADERS = frame.h lib.h +SOURCES = frame.cpp lib.cpp main.cpp +INCLUDEPATH += $(OPIEDIR)/include /usr/locale/include +DEPENDPATH += $(OPIEDIR)/include /usr/locale/include +LIBS += -lxine -lxineutils +TARGET = zeckeplayer
\ No newline at end of file |