openshot::WriterBase Class Referenceabstract

This abstract class is the base class, used by writers. Writers are types of classes that encode video, audio, and image files. More...

`#include <WriterBase.h>`

Inheritance diagram for openshot::WriterBase:

## Public Member Functions

void | CopyReaderInfo (openshot::ReaderBase *reader)
| This method copy's the info struct of a reader, and sets the writer with the same info. More...
void | DisplayInfo ()
| Display file information in the standard output stream (stdout) More...
virtual bool | IsOpen ()=0
| Determine if writer is open or closed. More...
std::string | Json () const
| Get and Set JSON methods. More...
Json::Value | JsonValue () const
| Generate Json::Value for this object. More...
virtual void | Open ()=0
| Open the writer (and start initializing streams) More...
void | SetJson (const std::string value)
| Load JSON string into this object. More...
void | SetJsonValue (const Json::Value root)
| Load Json::Value into this object. More...
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. More...
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. More...
| WriterBase ()
| Constructor for WriterBase class, many things are initialized here. More...
virtual | ~WriterBase ()=default

## Public Attributes

WriterInfo | info
| Information about the current media file. More...

## Detailed Description

This abstract class is the base class, used by writers. Writers are types of classes that encode video, audio, and image files.

The only requirements for a 'writer', are to derive from this base class, and implement the WriteFrame method.

Definition at line 87 of file WriterBase.h.

## Constructor & Destructor Documentation

## WriterBase()

WriterBase::WriterBase | ( |  | ) |

Constructor for WriterBase class, many things are initialized here.

Definition at line 36 of file WriterBase.cpp.

## ~WriterBase()

virtual openshot::WriterBase::~WriterBase | ( |  | ) |

virtual default

## Member Function Documentation

## CopyReaderInfo()

void WriterBase::CopyReaderInfo | ( | openshot::ReaderBase * | reader | ) |

This method copy's the info struct of a reader, and sets the writer with the same info.

Parameters

  reader | The source reader to copy

Definition at line 67 of file WriterBase.cpp.

Referenced by openshot::ChunkWriter::ChunkWriter().

## DisplayInfo()

void WriterBase::DisplayInfo | ( |  | ) |

Display file information in the standard output stream (stdout)

Definition at line 102 of file WriterBase.cpp.

## IsOpen()

virtual bool openshot::WriterBase::IsOpen | ( |  | ) |

pure virtual

Determine if writer is open or closed.

Implemented in openshot::ImageWriter, openshot::FFmpegWriter, openshot::DecklinkWriter, and openshot::ChunkWriter.

## Json()

std::string WriterBase::Json | ( |  | ) | const

Get and Set JSON methods.

Generate JSON string of this object

Definition at line 142 of file WriterBase.cpp.

## JsonValue()

Json::Value WriterBase::JsonValue | ( |  | ) | const

Generate Json::Value for this object.

Definition at line 149 of file WriterBase.cpp.

Referenced by Json().

## Open()

virtual void openshot::WriterBase::Open | ( |  | ) |

pure virtual

Open the writer (and start initializing streams)

Implemented in openshot::ImageWriter, openshot::FFmpegWriter, openshot::DecklinkWriter, and openshot::ChunkWriter.

## SetJson()

void WriterBase::SetJson | ( | const std::string | value | ) |

Load JSON string into this object.

Definition at line 198 of file WriterBase.cpp.

## SetJsonValue()

void WriterBase::SetJsonValue | ( | const Json::Value | root | ) |

Load Json::Value into this object.

Definition at line 215 of file WriterBase.cpp.

Referenced by SetJson().

## WriteFrame() [1/2]

virtual void openshot::WriterBase::WriteFrame | ( | openshot::ReaderBase * | reader,
|  | int64_t | start,
|  | int64_t | length
| ) |  |

pure virtual

This method is required for all derived classes of WriterBase. Write a block of frames from a reader.

Implemented in openshot::ImageWriter, openshot::FFmpegWriter, and openshot::ChunkWriter.

## WriteFrame() [2/2]

virtual void openshot::WriterBase::WriteFrame | ( | std::shared_ptr< openshot::Frame > | frame | ) |

pure virtual

This method is required for all derived classes of WriterBase. Write a Frame to the video file.

Implemented in openshot::FFmpegWriter, openshot::ChunkWriter, openshot::ImageWriter, and openshot::DecklinkWriter.

## Member Data Documentation

## info

WriterInfo openshot::WriterBase::info

Information about the current media file.

Definition at line 94 of file WriterBase.h.

Referenced by openshot::ChunkWriter::ChunkWriter(), CopyReaderInfo(), DisplayInfo(), openshot::FFmpegWriter::FFmpegWriter(), openshot::ImageWriter::ImageWriter(), JsonValue(), openshot::DecklinkWriter::Open(), openshot::FFmpegWriter::Open(), openshot::FFmpegWriter::PrepareStreams(), openshot::FFmpegWriter::SetAudioOptions(), SetJsonValue(), openshot::FFmpegWriter::SetOption(), openshot::FFmpegWriter::SetVideoOptions(), openshot::ImageWriter::SetVideoOptions(), openshot::ImageWriter::WriteFrame(), openshot::ChunkWriter::WriteFrame(), openshot::FFmpegWriter::WriteFrame(), openshot::FFmpegWriter::WriteHeader(), WriterBase(), and openshot::FFmpegWriter::WriteTrailer().

The documentation for this class was generated from the following files:

- WriterBase.h
- WriterBase.cpp