added probe on import functionality

This commit is contained in:
itsmattkc
2019-06-27 08:51:44 -07:00
parent d133ee9832
commit 955f80c622
14 changed files with 231 additions and 33 deletions
+3 -7
View File
@@ -22,11 +22,7 @@
AudioStream::AudioStream()
{
}
Stream::Type AudioStream::type()
{
return kAudio;
set_type(kAudio);
}
const int &AudioStream::channels()
@@ -39,12 +35,12 @@ void AudioStream::set_channels(const int &channels)
channels_ = channels;
}
const int &AudioStream::layout()
const uint64_t &AudioStream::layout()
{
return layout_;
}
void AudioStream::set_layout(const int &layout)
void AudioStream::set_layout(const uint64_t &layout)
{
layout_ = layout;
}
+7 -5
View File
@@ -21,6 +21,10 @@
#ifndef AUDIOSTREAM_H
#define AUDIOSTREAM_H
extern "C" {
#include <libavcodec/avcodec.h>
}
#include "rational.h"
#include "stream.h"
@@ -29,20 +33,18 @@ class AudioStream : public Stream
public:
AudioStream();
virtual Type type() override;
const int& channels();
void set_channels(const int& channels);
const int& layout();
void set_layout(const int& layout);
const uint64_t& layout();
void set_layout(const uint64_t& layout);
const int& sample_rate();
void set_sample_rate(const int& sample_rate);
private:
int channels_;
int layout_;
uint64_t layout_;
int sample_rate_;
};
+28 -3
View File
@@ -25,6 +25,20 @@ Footage::Footage()
}
Footage::~Footage()
{
ClearStreams();
}
void Footage::Clear()
{
// Clear filename string
filename_.clear();
// Clear all streams
ClearStreams();
}
const QString &Footage::filename()
{
return filename_;
@@ -45,21 +59,32 @@ void Footage::set_timestamp(const QDateTime &t)
timestamp_ = t;
}
void Footage::add_stream(const Stream &s)
void Footage::add_stream(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);
streams_.last()->set_footage(this);
}
const Stream *Footage::stream(int index)
{
return &streams_.at(index);
return streams_.at(index);
}
Item::Type Footage::type() const
{
return kFootage;
}
void Footage::ClearStreams()
{
// Delete all streams
for (int i=0;i<streams_.size();i++) {
delete streams_.at(i);
}
// Empty array
streams_.clear();
}
+28 -2
View File
@@ -34,23 +34,49 @@ class Footage : public Item
public:
Footage();
virtual ~Footage() override;
/**
* @brief Deleted copy constructor
*/
Footage(const Footage& other) = delete;
/**
* @brief Deleted move constructor
*/
Footage(Footage&& other) = delete;
/**
* @brief Deleted copy assignment
*/
Footage& operator=(const Footage& other) = delete;
/**
* @brief Deleted move assignment
*/
Footage& operator=(Footage&& other) = delete;
void Clear();
const QString& filename();
void set_filename(const QString& s);
const QDateTime& timestamp();
void set_timestamp(const QDateTime& t);
void add_stream(const Stream& s);
void add_stream(Stream* s);
const Stream* stream(int index);
virtual Type type() const override;
private:
void ClearStreams();
QString filename_;
QDateTime timestamp_;
QList<Stream> streams_;
QList<Stream*> streams_;
};
#endif // FOOTAGE_H
+12 -6
View File
@@ -1,7 +1,8 @@
#include "stream.h"
Stream::Stream() :
footage_(nullptr)
footage_(nullptr),
type_(kUnknown)
{
}
@@ -10,6 +11,16 @@ Stream::~Stream()
{
}
const Stream::Type &Stream::type()
{
return type_;
}
void Stream::set_type(const Stream::Type &type)
{
type_ = type;
}
Footage *Stream::footage()
{
return footage_;
@@ -20,11 +31,6 @@ void Stream::set_footage(Footage *f)
footage_ = f;
}
Stream::Type Stream::type()
{
return kUnknown;
}
const rational &Stream::timebase()
{
return timebase_;
+4 -1
View File
@@ -27,7 +27,8 @@ public:
*/
virtual ~Stream();
virtual Type type();
const Type& type();
void set_type(const Type& type);
Footage* footage();
void set_footage(Footage* f);
@@ -45,6 +46,8 @@ private:
int index_;
Type type_;
};
#endif // STREAM_H
+1 -5
View File
@@ -22,11 +22,7 @@
VideoStream::VideoStream()
{
}
Stream::Type VideoStream::type()
{
return kVideo;
set_type(kVideo);
}
const int &VideoStream::width()
-2
View File
@@ -29,8 +29,6 @@ class VideoStream : public Stream
public:
VideoStream();
virtual Type type() override;
const int& width();
void set_width(const int& width);