FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
demuxing.c File Reference

libavformat demuxing API use example. More...

#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavutil/timestamp.h>
#include <libavformat/avformat.h>

Go to the source code of this file.

Functions

static int decode_packet (int *got_frame, int cached)
 
static int open_codec_context (int *stream_idx, AVFormatContext *fmt_ctx, enum AVMediaType type)
 
static int get_format_from_sample_fmt (const char **fmt, enum AVSampleFormat sample_fmt)
 
int main (int argc, char **argv)
 

Variables

static AVFormatContextfmt_ctx = NULL
 
static AVCodecContextvideo_dec_ctx = NULL
 
static AVCodecContextaudio_dec_ctx
 
static AVStreamvideo_stream = NULL
 
static AVStreamaudio_stream = NULL
 
static const char * src_filename = NULL
 
static const char * video_dst_filename = NULL
 
static const char * audio_dst_filename = NULL
 
static FILE * video_dst_file = NULL
 
static FILE * audio_dst_file = NULL
 
static uint8_tvideo_dst_data [4] = {NULL}
 
static int video_dst_linesize [4]
 
static int video_dst_bufsize
 
static uint8_t ** audio_dst_data = NULL
 
static int audio_dst_linesize
 
static int audio_dst_bufsize
 
static int video_stream_idx = -1
 
static int audio_stream_idx = -1
 
static AVFrameframe = NULL
 
static AVPacket pkt
 
static int video_frame_count = 0
 
static int audio_frame_count = 0
 

Detailed Description

libavformat demuxing API use example.

Show how to use the libavformat and libavcodec API to demux and decode audio and video data.

Definition in file demuxing.c.

Function Documentation

static int decode_packet ( int *  got_frame,
int  cached 
)
static
Examples:
doc/examples/demuxing.c.

Definition at line 60 of file demuxing.c.

Referenced by main().

static int open_codec_context ( int *  stream_idx,
AVFormatContext fmt_ctx,
enum AVMediaType  type 
)
static
Examples:
doc/examples/demuxing.c.

Definition at line 127 of file demuxing.c.

Referenced by main().

static int get_format_from_sample_fmt ( const char **  fmt,
enum AVSampleFormat  sample_fmt 
)
static
Examples:
doc/examples/demuxing.c, and doc/examples/resampling_audio.c.

Definition at line 163 of file demuxing.c.

Referenced by main().

int main ( int  argc,
char **  argv 
)

Definition at line 192 of file demuxing.c.

Variable Documentation

AVFormatContext* fmt_ctx = NULL
static
AVCodecContext* video_dec_ctx = NULL
static
Examples:
doc/examples/demuxing.c.

Definition at line 38 of file demuxing.c.

AVCodecContext * audio_dec_ctx
static
Examples:
doc/examples/demuxing.c.

Definition at line 38 of file demuxing.c.

Referenced by decode_packet(), and main().

AVStream* video_stream = NULL
static
Examples:
doc/examples/demuxing.c.

Definition at line 39 of file demuxing.c.

Referenced by yop_read_header().

AVStream * audio_stream = NULL
static
Examples:
doc/examples/demuxing.c.

Definition at line 39 of file demuxing.c.

Referenced by main(), and yop_read_header().

const char* src_filename = NULL
static
Examples:
doc/examples/demuxing.c.

Definition at line 40 of file demuxing.c.

Referenced by main(), and open_codec_context().

const char* video_dst_filename = NULL
static
Examples:
doc/examples/demuxing.c.

Definition at line 41 of file demuxing.c.

Referenced by main().

const char* audio_dst_filename = NULL
static
Examples:
doc/examples/demuxing.c.

Definition at line 42 of file demuxing.c.

Referenced by main().

FILE* video_dst_file = NULL
static
Examples:
doc/examples/demuxing.c.

Definition at line 43 of file demuxing.c.

Referenced by decode_packet(), and main().

FILE* audio_dst_file = NULL
static
Examples:
doc/examples/demuxing.c.

Definition at line 44 of file demuxing.c.

Referenced by decode_packet(), and main().

uint8_t* video_dst_data[4] = {NULL}
static
Examples:
doc/examples/demuxing.c.

Definition at line 46 of file demuxing.c.

Referenced by decode_packet(), and main().

int video_dst_linesize[4]
static
Examples:
doc/examples/demuxing.c.

Definition at line 47 of file demuxing.c.

Referenced by decode_packet(), and main().

int video_dst_bufsize
static
Examples:
doc/examples/demuxing.c.

Definition at line 48 of file demuxing.c.

Referenced by decode_packet(), and main().

uint8_t** audio_dst_data = NULL
static
Examples:
doc/examples/demuxing.c.

Definition at line 50 of file demuxing.c.

Referenced by decode_packet(), and main().

int audio_dst_linesize
static
Examples:
doc/examples/demuxing.c.

Definition at line 51 of file demuxing.c.

Referenced by decode_packet().

int audio_dst_bufsize
static
Examples:
doc/examples/demuxing.c.

Definition at line 52 of file demuxing.c.

Referenced by decode_packet().

int video_stream_idx = -1
static
Examples:
doc/examples/demuxing.c.

Definition at line 54 of file demuxing.c.

Referenced by decode_packet(), and main().

int audio_stream_idx = -1
static
Examples:
doc/examples/demuxing.c.

Definition at line 54 of file demuxing.c.

Referenced by decode_packet(), and main().

AVFrame* frame = NULL
static
Examples:
doc/examples/decoding_encoding.c, doc/examples/demuxing.c, doc/examples/filtering_audio.c, doc/examples/filtering_video.c, and doc/examples/muxing.c.

Definition at line 55 of file demuxing.c.

Referenced by a64multi_encode_frame(), ac3_decode_frame(), add_frame(), add_timecode_metadata(), adpcm_decode_frame(), adx_decode_frame(), alac_decode_frame(), amrnb_decode_frame(), amrwb_decode_frame(), ape_decode_frame(), aqt_probe(), aqt_read_header(), atrac1_decode_frame(), atrac3_decode_frame(), audio_encode_example(), avcodec_alloc_frame(), avcodec_encode_audio2(), avcodec_free_frame(), bmv_aud_decode_frame(), channel_decorrelation(), cinaudio_decode_frame(), cng_decode_frame(), cook_decode_frame(), copy_samples(), cpia_decode_frame(), dca_decode_frame(), decode_bdlt(), decode_bmv_frame(), decode_close(), decode_dds1(), decode_dsw1(), decode_frame(), decode_tag(), decode_thread(), decode_tsw1(), decode_wdlt(), dirac_decode_frame_internal(), dpcm_decode_frame(), dv_write_packet(), eightsvx_decode_frame(), encode_frame(), encode_residual_ch(), evrc_decode_frame(), ff_filter_frame_framed(), ff_h264_fill_mbaff_ref_list(), ff_load_image(), filter_frame(), flac_decode_frame(), g722_decode_frame(), g723_1_decode_frame(), get_pts(), gsm_decode_frame(), ilbc_decode_frame(), imc_decode_frame(), init_frame(), libcelt_dec_decode(), libgsm_decode_frame(), libopenjpeg_encode_frame(), libopus_decode(), libschroedinger_decode_frame(), libspeex_decode_frame(), mace_decode_frame(), main(), microdvd_read_header(), mpc7_decode_frame(), mpc8_decode_frame(), mv_read_packet(), mv_read_seek(), mxf_write_system_item(), oggvorbis_decode_frame(), output_frame_end(), pad_last_frame(), paf_aud_decode(), paf_vid_decode(), pcm_bluray_decode_frame(), pcm_decode_frame(), pcx_encode_frame(), qcelp_decode_frame(), qdm2_decode_frame(), ra144_decode_frame(), ra288_decode_frame(), raw_decode(), CustomSource::read(), read_packets(), request_frame(), roq_encode_frame(), s302m_decode_frame(), sgirle_decode_frame(), shorten_decode_frame(), sipr_decode_frame(), smka_decode_frame(), Stagefright_close(), Stagefright_decode_frame(), swf_read_packet(), tak_decode_frame(), truespeech_decode_frame(), try_decode_frame(), tta_decode_frame(), twin_decode_frame(), unpack_frame(), v4l2_read_packet(), video_decode_example(), video_encode_example(), vmd_read_packet(), vmdaudio_decode_frame(), vorbis_decode_frame(), wavpack_decode_frame(), wma_decode_superframe(), worker(), write_frame_header(), and ws_snd_decode_frame().

AVPacket pkt
static
Examples:
doc/examples/decoding_encoding.c, doc/examples/demuxing.c, and doc/examples/muxing.c.

Definition at line 56 of file demuxing.c.

Referenced by add_to_pktbuf(), ape_tag_read_field(), asf_read_header(), asf_read_picture(), asf_read_pts(), audio_decode_frame(), audio_encode_example(), av_dup_packet(), av_packet_merge_side_data(), av_write_trailer(), avformat_find_stream_info(), do_audio_out(), do_subtitle_out(), do_video_out(), encode_frame(), estimate_timings_from_pts(), extract_mpeg4_header(), ff_interleave_add_packet(), ff_load_image(), ff_mpegts_parse_packet(), ff_write_chained(), find_missing_packets(), flush_encoders(), free_pkt_fifo(), gen_buffer_time(), gen_bytes_read(), gen_check_bw(), gen_connect(), gen_create_stream(), gen_delete_stream(), gen_fcpublish_stream(), gen_fcsubscribe_stream(), gen_fcunpublish_stream(), gen_play(), gen_pong(), gen_publish(), gen_release_stream(), gen_server_bw(), gen_swf_verification(), gxf_compare_field_nb(), http_prepare_data(), ipmovie_read_header(), mace_decode_frame(), main(), matroska_parse_frame(), matroska_parse_rm_audio(), mkv_copy_packet(), mkv_write_srt_blocks(), mov_create_chapter_track(), mov_create_timecode_track(), mov_read_covr(), movie_push_frame(), mpc_read_seek(), mpegts_get_dts(), mpegts_read_packet(), nsv_read_chunk(), output_packet(), packet_queue_flush(), packet_queue_put_private(), parse_file(), process_callback(), process_input(), queue_frames(), read_connect(), read_packets(), read_thread(), search_hi_lo_keyframes(), seek_frame_generic(), Stagefright_decode_frame(), str_read_packet(), subtitle_thread(), supply_new_packets(), try_decode_frame(), video_encode_example(), video_thread(), worker(), write_audio_frame(), write_frame(), write_video_frame(), and wv_read_seek().

int video_frame_count = 0
static
Examples:
doc/examples/demuxing.c.

Definition at line 57 of file demuxing.c.

Referenced by decode_packet().

int audio_frame_count = 0
static
Examples:
doc/examples/demuxing.c.

Definition at line 58 of file demuxing.c.

Referenced by decode_packet(), and fourxm_read_packet().