-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 @@ -12,3 +12,10 @@ 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 ); + } @@ -49,5 +56,7 @@ Lib::Lib() { // 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 ); } @@ -56,2 +65,3 @@ Lib::~Lib() { delete m_config; + xine_remove_event_listener( m_xine, xine_event_handler ); xine_exit( m_xine ); @@ -118,2 +128,26 @@ int Lib::error() { }; - +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 @@ -7,2 +7,4 @@ #include <qstring.h> +#include <qobject.h> + #include <xine.h> @@ -19,3 +21,4 @@ namespace XINE { class Frame; - class Lib { + class Lib : public QObject { + Q_OBJECT public: @@ -47,4 +50,43 @@ namespace XINE { + /** + * 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: @@ -55,2 +97,5 @@ namespace XINE { + 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 @@ -15,3 +15,5 @@ struct null_driver_s { uint32_t m_capabilities; - + int m_show_video; + int m_video_fullscreen; + int m_is_scaling; }; @@ -149,2 +151,5 @@ vo_driver_t* init_video_out_plugin( config_values_t* conf, 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? */ @@ -183 +188,31 @@ vo_info_t *get_video_out_plugin_info(){ } + +/* 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; +} + |