Commit 215ca118 authored by Vincent Carrubba's avatar Vincent Carrubba

Another intermediate commit , again

parent f70dcc9a
#include "VideoFrame.h"
#include <QtDebug>
VideoFrame::~VideoFrame()
{
if ( this->rvf.raw != NULL )
delete [] this->rvf.raw;
}
VideoFrame::VideoFrame()
{
this->rvf.raw = NULL;
this->nboctets = 0;
this->nbpixels = 0;
}
VideoFrame::VideoFrame( quint32 nboctets )
{
this->nboctets = nboctets;
this->nbpixels = nboctets / Pixel::NbComposantes;
this->rvf.raw = new quint8[nboctets];
}
VideoFrame::VideoFrame( quint8* tocopy, quint32 nboctets )
{
quint32 i;
this->nboctets = nboctets;
this->nbpixels = nboctets / Pixel::NbComposantes;
this->rvf.raw = new quint8[nboctets];
for ( i = 0; i < this->nboctets; ++i )
this->rvf.raw[i] = tocopy[i];
}
VideoFrame & VideoFrame::operator=( VideoFrame const & tocopy )
{
if ( this->rvf.raw == NULL )
{
if ( tocopy.rvf.raw != NULL )
{
this->rvf.raw = new quint8[tocopy.nboctets];
this->nboctets = tocopy.nboctets;
this->nbpixels = tocopy.nboctets / Pixel::NbComposantes;
quint32 i;
for ( i = 0; i < this->nboctets; ++i )
this->rvf.raw[i] = tocopy.rvf.raw[i];
}
}
else
{
qDebug() << __LINE__;
if ( tocopy.rvf.raw != NULL )
{
qDebug() << __LINE__;
if ( this->nboctets != tocopy.nboctets )
{
qDebug() << __LINE__ << "\n"
<< "this pixels = " << this->nbpixels
<< "tocopy pixels = " << tocopy.nbpixels;
delete [] this->rvf.raw;
this->rvf.raw = new quint8[tocopy.nboctets];
this->nboctets = tocopy.nboctets;
this->nbpixels = tocopy.nboctets / Pixel::NbComposantes;
qDebug() << __LINE__;
}
quint32 i;
qDebug() << __LINE__;
for ( i = 0; i < this->nboctets; ++i )
this->rvf.raw[i] = tocopy.rvf.raw[i];
qDebug() << __LINE__;
}
else
{
delete [] this->rvf.raw;
this->rvf.raw = NULL;
this->nboctets = 0;
this->nbpixels = 0;
}
}
return ( *this );
}
VideoFrame::VideoFrame( VideoFrame const & tocopy )
{
if (tocopy.rvf.raw != NULL)
{
quint32 i;
this->nboctets = tocopy.nboctets;
this->nbpixels = tocopy.nboctets / Pixel::NbComposantes;
this->rvf.raw = new quint8[tocopy.nboctets];
for ( i = 0; i < this->nboctets; ++i )
this->rvf.raw[i] = tocopy.rvf.raw[i];
}
else
{
this->nboctets = 0;
this->nbpixels = 0;
this->rvf.raw = NULL;
}
}
#ifndef VIDEOFRAME_H_
#define VIDEOFRAME_H_
#include <QSharedDataPointer>
#include <QSharedData>
#include <QDebug>
struct Pixel
{
enum
{
NbComposantes = 3
};
quint8 Red;
quint8 Green;
quint8 Blue;
};
union RawVideoFrame
{
Pixel* pixels;
quint8* octets;
};
struct VideoFrame : public QSharedData
{
~VideoFrame();
VideoFrame();
VideoFrame(VideoFrame const & tocopy);
RawVideoFrame frame;
quint32 nbpixels;
quint32 nboctets;
};
class LightVideoFrame
{
public:
LightVideoFrame();
LightVideoFrame(LightVideoFrame const & tocopy);
LightVideoFrame(quint32 nboctets);
LightVideoFrame(quint8 const * tocopy, quint32 nboctets);
~LightVideoFrame();
LightVideoFrame& operator=(LightVideoFrame const & tocopy);
VideoFrame const * operator->(void) const;
VideoFrame const & operator*(void) const;
VideoFrame* operator->(void);
VideoFrame& operator*(void);
private:
QSharedDataPointer<VideoFrame> m_videoFrame;
};
#endif // VIDEOFRAME_H_
......@@ -65,7 +65,7 @@ SOURCES += src/main.cpp \
src/GUI/VideoProjectPreferences.cpp \
src/Project/ProjectManager.cpp \
src/EffectsEngine/EffectsEngine.cpp \
src/EffectsEngine/VideoFrame.cpp \
src/EffectsEngine/LightVideoFrame.cpp \
src/EffectsEngine/GenericEffect.cpp \
src/EffectsEngine/PouetEffect.cpp \
src/EffectsEngine/MixerEffect.cpp \
......@@ -129,7 +129,6 @@ HEADERS += src/GUI/MainWindow.h \
src/EffectsEngine/EffectsEngine.h \
src/EffectsEngine/InSlot.hpp \
src/EffectsEngine/OutSlot.hpp \
src/EffectsEngine/VideoFrame.h \
src/EffectsEngine/Parameter.h \
src/EffectsEngine/CopyOnWrite.hpp \
src/EffectsEngine/LightVideoFrame.h \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment