Libav
Data Structures | Macros | Functions
output.c File Reference

libavformat API example. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "libavutil/channel_layout.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavformat/avformat.h"
#include "libavresample/avresample.h"
#include "libswscale/swscale.h"

Go to the source code of this file.

Data Structures

struct  OutputStream
 

Macros

#define STREAM_DURATION   5.0
 
#define STREAM_FRAME_RATE   25 /* 25 images/s */
 
#define STREAM_NB_FRAMES   ((int)(STREAM_DURATION * STREAM_FRAME_RATE))
 
#define STREAM_PIX_FMT   AV_PIX_FMT_YUV420P /* default pix_fmt */
 
#define SCALE_FLAGS   SWS_BICUBIC
 

Functions

static void add_audio_stream (OutputStream *ost, AVFormatContext *oc, enum AVCodecID codec_id)
 
static AVFramealloc_audio_frame (enum AVSampleFormat sample_fmt, uint64_t channel_layout, int sample_rate, int nb_samples)
 
static void open_audio (AVFormatContext *oc, OutputStream *ost)
 
static AVFrameget_audio_frame (OutputStream *ost)
 
static int encode_audio_frame (AVFormatContext *oc, OutputStream *ost, AVFrame *frame)
 
static int process_audio_stream (AVFormatContext *oc, OutputStream *ost)
 
static void add_video_stream (OutputStream *ost, AVFormatContext *oc, enum AVCodecID codec_id)
 
static AVFramealloc_picture (enum AVPixelFormat pix_fmt, int width, int height)
 
static void open_video (AVFormatContext *oc, OutputStream *ost)
 
static void fill_yuv_image (AVFrame *pict, int frame_index, int width, int height)
 
static AVFrameget_video_frame (OutputStream *ost)
 
static int write_video_frame (AVFormatContext *oc, OutputStream *ost)
 
static void close_stream (AVFormatContext *oc, OutputStream *ost)
 
int main (int argc, char **argv)
 

Detailed Description

libavformat API example.

Definition in file output.c.

Macro Definition Documentation

#define STREAM_DURATION   5.0

Definition at line 45 of file output.c.

Referenced by get_audio_frame(), and get_video_frame().

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

Definition at line 46 of file output.c.

Referenced by add_video_stream().

#define STREAM_NB_FRAMES   ((int)(STREAM_DURATION * STREAM_FRAME_RATE))

Definition at line 47 of file output.c.

#define STREAM_PIX_FMT   AV_PIX_FMT_YUV420P /* default pix_fmt */

Definition at line 48 of file output.c.

Referenced by add_video_stream().

#define SCALE_FLAGS   SWS_BICUBIC

Definition at line 50 of file output.c.

Referenced by get_video_frame().

Function Documentation

static void add_audio_stream ( OutputStream ost,
AVFormatContext oc,
enum AVCodecID  codec_id 
)
static

Definition at line 74 of file output.c.

Referenced by main().

static AVFrame* alloc_audio_frame ( enum AVSampleFormat  sample_fmt,
uint64_t  channel_layout,
int  sample_rate,
int  nb_samples 
)
static

Definition at line 134 of file output.c.

Referenced by open_audio().

static void open_audio ( AVFormatContext oc,
OutputStream ost 
)
static

Definition at line 162 of file output.c.

Referenced by main().

static AVFrame* get_audio_frame ( OutputStream ost)
static

Definition at line 194 of file output.c.

Referenced by process_audio_stream().

static int encode_audio_frame ( AVFormatContext oc,
OutputStream ost,
AVFrame frame 
)
static

Definition at line 220 of file output.c.

Referenced by process_audio_stream().

static int process_audio_stream ( AVFormatContext oc,
OutputStream ost 
)
static

Definition at line 248 of file output.c.

Referenced by main().

static void add_video_stream ( OutputStream ost,
AVFormatContext oc,
enum AVCodecID  codec_id 
)
static

Definition at line 314 of file output.c.

Referenced by main().

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

Definition at line 364 of file output.c.

Referenced by open_video().

static void open_video ( AVFormatContext oc,
OutputStream ost 
)
static

Definition at line 387 of file output.c.

Referenced by main().

static void fill_yuv_image ( AVFrame pict,
int  frame_index,
int  width,
int  height 
)
static

Definition at line 420 of file output.c.

Referenced by get_video_frame().

static AVFrame* get_video_frame ( OutputStream ost)
static

Definition at line 449 of file output.c.

Referenced by write_video_frame().

static int write_video_frame ( AVFormatContext oc,
OutputStream ost 
)
static

Definition at line 489 of file output.c.

Referenced by main().

static void close_stream ( AVFormatContext oc,
OutputStream ost 
)
static

Definition at line 544 of file output.c.

Referenced by main().

int main ( int  argc,
char **  argv 
)

Definition at line 556 of file output.c.