Comments and warning fixes

This commit is contained in:
David Sansome 2010-04-05 19:16:48 +00:00
parent 1c5b6c6b05
commit 57189ea911
3 changed files with 9 additions and 4 deletions

View File

@ -130,9 +130,9 @@ bool VlcEngine::canDecode(const QUrl &url) const {
}
bool VlcEngine::load(const QUrl &url, bool stream) {
// Create the media object
VlcScopedRef<libvlc_media_t> media(
libvlc_media_new(instance_, url.toEncoded().constData(), &exception_));
if (libvlc_exception_raised(&exception_))
return false;
@ -237,11 +237,11 @@ const Engine::Scope& VlcEngine::scope() {
QMutexLocker l(&scope_mutex_);
// Leave the scope unchanged if there's not enough data
if (scope_data_.size() < SCOPESIZE)
if (scope_data_.size() < uint(SCOPESIZE))
return m_scope;
// Take the samples off the front of the circular buffer
for (uint i=0 ; i<SCOPESIZE ; ++i)
for (uint i=0 ; i<uint(SCOPESIZE) ; ++i)
m_scope[i] = scope_data_[i] * (1 << 15);
// Remove the samples from the buffer. Unfortunately I think this is O(n) :(

View File

@ -53,7 +53,7 @@ class VlcEngine : public Engine::Base {
const Engine::Scope& scope();
protected:
void setVolumeSW( uint percent );
void setVolumeSW( uint percent );
private:
void HandleErrors() const;
@ -62,12 +62,15 @@ class VlcEngine : public Engine::Base {
static void StateChangedCallback(const libvlc_event_t* e, void* data);
private:
// The callbacks need access to this
static VlcEngine* sInstance;
// VLC bits and pieces
libvlc_exception_t exception_;
libvlc_instance_t* instance_;
libvlc_media_player_t* player_;
// Our clementine_scope VLC plugin puts data in here
QMutex scope_mutex_;
boost::circular_buffer<float> scope_data_;

View File

@ -26,6 +26,7 @@ class VlcScopedRef {
~VlcScopedRef();
operator T* () const { return ptr_; }
operator bool () const { return ptr_; }
T* operator ->() const { return ptr_; }
private:
@ -49,6 +50,7 @@ VLCSCOPEDREF_DEFINE2(instance, libvlc_release);
VLCSCOPEDREF_DEFINE(media_player);
VLCSCOPEDREF_DEFINE(media);
template <> void VlcScopedRef_Release<char>(char* ptr) { free(ptr); }
template <typename T>
VlcScopedRef<T>::VlcScopedRef(T* ptr)