SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
slip::AvWriter< ContainerVideo, T, Nb_components > Class Template Reference

AvWriter is a video writer. More...

#include <AvWriter.hpp>

Inheritance diagram for slip::AvWriter< ContainerVideo, T, Nb_components >:
Inheritance graph

Public Types

typedef ContainerVideo container_type
 
typedef T value_type
 
typedef ContainerWriter
< ContainerVideo, T > 
base
 

Public Member Functions

void initialize (std::size_t output_video_width, std::size_t output_video_height, std::size_t output_video_nbframes, int bit_rate, AVRational time_base, bool dimension_optimize=0, CodecID codec_id=CODEC_ID_NONE)
 initialized the writing process. Has to be called before the first write() call of a given video. More...
 
void release ()
 release the writing process. Has to be called when an video has been fully written. More...
 
int write (const container_type &data)
 write function. This function write the data within the output file after the previous one. When last is set to true, the output file is closed. More...
 
Constructors & Destructors
 AvWriter ()
 
 input_pxfmt_ (PIX_FMT_GRAY8)
 
 output_pxfmt_ (PIX_FMT_RGB24)
 
 row_stride (0)
 
 finished (0)
 
 total_nb_slice (0)
 
 initialized (false)
 
 AvWriter (std::string output_filename, std::size_t output_video_width, std::size_t output_video_height, std::size_t output_video_nbframes, int bit_rate, AVRational time_base, bool dimension_optimize=0, CodecID codec_id=CODEC_ID_NONE)
 
virtual ~AvWriter ()
 
Getters and setters
const std::string & get_output_filename () const
 return the output file name. More...
 
void set_output_filename (const std::string &output_filename)
 set the output file name. More...
 

Protected Attributes

std::string output_filename_
 

Detailed Description

template<class ContainerVideo, typename T, std::size_t Nb_components>
class slip::AvWriter< ContainerVideo, T, Nb_components >

AvWriter is a video writer.

Version
Fluex 1.0
Date
2013/04/29
Author
Denis Arrivault <denis.arrivault_AT_inria.fr>
Parameters
ContainerVideois the type of the containers that will be written in the avi file. It has to be a 3D container. The [][] operator and the slices(), the rows() and the cols() methods should have been defined.
Tthe type of the container data.
Nb_componentsthe number of video components (3 for a color video or 1 for a gray scale video).
Note
The input container format should be RGB24 or GRAY8 according to the Nb_component value.
only the video streams are registered, no sound can be added.
Examples:
av_file_io.cpp, and fits_file_io.cpp.

Definition at line 55 of file AvWriter.hpp.

Member Typedef Documentation

template<class ContainerVideo, typename T, std::size_t Nb_components>
typedef ContainerWriter<ContainerVideo, T> slip::AvWriter< ContainerVideo, T, Nb_components >::base

Definition at line 59 of file AvWriter.hpp.

template<class ContainerVideo, typename T, std::size_t Nb_components>
typedef ContainerVideo slip::AvWriter< ContainerVideo, T, Nb_components >::container_type

Definition at line 57 of file AvWriter.hpp.

template<class ContainerVideo, typename T, std::size_t Nb_components>
typedef T slip::AvWriter< ContainerVideo, T, Nb_components >::value_type

Definition at line 58 of file AvWriter.hpp.

Constructor & Destructor Documentation

template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::AvWriter ( )
inline

Default constructor

Definition at line 69 of file AvWriter.hpp.

template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::AvWriter ( std::string  output_filename,
std::size_t  output_video_width,
std::size_t  output_video_height,
std::size_t  output_video_nbframes,
int  bit_rate,
AVRational  time_base,
bool  dimension_optimize = 0,
CodecID  codec_id = CODEC_ID_NONE 
)
inline

Constructor with parameters.

Parameters
output_filenameis the name of the output file where the data of the container will be saved
output_video_widththe total video width
output_video_heightthe total video height
output_video_nbframesthe total video number of video frames
bit_rate= average bit rate of the video frame.
time_basetime base of the video stream = 1/frame_rate. AVRationnal is a structure used for writing a rational number. AvRational r{1,5} = 1/5.
codec_idis the id of the codec according to the CodecID enum defined in avcodec.h. By default it is guessed from the output filename extension if possible.
dimension_optimizetrue if output frame dimensions should be modified so that they will result in a memory buffer that is acceptable for the codec (frames will be rescaled). Be careful, some codec can operate with any kind of dimension. For exemple, every codec that are using Y'UV pixel format require dimensions that are at least divisible by 2 (mpgX codecs). Default is false.

Definition at line 92 of file AvWriter.hpp.

template<class ContainerVideo, typename T, std::size_t Nb_components>
virtual slip::AvWriter< ContainerVideo, T, Nb_components >::~AvWriter ( )
inlinevirtual

Destructor

Definition at line 106 of file AvWriter.hpp.

Member Function Documentation

template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::finished ( )
const std::string& slip::ContainerWriter< ContainerVideo , T >::get_output_filename ( ) const
inherited

return the output file name.

template<class ContainerVideo , typename T , std::size_t Nb_components>
void slip::AvWriter< ContainerVideo, T, Nb_components >::initialize ( std::size_t  output_video_width,
std::size_t  output_video_height,
std::size_t  output_video_nbframes,
int  bit_rate,
AVRational  time_base,
bool  dimension_optimize = 0,
CodecID  codec_id = CODEC_ID_NONE 
)
inline

initialized the writing process. Has to be called before the first write() call of a given video.

Parameters
bit_rate= average bit rate of the video frame.
output_video_widththe total video width
output_video_heightthe total video height
output_video_nbframesthe total video number of video frames
durationvideo stream duration
time_basetime base of the video stream = 1/frame_rate
codec_idis the id of the codec according to the CodecID enum defined in avcodec.h. By default it is guessed from the output filename extension if possible.
dimension_optimizetrue if output frame dimensions should be modified so that they will result in a memory buffer that is acceptable for the codec (frames will be rescaled). Be careful, some codec can operate with any kind of dimension. For exemple, every codec that are using Y'UV pixel format require dimensions that are at least divisible by 2 (mpgX codecs). Default is false.

Definition at line 200 of file AvWriter.hpp.

template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::initialized ( false  )
inline

Definition at line 73 of file AvWriter.hpp.

template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::input_pxfmt_ ( PIX_FMT_GRAY8  )
template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::output_pxfmt_ ( PIX_FMT_RGB24  )
template<class ContainerVideo , typename T , std::size_t Nb_components>
void slip::AvWriter< ContainerVideo, T, Nb_components >::release ( )
inline

release the writing process. Has to be called when an video has been fully written.

Definition at line 574 of file AvWriter.hpp.

template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::row_stride ( )
void slip::ContainerWriter< ContainerVideo , T >::set_output_filename ( const std::string &  output_filename)
inherited

set the output file name.

template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::total_nb_slice ( )
template<class ContainerVideo , typename T , std::size_t Nb_components>
int slip::AvWriter< ContainerVideo, T, Nb_components >::write ( const container_type data)
inlinevirtual

write function. This function write the data within the output file after the previous one. When last is set to true, the output file is closed.

Parameters
datais the video container to save. Warning, the container should be a 3d container with [][] operator, slices() rows() and cols() methods defined.
Returns
false if the file has been completely filled.
Note
Whatever the type of the data in the container, a static_cast is done for getting unsigned char. Be sure that the dynamic of the data is conform with this cast.
The input container format should be RGB24 or GRAY8 according to the Nb_component value.

Implements slip::ContainerWriter< ContainerVideo, T >.

Definition at line 527 of file AvWriter.hpp.

Member Data Documentation

std::string slip::ContainerWriter< ContainerVideo , T >::output_filename_
protectedinherited

Definition at line 89 of file ContainerWriter.hpp.


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