fleshed out footage class

This commit is contained in:
itsmattkc
2019-06-22 22:57:01 -07:00
parent 75081f76c9
commit 771a250a81
18 changed files with 788 additions and 7 deletions
+2 -4
View File
@@ -14,12 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
add_subdirectory(item)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
project/folder.h
project/folder.cpp
project/item.h
project/item.cpp
project/project.h
project/project.cpp
project/projectviewmodel.h
+25
View File
@@ -0,0 +1,25 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2019 Olive Team
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
add_subdirectory(folder)
add_subdirectory(footage)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
project/item/item.h
project/item/item.cpp
PARENT_SCOPE
)
+23
View File
@@ -0,0 +1,23 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2019 Olive Team
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
project/item/folder/folder.h
project/item/folder/folder.cpp
PARENT_SCOPE
)
@@ -1,7 +1,7 @@
#ifndef FOLDER_H
#define FOLDER_H
#include "item.h"
#include "project/item/item.h"
class Folder : public Item
{
+27
View File
@@ -0,0 +1,27 @@
# Olive - Non-Linear Video Editor
# Copyright (C) 2019 Olive Team
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
project/item/footage/audiostream.h
project/item/footage/audiostream.cpp
project/item/footage/footage.h
project/item/footage/footage.cpp
project/item/footage/videostream.h
project/item/footage/videostream.cpp
PARENT_SCOPE
)
+53
View File
@@ -0,0 +1,53 @@
#include "audiostream.h"
AudioStream::AudioStream(Footage* footage,
const int& channels,
const int& layout,
const int& sample_rate) :
footage_(footage),
channels_(channels),
layout_(layout),
sample_rate_(sample_rate)
{
}
Footage *AudioStream::footage()
{
return footage_;
}
void AudioStream::set_footage(Footage *f)
{
footage_ = f;
}
const int &AudioStream::channels()
{
return channels_;
}
void AudioStream::set_channels(const int &channels)
{
channels_ = channels;
}
const int &AudioStream::layout()
{
return layout_;
}
void AudioStream::set_layout(const int &layout)
{
layout_ = layout;
}
const int &AudioStream::sample_rate()
{
return sample_rate_;
}
void AudioStream::set_sample_rate(const int &sample_rate)
{
sample_rate_ = sample_rate;
}
+33
View File
@@ -0,0 +1,33 @@
#ifndef AUDIOSTREAM_H
#define AUDIOSTREAM_H
#include "rational.h"
class Footage;
class AudioStream
{
public:
AudioStream(Footage* footage, const int& channels, const int& layout, const int& sample_rate);
Footage* footage();
void set_footage(Footage* f);
const int& channels();
void set_channels(const int& channels);
const int& layout();
void set_layout(const int& layout);
const int& sample_rate();
void set_sample_rate(const int& sample_rate);
private:
Footage* footage_;
int channels_;
int layout_;
int sample_rate_;
};
#endif // AUDIOSTREAM_H
+21
View File
@@ -0,0 +1,21 @@
#include "footage.h"
Footage::Footage()
{
}
const QString &Footage::filename()
{
return filename_;
}
void Footage::set_filename(const QString &s)
{
filename_ = s;
}
Item::Type Footage::type() const
{
return kFootage;
}
+27
View File
@@ -0,0 +1,27 @@
#ifndef FOOTAGE_H
#define FOOTAGE_H
#include "project/item/item.h"
#include "project/item/footage/audiostream.h"
#include "project/item/footage/videostream.h"
#include <QList>
class Footage : public Item
{
public:
Footage();
const QString& filename();
void set_filename(const QString& s);
virtual Type type() const override;
private:
QString filename_;
QList<VideoStream> video_streams_;
QList<AudioStream> audio_streams_;
};
#endif // FOOTAGE_H
+64
View File
@@ -0,0 +1,64 @@
#include "videostream.h"
VideoStream::VideoStream(Footage *footage,
const int &index,
const int &width,
const int &height,
const rational &timebase) :
footage_(footage),
index_(index),
width_(width),
height_(height),
timebase_(timebase)
{
}
Footage *VideoStream::footage()
{
return footage_;
}
void VideoStream::set_footage(Footage *f)
{
footage_ = f;
}
const int &VideoStream::index()
{
return index_;
}
void VideoStream::set_index(const int &index)
{
index_ = index;
}
const int &VideoStream::width()
{
return width_;
}
void VideoStream::set_width(const int &width)
{
width_ = width;
}
const int &VideoStream::height()
{
return height_;
}
void VideoStream::set_height(const int &height)
{
height_ = height;
}
const rational &VideoStream::timebase()
{
return timebase_;
}
void VideoStream::set_timebase(const rational &timebase)
{
timebase_ = timebase;
}
+37
View File
@@ -0,0 +1,37 @@
#ifndef VIDEOSTREAM_H
#define VIDEOSTREAM_H
#include "rational.h"
class Footage;
class VideoStream
{
public:
VideoStream(Footage* footage, const int& index, const int& width, const int& height, const rational& timebase);
Footage* footage();
void set_footage(Footage* f);
const int& index();
void set_index(const int& index);
const int& width();
void set_width(const int& width);
const int& height();
void set_height(const int& height);
const rational& timebase();
void set_timebase(const rational& timebase);
private:
Footage* footage_;
int index_;
int width_;
int height_;
rational timebase_;
};
#endif // VIDEOSTREAM_H
@@ -7,6 +7,10 @@ Item::Item() :
Item::~Item()
{
// Delete all children
for (int i=0;i<children_.size();i++) {
delete children_.at(i);
}
}
void Item::add_child(Item* c)
+26 -1
View File
@@ -13,11 +13,36 @@ public:
kSequence
};
/**
* @brief Item constructor
*/
Item();
// Required virtual destructor (it's empty)
/**
* @brief Item destructor, deletes all children
*/
virtual ~Item();
/**
* @brief Deleted copy constructor
*/
Item(const Item& other) = delete;
/**
* @brief Deleted move constructor
*/
Item(Item&& other) = delete;
/**
* @brief Deleted copy assignment
*/
Item& operator=(const Item& other) = delete;
/**
* @brief Deleted move assignment
*/
Item& operator=(Item&& other) = delete;
virtual Type type() const = 0;
void add_child(Item *c);
+1 -1
View File
@@ -4,7 +4,7 @@
#include <QObject>
#include <memory>
#include "folder.h"
#include "project/item/folder/folder.h"
class Project : public QObject
{