Commit 5c63b168 authored by Ludovic Fauvet's avatar Ludovic Fauvet
Browse files

Revert "Merge branch 'master' of git@github.com:VLMC/vlmc into geoff_project_saving"

This reverts commit 4943285a, reversing
changes made to bca0bccc.

This should repair the broken master branch.
parent bf818bc9
#include "AudioProjectPreferences.h"
#include "QDebug"
AudioProjectPreferences::AudioProjectPreferences( QWidget *parent ) :
QWidget( parent )
{
this->setWidget( this );
m_ui.setupUi( this );
}
AudioProjectPreferences::~AudioProjectPreferences() { }
bool AudioProjectPreferences::load()
{
qDebug() << "Loading AudioProjectPreferences values";
return true;
}
void AudioProjectPreferences::save( QSettings& settings )
{
settings.beginGroup( "Project" );
//settings.setValue( "outputFPS", m_ui.outputFPS->text() );
settings.endGroup();
}
#ifndef AUDIOPROJECTPREFERENCES_H
#define AUDIOPROJECTPREFERENCES_H
#include <QWidget>
#include <QSettings>
#include "PreferenceWidget.h"
#include "ui_AudioProjectPreferences.h"
class AudioProjectPreferences : public QWidget, public PreferenceWidget
{
//Q_OBJECT
public:
AudioProjectPreferences(QWidget *parent = 0);
~AudioProjectPreferences();
bool load();
void save( QSettings& settings );
private:
Ui::AudioProjectPreferences m_ui;
};
#endif // AUDIOPROJECTPREFERENCES_H
......@@ -71,9 +71,11 @@ void GraphicsMovieItem::paint( QPainter* painter, const QStyleOptionGraphicsItem
painter->setBrush( QBrush( gradient ) );
painter->drawRect( boundingRect() );
paintAudioSpectrum( painter );
updateTitle();
}
void GraphicsMovieItem::setWidth( int width )
{
m_width = width;
......@@ -84,6 +86,50 @@ void GraphicsMovieItem::setHeight( int height )
m_height = height;
}
void GraphicsMovieItem::paintAudioSpectrum( QPainter* painter )
{
qreal x1, x2, y1, y2;
QRectF tmp = boundingRect();
tmp.getCoords( &x1, &y1, &x2, &y2 );
painter->setPen( Qt::black );
painter->setBrush( Qt::black );
QLineF line;
for (int i = 0; i < m_clip->getParent()->getAudioFrameList().size(); i++)
{
//qDebug() << "Frame: " << i << "/" << m_media->getAudioFrameList().size();
for (unsigned int u = 0; u < m_clip->getParent()->getAudioNbSample(); u += 400)
{
int value = m_clip->getParent()->getAudioFrameList()[i][u];
value /= 30;
if( value > 48 ) value = 48;
if( value < 0 ) value = 0;
//qDebug() << "frame nb:" << i << " buff value: " << value;
static QPointF point = QPointF( x1, ( y2 - y1 ) / 2 );
qreal y = ( ( y2 - y1 ) / 2 ) - value / 2;
x1 += 2;
QPointF point2( x1, y );
line.setPoints( point, point2);
//line.setLine( x1 , y, x1 + 2, y);
painter->drawLine(line);
//painter->drawRect(tmp);
point.setX( point2.x() );
point.setY( point2.y() );
}
}
}
Clip* GraphicsMovieItem::clip() const
{
return m_clip;
......
......@@ -34,16 +34,21 @@ class GraphicsMovieItem : public AbstractGraphicsMediaItem
public:
enum { Type = UserType + 1 };
GraphicsMovieItem( Clip* clip );
virtual ~GraphicsMovieItem();
Clip* clip() const;
virtual int type() const { return Type; }
virtual bool expandable() const { return false; }
virtual bool moveable() const { return true; }
virtual const QUuid& uuid() const { return m_media->getUuid(); }
virtual QRectF boundingRect() const;
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0 );
void setWidth( int width );
void setHeight( int height );
virtual ~GraphicsMovieItem();
virtual int type() const { return Type; }
virtual bool expandable() const { return false; }
virtual bool moveable() const { return true; }
virtual const QUuid& uuid() const { return m_clip->getUuid(); }
virtual QRectF boundingRect() const;
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0 );
void setWidth( int width );
void setHeight( int height );
Clip* clip() const;
void setClip( Clip* clip );
//void setAudioSpectrum( QVector<float*> spectrum );
void paintAudioSpectrum( QPainter* painter );
private:
void updateTitle();
......
......@@ -43,10 +43,6 @@
#include "PreviewWidget.h"
#include "PreferenceWidget.h"
#include "ProjectPreferences.h"
//#include "AudioDebugSpectrum.h"
#include "AudioProjectPreferences.h"
#include "VideoProjectPreferences.h"
#include "VLMCPreferences.h"
MainWindow::MainWindow( QWidget *parent ) :
QMainWindow( parent ), m_renderer( NULL )
......@@ -188,23 +184,20 @@ void MainWindow::initializeDockWidgets( void )
QDockWidget::AllDockWidgetFeatures,
Qt::LeftDockWidgetArea );
setupLibrary();
// dockManager->addDockedWidget( new AudioDebugSpectrum( this ),
// tr( "AudioDebugSpectrum" ),
// Qt::AllDockWidgetAreas,
// QDockWidget::AllDockWidgetFeatures,
// Qt::BottomDockWidgetArea );
m_metaDataManager = MetaDataManager::getInstance();
}
void MainWindow::createGlobalPreferences()
{
m_globalPreferences = new Settings( );
m_globalPreferences->addWidget("VLMC",
new VLMCPreferences,
"../images/vlmc.png",
"VLMC settings");
m_globalPreferences->addWidget("Project",
new ProjectPreferences,
"images/vlmc.png",
"Project");
m_globalPreferences->addWidget("test",
new ProjectPreferences,
"images/vlmc.png",
"Truc");
////For debugging purpose
//m_globalPreferences->addWidget("Test",
// new QLabel("This is a test"),
......@@ -260,22 +253,6 @@ void MainWindow::on_actionNew_Project_triggered()
{
//TODO : clear the library, the timeline, and show the configuration box
//of the newly created project
m_projectPreferences = new Settings( );
m_projectPreferences->addWidget("Project",
new ProjectPreferences,
"../images/vlmc.png",
"Project settings");
m_projectPreferences->addWidget("Video",
new VideoProjectPreferences,
"../images/scalable/video.svg",
"Video settings");
m_projectPreferences->addWidget("Audio",
new AudioProjectPreferences,
"../images/scalable/audio.svg",
"Audio settings");
m_projectPreferences->build();
m_projectPreferences->show();
}
void MainWindow::on_actionOpen_Project_triggered()
......
......@@ -37,6 +37,7 @@
#include "ListViewMediaItem.h"
#include "Settings.h"
class MainWindow : public QMainWindow
{
Q_OBJECT
......@@ -60,6 +61,7 @@ private:
void createStatusBar();
void createGlobalPreferences();
Ui::MainWindow m_ui;
MetaDataManager* m_metaDataManager;
QSlider* m_zoomSlider;
......@@ -67,8 +69,7 @@ private:
PreviewWidget* m_clipPreview;
PreviewWidget* m_projectPreview;
WorkflowFileRenderer* m_renderer;
Settings* m_globalPreferences;
Settings* m_projectPreferences;
Settings* m_globalPreferences;
private slots:
void on_actionFullscreen_triggered( bool checked );
......
......@@ -16,6 +16,7 @@ ProjectPreferences::ProjectPreferences( QWidget* parent )
ProjectPreferences::~ProjectPreferences() { }
bool ProjectPreferences::load()
{
qDebug() << "Loading ProjectPreferences values";
......
#include "VLMCPreferences.h"
#include "QDebug"
VLMCPreferences::VLMCPreferences(QWidget *parent) :
QWidget(parent)
{
this->setWidget( this );
m_ui.setupUi(this);
}
VLMCPreferences::~VLMCPreferences() { }
bool VLMCPreferences::load()
{
qDebug() << "Loading VLMCPreferences values";
return true;
}
void VLMCPreferences::save( QSettings& settings )
{
settings.beginGroup( "Project" );
//settings.setValue( "outputFPS", m_ui.outputFPS->text() );
settings.endGroup();
}
#ifndef VLMCPREFERENCES_H
#define VLMCPREFERENCES_H
#include <QWidget>
#include <QSettings>
#include "PreferenceWidget.h"
#include "ui_VLMCPreferences.h"
class VLMCPreferences : public QWidget, public PreferenceWidget
{
//Q_OBJECT
public:
VLMCPreferences(QWidget *parent = 0);
~VLMCPreferences();
bool load();
void save( QSettings& settings );
private:
Ui::VLMCPreferences m_ui;
};
#endif // VLMCPREFERENCES_H
#include "VideoProjectPreferences.h"
#include "QDebug"
VideoProjectPreferences::VideoProjectPreferences(QWidget *parent) :
QWidget(parent)
{
this->setWidget( this );
m_ui.setupUi( this );
}
VideoProjectPreferences::~VideoProjectPreferences() { }
bool VideoProjectPreferences::load()
{
qDebug() << "Loading VideoProjectPreferences values";
return true;
}
void VideoProjectPreferences::save( QSettings& settings )
{
settings.beginGroup( "Project" );
//settings.setValue( "outputFPS", m_ui.outputFPS->text() );
settings.endGroup();
}
#ifndef VIDEOPROJECTPREFERENCES_H
#define VIDEOPROJECTPREFERENCES_H
#include <QWidget>
#include <QSettings>
#include "PreferenceWidget.h"
#include "ui_VideoProjectPreferences.h"
class VideoProjectPreferences : public QWidget, public PreferenceWidget
{
//Q_OBJECT
public:
VideoProjectPreferences(QWidget *parent = 0);
~VideoProjectPreferences();
bool load();
void save( QSettings& settings );
private:
Ui::VideoProjectPreferences m_ui;
};
#endif // VIDEOPROJECTPREFERENCES_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AudioProjectPreferences</class>
<widget class="QWidget" name="AudioProjectPreferences">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>200</width>
<height>33</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="SampleRateLabel">
<property name="text">
<string>SampleRate</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VideoProjectPreferences</class>
<widget class="QWidget" name="VideoProjectPreferences">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>374</width>
<height>193</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="FPSLabel">
<property name="text">
<string>FPS</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="FrameSizeLabel_4">
<property name="text">
<string>Horizontal</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="HeightSpinBox_2">
<property name="suffix">
<string> Pixels</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65536</number>
</property>
<property name="value">
<number>800</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="FrameSizeLabel_5">
<property name="text">
<string>Vertical</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QSpinBox" name="WidthSpinBox_2">
<property name="suffix">
<string> Pixels</string>
</property>
<property name="maximum">
<number>65536</number>
</property>
<property name="value">
<number>600</number>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QSpinBox" name="FPSSpinBox">
<property name="suffix">
<string> Frames/Seconds</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65536</number>
</property>
<property name="value">
<number>25</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -4,7 +4,6 @@
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
* Geoffroy Lacarriere <geoffroylaca@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -29,7 +28,6 @@
#include <QtDebug>
#include "Media.h"
#include <QPainter>
QPixmap* Media::defaultSnapshot = NULL;
const QString Media::VideoExtensions = "*.mov *.avi *.mkv *.mpg *.mpeg *.wmv *.mp4";
......@@ -65,8 +63,6 @@ Media::Media( const QString& filePath )
m_fileType = Media::Video;
}
m_vlcMedia = new LibVLCpp::Media( m_mrl );
connect(this, SIGNAL(audioFramePointList(QVector<uint>*)), this, SLOT(addAudioFramePointList(QVector<uint>*)));
}
Media::~Media()
......@@ -186,10 +182,10 @@ Media::FileType Media::getFileType() const
void Media::initAudioData( void* datas, unsigned int* freq, unsigned int* nbChannels, unsigned int* fourCCFormat, unsigned int* frameSize )
{
m_audioData.freq = *freq;
m_audioData.nbChannels = *nbChannels;
m_audioData.frameSize = *frameSize;
m_audioData.fourCCFormat = *fourCCFormat;
m_audioData.freq = freq;
m_audioData.nbChannels = nbChannels;
m_audioData.frameSize = frameSize;
m_audioData.fourCCFormat = fourCCFormat;
m_audioData.datas = datas;
}
......@@ -198,49 +194,21 @@ void Media::addAudioFrame( void* datas, unsigned char* buffer, si
Q_UNUSED( datas );
m_audioData.nbSample = nbSample;
m_audioData.buffSize = buffSize;
unsigned int bytePerSample = buffSize / nbSample;
unsigned int bytePerChannelPerSample = bytePerSample / m_audioData.nbChannels;
int average = 0;
for (unsigned int i = 0; i < nbSample; i++)
{
unsigned int left = 0;
unsigned int right = 0;
for ( unsigned int u = 0; u < bytePerChannelPerSample ; u++ )
{
int increment = 0;
if ( m_audioData.nbChannels == 2 )
increment = 2;
left <<= 8;
left += buffer[ u ];
right <<= 8;
right += buffer[ u + increment ];
}
average += left;
//qDebug() << "Left: " << left << " Right: " << right;
}
static int i = 0;
average /= nbSample;
if ( i < 64 )
int* frame = new int[ m_audioData.buffSize ];
for (unsigned int i = 0, u = 0; u < m_audioData.nbSample; i += 4, u++)
{
//qDebug() << i;
m_pointList.append( average );
i++;
int value = buffer[i];
value <<= 8;
value += buffer[i + 1];
value <<= 8;
value += buffer[i + 2];
value <<= 8;
value += buffer[i + 3];
frame[u] = value;
}
else
{
emit audioFramePointList( &m_pointList );
i = 0;
}
}
void Media::addAudioFramePointList( QVector<uint>* pointList )
{
QPainter painter;
QPixmap pixmap;
qDebug("new frame");
m_audioData.frameList.append( frame );
// qDebug() << m_audioData.frameList.size();
}
void Media::emitMetaDataComputed()
......
......@@ -41,10 +41,10 @@
struct audioData
{
void* datas;
unsigned int freq;
unsigned int nbChannels;
unsigned int fourCCFormat;
unsigned int frameSize;
unsigned int* freq;
unsigned int* nbChannels;
unsigned int* fourCCFormat;
unsigned int* frameSize;
unsigned int nbSample;
unsigned char* buffer;
size_t buffSize;
......@@ -136,9 +136,6 @@ public:
private:
void setFileType();
private slots:
void addAudioFramePointList( QVector<uint>* );
protected:
static QPixmap* defaultSnapshot;
......@@ -157,13 +154,9 @@ protected:
FileType m_fileType;
InputType m_inputType;
QVector<uint> m_pointList;
signals:
void metaDataComputed();
void metaDataComputed( Media* );
void snapshotChanged();
void audioFramePointList( QVector<uint>* );
};
#endif // CLIP_H__
......@@ -5,8 +5,7 @@ TEMPLATE = app
OBJECTS_DIR = build
MOC_DIR = build/moc
UI_DIR = build/ui
QMAKE_EXT_H = .h \
.hpp
QMAKE_EXT_H = .h .hpp
INCLUDEPATH = build/moc \
build/ui
QT += gui \
......@@ -55,10 +54,7 @@ SOURCES += src/main.cpp \
src/GUI/Settings.cpp \