Exceptions.h
Go to the documentation of this file.
/**
* @file
* @brief Header file for all Exception classes
* @author Jonathan Thomas <jonathan@openshot.org>
*
* @section LICENSE
*
* Copyright (c) 2008-2014 OpenShot Studios, LLC
* <http://www.openshotstudios.com/>. This file is part of
* OpenShot Library (libopenshot), an open-source project dedicated to
* delivering high quality video editing and animation solutions to the
* world. For more information visit <http://www.openshot.org/>.
*
* OpenShot Library (libopenshot) is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* OpenShot Library (libopenshot) 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENSHOT_EXCEPTIONS_H
#define OPENSHOT_EXCEPTIONS_H
#include <string>
using namespace std;
namespace openshot {
/**
* @brief Base exception class with a custom message variable.
*
* A custom error message field has been added to the std::exception base class. All
* OpenShot exception classes inherit from this class.
*/
class BaseException : public std::exception //: public exception
{
protected:
string m_message;
public:
BaseException(string message) : m_message(message) { }
virtual ~BaseException() throw () {}
virtual const char* what() const throw () {
// return custom message
return m_message.c_str();
}
};
/// Exception when a required chunk is missing
class ChunkNotFound : public BaseException
{
public:
string file_path;
int64_t frame_number;
int64_t chunk_number;
int64_t chunk_frame;
ChunkNotFound(string message, int64_t frame_number, int64_t chunk_number, int64_t chunk_frame)
: BaseException(message), frame_number(frame_number), chunk_number(chunk_number), chunk_frame(chunk_frame) { }
virtual ~ChunkNotFound() throw () {}
};
/// Exception when accessing a blackmagic decklink card
class DecklinkError : public BaseException
{
public:
DecklinkError(string message)
: BaseException(message) { }
virtual ~DecklinkError() throw () {}
};
/// Exception when decoding audio packet
class ErrorDecodingAudio : public BaseException
{
public:
string file_path;
int64_t frame_number;
ErrorDecodingAudio(string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
virtual ~ErrorDecodingAudio() throw () {}
};
/// Exception when encoding audio packet
class ErrorEncodingAudio : public BaseException
{
public:
string file_path;
int64_t frame_number;
ErrorEncodingAudio(string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
virtual ~ErrorEncodingAudio() throw () {}
};
/// Exception when encoding audio packet
class ErrorEncodingVideo : public BaseException
{
public:
string file_path;
int64_t frame_number;
ErrorEncodingVideo(string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
virtual ~ErrorEncodingVideo() throw () {}
};
/// Exception when an invalid # of audio channels are detected
class InvalidChannels : public BaseException
{
public:
string file_path;
InvalidChannels(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidChannels() throw () {}
};
/// Exception when no valid codec is found for a file
class InvalidCodec : public BaseException
{
public:
string file_path;
InvalidCodec(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidCodec() throw () {}
};
/// Exception for files that can not be found or opened
class InvalidFile : public BaseException
{
public:
string file_path;
InvalidFile(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidFile() throw () {}
};
/// Exception when no valid format is found for a file
class InvalidFormat : public BaseException
{
public:
string file_path;
InvalidFormat(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidFormat() throw () {}
};
/// Exception for invalid JSON
class InvalidJSON : public BaseException
{
public:
string file_path;
InvalidJSON(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidJSON() throw () {}
};
/// Exception when invalid encoding options are used
class InvalidOptions : public BaseException
{
public:
string file_path;
InvalidOptions(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidOptions() throw () {}
};
/// Exception when invalid sample rate is detected during encoding
class InvalidSampleRate : public BaseException
{
public:
string file_path;
InvalidSampleRate(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~InvalidSampleRate() throw () {}
};
/// Exception for missing JSON Change key
class InvalidJSONKey : public BaseException
{
public:
string json;
InvalidJSONKey(string message, string json)
: BaseException(message), json(json) { }
virtual ~InvalidJSONKey() throw () {}
};
/// Exception when no streams are found in the file
class NoStreamsFound : public BaseException
{
public:
string file_path;
NoStreamsFound(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~NoStreamsFound() throw () {}
};
/// Exception for frames that are out of bounds.
class OutOfBoundsFrame : public BaseException
{
public:
int64_t FrameRequested;
int64_t MaxFrames;
OutOfBoundsFrame(string message, int64_t frame_requested, int64_t max_frames)
: BaseException(message), FrameRequested(frame_requested), MaxFrames(max_frames) { }
virtual ~OutOfBoundsFrame() throw () {}
};
/// Exception for an out of bounds key-frame point.
class OutOfBoundsPoint : public BaseException
{
public:
int PointRequested;
int MaxPoints;
OutOfBoundsPoint(string message, int point_requested, int max_points)
: BaseException(message), PointRequested(point_requested), MaxPoints(max_points) { }
virtual ~OutOfBoundsPoint() throw () {}
};
/// Exception when memory could not be allocated
class OutOfMemory : public BaseException
{
public:
string file_path;
OutOfMemory(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~OutOfMemory() throw () {}
};
/// Exception when a reader is closed, and a frame is requested
class ReaderClosed : public BaseException
{
public:
string file_path;
ReaderClosed(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~ReaderClosed() throw () {}
};
/// Exception when resample fails
class ResampleError : public BaseException
{
public:
string file_path;
ResampleError(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~ResampleError() throw () {}
};
/// Exception when too many seek attempts happen
class TooManySeeks : public BaseException
{
public:
string file_path;
TooManySeeks(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~TooManySeeks() throw () {}
};
/// Exception when a writer is closed, and a frame is requested
class WriterClosed : public BaseException
{
public:
string file_path;
WriterClosed(string message, string file_path)
: BaseException(message), file_path(file_path) { }
virtual ~WriterClosed() throw () {}
};
}
#endif
openshot::OutOfMemory::file_path
string file_path
Definition: Exceptions.h:227
openshot::BaseException::~BaseException
virtual ~BaseException()
Definition: Exceptions.h:48
openshot::WriterClosed::~WriterClosed
virtual ~WriterClosed()
Definition: Exceptions.h:270
openshot::ReaderClosed::file_path
string file_path
Definition: Exceptions.h:237
openshot::ChunkNotFound
Exception when a required chunk is missing.
Definition: Exceptions.h:56
openshot::InvalidChannels::file_path
string file_path
Definition: Exceptions.h:115
openshot::InvalidChannels
Exception when an invalid # of audio channels are detected.
Definition: Exceptions.h:112
openshot::BaseException
Base exception class with a custom message variable.
Definition: Exceptions.h:42
openshot::InvalidFile::~InvalidFile
virtual ~InvalidFile()
Definition: Exceptions.h:138
openshot::ChunkNotFound::~ChunkNotFound
virtual ~ChunkNotFound()
Definition: Exceptions.h:65
openshot::WriterClosed::file_path
string file_path
Definition: Exceptions.h:267
openshot::ErrorEncodingAudio
Exception when encoding audio packet.
Definition: Exceptions.h:90
openshot::InvalidSampleRate::~InvalidSampleRate
virtual ~InvalidSampleRate()
Definition: Exceptions.h:178
openshot::ChunkNotFound::chunk_number
int64_t chunk_number
Definition: Exceptions.h:61
openshot::OutOfBoundsFrame::FrameRequested
int64_t FrameRequested
Definition: Exceptions.h:205
openshot::TooManySeeks::TooManySeeks
TooManySeeks(string message, string file_path)
Definition: Exceptions.h:258
openshot::InvalidOptions::file_path
string file_path
Definition: Exceptions.h:165
std
openshot::InvalidChannels::~InvalidChannels
virtual ~InvalidChannels()
Definition: Exceptions.h:118
openshot::OutOfBoundsFrame::~OutOfBoundsFrame
virtual ~OutOfBoundsFrame()
Definition: Exceptions.h:209
openshot::DecklinkError::~DecklinkError
virtual ~DecklinkError()
Definition: Exceptions.h:75
openshot::InvalidCodec::file_path
string file_path
Definition: Exceptions.h:125
openshot::ResampleError::ResampleError
ResampleError(string message, string file_path)
Definition: Exceptions.h:248
openshot::ReaderClosed
Exception when a reader is closed, and a frame is requested.
Definition: Exceptions.h:234
openshot::ChunkNotFound::chunk_frame
int64_t chunk_frame
Definition: Exceptions.h:62
openshot::InvalidChannels::InvalidChannels
InvalidChannels(string message, string file_path)
Definition: Exceptions.h:116
openshot::OutOfBoundsPoint::PointRequested
int PointRequested
Definition: Exceptions.h:216
openshot::InvalidSampleRate::InvalidSampleRate
InvalidSampleRate(string message, string file_path)
Definition: Exceptions.h:176
openshot::InvalidJSONKey::~InvalidJSONKey
virtual ~InvalidJSONKey()
Definition: Exceptions.h:188
openshot::BaseException::BaseException
BaseException(string message)
Definition: Exceptions.h:47
openshot::ErrorDecodingAudio::file_path
string file_path
Definition: Exceptions.h:82
openshot::ErrorEncodingVideo
Exception when encoding audio packet.
Definition: Exceptions.h:101
openshot::InvalidSampleRate
Exception when invalid sample rate is detected during encoding.
Definition: Exceptions.h:172
openshot::OutOfMemory::~OutOfMemory
virtual ~OutOfMemory()
Definition: Exceptions.h:230
openshot::InvalidJSONKey
Exception for missing JSON Change key.
Definition: Exceptions.h:182
openshot::TooManySeeks::~TooManySeeks
virtual ~TooManySeeks()
Definition: Exceptions.h:260
openshot::InvalidFormat::file_path
string file_path
Definition: Exceptions.h:145
openshot::ErrorEncodingAudio::file_path
string file_path
Definition: Exceptions.h:93
openshot::InvalidCodec
Exception when no valid codec is found for a file.
Definition: Exceptions.h:122
openshot::OutOfMemory
Exception when memory could not be allocated.
Definition: Exceptions.h:224
openshot::ReaderClosed::~ReaderClosed
virtual ~ReaderClosed()
Definition: Exceptions.h:240
openshot::InvalidOptions
Exception when invalid encoding options are used.
Definition: Exceptions.h:162
openshot::ResampleError::file_path
string file_path
Definition: Exceptions.h:247
openshot::DecklinkError
Exception when accessing a blackmagic decklink card.
Definition: Exceptions.h:70
openshot::InvalidJSON::file_path
string file_path
Definition: Exceptions.h:155
openshot::NoStreamsFound
Exception when no streams are found in the file.
Definition: Exceptions.h:192
openshot::ReaderClosed::ReaderClosed
ReaderClosed(string message, string file_path)
Definition: Exceptions.h:238
openshot::InvalidFile
Exception for files that can not be found or opened.
Definition: Exceptions.h:132
openshot::ErrorEncodingAudio::ErrorEncodingAudio
ErrorEncodingAudio(string message, int64_t frame_number)
Definition: Exceptions.h:95
openshot::TooManySeeks::file_path
string file_path
Definition: Exceptions.h:257
openshot::InvalidJSON::InvalidJSON
InvalidJSON(string message, string file_path)
Definition: Exceptions.h:156
openshot::DecklinkError::DecklinkError
DecklinkError(string message)
Definition: Exceptions.h:73
openshot::ErrorEncodingAudio::frame_number
int64_t frame_number
Definition: Exceptions.h:94
openshot::NoStreamsFound::~NoStreamsFound
virtual ~NoStreamsFound()
Definition: Exceptions.h:198
openshot::OutOfMemory::OutOfMemory
OutOfMemory(string message, string file_path)
Definition: Exceptions.h:228
openshot::ChunkNotFound::file_path
string file_path
Definition: Exceptions.h:59
openshot::InvalidOptions::~InvalidOptions
virtual ~InvalidOptions()
Definition: Exceptions.h:168
openshot::InvalidJSONKey::InvalidJSONKey
InvalidJSONKey(string message, string json)
Definition: Exceptions.h:186
openshot::InvalidFormat::~InvalidFormat
virtual ~InvalidFormat()
Definition: Exceptions.h:148
openshot::WriterClosed::WriterClosed
WriterClosed(string message, string file_path)
Definition: Exceptions.h:268
openshot::InvalidFile::InvalidFile
InvalidFile(string message, string file_path)
Definition: Exceptions.h:136
openshot::BaseException::m_message
string m_message
Definition: Exceptions.h:45
openshot::ErrorEncodingAudio::~ErrorEncodingAudio
virtual ~ErrorEncodingAudio()
Definition: Exceptions.h:97
openshot::OutOfBoundsFrame
Exception for frames that are out of bounds.
Definition: Exceptions.h:202
openshot::InvalidSampleRate::file_path
string file_path
Definition: Exceptions.h:175
openshot::ErrorEncodingVideo::file_path
string file_path
Definition: Exceptions.h:104
openshot::NoStreamsFound::file_path
string file_path
Definition: Exceptions.h:195
openshot::InvalidJSONKey::json
string json
Definition: Exceptions.h:185
openshot::NoStreamsFound::NoStreamsFound
NoStreamsFound(string message, string file_path)
Definition: Exceptions.h:196
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: AudioBufferSource.h:45
openshot::ErrorEncodingVideo::frame_number
int64_t frame_number
Definition: Exceptions.h:105
openshot::ErrorEncodingVideo::~ErrorEncodingVideo
virtual ~ErrorEncodingVideo()
Definition: Exceptions.h:108
openshot::InvalidJSON
Exception for invalid JSON.
Definition: Exceptions.h:152
openshot::InvalidFormat::InvalidFormat
InvalidFormat(string message, string file_path)
Definition: Exceptions.h:146
openshot::BaseException::what
virtual const char * what() const
Definition: Exceptions.h:49
openshot::OutOfBoundsPoint
Exception for an out of bounds key-frame point.
Definition: Exceptions.h:213
openshot::ChunkNotFound::ChunkNotFound
ChunkNotFound(string message, int64_t frame_number, int64_t chunk_number, int64_t chunk_frame)
Definition: Exceptions.h:63
openshot::OutOfBoundsPoint::OutOfBoundsPoint
OutOfBoundsPoint(string message, int point_requested, int max_points)
Definition: Exceptions.h:218
openshot::ErrorEncodingVideo::ErrorEncodingVideo
ErrorEncodingVideo(string message, int64_t frame_number)
Definition: Exceptions.h:106
openshot::InvalidJSON::~InvalidJSON
virtual ~InvalidJSON()
Definition: Exceptions.h:158
openshot::ChunkNotFound::frame_number
int64_t frame_number
Definition: Exceptions.h:60
openshot::ResampleError::~ResampleError
virtual ~ResampleError()
Definition: Exceptions.h:250
openshot::InvalidCodec::~InvalidCodec
virtual ~InvalidCodec()
Definition: Exceptions.h:128
openshot::InvalidCodec::InvalidCodec
InvalidCodec(string message, string file_path)
Definition: Exceptions.h:126
openshot::ErrorDecodingAudio
Exception when decoding audio packet.
Definition: Exceptions.h:79
openshot::OutOfBoundsFrame::MaxFrames
int64_t MaxFrames
Definition: Exceptions.h:206
openshot::ErrorDecodingAudio::~ErrorDecodingAudio
virtual ~ErrorDecodingAudio()
Definition: Exceptions.h:86
openshot::ErrorDecodingAudio::ErrorDecodingAudio
ErrorDecodingAudio(string message, int64_t frame_number)
Definition: Exceptions.h:84
openshot::ErrorDecodingAudio::frame_number
int64_t frame_number
Definition: Exceptions.h:83
openshot::InvalidOptions::InvalidOptions
InvalidOptions(string message, string file_path)
Definition: Exceptions.h:166
openshot::WriterClosed
Exception when a writer is closed, and a frame is requested.
Definition: Exceptions.h:264
openshot::OutOfBoundsFrame::OutOfBoundsFrame
OutOfBoundsFrame(string message, int64_t frame_requested, int64_t max_frames)
Definition: Exceptions.h:207
openshot::InvalidFile::file_path
string file_path
Definition: Exceptions.h:135
openshot::InvalidFormat
Exception when no valid format is found for a file.
Definition: Exceptions.h:142
openshot::ResampleError
Exception when resample fails.
Definition: Exceptions.h:244
openshot::OutOfBoundsPoint::MaxPoints
int MaxPoints
Definition: Exceptions.h:217
openshot::OutOfBoundsPoint::~OutOfBoundsPoint
virtual ~OutOfBoundsPoint()
Definition: Exceptions.h:220
openshot::TooManySeeks
Exception when too many seek attempts happen.
Definition: Exceptions.h:254