13#ifndef OPENSHOT_WRITER_BASE_H
14#define OPENSHOT_WRITER_BASE_H
86 virtual void WriteFrame(std::shared_ptr<openshot::Frame> frame) = 0;
92 std::string
Json()
const;
94 void SetJson(
const std::string value);
Header file for ChannelLayout class.
Header file for Fraction class.
Header file for JSON class.
This class represents a fraction.
This abstract class is the base class, used by all readers in libopenshot.
This abstract class is the base class, used by writers. Writers are types of classes that encode vide...
void CopyReaderInfo(openshot::ReaderBase *reader)
This method copy's the info struct of a reader, and sets the writer with the same info.
virtual ~WriterBase()=default
std::string Json() const
Generate JSON string of this object.
virtual void WriteFrame(std::shared_ptr< openshot::Frame > frame)=0
This method is required for all derived classes of WriterBase. Write a Frame to the video file.
virtual void WriteFrame(openshot::ReaderBase *reader, int64_t start, int64_t length)=0
This method is required for all derived classes of WriterBase. Write a block of frames from a reader.
virtual void Open()=0
Open the writer (and start initializing streams)
void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Json::Value JsonValue() const
Generate Json::Value for this object.
virtual bool IsOpen()=0
Determine if writer is open or closed.
WriterInfo info
Information about the current media file.
void SetJson(const std::string value)
Load JSON string into this object.
WriterBase()
Constructor for WriterBase class, many things are initialized here.
void DisplayInfo(std::ostream *out=&std::cout)
Display file information in the standard output stream (stdout)
This namespace is the default namespace for all code in the openshot library.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround,...
This struct contains info about encoding a media file, such as height, width, frames per second,...
int height
The height of the video (in pixels)
int audio_bit_rate
The bit rate of the audio stream (in bytes)
int video_bit_rate
The bit rate of the video stream (in bytes)
bool has_audio
Determines if this file has an audio stream.
int64_t video_length
The number of frames in the video stream.
int pixel_format
The pixel format (i.e. YUV420P, RGB24, etc...)
bool top_field_first
Which interlaced field should be displayed first.
float duration
Length of time (in seconds)
int channels
The number of audio channels used in the audio stream.
std::string vcodec
The name of the video codec used to encode / decode the video stream.
bool has_video
Determines if this file has a video stream.
int audio_stream_index
The index of the audio stream.
std::map< std::string, std::string > metadata
An optional map/dictionary of video & audio metadata.
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
std::string acodec
The name of the audio codec used to encode / decode the video stream.
openshot::Fraction audio_timebase
The audio timebase determines how long each audio packet should be played.
openshot::Fraction video_timebase
The video timebase determines how long each frame stays on the screen.
int video_stream_index
The index of the video stream.
openshot::ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
openshot::Fraction display_ratio
The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3)
int width
The width of the video (in pixels)
openshot::Fraction pixel_ratio
The pixel ratio of the video stream as a fraction (i.e. some pixels are not square)
bool has_single_image
Determines if this file only contains a single image.
int sample_rate
The number of audio samples per second (44100 is a common sample rate)
bool interlaced_frame
Are the contents of this frame interlaced.
int64_t file_size
Size of file (in bytes)