-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 @@ -11,5 +11,12 @@ 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 ); + } @@ -48,11 +55,14 @@ Lib::Lib() { // 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; @@ -117,3 +127,27 @@ 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 @@ -6,4 +6,6 @@ #include <qcstring.h> #include <qstring.h> +#include <qobject.h> + #include <xine.h> @@ -18,5 +20,6 @@ namespace XINE { */ class Frame; - class Lib { + class Lib : public QObject { + Q_OBJECT public: Lib(); @@ -46,6 +49,45 @@ namespace XINE { 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; @@ -54,4 +96,7 @@ namespace XINE { 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 @@ -14,5 +14,7 @@ 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; @@ -148,4 +150,7 @@ vo_driver_t* init_video_out_plugin( config_values_t* conf, 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? */ @@ -182,2 +187,32 @@ vo_info_t *get_video_out_plugin_info(){ 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; +} + |