Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 84d28ce..5f281b7 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -32,110 +32,112 @@ _;:, .> :=|. This program is free software; you can | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "xinevideowidget.h" | 34 | #include "xinevideowidget.h" |
35 | #include "lib.h" | 35 | #include "lib.h" |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | #include <opie2/odebug.h> | 38 | #include <opie2/odebug.h> |
39 | #include <qpe/global.h> | 39 | #include <qpe/global.h> |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qtextstream.h> | 42 | #include <qtextstream.h> |
43 | #include <qdir.h> | 43 | #include <qdir.h> |
44 | #include <qgfx_qws.h> | 44 | #include <qgfx_qws.h> |
45 | 45 | ||
46 | /* STD */ | 46 | /* STD */ |
47 | #include <assert.h> | 47 | #include <assert.h> |
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | 49 | ||
50 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 50 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
51 | int width, int height,int bytes ); | 51 | int width, int height,int bytes ); |
52 | typedef void (*vo_scale_cb) (void*, int, int, double, | 52 | typedef void (*vo_scale_cb) (void*, int, int, double, |
53 | int*, int*, int*, int*, double*, int*, int* ); | 53 | int*, int*, int*, int*, double*, int*, int* ); |
54 | typedef void (*dest_size_cb) (void*, int, int, double, int*, int*, double*); | 54 | typedef void (*dest_size_cb) (void*, int, int, double, int*, int*, double*); |
55 | 55 | ||
56 | 56 | ||
57 | extern "C" { | 57 | extern "C" { |
58 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void *, vo_scale_cb, dest_size_cb ); | 58 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void *, vo_scale_cb, dest_size_cb ); |
59 | int null_is_showing_video( const xine_vo_driver_t* self ); | 59 | int null_is_showing_video( const xine_vo_driver_t* self ); |
60 | void null_set_show_video( const xine_vo_driver_t* self, int show ); | 60 | void null_set_show_video( const xine_vo_driver_t* self, int show ); |
61 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); | 61 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); |
62 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); | 62 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); |
63 | } | 63 | } |
64 | 64 | ||
65 | using namespace XINE; | 65 | using namespace XINE; |
66 | 66 | ||
67 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | 67 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
68 | { | 68 | { |
69 | m_initialized = false; | 69 | m_initialized = false; |
70 | m_duringInitialization = false; | 70 | m_duringInitialization = false; |
71 | m_video = false; | 71 | m_video = false; |
72 | m_wid = widget; | 72 | m_wid = widget; |
73 | printf("Lib"); | 73 | printf("Lib"); |
74 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 74 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
75 | // get the configuration | 75 | // get the configuration |
76 | 76 | ||
77 | // not really OO, should be an extra class, later | 77 | // not really OO, should be an extra class, later |
78 | if ( !QFile::exists(configPath) ) { | 78 | if ( !QFile::exists(configPath) ) { |
79 | QFile f(configPath); | 79 | QFile f(configPath); |
80 | f.open(IO_WriteOnly); | 80 | if (f.open(IO_WriteOnly)) { |
81 | QTextStream ts( &f ); | 81 | QTextStream ts( &f ); |
82 | ts << "misc.memcpy_method:glibc\n"; | 82 | ts << "misc.memcpy_method:glibc\n"; |
83 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; | 83 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; |
84 | ts << "codec.ffmpeg_pp_quality:3\n"; | 84 | ts << "codec.ffmpeg_pp_quality:3\n"; |
85 | ts << "audio.num_buffers:50\n"; | 85 | ts << "audio.num_buffers:50\n"; |
86 | ts << "audio.size_buffers:4096\n"; | 86 | ts << "audio.size_buffers:4096\n"; |
87 | ts << "video.num_buffers:20\n"; | 87 | ts << "video.num_buffers:20\n"; |
88 | ts << "video.size_buffers:4096\n"; | 88 | ts << "video.size_buffers:4096\n"; |
89 | ts << "audio.out_num_audio_buf:16\n"; | 89 | ts << "audio.out_num_audio_buf:16\n"; |
90 | ts << "audio.out_size_audio_buf:8096\n"; | 90 | ts << "audio.out_size_audio_buf:8096\n"; |
91 | ts << "audio.out_size_zero_buf:1024\n"; | 91 | ts << "audio.out_size_zero_buf:1024\n"; |
92 | ts << "audio.passthrough_offset:0\n"; | 92 | ts << "audio.passthrough_offset:0\n"; |
93 | f.close(); | 93 | f.close(); |
94 | } else | ||
95 | owarn << "Failed to open " f.name() << oendl; | ||
94 | } | 96 | } |
95 | 97 | ||
96 | if ( initMode == InitializeImmediately ) { | 98 | if ( initMode == InitializeImmediately ) { |
97 | initialize(); | 99 | initialize(); |
98 | m_initialized = true; | 100 | m_initialized = true; |
99 | } | 101 | } |
100 | else | 102 | else |
101 | start(); | 103 | start(); |
102 | } | 104 | } |
103 | 105 | ||
104 | void Lib::run() | 106 | void Lib::run() |
105 | { | 107 | { |
106 | odebug << "Lib::run() started" << oendl; | 108 | odebug << "Lib::run() started" << oendl; |
107 | initialize(); | 109 | initialize(); |
108 | m_initialized = true; | 110 | m_initialized = true; |
109 | odebug << "Lib::run() finished" << oendl; | 111 | odebug << "Lib::run() finished" << oendl; |
110 | } | 112 | } |
111 | 113 | ||
112 | void Lib::initialize() | 114 | void Lib::initialize() |
113 | { | 115 | { |
114 | m_duringInitialization = true; | 116 | m_duringInitialization = true; |
115 | m_xine = xine_new( ); | 117 | m_xine = xine_new( ); |
116 | 118 | ||
117 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 119 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
118 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 120 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
119 | 121 | ||
120 | xine_init( m_xine ); | 122 | xine_init( m_xine ); |
121 | 123 | ||
122 | // allocate oss for sound | 124 | // allocate oss for sound |
123 | // and fb for framebuffer | 125 | // and fb for framebuffer |
124 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 126 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
125 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, | 127 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, |
126 | xine_display_frame, this, | 128 | xine_display_frame, this, |
127 | xine_vo_scale_cb, | 129 | xine_vo_scale_cb, |
128 | xine_dest_cb ); | 130 | xine_dest_cb ); |
129 | 131 | ||
130 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 132 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
131 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | 133 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); |
132 | 134 | ||
133 | if (m_wid != 0 ) | 135 | if (m_wid != 0 ) |
134 | setWidget( m_wid ); | 136 | setWidget( m_wid ); |
135 | 137 | ||
136 | 138 | ||
137 | m_queue = xine_event_new_queue (m_stream); | 139 | m_queue = xine_event_new_queue (m_stream); |
138 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 140 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
139 | 141 | ||
140 | m_duringInitialization = false; | 142 | m_duringInitialization = false; |
141 | } | 143 | } |