mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 19:30:21 +02:00
removed too unstable dsp, done remaning TODOs for vlc
This commit is contained in:
@@ -215,7 +215,6 @@ list(APPEND libSources
|
||||
|
||||
audio/AudioEngine.cpp
|
||||
audio/AudioOutput.cpp
|
||||
audio/VlcDsp.cpp
|
||||
|
||||
collection/Collection.cpp
|
||||
collection/ArtistsRequest.cpp
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#include "playlist/SingleTrackPlaylistInterface.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Qnr_IoDeviceStream.h"
|
||||
#include "utils/Qnr_IoDeviceSFtream.h"
|
||||
|
||||
#include "Album.h"
|
||||
#include "Artist.h"
|
||||
@@ -75,9 +75,7 @@ AudioEnginePrivate::onStateChanged( AudioOutput::AudioState newState, AudioOutpu
|
||||
if ( newState == AudioOutput::Error )
|
||||
{
|
||||
q_ptr->stop( AudioEngine::UnknownError );
|
||||
|
||||
//TODO tDebug() << "AudioOutput Error:" << audioOutput->errorString() << audioOutput->errorType();
|
||||
|
||||
tDebug() << "AudioOutput Error";
|
||||
emit q_ptr->error( AudioEngine::UnknownError );
|
||||
q_ptr->setState( AudioEngine::Error );
|
||||
}
|
||||
@@ -1244,8 +1242,8 @@ AudioEngine::currentTime() const
|
||||
qint64
|
||||
AudioEngine::currentTrackTotalTime() const
|
||||
{
|
||||
// TODO : This is too hacky. The problem is that I don't know why
|
||||
// libVLC doesn't report total duration for stream data (imem://)
|
||||
// FIXME : This is too hacky. The problem is that I don't know why
|
||||
// libVLC doesn't report total duration for stream data (imem://)
|
||||
// But it's not a real problem for playback, since EndOfStream is emitted by libVLC itself
|
||||
// This value is only used by AudioOutput to evaluate if it's close to end of stream
|
||||
if ( d_func()->audioOutput->totalTime() <= 0 && d_func()->currentTrack && d_func()->currentTrack->track() ) {
|
||||
|
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "AudioEngine.h"
|
||||
#include "AudioOutput.h"
|
||||
#include "VlcDsp.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
@@ -91,10 +90,6 @@ AudioOutput::AudioOutput( QObject* parent )
|
||||
*/
|
||||
args << "--no-video";
|
||||
args << "--no-xlib";
|
||||
#ifdef VLC_DSP_PLUGIN_ENABLED
|
||||
args << "--audio-filter=dsp";
|
||||
args << QString("--dsp-callback=%1").arg((quint64)&AudioOutput::s_dspCallback, 0, 16).toAscii();
|
||||
#endif
|
||||
|
||||
QVarLengthArray< const char * , 64 > vlcArgs( args.size() );
|
||||
for ( int i = 0 ; i < args.size() ; ++i ) {
|
||||
@@ -145,7 +140,18 @@ AudioOutput::~AudioOutput()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
|
||||
// TODO
|
||||
if ( vlcPlayer != 0 ) {
|
||||
libvlc_media_player_stop( vlcPlayer );
|
||||
libvlc_media_player_release( vlcPlayer );
|
||||
vlcPlayer = 0;
|
||||
}
|
||||
if ( vlcMedia != 0 ) {
|
||||
libvlc_media_release( vlcMedia );
|
||||
vlcMedia = 0;
|
||||
}
|
||||
if ( vlcInstance != 0 ) {
|
||||
libvlc_release( vlcInstance );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,10 +233,6 @@ AudioOutput::setCurrentSource(MediaStream* stream)
|
||||
|
||||
libvlc_media_player_set_media( vlcPlayer, vlcMedia );
|
||||
|
||||
#ifdef VLC_DSP_PLUGIN_ENABLED
|
||||
VlcDspSetup( vlcPlayer );
|
||||
#endif
|
||||
|
||||
if ( stream->type() == MediaStream::Url ) {
|
||||
m_totalTime = libvlc_media_get_duration( vlcMedia );
|
||||
}
|
||||
@@ -475,7 +477,11 @@ AudioOutput::vlcEventCallback( const libvlc_event_t* event, void* opaque )
|
||||
that->setState(Stopped);
|
||||
break;
|
||||
case libvlc_MediaPlayerEncounteredError:
|
||||
// TODO emit Error
|
||||
tDebug() << "LibVLC error : MediaPlayerEncounteredError. Stopping";
|
||||
if ( that->vlcPlayer != 0 ) {
|
||||
that->stop();
|
||||
}
|
||||
that->setState( Error );
|
||||
break;
|
||||
case libvlc_MediaPlayerVout:
|
||||
case libvlc_MediaPlayerMediaChanged:
|
||||
|
@@ -1,38 +0,0 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "VlcDsp_p.h"
|
||||
|
||||
#ifdef VLC_DSP_PLUGIN_ENABLED
|
||||
|
||||
void
|
||||
VlcDspSetup( libvlc_media_player_t* vlcPlayer )
|
||||
{
|
||||
vlc_value_t val;
|
||||
|
||||
if ( vlcPlayer->input.p_resource != 0 ) {
|
||||
audio_output_t *aout = input_resource_GetAout( vlcPlayer->input.p_resource );
|
||||
if ( aout != 0 ) {
|
||||
var_Create( ( vlc_object_t* )aout, "audio-filter", VLC_VAR_STRING );
|
||||
val.psz_string = (char*)"dsp";
|
||||
var_SetChecked( ( vlc_object_t* )aout, "audio-filter", VLC_VAR_STRING, val );
|
||||
aout->event.restart_request( aout, AOUT_RESTART_FILTERS );
|
||||
input_resource_PutAout( vlcPlayer->input.p_resource, aout );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // VLC_DSP_PLUGIN_ENABLED
|
@@ -1,47 +0,0 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef VLCDSP_H
|
||||
#define VLCDSP_H
|
||||
|
||||
/*
|
||||
* Very tricky technique to enable DSP plugin support
|
||||
* There is no other way to do this with libvlc for the moment
|
||||
*
|
||||
* A VLC audio filter plugin specificaly made for Tomahawk
|
||||
* is necessary to get it functionning
|
||||
*
|
||||
* TODO : Check thoroughly if libvlc_media_player_t
|
||||
* structure is identical to the one in running libvlccore.so
|
||||
* (checking if libVLC version is >= than the one used to compile Tomahawk
|
||||
* and verifying pointers integrity should be enough.
|
||||
* + check if audio filter "dsp" is present in libVLC plugins list)
|
||||
*
|
||||
* The define 'VLC_DSP_PLUGIN_ENABLED' better should be a CMake option
|
||||
*/
|
||||
|
||||
// Maybe later :)
|
||||
//#define VLC_DSP_PLUGIN_ENABLED
|
||||
|
||||
#ifdef VLC_DSP_PLUGIN_ENABLED
|
||||
|
||||
struct libvlc_media_player_t;
|
||||
|
||||
void VlcDspSetup( libvlc_media_player_t* vlcPlayer );
|
||||
|
||||
#endif // VLC_DSP_PLUGIN_ENABLED
|
||||
|
||||
#endif // VLCDSP_H
|
@@ -1,62 +0,0 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef VLCDSP_P_H
|
||||
#define VLCDSP_P_H
|
||||
|
||||
#include "VlcDsp.h"
|
||||
|
||||
#ifdef VLC_DSP_PLUGIN_ENABLED
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <vlc/libvlc.h>
|
||||
#include <vlc/libvlc_media.h>
|
||||
#include <vlc/libvlc_media_player.h>
|
||||
#include <vlc/libvlc_events.h>
|
||||
#include <vlc/libvlc_version.h>
|
||||
|
||||
#define restrict
|
||||
#define _(s) s
|
||||
|
||||
#include <vlc/plugins/vlc_aout.h>
|
||||
#include <vlc/plugins/vlc_input.h>
|
||||
|
||||
typedef struct libvlc_media_player_t
|
||||
{
|
||||
const char *psz_object_type;
|
||||
char *psz_header;
|
||||
int i_flags;
|
||||
bool b_force;
|
||||
void *p_libvlc;
|
||||
void *p_parent;
|
||||
int i_refcount;
|
||||
vlc_mutex_t object_lock;
|
||||
struct
|
||||
{
|
||||
void *p_thread;
|
||||
input_resource_t *p_resource;
|
||||
vlc_mutex_t lock;
|
||||
} input;
|
||||
void *p_libvlc_instance;
|
||||
void *p_md;
|
||||
void *p_event_manager;
|
||||
int state;
|
||||
} libvlc_media_player_t;
|
||||
|
||||
#endif // VLC_DSP_PLUGIN_ENABLED
|
||||
|
||||
#endif // VLCDSP_P_H
|
@@ -45,7 +45,7 @@ MediaStream::MediaStream( QObject* parent )
|
||||
|
||||
MediaStream::MediaStream( const QUrl &url )
|
||||
: QObject( 0 )
|
||||
, m_type(Url)
|
||||
, m_type( Url )
|
||||
, m_ioDevice ( 0 )
|
||||
, m_started( false )
|
||||
, m_bufferingFinished( false )
|
||||
@@ -61,7 +61,7 @@ MediaStream::MediaStream( const QUrl &url )
|
||||
|
||||
MediaStream::MediaStream( QIODevice* device )
|
||||
: QObject( 0 )
|
||||
, m_type(IODevice)
|
||||
, m_type( IODevice )
|
||||
, m_url( QUrl() )
|
||||
, m_ioDevice ( 0 )
|
||||
, m_started( false )
|
||||
@@ -202,7 +202,7 @@ MediaStream::readDoneCallback ( void *data, const char *cookie, size_t bufferSiz
|
||||
MediaStream* that = static_cast < MediaStream * > ( data );
|
||||
|
||||
if ( ( that->m_type == Stream ) && buffer != 0 && bufferSize > 0 ) {
|
||||
delete static_cast<char *>(buffer);
|
||||
delete static_cast< char* >( buffer );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user