OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
ImageWriter.h
Go to the documentation of this file.
1
9// Copyright (c) 2008-2019 OpenShot Studios, LLC, Fabrice Bellard
10//
11// SPDX-License-Identifier: LGPL-3.0-or-later
12
13#ifndef OPENSHOT_IMAGE_WRITER_H
14#define OPENSHOT_IMAGE_WRITER_H
15
16#ifdef USE_IMAGEMAGICK
17
18#include <string>
19#include <vector>
20
21#include "WriterBase.h"
22#include "MagickUtilities.h"
23
24#include "Fraction.h"
25
26namespace openshot
27{
28 // Forward decls
29 class Frame;
30 class ReaderBase;
31
59 class ImageWriter : public WriterBase
60 {
61 private:
62 std::string path;
63 int cache_size;
64 bool is_open;
65 int64_t write_video_count;
66 std::vector<Magick::Image> frames;
67 int image_quality;
68 int number_of_loops;
69 bool combine_frames;
70
71 std::shared_ptr<Frame> last_frame;
72
73 public:
74
77 ImageWriter(std::string path);
78
81 void Close();
82
84 int GetCacheSize() { return cache_size; };
85
87 bool IsOpen() { return is_open; };
88
90 void Open();
91
94 void SetCacheSize(int new_size) { cache_size = new_size; };
95
104 void SetVideoOptions(
105 std::string format, Fraction fps, int width, int height,
106 int quality, int loops, bool combine);
107
110 void WriteFrame(std::shared_ptr<Frame> frame);
111
116 void WriteFrame(ReaderBase* reader, int64_t start, int64_t length);
117
118 };
119
120} // namespace
121
122#endif //USE_IMAGEMAGICK
123#endif //OPENSHOT_IMAGE_WRITER_H
Header file for Fraction class.
Header file for MagickUtilities (IM6/IM7 compatibility overlay)
Header file for WriterBase class.
This class represents a fraction.
Definition Fraction.h:30
This class uses the ImageMagick library to write image files (including animated GIFs)
Definition ImageWriter.h:60
int GetCacheSize()
Get the cache size.
Definition ImageWriter.h:84
void Close()
Close the writer and encode/output final image to the disk. This is a requirement of ImageMagick,...
void SetVideoOptions(std::string format, Fraction fps, int width, int height, int quality, int loops, bool combine)
Set the video export options.
void WriteFrame(std::shared_ptr< Frame > frame)
Add a frame to the stack waiting to be encoded.
void Open()
Open writer.
bool IsOpen()
Determine if writer is open or closed.
Definition ImageWriter.h:87
void SetCacheSize(int new_size)
Set the cache size (number of frames to queue before writing)
Definition ImageWriter.h:94
This abstract class is the base class, used by all readers in libopenshot.
Definition ReaderBase.h:76
This abstract class is the base class, used by writers. Writers are types of classes that encode vide...
Definition WriterBase.h:70
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29