From 013877c8e13bebc4291603e7ea63af8f23b90045 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 24 Jun 2020 22:36:42 +0900 Subject: [PATCH] Fixed FTBFS with xine 1.2.10. The use of the xine scope plugin is currently disabled when xine >= 1.2.10 is detected. This resolves bug 3065 and 3066. Additional info: The xine scope plugin is statically linked and therefore written by accessing internal xine data that are no longer publicly available from xine 1.2.10. To add back the scope plugin functionality, the plugin will have to be converted into a dynamically linked one and further work done to fix the logic of the plugin itself. Signed-off-by: Michele Calgaro (cherry picked from commit f643355717f541980638b84933b987f6e4ed27a1) --- amarok/src/engine/xine/xine-engine.cpp | 21 ++++++++++++++++----- amarok/src/engine/xine/xine-scope.c | 6 ++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/amarok/src/engine/xine/xine-engine.cpp b/amarok/src/engine/xine/xine-engine.cpp index a6c1069d..2f6344e5 100644 --- a/amarok/src/engine/xine/xine-engine.cpp +++ b/amarok/src/engine/xine/xine-engine.cpp @@ -189,13 +189,16 @@ XineEngine::makeNewStream() &XineEngine::XineEventListener, (void*)this ); - #ifndef XINE_SAFE_MODE +#ifndef XINE_SAFE_MODE +#if XINE_MAJOR_VERSION < 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION < 2) || \ + (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION == 2 && XINE_SUB_VERSION < 10) //implemented in xine-scope.h m_post = scope_plugin_new( m_xine, m_audioPort ); +#endif xine_set_param( m_stream, XINE_PARAM_METRONOM_PREBUFFER, 6000 ); xine_set_param( m_stream, XINE_PARAM_IGNORE_VIDEO, 1 ); - #endif +#endif #ifdef XINE_PARAM_EARLY_FINISHED_EVENT if ( xine_check_version(1,1,1) && !(m_xfadeLength > 0) ) { // enable gapless playback @@ -260,14 +263,17 @@ XineEngine::load( const KURL &url, bool isStream ) { debug() << "After xine_open() *****" << endl; - #ifndef XINE_SAFE_MODE +#ifndef XINE_SAFE_MODE //we must ensure the scope is pruned of old buffers timerEvent( 0 ); +#if XINE_MAJOR_VERSION < 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION < 2) || \ + (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION == 2 && XINE_SUB_VERSION < 10) xine_post_out_t *source = xine_get_audio_source( m_stream ); xine_post_in_t *target = (xine_post_in_t*)xine_post_input( m_post, const_cast("audio in") ); xine_post_wire( source, target ); - #endif +#endif +#endif playlistChanged(); @@ -718,6 +724,8 @@ XineEngine::scope() if( !m_post || !m_stream || xine_get_status( m_stream ) != XINE_STATUS_PLAY ) return m_scope; +#if XINE_MAJOR_VERSION < 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION < 2) || \ + (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION == 2 && XINE_SUB_VERSION < 10) MyNode* const myList = scope_plugin_list( m_post ); metronom_t* const myMetronom = scope_plugin_metronom( m_post ); const int myChannels = scope_plugin_channels( m_post ); @@ -776,6 +784,7 @@ XineEngine::scope() } Log::scopeCallCount++; +#endif return m_scope; } @@ -786,8 +795,9 @@ XineEngine::timerEvent( TQTimerEvent* ) if ( !m_stream ) return; +#if XINE_MAJOR_VERSION < 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION < 2) || \ + (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION == 2 && XINE_SUB_VERSION < 10) //here we prune the buffer list regularly - MyNode *myList = scope_plugin_list( m_post ); if ( ! myList ) return; @@ -816,6 +826,7 @@ XineEngine::timerEvent( TQTimerEvent* ) prev = node; } +#endif } Amarok::PluginConfig* diff --git a/amarok/src/engine/xine/xine-scope.c b/amarok/src/engine/xine/xine-scope.c index 8ff422e9..c2ecf5ca 100644 --- a/amarok/src/engine/xine/xine-scope.c +++ b/amarok/src/engine/xine/xine-scope.c @@ -65,6 +65,8 @@ scope_port_close( xine_audio_port_t *port_gen, xine_stream_t *stream ) static void scope_port_put_buffer( xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream ) { +#if XINE_MAJOR_VERSION < 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION < 2) || \ + (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION == 2 && XINE_SUB_VERSION < 10) /* FIXME With 8-bit samples the scope won't work correctly. For a special 8-bit code path, the sample size could be checked like this: if( port->bits == 8 ) */ @@ -97,6 +99,7 @@ scope_port_put_buffer( xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_st * this is thread-safe due to the way we handle the list in the GUI thread */ new_node->next = this->list->next; this->list->next = new_node; +#endif #undef port #undef this @@ -153,12 +156,15 @@ scope_plugin_new( xine_t *xine, xine_audio_port_t *audio_target ) post_plugin->dispose = scope_dispose; } +#if XINE_MAJOR_VERSION < 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION < 2) || \ + (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION == 2 && XINE_SUB_VERSION < 10) /* code is straight from xine_init_post() can't use that function as it only dlopens the plugins and our plugin is statically linked in */ post_plugin->running_ticket = xine->port_ticket; post_plugin->xine = xine; +#endif /* scope_plugin_t init */ scope_plugin->list = xine_xmalloc( sizeof(MyNode) );