This file is indexed.

/usr/include/libopenshot/ImageWriter.h is in libopenshot-dev 0.1.9+dfsg1-3build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/**
 * @file
 * @brief Header file for ImageWriter class
 * @author Jonathan Thomas <jonathan@openshot.org>, Fabrice Bellard
 *
 * @section LICENSE
 *
 * Copyright (c) 2008-2013 OpenShot Studios, LLC, Fabrice Bellard
 * (http://www.openshotstudios.com). This file is part of
 * OpenShot Library (http://www.openshot.org), an open-source project
 * dedicated to delivering high quality video editing and animation solutions
 * to the world.
 *
 * This file is originally based on the Libavformat API example, and then modified
 * by the libopenshot project.
 *
 * OpenShot Library 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.
 * * 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_IMAGE_WRITER_H
#define OPENSHOT_IMAGE_WRITER_H

#include "ReaderBase.h"
#include "WriterBase.h"

#include <cmath>
#include <ctime>
#include <iostream>
#include <stdio.h>
#include <unistd.h>
#include "Magick++.h"
#include "CacheMemory.h"
#include "Exceptions.h"
#include "OpenMPUtilities.h"


using namespace std;

namespace openshot
{

	/**
	 * @brief This class uses the ImageMagick library to write image files (including animated GIFs)
	 *
	 * All image formats supported by ImageMagick are supported by this class.
	 *
	 * @code
	 * // Create a reader for a video
	 * FFmpegReader r("MyAwesomeVideo.webm");
	 * r.Open(); // Open the reader
	 *
	 * // Create a writer (which will create an animated GIF file)
	 * ImageWriter w("/home/jonathan/NewAnimation.gif");
	 *
	 * // Set the image output settings (format, fps, width, height, quality, loops, combine)
	 * w.SetVideoOptions("GIF", r.info.fps, r.info.width, r.info.height, 70, 1, true);
	 *
	 * // Open the writer
	 * w.Open();
	 *
	 * // Write the 1st 30 frames from the reader
	 * w.WriteFrame(&r, 1, 30);
	 *
	 * // Close the reader & writer
	 * w.Close();
	 * r.Close();
	 * @endcode
	 */
	class ImageWriter : public WriterBase
	{
	private:
		string path;
		int cache_size;
		bool is_writing;
		bool is_open;
		int64_t write_video_count;
		vector<Magick::Image> frames;
		int image_quality;
		int number_of_loops;
		bool combine_frames;

	    std::shared_ptr<Frame> last_frame;

	public:

		/// @brief Constructor for ImageWriter. Throws one of the following exceptions.
		/// @param path The path of the file you want to create
		ImageWriter(string path);

		/// @brief Close the writer and encode/output final image to the disk. This is a requirement of ImageMagick,
		/// which writes all frames of a multi-frame image at one time.
		void Close();

		/// @brief Get the cache size
		int GetCacheSize() { return cache_size; };

		/// Determine if writer is open or closed
		bool IsOpen() { return is_open; };

		/// Open writer
		void Open();

		/// @brief Set the cache size (number of frames to queue before writing)
		/// @param new_size Number of frames to queue before writing
		void SetCacheSize(int new_size) { cache_size = new_size; };

		/// @brief Set the video export options
		/// @param format The image format (such as GIF)
		/// @param fps Frames per second of the image (used on certain multi-frame image formats, such as GIF)
		/// @param width Width in pixels of image
		/// @param height Height in pixels of image
		/// @param quality Quality of image (0 to 100, 70 is default)
		/// @param loops Number of times to repeat the image (used on certain multi-frame image formats, such as GIF)
		/// @param combine Combine frames into a single image (if possible), or save each frame as it's own image
		void SetVideoOptions(string format, Fraction fps, int width, int height,
				int quality, int loops, bool combine);

		/// @brief Add a frame to the stack waiting to be encoded.
		/// @param frame The openshot::Frame object to write to this image
		void WriteFrame(std::shared_ptr<Frame> frame);

		/// @brief Write a block of frames from a reader
		/// @param reader A openshot::ReaderBase object which will provide frames to be written
		/// @param start The starting frame number of the reader
		/// @param length The number of frames to write
		void WriteFrame(ReaderBase* reader, int64_t start, int64_t length);

	};

}

#endif