FFmpeg
4.0
|
Demuxing and decoding 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, AVCodecContext **dec_ctx, 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 AVFormatContext * | fmt_ctx = NULL |
static AVCodecContext * | video_dec_ctx = NULL |
static AVCodecContext * | audio_dec_ctx |
static int | width |
static int | height |
static enum AVPixelFormat | pix_fmt |
static AVStream * | video_stream = NULL |
static AVStream * | audio_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_t * | video_dst_data [4] = {NULL} |
static int | video_dst_linesize [4] |
static int | video_dst_bufsize |
static int | video_stream_idx = -1 |
static int | audio_stream_idx = -1 |
static AVFrame * | frame = NULL |
static AVPacket | pkt |
static int | video_frame_count = 0 |
static int | audio_frame_count = 0 |
static int | refcount = 0 |
Demuxing and decoding example.
Show how to use the libavformat and libavcodec API to demux and decode audio and video data.
Definition in file demuxing_decoding.c.
Definition at line 64 of file demuxing_decoding.c.
Referenced by main().
|
static |
Definition at line 149 of file demuxing_decoding.c.
Referenced by main().
|
static |
Definition at line 202 of file demuxing_decoding.c.
Referenced by main().
Definition at line 231 of file demuxing_decoding.c.
|
static |
Definition at line 37 of file demuxing_decoding.c.
Referenced by main(), open_input_file(), process_frame(), read_interval_packets(), read_packets(), seek_test(), show_chapters(), show_format(), show_program(), show_programs(), show_streams(), video_decode(), and video_decode_example().
|
static |
Definition at line 38 of file demuxing_decoding.c.
|
static |
Definition at line 38 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
|
static |
Definition at line 39 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
|
static |
Definition at line 39 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
|
static |
Definition at line 40 of file demuxing_decoding.c.
Referenced by alloc_picture(), amf_init_encoder(), av_get_pix_fmt(), av_get_pix_fmt_name(), av_get_pix_fmt_string(), av_hwframe_ctx_init(), av_pix_fmt_desc_get(), avi_write_header(), bufref_wrap_interface(), dc1394_read_common(), decode_packet(), dshow_cycle_formats(), fbdev_read_header(), fbdev_write_header(), ff_img_read_header(), ff_parse_pixel_format(), ff_put_bmp_header(), ff_rint64_clip(), ff_videotoolbox_uninit(), fill_frameinfo_by_link(), get_format(), get_pix_fmt_internal(), have_alpha_planar(), hls_slice_header(), init(), list_formats(), load_mask(), main(), mpegvideo_extract_headers(), opencl_frames_get_constraints(), opengl_draw(), opengl_fill_color_map(), query_formats(), rawvideo_read_header(), set_sps(), show_pix_fmts(), swf_read_packet(), sws_isSupportedEndiannessConversion(), sws_isSupportedInput(), sws_isSupportedOutput(), v4l2_read_header(), vdpau_transfer_data_from(), vdpau_transfer_data_to(), xwd_encode_frame(), and yuv4_read_header().
Definition at line 41 of file demuxing_decoding.c.
Referenced by event_loop(), main(), seek_test(), video_decode(), video_decode_example(), and yop_read_header().
Definition at line 41 of file demuxing_decoding.c.
Referenced by event_loop(), main(), and yop_read_header().
|
static |
Definition at line 42 of file demuxing_decoding.c.
Referenced by main(), and open_codec_context().
|
static |
Definition at line 43 of file demuxing_decoding.c.
Referenced by main().
|
static |
Definition at line 44 of file demuxing_decoding.c.
Referenced by main().
|
static |
Definition at line 45 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
|
static |
Definition at line 46 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
Definition at line 48 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
|
static |
Definition at line 49 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
|
static |
Definition at line 50 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
|
static |
Definition at line 52 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
|
static |
Definition at line 52 of file demuxing_decoding.c.
Referenced by decode_packet(), and main().
Definition at line 53 of file demuxing_decoding.c.
Referenced by a64multi_encode_frame(), ac3_decode_frame(), activate(), add_frame(), add_timecode_metadata(), adpcm_decode_frame(), adx_decode_frame(), alac_decode_frame(), alloc_frame(), ape_decode_frame(), aptx_decode_frame(), aqt_probe(), aqt_read_header(), atrac1_decode_frame(), atrac3_decode_frame(), atrac3al_decode_frame(), atrac3p_decode_frame(), aura_decode_frame(), av_buffersrc_add_frame(), av_frame_alloc(), avcodec_get_subtitle_rect_class(), avisynth_read_packet_video(), bfi_decode_frame(), bitpacked_decode(), bmv_aud_decode_frame(), cfhd_decode(), channel_decorrelation(), cinaudio_decode_frame(), cllc_decode_frame(), cmv_decode_frame(), cng_decode_frame(), compand_drain(), compand_nodelay(), config_input(), config_output(), consume_from_fifos(), cook_decode_frame(), copy_samples(), cpia_decode_frame(), cuvid_decode_frame(), cyuv_decode_frame(), d3d11va_transfer_data(), dcadec_decode_frame(), dds_decode(), dec_enc(), decklink_write_video_packet(), decode_bdlt(), decode_dds1(), decode_dsw1(), decode_entropy_coded_image(), decode_frame(), decode_tag(), decode_tsw1(), decode_wdlt(), decode_write(), decompress_texture_thread(), decompress_texture_thread_internal(), dfa_decode_frame(), dirac_decode_frame_internal(), dnxhd_decode_frame(), do_chromakey_slice(), do_colorkey_slice(), do_despill_slice(), do_lumakey_slice16(), do_lumakey_slice8(), downscale(), dpcm_decode_frame(), dss_sp_decode_frame(), dv_write_packet(), dvvideo_decode_frame(), dvvideo_encode_frame(), eightsvx_decode_frame(), encode_frame(), encode_residual_ch(), escape124_decode_frame(), evrc_decode_frame(), fdk_aac_decode_frame(), ff_dca_core_dequantize(), ff_decode_frame_props(), ff_default_get_audio_buffer(), ff_default_get_video_buffer(), ff_exp2fi(), ff_filter_frame_to_filter(), ff_frame_pool_get(), ff_framequeue_add(), ff_framequeue_free(), ff_framequeue_skip_samples(), ff_framesync_get_frame(), ff_hevc_bump_frame(), ff_hevc_frame_rps(), ff_hevc_nal_is_nonref(), ff_hevc_output_frame(), ff_inlink_consume_frame(), ff_inlink_consume_samples(), ff_inlink_make_frame_writable(), ff_inlink_set_status(), ff_ivi_decode_frame(), ff_load_image(), ff_mjpeg_decode_frame(), ff_twinvq_decode_frame(), ff_videotoolbox_uninit(), ffat_decode(), ffat_encode_callback(), ffmmal_decode(), ffmpeg_cleanup(), fill_picture_parameters(), fill_vaapi_reference_frames(), filter_frame(), filter_frame_left(), filter_frame_main(), filter_frame_overlay(), filter_frame_right(), filter_slice_alpha(), filter_slice_chroma(), filter_slice_luma(), filter_slice_rgb(), flac_decode_frame(), flush(), framesync_inject_frame(), free_avframe(), g722_decode_frame(), g723_1_decode_frame(), g726_reset(), generate_missing_ref(), get_free_frame(), get_pts(), get_surface(), get_video_buffer(), get_video_frame(), gsm_decode_frame(), h264_fill_mbaff_ref_list(), hnm_decode_frame(), hqx_decode_frame(), idcin_decode_frame(), ilbc_decode_frame(), imc_decode_frame(), init_frame(), init_slice_rpl(), ipvideo_decode_format_06_opcodes(), ipvideo_decode_format_10_opcodes(), ipvideo_decode_format_11_opcodes(), ipvideo_decode_frame(), jpeg2000_decode_frame(), kmsgrab_free_frame(), kmsgrab_read_packet(), lag_decode_frame(), lavfi_read_packet(), libcelt_dec_decode(), libcodec2_decode(), libgsm_decode_frame(), libopenjpeg_decode_frame(), libopus_decode(), librsvg_decode_frame(), libspeex_decode_frame(), LLVMFuzzerTestOneInput(), m101_decode_frame(), mace_decode_frame(), magy_decode_frame(), main(), microdvd_read_header(), movie_push_frame(), mpc7_decode_frame(), mpc8_decode_frame(), mss2_decode_frame(), mvc_decode_frame(), mxf_write_system_item(), oggvorbis_decode_frame(), on2avc_decode_frame(), opencl_map_frame(), opus_decode_packet(), output_frame_end(), pad_last_frame(), paf_audio_decode(), pcm_bluray_decode_frame(), pcm_decode_frame(), pcm_dvd_decode_frame(), pix_decode_frame(), pixlet_decode_frame(), predictor_calc_error(), push_frame(), qdm2_decode_frame(), qdmc_decode_frame(), qsv_decode_frame(), ra144_decode_frame(), ra288_decode_frame(), raw_decode(), read_frame(), read_interval_packets(), request_frame(), rl2_decode_frame(), roq_encode_frame(), rscc_decode_frame(), s302m_decode_frame(), sbc_decode_frame(), decklink_output_callback::ScheduledFrameCompleted(), screenpresso_decode_frame(), set_frame_data(), sgirle_decode_frame(), shift_frame(), shorten_decode_frame(), silk_decode_frame(), sipr_decode_frame(), smka_decode_frame(), snow_horizontal_compose_liftS_lead_out(), source_request_frame(), speedhq_decode_frame(), sub2video_get_blank_frame(), sub2video_push_ref(), sub2video_update(), swf_read_packet(), tak_decode_frame(), take_samples(), tdsc_decode_frame(), tgq_decode_frame(), tgv_decode_frame(), tmv_decode_frame(), truespeech_decode_frame(), try_decode_frame(), try_decode_video_frame(), try_push_frame(), tta_decode_frame(), uninit(), unpack_frame(), v4l2_read_packet(), vble_decode_frame(), vc1_probe(), vdpau_hevc_start_frame(), vmd_read_packet(), vmdaudio_decode_frame(), vmdvideo_decode_frame(), vorbis_decode_frame(), vp3_decode_frame(), vp8_find_free_buffer(), vp9_raw_reorder_filter(), vp9_raw_reorder_make_output(), vqa_decode_frame(), vtenc_frame(), wavesynth_decode(), wavpack_decode_frame(), wma_decode_superframe(), wmapro_decode_packet(), worker(), wrapped_avframe_release_buffer(), write_frame(), write_frame_header(), write_packet(), ws_snd_decode_frame(), xan_decode_frame(), xface_decode_frame(), xma_decode_packet(), and yuv4_write_packet().
|
static |
Definition at line 54 of file demuxing_decoding.c.
Referenced by android_camera_read_close(), ape_tag_read_field(), asf_deinterleave(), asf_read_header(), asf_read_picture(), asf_read_pts(), asf_read_timestamp(), audio_write_frame(), av_bitstream_filter_filter(), av_dup_packet(), av_packet_alloc(), av_packet_merge_side_data(), av_write_trailer(), av_write_uncoded_frame_internal(), avcodec_get_subtitle_rect_class(), avf_read_packet(), avformat_find_stream_info(), avi_write_packet(), avpacket_queue_flush(), avpriv_mpegts_parse_packet(), bsf_list_filter(), check_init_output_file(), check_keyboard_interaction(), compute_crc_of_packets(), crystalhd_receive_frame(), cuvid_output_frame(), dash_check_bitstream(), decode_extradata_ps(), decode_simple_internal(), decode_video(), do_audio_out(), do_subtitle_out(), do_video_out(), encode_frame(), estimate_timings_from_pts(), ff_decode_frame_props(), ff_exp2fi(), ff_interleave_add_packet(), ff_ivi_decode_frame(), ff_load_image(), ff_mjpeg_encode_mb(), ff_packet_list_put(), ff_qsv_enc_close(), ff_reshuffle_raw_rgb(), ff_rtsp_open_transport_ctx(), ff_stream_add_bitstream_filter(), ff_write_chained(), ffmmal_decode(), ffmpeg_cleanup(), fifo_basic_test(), fifo_overflow_drop_test(), fifo_thread_attempt_recovery(), filter(), filter_frame(), find_missing_packets(), find_video_stream_info(), flac_finish_header(), flac_queue_flush(), flac_read_timestamp(), flush_encoders(), flush_packet(), force_one_stream(), 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_get_stream_length(), gen_pause(), gen_play(), gen_pong(), gen_publish(), gen_release_stream(), gen_seek(), gen_swf_verification(), gen_window_ack_size(), gxf_compare_field_nb(), hevc_decode_nal_units(), image_available(), ipmovie_read_header(), libopenjpeg_encode_frame(), mace_decode_frame(), main(), matroska_parse_frame(), matroska_parse_rm_audio(), matroska_parse_webvtt(), mov_read_chapters(), mov_read_covr(), movie_push_frame(), mp3_queue_flush(), mpc_read_seek(), mpegts_get_dts(), mpegts_read_packet(), mux_frames(), nsv_read_chunk(), opus_decode_packet(), parse_file(), process_callback(), process_input(), process_input_packet(), pulse_write_frame(), qsv_clear_buffers(), queue_frames(), read_interval_packets(), reset_packet_state(), rkmpp_receive_frame(), seek_frame_generic(), set_spdif(), signal_init_ts(), str_read_packet(), supply_new_packets(), try_decode_frame(), tta_queue_flush(), video_decode(), video_decode_example(), decklink_input_callback::VideoInputFrameArrived(), vp8_lossy_decode_frame(), wait_frame(), webm_clusters_start_with_keyframe(), worker(), write_audio_frame(), and write_video_frame().
|
static |
Definition at line 55 of file demuxing_decoding.c.
Referenced by decode_packet().
|
static |
Definition at line 56 of file demuxing_decoding.c.
Referenced by decode_packet(), and fourxm_read_packet().
|
static |
Definition at line 62 of file demuxing_decoding.c.
Referenced by decode_packet(), main(), and open_codec_context().