-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 @@ -9,9 +9,16 @@ #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; @@ -46,15 +53,18 @@ Lib::Lib() { // 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; @@ -115,5 +125,29 @@ Frame Lib::currentFrame() { }; 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 @@ -4,8 +4,10 @@ #define ZECKEXINELIB_H #include <qcstring.h> #include <qstring.h> +#include <qobject.h> + #include <xine.h> namespace XINE { @@ -16,9 +18,10 @@ namespace XINE { * It supports playing, pausing, info, * stooping, seeking. */ class Frame; - class Lib { + class Lib : public QObject { + Q_OBJECT public: Lib(); ~Lib(); QCString version(); @@ -44,16 +47,58 @@ namespace XINE { 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); }; }; 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 @@ -12,9 +12,11 @@ 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; @@ -146,8 +148,11 @@ static int null_redraw_needed( vo_driver_t* self ){ 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; @@ -180,4 +185,34 @@ static vo_info_t vo_info_null = { 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; +} + |