summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp36
-rw-r--r--noncore/multimedia/opieplayer2/lib.h47
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c37
3 files changed, 117 insertions, 3 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
@@ -1,119 +1,153 @@
#include <stdio.h>
#include <stdlib.h>
//#include <qpe/qpeapplication.h>
#include <qfile.h>
#include "frame.h"
#include "lib.h"
extern "C" {
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";
// 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 );
// test loading
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() );
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 );
};
-
+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,60 +1,105 @@
#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*/;
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*/;
+ /**
+ * 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
@@ -1,183 +1,218 @@
/*#include <xine.h>*/
#include <stdlib.h>
#include <stdio.h>
#include <xine/video_out.h>
#include <xine/xine_internal.h>
#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;
uint8_t *chunk[3];
null_driver_t *output;
};
static uint32_t null_get_capabilities(vo_driver_t *self ){
null_driver_t* this = (null_driver_t*)self;
printf("capabilities\n");
return this->m_capabilities;
}
/* take care of the frame*/
static void null_frame_dispose( vo_frame_t* vo_img){
opie_frame_t* frame = (opie_frame_t*)vo_img;
printf("frame_dispose\n");
free (frame);
}
static void null_frame_field( vo_frame_t* frame, int inti ){
printf("frame_field\n");
/* not needed */
}
/* end take care of frames*/
static vo_frame_t* null_alloc_frame( vo_driver_t* self ){
null_driver_t* this = (null_driver_t*)self;
opie_frame_t* frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) );
memset( frame, 0, sizeof( opie_frame_t) );
printf("alloc_frame\n");
frame->name = "opie\0";
frame->version = 1;
frame->output = this;
/* initialize the frame*/
frame->frame.driver = self;
/*frame.frame.free = null_frame_free;*/
frame->frame.copy = NULL;
frame->frame.field = null_frame_field;
frame->frame.dispose = null_frame_dispose;
return (vo_frame_t*) frame;
}
static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
uint32_t width, uint32_t height,
int ratio_code, int format, int flags ){
null_driver_t* this = (null_driver_t*) self;
opie_frame_t* frame = (opie_frame_t*)img;
/* not needed now */
printf("update_frame_format\n");
printf("al crash aye?\n");
if(frame->chunk[0] ){
free( frame->chunk[0] );
frame->chunk[0] = NULL;
}
if(frame->chunk[1] ){
free ( frame->chunk[1] );
frame->chunk[1] = NULL;
}
if(frame->chunk[2] ){
free ( frame->chunk[2] );
frame->chunk[2] = NULL;
}
if( format == IMGFMT_YV12 ) {
int image_size = width * height; /* cast ouch*/
frame->frame.base[0] = xine_xmalloc_aligned(16, image_size,
(void **)&frame->chunk[0] );
frame->frame.base[1] = xine_xmalloc_aligned(16, image_size,
(void **)&frame->chunk[1] );
frame->frame.base[2] = xine_xmalloc_aligned(16, image_size,
(void **)&frame->chunk[2] );
}else{
int image_size = width * height; /* cast ouch*/
frame->frame.base[0] = xine_xmalloc_aligned(16, image_size,
(void **)&frame->chunk[0] );
frame->chunk[1] = NULL;
frame->chunk[2] = NULL;
}
}
static void null_display_frame( vo_driver_t* self, vo_frame_t *frame ){
printf("display frame\n");
}
static void null_overlay_blend( vo_driver_t* self, vo_frame_t* frame,
vo_overlay_t* overlay ){
/* sure */
}
static int null_get_property( vo_driver_t* self,
int property ){
printf("property get]n");
return 0;
}
static int null_set_property( vo_driver_t* self,
int property,
int value ){
printf("set property\n");
return value;
}
static void null_get_property_min_max( vo_driver_t* self,
int property, int *min,
int *max ){
printf("min max\n");
*max = 0;
*min = 0;
}
static int null_gui_data_exchange( vo_driver_t* self,
int data_type,
void *data ){
return 0;
}
static void null_exit( vo_driver_t* self ){
null_driver_t* this = (null_driver_t*)self;
free ( this );
}
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;
vo->vo_driver.get_property = null_get_property;
vo->vo_driver.set_property = null_set_property;
vo->vo_driver.get_property_min_max = null_get_property_min_max;
vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
vo->vo_driver.exit = null_exit;
vo->vo_driver.redraw_needed = null_redraw_needed;
/* capabilities */
vo->m_capabilities = /*VO_CAP_COPIES_IMAGE |*/ VO_CAP_YV12 | VO_CAP_BRIGHTNESS;
printf("done initialisation\n");
return (vo_driver_t*) vo;
}
static vo_info_t vo_info_null = {
5,
"null plugin",
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;
+}
+