Loading...
Searching...
No Matches
ImageWriter.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC, Fabrice Bellard
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_IMAGE_WRITER_H
#define OPENSHOT_IMAGE_WRITER_H
#ifdef USE_IMAGEMAGICK
#include <string>
#include <vector>
#include "WriterBase.h"
#include "MagickUtilities.h"
#include "Fraction.h"
namespace openshot
{
// Forward decls
class Frame;
class ReaderBase;
class ImageWriter : public WriterBase
{
private:
std::string path;
int cache_size;
bool is_open;
int64_t write_video_count;
std::vector<Magick::Image> frames;
int image_quality;
int number_of_loops;
bool combine_frames;
std::shared_ptr<Frame> last_frame;
public:
ImageWriter(std::string path);
void Close();
int GetCacheSize() { return cache_size; };
bool IsOpen() { return is_open; };
void Open();
void SetCacheSize(int new_size) { cache_size = new_size; };
void SetVideoOptions(
std::string format, Fraction fps, int width, int height,
int quality, int loops, bool combine);
void WriteFrame(std::shared_ptr<Frame> frame);
void WriteFrame(ReaderBase* reader, int64_t start, int64_t length);
};
} // namespace
#endif //USE_IMAGEMAGICK
#endif //OPENSHOT_IMAGE_WRITER_H
Fraction.h
Header file for Fraction class.
MagickUtilities.h
Header file for MagickUtilities (IM6/IM7 compatibility overlay).
WriterBase.h
Header file for WriterBase class.
openshot::Fraction
This class represents a fraction.
Definition Fraction.h:30
openshot::Frame
This class represents a single frame of video (i.e. image & audio data).
Definition Frame.h:89
openshot::ImageWriter::GetCacheSize
int GetCacheSize()
Get the cache size.
Definition ImageWriter.h:84
openshot::ImageWriter::Close
void Close()
Close the writer and encode/output final image to the disk. This is a requirement of ImageMagick,...
Definition ImageWriter.cpp:140
openshot::ImageWriter::ImageWriter
ImageWriter(std::string path)
Constructor for ImageWriter. Throws one of the following exceptions.
Definition ImageWriter.cpp:27
openshot::ImageWriter::SetVideoOptions
void SetVideoOptions(std::string format, Fraction fps, int width, int height, int quality, int loops, bool combine)
Set the video export options.
Definition ImageWriter.cpp:36
openshot::ImageWriter::WriteFrame
void WriteFrame(std::shared_ptr< Frame > frame)
Add a frame to the stack waiting to be encoded.
Definition ImageWriter.cpp:85
openshot::ImageWriter::Open
void Open()
Open writer.
Definition ImageWriter.cpp:79
openshot::ImageWriter::IsOpen
bool IsOpen()
Determine if writer is open or closed.
Definition ImageWriter.h:87
openshot::ImageWriter::SetCacheSize
void SetCacheSize(int new_size)
Set the cache size (number of frames to queue before writing).
Definition ImageWriter.h:94
openshot::ReaderBase
This abstract class is the base class, used by all readers in libopenshot.
Definition ReaderBase.h:76
openshot::WriterBase::WriterBase
WriterBase()
Constructor for WriterBase class, many things are initialized here.
Definition WriterBase.cpp:25
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29