decoder source documentation and license boilerplate
This commit is contained in:
@@ -1,3 +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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#include "decoder.h"
|
#include "decoder.h"
|
||||||
|
|
||||||
Decoder::Decoder() :
|
Decoder::Decoder() :
|
||||||
|
|||||||
@@ -1,3 +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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#ifndef DECODER_H
|
#ifndef DECODER_H
|
||||||
#define DECODER_H
|
#define DECODER_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#include "ffmpegdecoder.h"
|
#include "ffmpegdecoder.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -1,3 +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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#ifndef FFMPEGDECODER_H
|
#ifndef FFMPEGDECODER_H
|
||||||
#define FFMPEGDECODER_H
|
#define FFMPEGDECODER_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|||||||
@@ -1,3 +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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#ifndef FRAME_H
|
#ifndef FRAME_H
|
||||||
#define FRAME_H
|
#define FRAME_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,28 @@
|
|||||||
|
/***
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#include "probeserver.h"
|
#include "probeserver.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
#include "decoder/ffmpeg/ffmpegdecoder.h"
|
#include "decoder/ffmpeg/ffmpegdecoder.h"
|
||||||
|
|
||||||
@@ -13,11 +34,31 @@ bool olive::ProbeMedia(Footage *f)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check file exists
|
||||||
|
if (!QFileInfo::exists(f->filename())) {
|
||||||
|
qWarning() << QCoreApplication::translate("ProbeMedia", "Tried to probe file that doesn't exist");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset Footage state for probing
|
||||||
|
f->Clear();
|
||||||
|
|
||||||
|
// Create decoder instance
|
||||||
FFmpegDecoder ff_dec;
|
FFmpegDecoder ff_dec;
|
||||||
|
|
||||||
// Pass footage through FFmpeg's probe function
|
// Create list to iterate through
|
||||||
if (ff_dec.Probe(f)) {
|
QList<Decoder*> decoder_list;
|
||||||
return true;
|
decoder_list.append(&ff_dec);
|
||||||
|
|
||||||
|
// Pass Footage through each Decoder's probe function
|
||||||
|
for (int i=0;i<decoder_list.size();i++) {
|
||||||
|
if (decoder_list.at(i)->Probe(f)) {
|
||||||
|
|
||||||
|
// TODO Some way of "attaching" the Footage to the Decoder without having to iterate through Decoders like this
|
||||||
|
|
||||||
|
f->set_ready(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,3 +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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#ifndef PROBESERVER_H
|
#ifndef PROBESERVER_H
|
||||||
#define PROBESERVER_H
|
#define PROBESERVER_H
|
||||||
|
|
||||||
@@ -5,6 +25,25 @@
|
|||||||
|
|
||||||
namespace olive {
|
namespace olive {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Try to probe a Footage file by passing it through all available Decoders
|
||||||
|
*
|
||||||
|
* This is a helper function designed to abstract the process of communicating with several Decoders from the rest of
|
||||||
|
* the application. This function will take a Footage file and manually pass it through the available Decoders' Probe()
|
||||||
|
* functions until one indicates that it can decode this file. That Decoder will then dump information about the file
|
||||||
|
* into the Footage object for use throughout the program.
|
||||||
|
*
|
||||||
|
* Probing may be a lengthy process and it's recommended to run this in a separate thread.
|
||||||
|
*
|
||||||
|
* @param f
|
||||||
|
*
|
||||||
|
* A Footage object with a valid filename. If the Footage does not have a valid filename (e.g. is empty or file doesn't
|
||||||
|
* exist), this function will return FALSE.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* TRUE if a Decoder was successfully able to parse and probe this file. FALSE if not.
|
||||||
|
*/
|
||||||
bool ProbeMedia(Footage* f);
|
bool ProbeMedia(Footage* f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,13 +30,23 @@ Footage::~Footage()
|
|||||||
ClearStreams();
|
ClearStreams();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Footage::ready()
|
||||||
|
{
|
||||||
|
return ready_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Footage::set_ready(const bool &ready)
|
||||||
|
{
|
||||||
|
ready_ = ready;
|
||||||
|
}
|
||||||
|
|
||||||
void Footage::Clear()
|
void Footage::Clear()
|
||||||
{
|
{
|
||||||
// Clear filename string
|
|
||||||
filename_.clear();
|
|
||||||
|
|
||||||
// Clear all streams
|
// Clear all streams
|
||||||
ClearStreams();
|
ClearStreams();
|
||||||
|
|
||||||
|
// Reset ready state
|
||||||
|
set_ready(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &Footage::filename()
|
const QString &Footage::filename()
|
||||||
@@ -73,6 +83,11 @@ const Stream *Footage::stream(int index)
|
|||||||
return streams_.at(index);
|
return streams_.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Footage::stream_count()
|
||||||
|
{
|
||||||
|
return streams_.size();
|
||||||
|
}
|
||||||
|
|
||||||
Item::Type Footage::type() const
|
Item::Type Footage::type() const
|
||||||
{
|
{
|
||||||
return kFootage;
|
return kFootage;
|
||||||
@@ -80,6 +95,10 @@ Item::Type Footage::type() const
|
|||||||
|
|
||||||
void Footage::ClearStreams()
|
void Footage::ClearStreams()
|
||||||
{
|
{
|
||||||
|
if (streams_.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Delete all streams
|
// Delete all streams
|
||||||
for (int i=0;i<streams_.size();i++) {
|
for (int i=0;i<streams_.size();i++) {
|
||||||
delete streams_.at(i);
|
delete streams_.at(i);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
||||||
Olive - Non-Linear Video Editor
|
Olive - Non-Linear Video Editor
|
||||||
@@ -32,8 +31,16 @@
|
|||||||
class Footage : public Item
|
class Footage : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Footage Constructor
|
||||||
|
*/
|
||||||
Footage();
|
Footage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Footage Destructor
|
||||||
|
*
|
||||||
|
* Makes sure Stream objects are cleared properly
|
||||||
|
*/
|
||||||
virtual ~Footage() override;
|
virtual ~Footage() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,27 +63,134 @@ public:
|
|||||||
*/
|
*/
|
||||||
Footage& operator=(Footage&& other) = delete;
|
Footage& operator=(Footage&& other) = delete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check the ready state of this Footage object
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* If the Footage has been successfully probed, this will return TRUE.
|
||||||
|
*/
|
||||||
|
bool ready();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set ready state
|
||||||
|
*
|
||||||
|
* This should only be set by olive::ProbeMedia. Sets the ready state (see ready()).
|
||||||
|
*/
|
||||||
|
void set_ready(const bool& ready);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reset Footage state ready for running through Probe() again
|
||||||
|
*
|
||||||
|
* If a Footage object needs to be re-probed (e.g. source file changes or Footage is linked to a new file), its
|
||||||
|
* state needs to be reset so the Decoder::Probe() function can accurately mirror the source file. Clear() will
|
||||||
|
* reset the Footage object's state to being freshly created (keeping the filename).
|
||||||
|
*
|
||||||
|
* In most cases, you'll be using olive::ProbeMedia() for re-probing which already runs Clear(), so you won't need
|
||||||
|
* to worry about this.
|
||||||
|
*/
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return the current filename of this Footage object
|
||||||
|
*/
|
||||||
const QString& filename();
|
const QString& filename();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the filename
|
||||||
|
*
|
||||||
|
* NOTE: This does not automtaically clear the old streams and re-probe for new ones. If the file link has been
|
||||||
|
* changed, this will need to be done manually.
|
||||||
|
*
|
||||||
|
* @param s
|
||||||
|
*
|
||||||
|
* New filename
|
||||||
|
*/
|
||||||
void set_filename(const QString& s);
|
void set_filename(const QString& s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Retrieve the last modified time/date
|
||||||
|
*
|
||||||
|
* The file's last modified timestamp is stored for potential organization in the ProjectExplorer. It can be
|
||||||
|
* retrieved here.
|
||||||
|
*/
|
||||||
const QDateTime& timestamp();
|
const QDateTime& timestamp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the last modified time/date
|
||||||
|
*
|
||||||
|
* This should probably only be done on import or replace.
|
||||||
|
*
|
||||||
|
* @param t
|
||||||
|
*
|
||||||
|
* New last modified time/date
|
||||||
|
*/
|
||||||
void set_timestamp(const QDateTime& t);
|
void set_timestamp(const QDateTime& t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a stream metadata object to this footage
|
||||||
|
*
|
||||||
|
* Usually done during a Decoder::Probe() function for retrieving metadata about the video/audio/other streams
|
||||||
|
* inside a container. Streams can have non-video/audio types so that they can be equivalent to the file's actual
|
||||||
|
* stream list, though the only streams officially supported are video and audio streams.
|
||||||
|
*
|
||||||
|
* @param s
|
||||||
|
*
|
||||||
|
* A pointer to a stream object. The Footage takes ownership of this object and will free it when it's deleted.
|
||||||
|
*/
|
||||||
void add_stream(Stream* s);
|
void add_stream(Stream* s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Retrieve a stream at the given index.
|
||||||
|
*
|
||||||
|
* @param index
|
||||||
|
*
|
||||||
|
* The index will be equivalent to the stream's index in the file (or in FFmpeg
|
||||||
|
* terms AVStream->file_index). Must be < stream_count().
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
* The stream at the index provided
|
||||||
|
*/
|
||||||
const Stream* stream(int index);
|
const Stream* stream(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Retrieve total number of streams in this Footage file
|
||||||
|
*/
|
||||||
|
int stream_count();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Item::Type() override
|
||||||
|
*
|
||||||
|
* @return kFootage
|
||||||
|
*/
|
||||||
virtual Type type() const override;
|
virtual Type type() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* @brief Internal function to delete all Stream children and empty the array
|
||||||
|
*/
|
||||||
void ClearStreams();
|
void ClearStreams();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal filename string
|
||||||
|
*/
|
||||||
QString filename_;
|
QString filename_;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal timestamp object
|
||||||
|
*/
|
||||||
QDateTime timestamp_;
|
QDateTime timestamp_;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal streams array
|
||||||
|
*/
|
||||||
QList<Stream*> streams_;
|
QList<Stream*> streams_;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Internal ready setting
|
||||||
|
*/
|
||||||
|
bool ready_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FOOTAGE_H
|
#endif // FOOTAGE_H
|
||||||
|
|||||||
@@ -1,3 +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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
|
|
||||||
Stream::Stream() :
|
Stream::Stream() :
|
||||||
|
|||||||
@@ -1,3 +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/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#ifndef STREAM_H
|
#ifndef STREAM_H
|
||||||
#define STREAM_H
|
#define STREAM_H
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user