summaryrefslogtreecommitdiff
authorzecke <zecke>2002-07-02 15:25:38 (UTC)
committer zecke <zecke>2002-07-02 15:25:38 (UTC)
commite26bf96e2e4f2d1edf19e81dc67eace3cb8622dc (patch) (unidiff)
tree0346837eed0c9acc55f25601e495a188fb1111fb
parentd4a5bcbba0e6f67ef9d41e08c7d5ae598caa61a8 (diff)
downloadopie-e26bf96e2e4f2d1edf19e81dc67eace3cb8622dc.zip
opie-e26bf96e2e4f2d1edf19e81dc67eace3cb8622dc.tar.gz
opie-e26bf96e2e4f2d1edf19e81dc67eace3cb8622dc.tar.bz2
my hacky null video output plugin
This will become our smart opie video widget controller...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mainTest.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c137
-rw-r--r--noncore/multimedia/opieplayer2/zeckeplayer.pro6
4 files changed, 142 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index ecaeeea..4b13f00 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,105 +1,105 @@
1 1
2#include <stdio.h> 2#include <stdio.h>
3#include <stdlib.h> 3#include <stdlib.h>
4//#include <qpe/qpeapplication.h> 4//#include <qpe/qpeapplication.h>
5 5
6#include <qfile.h> 6#include <qfile.h>
7 7
8#include "frame.h" 8#include "frame.h"
9#include "xinelib.h" 9#include "lib.h"
10 10
11 11
12 12
13 13
14using namespace XINE; 14using namespace XINE;
15 15
16Lib::Lib() { 16Lib::Lib() {
17 printf("Lib"); 17 printf("Lib");
18 QCString str( getenv("HOME") ); 18 QCString str( getenv("HOME") );
19 str += "/Settings/opiexine.cf"; 19 str += "/Settings/opiexine.cf";
20 // get the configuration 20 // get the configuration
21 m_config = xine_config_file_init( str.data() ); 21 m_config = xine_config_file_init( str.data() );
22 22
23 // allocate oss for sound 23 // allocate oss for sound
24 // and fb for framebuffer 24 // and fb for framebuffer
25 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; 25 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ;
26 if (m_audioOutput == NULL ) 26 if (m_audioOutput == NULL )
27 printf("Failure\n"); 27 printf("Failure\n");
28 else 28 else
29 printf("Success\n"); 29 printf("Success\n");
30 30
31 31
32 // test code 32 // test code
33 m_videoOutput = xine_load_video_output_plugin(m_config, "fb", 33 m_videoOutput = xine_load_video_output_plugin(m_config, "fb",
34 VISUAL_TYPE_FB, 34 VISUAL_TYPE_FB,
35 0 ); 35 0 );
36 36
37 char** files = xine_list_video_output_plugins(3); 37 char** files = xine_list_video_output_plugins(3);
38 char* out; 38 char* out;
39 int i = 0; 39 int i = 0;
40 while ( ( out = files[i] ) != 0 ) { 40 while ( ( out = files[i] ) != 0 ) {
41 printf("Audio %s\n", out ); 41 printf("Audio %s\n", out );
42 i++; 42 i++;
43 } 43 }
44 m_xine = xine_init( m_videoOutput, 44 m_xine = xine_init( m_videoOutput,
45 m_audioOutput, 45 m_audioOutput,
46 m_config ); 46 m_config );
47} 47}
48 48
49Lib::~Lib() { 49Lib::~Lib() {
50 delete m_config; 50 delete m_config;
51 xine_exit( m_xine ); 51 xine_exit( m_xine );
52 delete m_videoOutput; 52 delete m_videoOutput;
53 //delete m_audioOutput; 53 //delete m_audioOutput;
54 54
55} 55}
56 56
57QCString Lib::version() { 57QCString Lib::version() {
58 QCString str( xine_get_str_version() ); 58 QCString str( xine_get_str_version() );
59 return str; 59 return str;
60}; 60};
61 61
62int Lib::majorVersion() { 62int Lib::majorVersion() {
63 return xine_get_major_version(); 63 return xine_get_major_version();
64} 64}
65int Lib::minorVersion() { 65int Lib::minorVersion() {
66 return xine_get_minor_version(); 66 return xine_get_minor_version();
67}; 67};
68int Lib::subVersion() { 68int Lib::subVersion() {
69 return xine_get_sub_version(); 69 return xine_get_sub_version();
70} 70}
71int Lib::play( const QString& fileName, 71int Lib::play( const QString& fileName,
72 int startPos, 72 int startPos,
73 int start_time ) { 73 int start_time ) {
74 QString str = fileName; 74 QString str = fileName;
75 return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), 75 return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(),
76 startPos, start_time); 76 startPos, start_time);
77} 77}
78void Lib::stop() { 78void Lib::stop() {
79 xine_stop(m_xine ); 79 xine_stop(m_xine );
80} 80}
81void Lib::pause(){ 81void Lib::pause(){
82 xine_set_speed( m_xine, SPEED_PAUSE ); 82 xine_set_speed( m_xine, SPEED_PAUSE );
83} 83}
84int Lib::speed() { 84int Lib::speed() {
85 return xine_get_speed( m_xine ); 85 return xine_get_speed( m_xine );
86} 86}
87void Lib::setSpeed( int speed ) { 87void Lib::setSpeed( int speed ) {
88 xine_set_speed( m_xine, speed ); 88 xine_set_speed( m_xine, speed );
89} 89}
90int Lib::status(){ 90int Lib::status(){
91 return xine_get_status( m_xine ); 91 return xine_get_status( m_xine );
92} 92}
93int Lib::currentPosition(){ 93int Lib::currentPosition(){
94 return xine_get_current_position( m_xine ); 94 return xine_get_current_position( m_xine );
95} 95}
96int Lib::currentTime() { 96int Lib::currentTime() {
97 return xine_get_current_time( m_xine ); 97 return xine_get_current_time( m_xine );
98}; 98};
99int Lib::length() { 99int Lib::length() {
100 return xine_get_stream_length( m_xine ); 100 return xine_get_stream_length( m_xine );
101} 101}
102bool Lib::isSeekable() { 102bool Lib::isSeekable() {
103 return xine_is_stream_seekable(m_xine); 103 return xine_is_stream_seekable(m_xine);
104} 104}
105Frame Lib::currentFrame() { 105Frame Lib::currentFrame() {
diff --git a/noncore/multimedia/opieplayer2/mainTest.cpp b/noncore/multimedia/opieplayer2/mainTest.cpp
index f130c51..58a8b47 100644
--- a/noncore/multimedia/opieplayer2/mainTest.cpp
+++ b/noncore/multimedia/opieplayer2/mainTest.cpp
@@ -1,15 +1,15 @@
1 1
2#include <stdlib.h> 2#include <stdlib.h>
3#include <stdio.h> 3#include <stdio.h>
4 4
5#include "xinelib.h" 5#include "lib.h"
6 6
7int main( int argc, char *argv[] ) { 7int main( int argc, char *argv[] ) {
8 printf("FixME\n"); 8 printf("FixME\n");
9 //return 0; 9 //return 0;
10 XINE::Lib lib; 10 XINE::Lib lib;
11 QString str = QString::fromLatin1( argv[1] ); 11 QString str = QString::fromLatin1( argv[1] );
12 lib.play( str ); 12 lib.play( str );
13 for (;;); 13 for (;;);
14 return 0; 14 return 0;
15} 15}
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
new file mode 100644
index 0000000..c97800c
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -0,0 +1,137 @@
1
2/*#include <xine.h>*/
3#include <stdlib.h>
4#include <stdio.h>
5
6#include <xine/video_out.h>
7#include <xine/xine_internal.h>
8#include <xine/xineutils.h>
9#include <xine/configfile.h>
10
11typedef struct null_driver_s null_driver_t;
12
13struct null_driver_s {
14 vo_driver_t vo_driver;
15 uint32_t m_capabilities;
16
17};
18typedef struct opie_frame_s opie_frame_t;
19struct opie_frame_s {
20 vo_frame_t frame;
21 char* name;
22 int version;
23 null_driver_t *output;
24};
25
26static uint32_t null_get_capabilities(vo_driver_t *self ){
27 null_driver_t* this = (null_driver_t*)self;
28 return this->m_capabilities;
29}
30
31/* take care of the frame*/
32static void null_frame_dispose( vo_frame_t* vo_img){
33 opie_frame_t* frame = (opie_frame_t*)vo_img;
34 free (frame);
35}
36static void null_frame_field( vo_frame_t* frame, int inti ){
37 /* not needed */
38}
39
40/* end take care of frames*/
41
42static vo_frame_t* null_alloc_frame( vo_driver_t* self ){
43 null_driver_t* this = (null_driver_t*)self;
44 opie_frame_t* frame = (opie_frame_t*)malloc ( sizeof(opie_frame_t) );
45 memset( frame, 0, sizeof( opie_frame_t) );
46 frame->name = "opie\0";
47 frame->version = 1;
48 frame->output = this;
49
50 /* initialize the frame*/
51 frame->frame.driver = self;
52 /*frame.frame.free = null_frame_free;*/
53 frame->frame.copy = NULL;
54 frame->frame.field = null_frame_field;
55 frame->frame.dispose = null_frame_dispose;
56
57 return (vo_frame_t*) frame;
58}
59static void null_update_frame_format( vo_driver_t* self, vo_frame_t* img,
60 uint32_t width, uint32_t height,
61 int ratio_code, int format, int flags ){
62 /* not needed now */
63}
64static void null_display_frame( vo_driver_t* self, vo_frame_t *frame ){
65 printf("display frame");
66}
67static void null_overlay_blend( vo_driver_t* self, vo_frame_t* frame,
68 vo_overlay_t* overlay ){
69 /* sure */
70}
71static int null_get_property( vo_driver_t* self,
72 int property ){
73 return 0;
74}
75static int null_set_property( vo_driver_t* self,
76 int property,
77 int value ){
78 return value;
79}
80static void null_get_property_min_max( vo_driver_t* self,
81 int property, int *min,
82 int *max ){
83 *max = 0;
84 *min = 0;
85}
86static int null_gui_data_exchange( vo_driver_t* self,
87 int data_type,
88 void *data ){
89 return 0;
90}
91static void null_exit( vo_driver_t* self ){
92 null_driver_t* this = (null_driver_t*)self;
93 free ( this );
94}
95static int null_redraw_needed( vo_driver_t* self ){
96 return 0;
97}
98
99
100vo_driver_t* init_video_out_plugin( config_values_t* conf,
101 void* video ){
102 null_driver_t *vo;
103 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) );
104 /* memset? */
105
106 /* install callback handlers*/
107 vo->vo_driver.get_capabilities = null_get_capabilities;
108 vo->vo_driver.alloc_frame = null_alloc_frame;
109 vo->vo_driver.update_frame_format = null_update_frame_format;
110 vo->vo_driver.display_frame = null_display_frame;
111 vo->vo_driver.overlay_blend = null_overlay_blend;
112 vo->vo_driver.get_property = null_get_property;
113 vo->vo_driver.set_property = null_set_property;
114 vo->vo_driver.get_property_min_max = null_get_property_min_max;
115 vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
116 vo->vo_driver.exit = null_exit;
117 vo->vo_driver.redraw_needed = null_redraw_needed;
118
119
120 /* capabilities */
121 vo->m_capabilities = /*VO_CAP_COPIES_IMAGE |*/ VO_CAP_YV12 | VO_CAP_BRIGHTNESS;
122 printf("done initialisation\n");
123 return (vo_driver_t*) vo;
124}
125
126static vo_info_t vo_info_null = {
127 5,
128 "null plugin",
129 NULL,
130 VISUAL_TYPE_FB,
131 5
132};
133
134vo_info_t *get_video_out_plugin_info(){
135 vo_info_null.description = _("xine video output plugin using null device");
136 return &vo_info_null;
137}
diff --git a/noncore/multimedia/opieplayer2/zeckeplayer.pro b/noncore/multimedia/opieplayer2/zeckeplayer.pro
index e63713f..2484c86 100644
--- a/noncore/multimedia/opieplayer2/zeckeplayer.pro
+++ b/noncore/multimedia/opieplayer2/zeckeplayer.pro
@@ -1,10 +1,10 @@
1 TEMPLATE= app 1 TEMPLATE= app
2DESTDIR = . 2DESTDIR = .
3 #CONFIG = qt warn_on debug 3 #CONFIG = qt warn_on debug
4 CONFIG = qt warn_on release 4 CONFIG = qt warn_on release
5 HEADERS = frame.h lib.h 5 HEADERS = frame.h lib.h
6 SOURCES = frame.cpp lib.cpp main.cpp 6 SOURCES = nullvideo.o frame.cpp lib.cpp mainTest.cpp
7 INCLUDEPATH+= $(OPIEDIR)/include /usr/locale/include 7 INCLUDEPATH+= $(OPIEDIR)/include /usr/include
8 DEPENDPATH+= $(OPIEDIR)/include /usr/locale/include 8 DEPENDPATH+= $(OPIEDIR)/include /usr/include
9LIBS += -lxine -lxineutils 9LIBS += -lxine -lxineutils
10TARGET = zeckeplayer \ No newline at end of file 10TARGET = zeckeplayer \ No newline at end of file