-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 40 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 47 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 37 |
3 files changed, 119 insertions, 5 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 @@ -5,17 +5,24 @@ #include <qfile.h> #include "frame.h" #include "lib.h" extern "C" { -vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); + vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); + int null_is_showing_video( vo_driver_t* self ); + void null_set_show_video( vo_driver_t* self, int show ); + int null_is_fullscreen( vo_driver_t* self ); + void null_set_fullscreen( vo_driver_t* self, int screen ); + int null_is_scaling( vo_driver_t* self ); + void null_set_scaling( vo_driver_t* self, int scale ); + } using namespace XINE; Lib::Lib() { printf("Lib"); QCString str( getenv("HOME") ); str += "/Settings/opiexine.cf"; @@ -42,23 +49,26 @@ Lib::Lib() { while ( ( out = files[i] ) != 0 ) { printf("Audio %s\n", out ); i++; } // m_xine = xine_init( m_videoOutput, // m_audioOutput, // m_config ); // test loading - m_videoOutput = ::init_video_out_plugin( m_config, NULL ); + m_videoOutput = ::init_video_out_plugin( m_config, NULL ); m_xine = xine_init( m_videoOutput, m_audioOutput, m_config ); + // install the event handler + xine_register_event_listener( m_xine, xine_event_handler, this ); } Lib::~Lib() { delete m_config; + xine_remove_event_listener( m_xine, xine_event_handler ); xine_exit( m_xine ); delete m_videoOutput; //delete m_audioOutput; } QCString Lib::version() { QCString str( xine_get_str_version() ); @@ -111,9 +121,33 @@ bool Lib::isSeekable() { } Frame Lib::currentFrame() { Frame frame; return frame; }; int Lib::error() { return xine_get_error( m_xine ); }; - +void Lib::handleXineEvent( xine_event_t* t ) { + if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) + emit stopped(); +} +void Lib::setShowVideo( bool video ) { + ::null_set_show_video( m_videoOutput, video ); +} +bool Lib::isShowingVideo() { + return ::null_is_showing_video( m_videoOutput ); +} +void Lib::showVideoFullScreen( bool fullScreen ) { + ::null_set_fullscreen( m_videoOutput, fullScreen ); +} +bool Lib::isVideoFullScreen() { + return ::null_is_fullscreen( m_videoOutput ); +} +void Lib::setScaling( bool scale ) { + ::null_set_scaling( m_videoOutput, scale ); +} +bool Lib::isScaling() { + return ::null_is_scaling( m_videoOutput ); +} +void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { + ((Lib*)user_data)->handleXineEvent( t ); +} diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index d9dc931..00a1248 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h @@ -1,28 +1,31 @@ #ifndef ZECKEXINELIB_H #define ZECKEXINELIB_H #include <qcstring.h> #include <qstring.h> +#include <qobject.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 { + class Lib : public QObject { + Q_OBJECT public: Lib(); ~Lib(); QCString version(); int majorVersion()/*const*/; int minorVersion()/*const*/; int subVersion()/*const*/; @@ -40,21 +43,63 @@ namespace XINE { int currentPosition()/*const*/; //in seconds int currentTime()/*const*/; int length() /*const*/; bool isSeekable()/*const*/; + /** + * Whether or not to show video output + */ + void setShowVideo(bool video); + + /** + * is we show video + */ + bool isShowingVideo() /*const*/; + + /** + * + */ + void showVideoFullScreen( bool fullScreen ); + + /** + * + */ + bool isVideoFullScreen()/*const*/ ; + + /** + * + */ + bool isScaling(); + + /** + * + */ + void setScaling( bool ); + /** + * test + */ Frame currentFrame()/*const*/; + + /** + * Returns the error code + */ int error() /*const*/; + + signals: + void stopped(); private: xine_t *m_xine; config_values_t *m_config; vo_driver_t *m_videoOutput; ao_driver_t* m_audioOutput; + void handleXineEvent( xine_event_t* t ); + // C -> C++ bridge for the event system + static void xine_event_handler( void* user_data, xine_event_t* t); }; }; #endif diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index 5224862..b8b8eb3 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c @@ -8,17 +8,19 @@ #include <xine/xineutils.h> #include <xine/configfile.h> typedef struct null_driver_s null_driver_t; struct null_driver_s { vo_driver_t vo_driver; uint32_t m_capabilities; - + int m_show_video; + int m_video_fullscreen; + int m_is_scaling; }; typedef struct opie_frame_s opie_frame_t; struct opie_frame_s { vo_frame_t frame; char* name; int version; int m_width; int m_height; @@ -142,16 +144,19 @@ static int null_redraw_needed( vo_driver_t* self ){ return 0; } vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video ){ null_driver_t *vo; vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); + vo->m_show_video = 0; // false + vo->m_video_fullscreen = 0; + vo->m_is_scaling = 0; /* memset? */ /* install callback handlers*/ vo->vo_driver.get_capabilities = null_get_capabilities; vo->vo_driver.alloc_frame = null_alloc_frame; vo->vo_driver.update_frame_format = null_update_frame_format; vo->vo_driver.display_frame = null_display_frame; vo->vo_driver.overlay_blend = null_overlay_blend; @@ -176,8 +181,38 @@ static vo_info_t vo_info_null = { VISUAL_TYPE_FB, 5 }; vo_info_t *get_video_out_plugin_info(){ vo_info_null.description = _("xine video output plugin using null device"); return &vo_info_null; } + +/* this is special for this device */ +/** + * We know that we will be controled by the XINE LIB++ + */ + +/** + * + */ +int null_is_showing_video( vo_driver_t* self ){ + null_driver_t* this = (null_driver_t*)self; + return this->m_show_video; +} +void null_set_show_video( vo_driver_t* self, int show ) { + ((null_driver_t*)self)->m_show_video = show; +} + +int null_is_fullscreen( vo_driver_t* self ){ + return ((null_driver_t*)self)->m_video_fullscreen; +} +void null_set_fullscreen( vo_driver_t* self, int screen ){ + ((null_driver_t*)self)->m_video_fullscreen = screen; +} +int null_is_scaling( vo_driver_t* self ){ + return ((null_driver_t*)self)->m_is_scaling; +} +void null_set_scaling( vo_driver_t* self, int scale ){ + ((null_driver_t*)self)->m_is_scaling = scale; +} + |