Loading...
Searching...
No Matches
ChunkWriter.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_CHUNK_WRITER_H
#define OPENSHOT_CHUNK_WRITER_H
#include "ReaderBase.h"
#include "WriterBase.h"
#include "FFmpegWriter.h"
#include "CacheMemory.h"
#include "Json.h"
#include <cmath>
#include <ctime>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <sstream>
#include <unistd.h>
#include <omp.h>
#include <QtCore/QDir>
namespace openshot
{
class ChunkWriter : public WriterBase
{
private:
std::string path;
int64_t chunk_count;
int64_t chunk_size;
int64_t frame_count;
bool is_open;
bool is_writing;
openshot::ReaderBase *local_reader;
openshot::FFmpegWriter *writer_thumb;
openshot::FFmpegWriter *writer_preview;
openshot::FFmpegWriter *writer_final;
std::shared_ptr<Frame> last_frame;
bool last_frame_needed;
std::string default_extension;
std::string default_vcodec;
std::string default_acodec;
void create_folder(std::string path);
std::string get_chunk_path(int64_t chunk_number, std::string folder, std::string extension);
bool is_chunk_valid();
void write_json_meta_data();
public:
ChunkWriter(std::string path, openshot::ReaderBase *reader);
void Close();
int64_t GetChunkSize() { return chunk_size; };
bool IsOpen() { return is_open; };
void Open();
void SetChunkSize(int64_t new_size) { chunk_size = new_size; };
void WriteFrame(std::shared_ptr<openshot::Frame> frame);
void WriteFrame(int64_t start, int64_t length);
void WriteFrame(openshot::ReaderBase* reader, int64_t start, int64_t length);
};
}
#endif
CacheMemory.h
Header file for CacheMemory class.
path
path
Definition FFmpegWriter.cpp:1515
FFmpegWriter.h
Header file for FFmpegWriter class.
Json.h
Header file for JSON class.
ReaderBase.h
Header file for ReaderBase class.
WriterBase.h
Header file for WriterBase class.
openshot::ChunkWriter
This class takes any reader and generates a special type of video file, built with chunks of small vi...
Definition ChunkWriter.h:63
openshot::ChunkWriter::Close
void Close()
Close the writer.
Definition ChunkWriter.cpp:209
openshot::ChunkWriter::IsOpen
bool IsOpen()
Determine if writer is open or closed.
Definition ChunkWriter.h:107
openshot::ChunkWriter::SetChunkSize
void SetChunkSize(int64_t new_size)
Set the chunk size (number of frames to write in each chunk)
Definition ChunkWriter.h:114
openshot::ChunkWriter::GetChunkSize
int64_t GetChunkSize()
Get the chunk size (number of frames to write in each chunk)
Definition ChunkWriter.h:104
openshot::ChunkWriter::Open
void Open()
Open writer.
Definition ChunkWriter.cpp:280
openshot::ChunkWriter::WriteFrame
void WriteFrame(std::shared_ptr< openshot::Frame > frame)
Add a frame to the stack waiting to be encoded.
Definition ChunkWriter.cpp:64
openshot::FFmpegWriter
This class uses the FFmpeg libraries, to write and encode video files and audio files.
Definition FFmpegWriter.h:116
openshot::ReaderBase
This abstract class is the base class, used by all readers in libopenshot.
Definition ReaderBase.h:76
openshot::WriterBase
This abstract class is the base class, used by writers. Writers are types of classes that encode vide...
Definition WriterBase.h:70
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29