folded decoder hierarchy back in

This commit is contained in:
itsmattkc
2019-06-26 16:48:14 -07:00
parent 854a10321c
commit f47de0be0d
10 changed files with 130 additions and 84 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ set(OLIVE_SOURCES
rational.cpp
)
#add_subdirectory(decoder)
add_subdirectory(decoder)
add_subdirectory(panel)
add_subdirectory(project)
add_subdirectory(render)
+2
View File
@@ -21,6 +21,8 @@ set(OLIVE_SOURCES
project/item/footage/audiostream.cpp
project/item/footage/footage.h
project/item/footage/footage.cpp
project/item/footage/stream.h
project/item/footage/stream.cpp
project/item/footage/videostream.h
project/item/footage/videostream.cpp
PARENT_SCOPE
+3 -15
View File
@@ -20,26 +20,14 @@
#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)
AudioStream::AudioStream()
{
}
Footage *AudioStream::footage()
Stream::Type AudioStream::type()
{
return footage_;
}
void AudioStream::set_footage(Footage *f)
{
footage_ = f;
return kAudio;
}
const int &AudioStream::channels()
+4 -8
View File
@@ -22,16 +22,14 @@
#define AUDIOSTREAM_H
#include "rational.h"
#include "stream.h"
class Footage;
class AudioStream
class AudioStream : public Stream
{
public:
AudioStream(Footage* footage, const int& channels, const int& layout, const int& sample_rate);
AudioStream();
Footage* footage();
void set_footage(Footage* f);
virtual Type type() override;
const int& channels();
void set_channels(const int& channels);
@@ -43,8 +41,6 @@ public:
void set_sample_rate(const int& sample_rate);
private:
Footage* footage_;
int channels_;
int layout_;
int sample_rate_;
+14
View File
@@ -45,6 +45,20 @@ void Footage::set_timestamp(const QDateTime &t)
timestamp_ = t;
}
void Footage::add_stream(const Stream &s)
{
// Add a copy of this stream to the list
streams_.append(s);
// Set its footage parent to this
streams_.last().set_footage(this);
}
const Stream *Footage::stream(int index)
{
return &streams_.at(index);
}
Item::Type Footage::type() const
{
return kFootage;
+3 -7
View File
@@ -40,11 +40,8 @@ public:
const QDateTime& timestamp();
void set_timestamp(const QDateTime& t);
void add_audio_stream(const AudioStream& as);
void add_video_stream(const VideoStream& vs);
const AudioStream* audio_stream(int index);
const VideoStream* video_stream(int index);
void add_stream(const Stream& s);
const Stream* stream(int index);
virtual Type type() const override;
@@ -53,8 +50,7 @@ private:
QDateTime timestamp_;
QList<VideoStream> video_streams_;
QList<AudioStream> audio_streams_;
QList<Stream> streams_;
};
#endif // FOOTAGE_H
+46
View File
@@ -0,0 +1,46 @@
#include "stream.h"
Stream::Stream() :
footage_(nullptr)
{
}
Stream::~Stream()
{
}
Footage *Stream::footage()
{
return footage_;
}
void Stream::set_footage(Footage *f)
{
footage_ = f;
}
Stream::Type Stream::type()
{
return kUnknown;
}
const rational &Stream::timebase()
{
return timebase_;
}
void Stream::set_timebase(const rational &timebase)
{
timebase_ = timebase;
}
const int &Stream::index()
{
return index_;
}
void Stream::set_index(const int &index)
{
index_ = index;
}
+50
View File
@@ -0,0 +1,50 @@
#ifndef STREAM_H
#define STREAM_H
#include "rational.h"
class Footage;
class Stream
{
public:
enum Type {
kUnknown,
kVideo,
kAudio,
kData,
kSubtitle,
kAttachment
};
/**
* @brief Stream constructor
*/
Stream();
/**
* @brief Required virtual destructor, serves no purpose
*/
virtual ~Stream();
virtual Type type();
Footage* footage();
void set_footage(Footage* f);
const rational& timebase();
void set_timebase(const rational& timebase);
const int& index();
void set_index(const int& index);
private:
Footage* footage_;
rational timebase_;
int index_;
};
#endif // STREAM_H
+3 -37
View File
@@ -20,37 +20,13 @@
#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)
VideoStream::VideoStream()
{
}
Footage *VideoStream::footage()
Stream::Type VideoStream::type()
{
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;
return kVideo;
}
const int &VideoStream::width()
@@ -72,13 +48,3 @@ void VideoStream::set_height(const int &height)
{
height_ = height;
}
const rational &VideoStream::timebase()
{
return timebase_;
}
void VideoStream::set_timebase(const rational &timebase)
{
timebase_ = timebase;
}
+4 -16
View File
@@ -22,19 +22,14 @@
#define VIDEOSTREAM_H
#include "rational.h"
#include "stream.h"
class Footage;
class VideoStream
class VideoStream : public Stream
{
public:
VideoStream(Footage* footage, const int& index, const int& width, const int& height, const rational& timebase);
VideoStream();
Footage* footage();
void set_footage(Footage* f);
const int& index();
void set_index(const int& index);
virtual Type type() override;
const int& width();
void set_width(const int& width);
@@ -42,16 +37,9 @@ public:
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