Fixed FTBFS with xine 1.2.10. The use of the xine scope plugin is currently

disabled when xine >= 1.2.10 is detected.

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 <michele.calgaro@yahoo.it>
pull/1/head
Michele Calgaro 5 years ago
parent 088b37ef3c
commit b51af279c4
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -146,16 +146,19 @@ VideoWindow::init()
xine_osd_set_text_palette( m_osd, XINE_TEXTPALETTE_WHITE_BLACK_TRANSPARENT, XINE_OSD_TEXT1 ); xine_osd_set_text_palette( m_osd, XINE_TEXTPALETTE_WHITE_BLACK_TRANSPARENT, XINE_OSD_TEXT1 );
} }
#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)
debug() << "scope_plugin_new()\n"; debug() << "scope_plugin_new()\n";
m_scope = scope_plugin_new( m_xine, m_audioPort ); m_scope = scope_plugin_new( m_xine, m_audioPort );
#endif
//FIXME this one seems to make seeking unstable for Codeine, perhaps //FIXME this one seems to make seeking unstable for Codeine, perhaps
xine_set_param( m_stream, XINE_PARAM_METRONOM_PREBUFFER, 6000 ); //less buffering, faster seeking.. xine_set_param( m_stream, XINE_PARAM_METRONOM_PREBUFFER, 6000 ); //less buffering, faster seeking..
// causes an abort currently // causes an abort currently
//xine_trick_mode( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, 1 ); //xine_trick_mode( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, 1 );
#endif #endif
{ {
@ -266,11 +269,14 @@ VideoWindow::load( const KURL &url )
// FIXME leaves one erroneous buffer // FIXME leaves one erroneous buffer
timerEvent( 0 ); 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)
if( m_scope ) { if( m_scope ) {
xine_post_out_t *source = xine_get_audio_source( m_stream ); xine_post_out_t *source = xine_get_audio_source( m_stream );
xine_post_in_t *target = (xine_post_in_t*)xine_post_input( m_scope, const_cast<char*>("audio in") ); xine_post_in_t *target = (xine_post_in_t*)xine_post_input( m_scope, const_cast<char*>("audio in") );
xine_post_wire( source, target ); xine_post_wire( source, target );
} }
#endif
#endif #endif
announceStateChange(); announceStateChange();
@ -572,6 +578,8 @@ VideoWindow::scope()
if( xine_get_status( m_stream ) != XINE_STATUS_PLAY ) if( xine_get_status( m_stream ) != XINE_STATUS_PLAY )
return scope; return 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)
//prune the buffer list and update the m_current_vpts timestamp //prune the buffer list and update the m_current_vpts timestamp
timerEvent( 0 ); timerEvent( 0 );
@ -618,6 +626,7 @@ VideoWindow::scope()
m_current_vpts = best_node->vpts_end; m_current_vpts = best_node->vpts_end;
m_current_vpts++; //FIXME needs to be done for some reason, or you get situations where it uses same buffer again and again m_current_vpts++; //FIXME needs to be done for some reason, or you get situations where it uses same buffer again and again
} }
#endif
return scope; return scope;
} }
@ -625,6 +634,8 @@ VideoWindow::scope()
void void
VideoWindow::timerEvent( TQTimerEvent* ) VideoWindow::timerEvent( TQTimerEvent* )
{ {
#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 /// here we prune the buffer list regularly
#ifndef XINE_SAFE_MODE #ifndef XINE_SAFE_MODE
MyNode * const first_node = myList->next; MyNode * const first_node = myList->next;
@ -650,6 +661,7 @@ VideoWindow::timerEvent( TQTimerEvent* )
prev = node; prev = node;
} }
#endif #endif
#endif
} }
void void

@ -1,148 +1,154 @@
/* Author: Max Howell <max.howell@methylblue.com>, (C) 2004 /* Author: Max Howell <max.howell@methylblue.com>, (C) 2004
Copyright: See COPYING file that comes with this distribution */ Copyright: See COPYING file that comes with this distribution */
/* gcc doesn't like inline for me */ /* gcc doesn't like inline for me */
#define inline #define inline
/* need access to port_ticket */ /* need access to port_ticket */
#define XINE_ENGINE_INTERNAL #define XINE_ENGINE_INTERNAL
#include "xineScope.h" #include "xineScope.h"
#include <xine/post.h> #include <xine/post.h>
#include <xine/xine_internal.h> #include <xine/xine_internal.h>
static MyNode theList; static MyNode theList;
static metronom_t theMetronom; static metronom_t theMetronom;
static int myChannels = 0; static int myChannels = 0;
MyNode* const myList = &theList; MyNode* const myList = &theList;
metronom_t* const myMetronom = &theMetronom; metronom_t* const myMetronom = &theMetronom;
/* defined in xineEngine.cpp */ /* defined in xineEngine.cpp */
extern void _debug( const char * ); extern void _debug( const char * );
/************************* /*************************
* post plugin functions * * post plugin functions *
*************************/ *************************/
static int static int
scope_port_open( xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode ) scope_port_open( xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode )
{ {
_debug( "scope_port_open()\n" ); _debug( "scope_port_open()\n" );
#define port ((post_audio_port_t*)port_gen) #define port ((post_audio_port_t*)port_gen)
_x_post_rewire( (post_plugin_t*)port->post ); _x_post_rewire( (post_plugin_t*)port->post );
_x_post_inc_usage( port ); _x_post_inc_usage( port );
port->stream = stream; port->stream = stream;
port->bits = bits; port->bits = bits;
port->rate = rate; port->rate = rate;
port->mode = mode; port->mode = mode;
myChannels = _x_ao_mode2channels( mode ); myChannels = _x_ao_mode2channels( mode );
return port->original_port->open( port->original_port, stream, bits, rate, mode ); return port->original_port->open( port->original_port, stream, bits, rate, mode );
} }
static void static void
scope_port_close( xine_audio_port_t *port_gen, xine_stream_t *stream ) scope_port_close( xine_audio_port_t *port_gen, xine_stream_t *stream )
{ {
_debug( "scope_port_close()\n" ); _debug( "scope_port_close()\n" );
port->stream = NULL; port->stream = NULL;
port->original_port->close( port->original_port, stream ); port->original_port->close( port->original_port, stream );
_x_post_dec_usage( port ); _x_post_dec_usage( port );
} }
static void static void
scope_port_put_buffer( xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream ) scope_port_put_buffer( xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream )
{ {
MyNode *new_node; #if XINE_MAJOR_VERSION < 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION < 2) || \
const int num_samples = buf->num_frames * myChannels; (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION == 2 && XINE_SUB_VERSION < 10)
MyNode *new_node;
/* we are too simple to handle 8bit */ const int num_samples = buf->num_frames * myChannels;
/* what does it mean when stream == NULL? */
if( port->bits == 8 ) { /* we are too simple to handle 8bit */
port->original_port->put_buffer( port->original_port, buf, stream ); return; } /* what does it mean when stream == NULL? */
if( port->bits == 8 ) {
/* I keep my own metronom because xine wouldn't for some reason */ port->original_port->put_buffer( port->original_port, buf, stream ); return; }
memcpy( myMetronom, stream->metronom, sizeof(metronom_t) );
/* I keep my own metronom because xine wouldn't for some reason */
new_node = malloc( sizeof(MyNode) ); memcpy( myMetronom, stream->metronom, sizeof(metronom_t) );
new_node->vpts = myMetronom->got_audio_samples( myMetronom, buf->vpts, buf->num_frames );
new_node->num_frames = buf->num_frames; new_node = malloc( sizeof(MyNode) );
new_node->mem = malloc( num_samples * 2 ); new_node->vpts = myMetronom->got_audio_samples( myMetronom, buf->vpts, buf->num_frames );
memcpy( new_node->mem, buf->mem, num_samples * 2 ); new_node->num_frames = buf->num_frames;
new_node->mem = malloc( num_samples * 2 );
{ memcpy( new_node->mem, buf->mem, num_samples * 2 );
int64_t
K = myMetronom->pts_per_smpls; /*smpls = 1<<16 samples*/ {
K *= num_samples; int64_t
K /= (1<<16); K = myMetronom->pts_per_smpls; /*smpls = 1<<16 samples*/
K += new_node->vpts; K *= num_samples;
K /= (1<<16);
new_node->vpts_end = K; K += new_node->vpts;
}
new_node->vpts_end = K;
/* pass data to original port */ }
port->original_port->put_buffer( port->original_port, buf, stream );
/* pass data to original port */
/* finally we should append the current buffer to the list port->original_port->put_buffer( port->original_port, buf, stream );
* NOTE this is thread-safe due to the way we handle the list in the GUI thread */
new_node->next = myList->next; /* finally we should append the current buffer to the list
myList->next = new_node; * NOTE this is thread-safe due to the way we handle the list in the GUI thread */
new_node->next = myList->next;
#undef port myList->next = new_node;
} #endif
static void #undef port
scope_dispose( post_plugin_t *this ) }
{
free( this ); static void
} scope_dispose( post_plugin_t *this )
{
free( this );
/************************ }
* plugin init function *
************************/
/************************
xine_post_t* * plugin init function *
scope_plugin_new( xine_t *xine, xine_audio_port_t *audio_target ) ************************/
{
if( audio_target == NULL ) xine_post_t*
return NULL; scope_plugin_new( xine_t *xine, xine_audio_port_t *audio_target )
{
post_plugin_t *post_plugin = xine_xmalloc( sizeof(post_plugin_t) ); if( audio_target == NULL )
return NULL;
{
post_plugin_t *this = post_plugin; post_plugin_t *post_plugin = xine_xmalloc( sizeof(post_plugin_t) );
post_in_t *input;
post_out_t *output; {
post_audio_port_t *port; post_plugin_t *this = post_plugin;
post_in_t *input;
_x_post_init( this, 1, 0 ); post_out_t *output;
post_audio_port_t *port;
port = _x_post_intercept_audio_port( this, audio_target, &input, &output );
port->new_port.open = scope_port_open; _x_post_init( this, 1, 0 );
port->new_port.close = scope_port_close;
port->new_port.put_buffer = scope_port_put_buffer; port = _x_post_intercept_audio_port( this, audio_target, &input, &output );
port->new_port.open = scope_port_open;
this->xine_post.audio_input[0] = &port->new_port; port->new_port.close = scope_port_close;
this->xine_post.type = PLUGIN_POST; port->new_port.put_buffer = scope_port_put_buffer;
this->dispose = scope_dispose; this->xine_post.audio_input[0] = &port->new_port;
} this->xine_post.type = PLUGIN_POST;
/* code is straight from xine_init_post() this->dispose = scope_dispose;
can't use that function as it only dlopens the plugins }
and our plugin is statically linked in */
#if XINE_MAJOR_VERSION < 1 || (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION < 2) || \
post_plugin->running_ticket = xine->port_ticket; (XINE_MAJOR_VERSION == 1 && XINE_MINOR_VERSION == 2 && XINE_SUB_VERSION < 10)
post_plugin->xine = xine; /* code is straight from xine_init_post()
can't use that function as it only dlopens the plugins
return &post_plugin->xine_post; and our plugin is statically linked in */
}
post_plugin->running_ticket = xine->port_ticket;
post_plugin->xine = xine;
#endif
return &post_plugin->xine_post;
}

Loading…
Cancel
Save