Make visualisations work again (how did nobody notice this for 3 months??)

This commit is contained in:
David Sansome 2011-03-20 21:41:09 +00:00
parent 008d396077
commit 4f11cb94e1
2 changed files with 0 additions and 8 deletions

View File

@ -162,14 +162,12 @@ void ProjectMVisualisation::SetDuration(int seconds) {
}
void ProjectMVisualisation::ConsumeBuffer(GstBuffer* buffer, int) {
#ifdef HAVE_GSTREAMER
const int samples_per_channel = GST_BUFFER_SIZE(buffer) / sizeof(short) / 2;
const short* data = reinterpret_cast<short*>(GST_BUFFER_DATA(buffer));
if (projectm_)
projectm_->pcm()->addPCM16Data(data, samples_per_channel);
gst_buffer_unref(buffer);
#endif
}
void ProjectMVisualisation::SetSelected(const QStringList& paths, bool selected) {

View File

@ -130,10 +130,8 @@ void VisualisationContainer::AddMenuItem(const QString &name, int value, int def
void VisualisationContainer::SetEngine(GstEngine* engine) {
engine_ = engine;
#ifdef HAVE_GSTREAMER
if (isVisible())
engine_->AddBufferConsumer(vis_);
#endif
}
void VisualisationContainer::showEvent(QShowEvent* e) {
@ -145,20 +143,16 @@ void VisualisationContainer::showEvent(QShowEvent* e) {
QGraphicsView::showEvent(e);
update_timer_.start(1000 / fps_, this);
#ifdef HAVE_GSTREAMER
if (engine_)
engine_->AddBufferConsumer(vis_);
#endif
}
void VisualisationContainer::hideEvent(QHideEvent* e) {
QGraphicsView::hideEvent(e);
update_timer_.stop();
#ifdef HAVE_GSTREAMER
if (engine_)
engine_->RemoveBufferConsumer(vis_);
#endif
}
void VisualisationContainer::resizeEvent(QResizeEvent* e) {