YARP
Yet Another Robot Platform
FfmpegWriter.cpp File Reference
#include "FfmpegWriter.h"
#include "ffmpeg_api.h"
#include <yarp/os/all.h>
#include <yarp/sig/all.h>
#include <yarp/os/Log.h>
#include <yarp/os/LogComponent.h>
#include <cstdlib>
#include <cstring>
#include <cmath>
+ Include dependency graph for FfmpegWriter.cpp:

Go to the source code of this file.

Macros

#define M_PI   3.1415926535897931
 
#define STREAM_FRAME_RATE   25 /* 25 images/s */
 
#define STREAM_PIX_FMT   AV_PIX_FMT_YUV420P /* default pix_fmt */
 
#define STREAM_PIX_WORK   AV_PIX_FMT_RGB24
 

Functions

static AVStream * add_audio_stream (AVFormatContext *oc, AVCodecID codec_id)
 
static void open_audio (AVFormatContext *oc, AVStream *st)
 
static void get_audio_frame (int16_t *samples, int frame_size, int nb_channels)
 
static void make_audio_frame (AVCodecContext *c, AVFrame *&frame, void *&samples)
 
static void write_audio_frame (AVFormatContext *oc, AVStream *st)
 
static void write_audio_frame (AVFormatContext *oc, AVStream *st, Sound &snd)
 
static void close_audio (AVFormatContext *oc, AVStream *st)
 
static AVStream * add_video_stream (AVFormatContext *oc, AVCodecID codec_id, int w, int h, int framerate)
 
static AVFrame * alloc_picture (int pix_fmt, int width, int height)
 
static void fill_rgb_image (AVFrame *pict, int frame_index, int width, int height, ImageOf< PixelRgb > &img)
 

Variables

float t
 
float tincr
 
float tincr2
 
int16_t * samples
 
int samples_size
 
int samples_at
 
int samples_channels
 
uint8_t * audio_outbuf
 
int audio_outbuf_size
 
int audio_input_frame_size
 

Macro Definition Documentation

◆ M_PI

#define M_PI   3.1415926535897931

Definition at line 54 of file FfmpegWriter.cpp.

◆ STREAM_FRAME_RATE

#define STREAM_FRAME_RATE   25 /* 25 images/s */

Definition at line 57 of file FfmpegWriter.cpp.

◆ STREAM_PIX_FMT

#define STREAM_PIX_FMT   AV_PIX_FMT_YUV420P /* default pix_fmt */

Definition at line 58 of file FfmpegWriter.cpp.

◆ STREAM_PIX_WORK

#define STREAM_PIX_WORK   AV_PIX_FMT_RGB24

Definition at line 59 of file FfmpegWriter.cpp.

Function Documentation

◆ add_audio_stream()

static AVStream* add_audio_stream ( AVFormatContext *  oc,
AVCodecID  codec_id 
)
static

Definition at line 88 of file FfmpegWriter.cpp.

◆ add_video_stream()

static AVStream* add_video_stream ( AVFormatContext *  oc,
AVCodecID  codec_id,
int  w,
int  h,
int  framerate 
)
static

Definition at line 339 of file FfmpegWriter.cpp.

◆ alloc_picture()

static AVFrame* alloc_picture ( int  pix_fmt,
int  width,
int  height 
)
static

Definition at line 385 of file FfmpegWriter.cpp.

◆ close_audio()

static void close_audio ( AVFormatContext *  oc,
AVStream *  st 
)
static

Definition at line 326 of file FfmpegWriter.cpp.

◆ fill_rgb_image()

static void fill_rgb_image ( AVFrame *  pict,
int  frame_index,
int  width,
int  height,
ImageOf< PixelRgb > &  img 
)
static

Definition at line 452 of file FfmpegWriter.cpp.

◆ get_audio_frame()

static void get_audio_frame ( int16_t *  samples,
int  frame_size,
int  nb_channels 
)
static

Definition at line 168 of file FfmpegWriter.cpp.

◆ make_audio_frame()

static void make_audio_frame ( AVCodecContext *  c,
AVFrame *&  frame,
void *&  samples 
)
static

Definition at line 183 of file FfmpegWriter.cpp.

◆ open_audio()

static void open_audio ( AVFormatContext *  oc,
AVStream *  st 
)
static

Definition at line 109 of file FfmpegWriter.cpp.

◆ write_audio_frame() [1/2]

static void write_audio_frame ( AVFormatContext *  oc,
AVStream *  st 
)
static

Definition at line 212 of file FfmpegWriter.cpp.

◆ write_audio_frame() [2/2]

static void write_audio_frame ( AVFormatContext *  oc,
AVStream *  st,
Sound snd 
)
static

Definition at line 254 of file FfmpegWriter.cpp.

Variable Documentation

◆ audio_input_frame_size

int audio_input_frame_size

Definition at line 83 of file FfmpegWriter.cpp.

◆ audio_outbuf

uint8_t* audio_outbuf

Definition at line 81 of file FfmpegWriter.cpp.

◆ audio_outbuf_size

int audio_outbuf_size

Definition at line 82 of file FfmpegWriter.cpp.

◆ samples

int16_t* samples

Definition at line 76 of file FfmpegWriter.cpp.

◆ samples_at

int samples_at

Definition at line 78 of file FfmpegWriter.cpp.

◆ samples_channels

int samples_channels

Definition at line 79 of file FfmpegWriter.cpp.

◆ samples_size

int samples_size

Definition at line 77 of file FfmpegWriter.cpp.

◆ t

◆ tincr

float tincr

Definition at line 74 of file FfmpegWriter.cpp.

◆ tincr2

float tincr2

Definition at line 74 of file FfmpegWriter.cpp.