#include <stdlib.h>#include <stdio.h>#include <string.h>#include <math.h>#include "avformat.h"

Go to the source code of this file.
Defines | |
| #define | M_PI 3.1415926535897931 |
| #define | STREAM_DURATION 5.0 |
| #define | STREAM_FRAME_RATE 25 |
| #define | STREAM_NB_FRAMES ((int)(STREAM_DURATION * STREAM_FRAME_RATE)) |
| #define | STREAM_PIX_FMT PIX_FMT_YUV420P |
Functions | |
| AVStream * | add_audio_stream (AVFormatContext *oc, int codec_id) |
| void | open_audio (AVFormatContext *oc, AVStream *st) |
| void | get_audio_frame (int16_t *samples, int frame_size, int nb_channels) |
| void | write_audio_frame (AVFormatContext *oc, AVStream *st) |
| void | close_audio (AVFormatContext *oc, AVStream *st) |
| AVStream * | add_video_stream (AVFormatContext *oc, int codec_id) |
| AVFrame * | alloc_picture (int pix_fmt, int width, int height) |
| void | open_video (AVFormatContext *oc, AVStream *st) |
| void | fill_yuv_image (AVFrame *pict, int frame_index, int width, int height) |
| void | write_video_frame (AVFormatContext *oc, AVStream *st) |
| void | close_video (AVFormatContext *oc, AVStream *st) |
| int | main (int argc, char **argv) |
Variables | |
| float | t |
| float | tincr |
| float | tincr2 |
| int16_t * | samples |
| uint8_t * | audio_outbuf |
| int | audio_outbuf_size |
| int | audio_input_frame_size |
| AVFrame * | picture |
| AVFrame * | tmp_picture |
| uint8_t * | video_outbuf |
| int | frame_count |
| int | video_outbuf_size |
| #define M_PI 3.1415926535897931 |
Definition at line 31 of file output_example.c.
| #define STREAM_DURATION 5.0 |
| #define STREAM_FRAME_RATE 25 |
| #define STREAM_NB_FRAMES ((int)(STREAM_DURATION * STREAM_FRAME_RATE)) |
| #define STREAM_PIX_FMT PIX_FMT_YUV420P |
| AVStream* add_audio_stream | ( | AVFormatContext * | oc, | |
| int | codec_id | |||
| ) |
Definition at line 54 of file output_example.c.
References AVCodecContext::bit_rate, c, AVCodecContext::channels, AVCodecContext::codec, AVCodecContext::codec_id, AVCodecContext::codec_type, CODEC_TYPE_AUDIO, fprintf, and AVCodecContext::sample_rate.
Referenced by main().
| AVStream* add_video_stream | ( | AVFormatContext * | oc, | |
| int | codec_id | |||
| ) |
Definition at line 182 of file output_example.c.
References AVCodecContext::bit_rate, c, AVCodecContext::codec, CODEC_FLAG_GLOBAL_HEADER, AVCodecContext::codec_id, CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO, AVCodecContext::codec_type, CODEC_TYPE_VIDEO, AVRational::den, AVCodecContext::flags, fprintf, AVCodecContext::gop_size, AVCodecContext::height, AVCodecContext::max_b_frames, AVCodecContext::mb_decision, AVRational::num, AVCodecContext::pix_fmt, STREAM_FRAME_RATE, STREAM_PIX_FMT, AVCodecContext::time_base, and AVCodecContext::width.
Referenced by main().
| AVFrame* alloc_picture | ( | int | pix_fmt, | |
| int | width, | |||
| int | height | |||
| ) |
Definition at line 224 of file output_example.c.
References av_free(), avcodec_alloc_frame(), avpicture_fill(), avpicture_get_size(), and NULL.

| void close_audio | ( | AVFormatContext * | oc, | |
| AVStream * | st | |||
| ) |
Definition at line 166 of file output_example.c.
References audio_outbuf, av_free(), avcodec_close(), and samples.
Referenced by main().

| void close_video | ( | AVFormatContext * | oc, | |
| AVStream * | st | |||
| ) |
Definition at line 380 of file output_example.c.
References av_free(), avcodec_close(), and video_outbuf.
Referenced by main().

| void fill_yuv_image | ( | AVFrame * | pict, | |
| int | frame_index, | |||
| int | width, | |||
| int | height | |||
| ) |
| void get_audio_frame | ( | int16_t * | samples, | |
| int | frame_size, | |||
| int | nb_channels | |||
| ) |
Definition at line 127 of file output_example.c.
References t, tincr, and tincr2.
Referenced by write_audio_frame().
| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 395 of file output_example.c.
References add_audio_stream(), add_video_stream(), av_free(), av_freep(), close_audio(), close_video(), CODEC_ID_NONE, fprintf, NULL, open_audio(), open_video(), STREAM_DURATION, write_audio_frame(), and write_video_frame().

| void open_audio | ( | AVFormatContext * | oc, | |
| AVStream * | st | |||
| ) |
Definition at line 76 of file output_example.c.
References audio_input_frame_size, audio_outbuf, audio_outbuf_size, avcodec_find_encoder(), avcodec_open(), c, AVCodecContext::channels, AVCodecContext::codec, AVCodecContext::codec_id, CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE, CODEC_ID_PCM_U16BE, CODEC_ID_PCM_U16LE, fprintf, AVCodecContext::frame_size, M_PI, AVCodecContext::sample_rate, samples, t, tincr, and tincr2.
Referenced by main().

| void open_video | ( | AVFormatContext * | oc, | |
| AVStream * | st | |||
| ) |
Definition at line 244 of file output_example.c.
References alloc_picture(), avcodec_find_encoder(), avcodec_open(), c, AVCodecContext::codec, AVCodecContext::codec_id, fprintf, AVCodecContext::height, NULL, AVCodecContext::pix_fmt, PIX_FMT_YUV420P, video_outbuf, video_outbuf_size, and AVCodecContext::width.
Referenced by main().

| void write_audio_frame | ( | AVFormatContext * | oc, | |
| AVStream * | st | |||
| ) |
Definition at line 142 of file output_example.c.
References audio_input_frame_size, audio_outbuf, audio_outbuf_size, av_rescale_q(), avcodec_encode_audio(), c, AVCodecContext::channels, AVCodecContext::codec, AVCodecContext::coded_frame, fprintf, get_audio_frame(), samples, and AVCodecContext::time_base.
Referenced by main().

| void write_video_frame | ( | AVFormatContext * | oc, | |
| AVStream * | st | |||
| ) |
Definition at line 315 of file output_example.c.
References av_rescale_q(), avcodec_encode_video(), c, AVCodecContext::codec, AVCodecContext::coded_frame, fill_yuv_image(), fprintf, frame_count, AVCodecContext::height, img_convert(), AVCodecContext::pix_fmt, PIX_FMT_YUV420P, STREAM_NB_FRAMES, AVCodecContext::time_base, video_outbuf, video_outbuf_size, and AVCodecContext::width.
Referenced by main().

Definition at line 49 of file output_example.c.
Referenced by open_audio(), and write_audio_frame().
| uint8_t* audio_outbuf |
Definition at line 47 of file output_example.c.
Referenced by close_audio(), open_audio(), and write_audio_frame().
Definition at line 48 of file output_example.c.
Referenced by open_audio(), and write_audio_frame().
| int frame_count |
Definition at line 179 of file output_example.c.
Referenced by main(), msmpeg4_decode_picture_header(), FileDV::read_samples(), and write_video_frame().
Definition at line 177 of file output_example.c.
Referenced by decode_frame(), encode(), ff_xvid_encode_frame(), ir2_decode_frame(), itransform_engine_loop(), LiveVideo::LiveVideo(), mjpeg_decode_frame(), mjpegb_decode_frame(), motion_engine_loop(), mpeg_decode_frame(), output_packet(), pnm_decode_frame(), raw_decode(), slice_engine_loop(), transform_engine_loop(), VDeviceV4L::v4l_init(), video_decode_example(), and video_encode_example().
| int16_t* samples |
Definition at line 46 of file output_example.c.
| float t |
Definition at line 45 of file output_example.c.
Referenced by alaw2linear(), audio_encode_example(), bessel(), calc_undistorted_coords(), canon_600_coeff(), decode_subband_slice_buffered(), dering(), CWindowCanvas::do_mask(), Playback3D::do_mask_sync(), draw_line(), encode_subband_c0run(), fht(), get_audio_frame(), FloatAutos::get_value(), guess_byte_order(), hpel_motion_search(), HSV::hsv_to_rgb(), idct32(), idct_row(), init_layer3(), ir2_decode_plane(), ir2_decode_plane_inter(), nikon_e2100(), open_audio(), pow_m1_4(), HoloClient::process_package(), MaskUnit::process_package(), psycho_1_dump(), psycho_1_threshold(), qpel_motion_search(), quicktime_current_time(), radc_token(), read_ana_window(), read_bit_alloc(), HSV::rgb_to_hsv(), sad_hpel_motion_search(), scale_factor_calc(), ulaw2linear(), ulti_grad(), unpack_coeffs(), vng_interpolate(), vorbis_parse_setup_hdr_codebooks(), window_subband12(), ws_snd_decode_frame(), and xa_decode().
| float tincr |
Definition at line 45 of file output_example.c.
Referenced by audio_encode_example(), get_audio_frame(), and open_audio().
| float tincr2 |
Definition at line 177 of file output_example.c.
| uint8_t* video_outbuf |
Definition at line 178 of file output_example.c.
Referenced by close_video(), open_video(), and write_video_frame().
Definition at line 179 of file output_example.c.
Referenced by open_video(), and write_video_frame().
1.5.5