FFmpeg
4.0
|
simple media player based on the FFmpeg libraries More...
#include "config.h"
#include <inttypes.h>
#include <math.h>
#include <limits.h>
#include <signal.h>
#include <stdint.h>
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/dict.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/avassert.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
#include "libavutil/opt.h"
#include "libavcodec/avfft.h"
#include "libswresample/swresample.h"
#include <SDL.h>
#include <SDL_thread.h>
#include "cmdutils.h"
#include <assert.h>
Go to the source code of this file.
Data Structures | |
struct | MyAVPacketList |
struct | PacketQueue |
struct | AudioParams |
struct | Clock |
struct | Frame |
struct | FrameQueue |
struct | Decoder |
struct | VideoState |
struct | TextureFormatEntry |
Macros | |
#define | MAX_QUEUE_SIZE (15 * 1024 * 1024) |
#define | MIN_FRAMES 25 |
#define | EXTERNAL_CLOCK_MIN_FRAMES 2 |
#define | EXTERNAL_CLOCK_MAX_FRAMES 10 |
#define | SDL_AUDIO_MIN_BUFFER_SIZE 512 |
#define | SDL_AUDIO_MAX_CALLBACKS_PER_SEC 30 |
#define | SDL_VOLUME_STEP (0.75) |
#define | AV_SYNC_THRESHOLD_MIN 0.04 |
#define | AV_SYNC_THRESHOLD_MAX 0.1 |
#define | AV_SYNC_FRAMEDUP_THRESHOLD 0.1 |
#define | AV_NOSYNC_THRESHOLD 10.0 |
#define | SAMPLE_CORRECTION_PERCENT_MAX 10 |
#define | EXTERNAL_CLOCK_SPEED_MIN 0.900 |
#define | EXTERNAL_CLOCK_SPEED_MAX 1.010 |
#define | EXTERNAL_CLOCK_SPEED_STEP 0.001 |
#define | AUDIO_DIFF_AVG_NB 20 |
#define | REFRESH_RATE 0.01 |
#define | SAMPLE_ARRAY_SIZE (8 * 65536) |
#define | CURSOR_HIDE_DELAY 1000000 |
#define | USE_ONEPASS_SUBTITLE_RENDER 1 |
#define | VIDEO_PICTURE_QUEUE_SIZE 3 |
#define | SUBPICTURE_QUEUE_SIZE 16 |
#define | SAMPLE_QUEUE_SIZE 9 |
#define | FRAME_QUEUE_SIZE FFMAX(SAMPLE_QUEUE_SIZE, FFMAX(VIDEO_PICTURE_QUEUE_SIZE, SUBPICTURE_QUEUE_SIZE)) |
#define | FF_QUIT_EVENT (SDL_USEREVENT + 2) |
Enumerations | |
enum | { AV_SYNC_AUDIO_MASTER, AV_SYNC_VIDEO_MASTER, AV_SYNC_EXTERNAL_CLOCK } |
Variables | |
const char | program_name [] = "ffplay" |
program name, defined by the program for show_version(). More... | |
const int | program_birth_year = 2003 |
program birth year, defined by the program for show_banner() More... | |
static unsigned | sws_flags = SWS_BICUBIC |
static AVInputFormat * | file_iformat |
static const char * | input_filename |
static const char * | window_title |
static int | default_width = 640 |
static int | default_height = 480 |
static int | screen_width = 0 |
static int | screen_height = 0 |
static int | audio_disable |
static int | video_disable |
static int | subtitle_disable |
static const char * | wanted_stream_spec [AVMEDIA_TYPE_NB] = {0} |
static int | seek_by_bytes = -1 |
static int | display_disable |
static int | borderless |
static int | startup_volume = 100 |
static int | show_status = 1 |
static int | av_sync_type = AV_SYNC_AUDIO_MASTER |
static int64_t | start_time = AV_NOPTS_VALUE |
static int64_t | duration = AV_NOPTS_VALUE |
static int | fast = 0 |
static int | genpts = 0 |
static int | lowres = 0 |
static int | decoder_reorder_pts = -1 |
static int | autoexit |
static int | exit_on_keydown |
static int | exit_on_mousedown |
static int | loop = 1 |
static int | framedrop = -1 |
static int | infinite_buffer = -1 |
static enum ShowMode | show_mode = SHOW_MODE_NONE |
static const char * | audio_codec_name |
static const char * | subtitle_codec_name |
static const char * | video_codec_name |
double | rdftspeed = 0.02 |
static int64_t | cursor_last_shown |
static int | cursor_hidden = 0 |
static int | autorotate = 1 |
static int | find_stream_info = 1 |
static int | is_full_screen |
static int64_t | audio_callback_time |
static AVPacket | flush_pkt |
static SDL_Window * | window |
static SDL_Renderer * | renderer |
static SDL_RendererInfo | renderer_info = {0} |
static SDL_AudioDeviceID | audio_dev |
static const struct TextureFormatEntry | sdl_texture_format_map [] |
static int | dummy |
static const OptionDef | options [] |
simple media player based on the FFmpeg libraries
Definition in file ffplay.c.
#define MAX_QUEUE_SIZE (15 * 1024 * 1024) |
Definition at line 66 of file ffplay.c.
Referenced by read_thread().
#define MIN_FRAMES 25 |
Definition at line 67 of file ffplay.c.
Referenced by stream_has_enough_packets().
#define EXTERNAL_CLOCK_MIN_FRAMES 2 |
Definition at line 68 of file ffplay.c.
Referenced by check_external_clock_speed().
#define EXTERNAL_CLOCK_MAX_FRAMES 10 |
Definition at line 69 of file ffplay.c.
Referenced by check_external_clock_speed().
#define SDL_AUDIO_MIN_BUFFER_SIZE 512 |
Definition at line 72 of file ffplay.c.
Referenced by audio_open(), and sdl_audio_callback().
#define SDL_AUDIO_MAX_CALLBACKS_PER_SEC 30 |
Definition at line 74 of file ffplay.c.
Referenced by audio_open().
#define SDL_VOLUME_STEP (0.75) |
Definition at line 77 of file ffplay.c.
Referenced by event_loop().
#define AV_SYNC_THRESHOLD_MIN 0.04 |
Definition at line 80 of file ffplay.c.
Referenced by compute_target_delay().
#define AV_SYNC_THRESHOLD_MAX 0.1 |
Definition at line 82 of file ffplay.c.
Referenced by compute_target_delay(), and video_refresh().
#define AV_SYNC_FRAMEDUP_THRESHOLD 0.1 |
Definition at line 84 of file ffplay.c.
Referenced by compute_target_delay().
#define AV_NOSYNC_THRESHOLD 10.0 |
Definition at line 86 of file ffplay.c.
Referenced by get_video_frame(), sync_clock_to_slave(), synchronize_audio(), and video_thread().
#define SAMPLE_CORRECTION_PERCENT_MAX 10 |
Definition at line 89 of file ffplay.c.
Referenced by synchronize_audio().
#define EXTERNAL_CLOCK_SPEED_MIN 0.900 |
Definition at line 92 of file ffplay.c.
Referenced by check_external_clock_speed().
#define EXTERNAL_CLOCK_SPEED_MAX 1.010 |
Definition at line 93 of file ffplay.c.
Referenced by check_external_clock_speed().
#define EXTERNAL_CLOCK_SPEED_STEP 0.001 |
Definition at line 94 of file ffplay.c.
Referenced by check_external_clock_speed().
#define AUDIO_DIFF_AVG_NB 20 |
Definition at line 97 of file ffplay.c.
Referenced by stream_component_open(), and synchronize_audio().
#define REFRESH_RATE 0.01 |
Definition at line 100 of file ffplay.c.
Referenced by refresh_loop_wait_event().
#define SAMPLE_ARRAY_SIZE (8 * 65536) |
Definition at line 104 of file ffplay.c.
Referenced by update_sample_display(), and video_audio_display().
#define CURSOR_HIDE_DELAY 1000000 |
Definition at line 106 of file ffplay.c.
Referenced by refresh_loop_wait_event().
#define VIDEO_PICTURE_QUEUE_SIZE 3 |
Definition at line 129 of file ffplay.c.
Referenced by stream_open().
#define SUBPICTURE_QUEUE_SIZE 16 |
Definition at line 130 of file ffplay.c.
Referenced by stream_open().
#define SAMPLE_QUEUE_SIZE 9 |
Definition at line 131 of file ffplay.c.
Referenced by stream_open().
#define FRAME_QUEUE_SIZE FFMAX(SAMPLE_QUEUE_SIZE, FFMAX(VIDEO_PICTURE_QUEUE_SIZE, SUBPICTURE_QUEUE_SIZE)) |
Definition at line 132 of file ffplay.c.
Referenced by frame_queue_init().
#define FF_QUIT_EVENT (SDL_USEREVENT + 2) |
Definition at line 360 of file ffplay.c.
Referenced by event_loop(), read_thread(), and video_thread().
anonymous enum |
|
inlinestatic |
Definition at line 403 of file ffplay.c.
Referenced by audio_thread().
|
inlinestatic |
Definition at line 414 of file ffplay.c.
Referenced by audio_thread(), and stream_component_open().
|
static |
Definition at line 422 of file ffplay.c.
Referenced by packet_queue_put(), and packet_queue_start().
|
static |
Definition at line 451 of file ffplay.c.
Referenced by packet_queue_put_nullpacket(), and read_thread().
|
static |
Definition at line 465 of file ffplay.c.
Referenced by read_thread().
|
static |
Definition at line 476 of file ffplay.c.
Referenced by stream_open().
|
static |
Definition at line 493 of file ffplay.c.
Referenced by decoder_abort(), packet_queue_destroy(), and read_thread().
|
static |
Definition at line 511 of file ffplay.c.
Referenced by stream_close().
|
static |
Definition at line 518 of file ffplay.c.
Referenced by decoder_abort().
|
static |
Definition at line 529 of file ffplay.c.
Referenced by decoder_start().
|
static |
Definition at line 538 of file ffplay.c.
Referenced by decoder_decode_frame().
|
static |
Definition at line 576 of file ffplay.c.
Referenced by stream_component_open().
|
static |
Definition at line 585 of file ffplay.c.
Referenced by audio_thread(), get_video_frame(), and subtitle_thread().
Definition at line 674 of file ffplay.c.
Referenced by stream_component_close().
Definition at line 679 of file ffplay.c.
Referenced by frame_queue_destory(), and frame_queue_next().
|
static |
Definition at line 685 of file ffplay.c.
Referenced by stream_open().
|
static |
Definition at line 706 of file ffplay.c.
Referenced by stream_close().
|
static |
Definition at line 718 of file ffplay.c.
Referenced by decoder_abort().
|
static |
Definition at line 725 of file ffplay.c.
Referenced by video_image_display(), and video_refresh().
|
static |
Definition at line 730 of file ffplay.c.
Referenced by video_refresh().
|
static |
Definition at line 735 of file ffplay.c.
Referenced by video_image_display(), and video_refresh().
|
static |
Definition at line 740 of file ffplay.c.
Referenced by audio_thread(), queue_picture(), and subtitle_thread().
|
static |
Definition at line 756 of file ffplay.c.
Referenced by audio_decode_frame().
|
static |
Definition at line 772 of file ffplay.c.
Referenced by audio_thread(), queue_picture(), and subtitle_thread().
|
static |
Definition at line 782 of file ffplay.c.
Referenced by audio_decode_frame(), and video_refresh().
|
static |
Definition at line 798 of file ffplay.c.
Referenced by audio_decode_frame(), read_thread(), video_image_display(), and video_refresh().
|
static |
Definition at line 804 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 813 of file ffplay.c.
Referenced by stream_component_close().
Definition at line 822 of file ffplay.c.
Referenced by decode_cabac_luma_residual(), decode_cabac_residual_internal(), decode_cabac_residual_nondc(), decode_luma_residual(), ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), fill_decode_caches(), fill_filter_caches_inter(), h264_er_decode_mb(), hl_decode_mb(), hl_decode_mb_444(), pred_pskip_motion(), pred_spatial_direct_motion(), pred_temp_direct_motion(), rv34_decode_inter_macroblock(), rv34_decode_inter_mb_header(), rv34_decode_intra_macroblock(), rv34_decode_intra_mb_header(), rv34_output_intra(), svq3_mc_dir(), video_audio_display(), write_back_motion(), and ZERO8x2().
|
static |
Definition at line 833 of file ffplay.c.
Referenced by upload_texture(), video_audio_display(), and video_image_display().
|
static |
Definition at line 856 of file ffplay.c.
Referenced by set_default_window_size(), and video_image_display().
|
static |
Definition at line 887 of file ffplay.c.
Referenced by upload_texture().
|
static |
Definition at line 905 of file ffplay.c.
Referenced by video_image_display().
|
static |
Definition at line 956 of file ffplay.c.
Referenced by video_display().
Definition at line 1037 of file ffplay.c.
Referenced by video_audio_display().
|
static |
Definition at line 1042 of file ffplay.c.
Referenced by video_display().
|
static |
Definition at line 1184 of file ffplay.c.
Referenced by stream_close(), and stream_cycle_channel().
|
static |
Definition at line 1241 of file ffplay.c.
Referenced by do_exit(), and stream_open().
|
static |
Definition at line 1278 of file ffplay.c.
Referenced by event_loop(), and main().
|
static |
Definition at line 1304 of file ffplay.c.
Referenced by queue_picture(), and read_thread().
|
static |
Definition at line 1312 of file ffplay.c.
Referenced by video_display().
|
static |
Definition at line 1341 of file ffplay.c.
Referenced by video_refresh().
|
static |
Definition at line 1355 of file ffplay.c.
Referenced by compute_target_delay(), get_master_clock(), set_clock_speed(), stream_toggle_pause(), sync_clock_to_slave(), synchronize_audio(), and video_refresh().
Definition at line 1367 of file ffplay.c.
Referenced by sdl_audio_callback(), and set_clock().
Definition at line 1375 of file ffplay.c.
Referenced by init_clock(), read_thread(), set_clock_speed(), stream_toggle_pause(), sync_clock_to_slave(), and update_video_pts().
Definition at line 1381 of file ffplay.c.
Referenced by check_external_clock_speed().
Definition at line 1387 of file ffplay.c.
Referenced by stream_open().
Definition at line 1395 of file ffplay.c.
Referenced by sdl_audio_callback(), and update_video_pts().
|
static |
Definition at line 1403 of file ffplay.c.
Referenced by compute_target_delay(), get_master_clock(), get_video_frame(), synchronize_audio(), and video_refresh().
|
static |
Definition at line 1420 of file ffplay.c.
Referenced by compute_target_delay(), event_loop(), get_video_frame(), seek_chapter(), synchronize_audio(), and video_refresh().
|
static |
Definition at line 1438 of file ffplay.c.
Referenced by video_refresh().
|
static |
Definition at line 1453 of file ffplay.c.
Referenced by event_loop(), read_thread(), and seek_chapter().
|
static |
Definition at line 1467 of file ffplay.c.
Referenced by step_to_next_frame(), toggle_pause(), and video_refresh().
|
static |
Definition at line 1480 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 1486 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 1491 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 1498 of file ffplay.c.
Referenced by event_loop(), and read_thread().
|
static |
Definition at line 1506 of file ffplay.c.
Referenced by video_refresh().
|
static |
Definition at line 1536 of file ffplay.c.
Referenced by video_refresh().
|
static |
Definition at line 1548 of file ffplay.c.
Referenced by video_refresh().
Definition at line 1555 of file ffplay.c.
Referenced by refresh_loop_wait_event().
|
static |
Definition at line 1713 of file ffplay.c.
Referenced by video_thread().
|
static |
Definition at line 1744 of file ffplay.c.
Referenced by video_thread().
Definition at line 2002 of file ffplay.c.
Referenced by stream_component_open().
Definition at line 2089 of file ffplay.c.
Referenced by stream_component_open().
Definition at line 2100 of file ffplay.c.
Referenced by stream_component_open().
Definition at line 2209 of file ffplay.c.
Referenced by stream_component_open().
|
static |
Definition at line 2244 of file ffplay.c.
Referenced by sdl_audio_callback().
|
static |
Definition at line 2264 of file ffplay.c.
Referenced by audio_decode_frame().
|
static |
Decode one audio frame and return its uncompressed size.
The processed audio frame is decoded, converted if required, and stored in is->audio_buf, with size in bytes given by the return value.
Definition at line 2312 of file ffplay.c.
Referenced by sdl_audio_callback().
Definition at line 2425 of file ffplay.c.
Referenced by audio_open().
|
static |
Definition at line 2468 of file ffplay.c.
Referenced by stream_component_open().
|
static |
Definition at line 2542 of file ffplay.c.
Referenced by read_thread(), and stream_cycle_channel().
Definition at line 2694 of file ffplay.c.
Referenced by read_thread().
|
static |
Definition at line 2700 of file ffplay.c.
Referenced by read_thread().
|
static |
Definition at line 2707 of file ffplay.c.
Referenced by read_thread().
Definition at line 2724 of file ffplay.c.
Referenced by stream_open().
|
static |
|
static |
Definition at line 3101 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 3180 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 3186 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 3198 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 3215 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 3601 of file ffplay.c.
Referenced by main(), and show_help_default().
void show_help_default | ( | const char * | opt, |
const char * | arg | ||
) |
Per-fftool specific help handler.
Implemented in each fftool, called by show_help().
const char program_name[] = "ffplay" |
program name, defined by the program for show_version().
Definition at line 63 of file ffplay.c.
Referenced by main(), and show_usage().
const int program_birth_year = 2003 |
program birth year, defined by the program for show_banner()
|
static |
Definition at line 110 of file ffplay.c.
Referenced by upload_texture().
|
static |
Definition at line 310 of file ffplay.c.
Referenced by open_input_file().
|
static |
Definition at line 311 of file ffplay.c.
Referenced by main(), opt_input_file(), read_thread(), and video_open().
|
static |
Definition at line 312 of file ffplay.c.
Referenced by read_thread(), and video_open().
|
static |
Definition at line 313 of file ffplay.c.
Referenced by main(), set_default_window_size(), and video_open().
|
static |
Definition at line 314 of file ffplay.c.
Referenced by main(), set_default_window_size(), and video_open().
|
static |
Definition at line 315 of file ffplay.c.
Referenced by event_loop(), opt_width(), and video_open().
|
static |
Definition at line 316 of file ffplay.c.
Referenced by event_loop(), opt_height(), and video_open().
|
static |
Definition at line 317 of file ffplay.c.
Referenced by main(), open_output_file(), and read_thread().
|
static |
Definition at line 318 of file ffplay.c.
Referenced by main(), open_output_file(), and read_thread().
|
static |
Definition at line 319 of file ffplay.c.
Referenced by read_thread().
|
static |
Definition at line 320 of file ffplay.c.
Referenced by read_thread().
|
static |
Definition at line 321 of file ffplay.c.
Referenced by event_loop(), and read_thread().
|
static |
Definition at line 322 of file ffplay.c.
Referenced by main(), and video_refresh().
|
static |
Definition at line 324 of file ffplay.c.
Referenced by stream_open().
|
static |
Definition at line 325 of file ffplay.c.
Referenced by do_exit(), read_thread(), and video_refresh().
|
static |
Definition at line 326 of file ffplay.c.
Referenced by opt_sync(), and stream_open().
|
static |
Definition at line 327 of file ffplay.c.
Referenced by asf_read_ext_stream_properties(), asf_read_stream_properties(), calc_next_seg_no_from_timelines(), copy_chapters(), decode(), do_streamcopy(), get_concatdec_select(), get_segment_start_time_based_on_timeline(), gxf_seek(), libAVFilter_Run(), main(), mov_build_index(), open_input_file(), open_output_file(), opt_seek(), read_thread(), real_seek(), reap_filters(), rm_read_header(), skeleton_header(), update_stream_timings(), and write_manifest().
|
static |
Definition at line 328 of file ffplay.c.
Referenced by opt_duration(), queue_picture(), read_thread(), video_refresh(), video_thread(), and vp_duration().
|
static |
Definition at line 329 of file ffplay.c.
Referenced by stream_component_open().
|
static |
Definition at line 330 of file ffplay.c.
Referenced by av_read_frame(), and read_thread().
|
static |
Definition at line 331 of file ffplay.c.
Referenced by avpriv_find_pix_fmt(), chroma_4mv_motion_lowres(), hpel_motion_lowres(), mpeg_decode_slice(), mpeg_motion_lowres(), MPV_motion_lowres(), and stream_component_open().
|
static |
Definition at line 332 of file ffplay.c.
Referenced by decoder_decode_frame().
|
static |
Definition at line 333 of file ffplay.c.
Referenced by read_thread().
|
static |
Definition at line 334 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 335 of file ffplay.c.
Referenced by event_loop().
|
static |
Definition at line 336 of file ffplay.c.
Referenced by hevc_idct_dc_16x16_msa(), hevc_idct_dc_32x32_msa(), img_read_seek(), process_input(), read_header(), and read_thread().
|
static |
Definition at line 337 of file ffplay.c.
Referenced by get_video_frame(), and video_refresh().
|
static |
Definition at line 338 of file ffplay.c.
Referenced by read_thread().
|
static |
Definition at line 339 of file ffplay.c.
Referenced by opt_show_mode(), and read_thread().
|
static |
Definition at line 340 of file ffplay.c.
Referenced by open_input_file(), opt_codec(), and stream_component_open().
|
static |
Definition at line 341 of file ffplay.c.
Referenced by open_input_file(), open_output_file(), opt_codec(), and stream_component_open().
|
static |
Definition at line 342 of file ffplay.c.
Referenced by open_input_file(), opt_codec(), and stream_component_open().
double rdftspeed = 0.02 |
Definition at line 343 of file ffplay.c.
Referenced by video_refresh().
|
static |
Definition at line 344 of file ffplay.c.
Referenced by event_loop(), and refresh_loop_wait_event().
|
static |
Definition at line 345 of file ffplay.c.
Referenced by event_loop(), and refresh_loop_wait_event().
|
static |
Definition at line 351 of file ffplay.c.
Referenced by add_input_streams(), and get_video_frame().
|
static |
Definition at line 352 of file ffplay.c.
Referenced by read_thread().
|
static |
Definition at line 355 of file ffplay.c.
Referenced by toggle_full_screen(), and video_open().
|
static |
Definition at line 356 of file ffplay.c.
Referenced by audio_decode_frame(), sdl_audio_callback(), and video_audio_display().
|
static |
Definition at line 358 of file ffplay.c.
Referenced by parse_packet().
|
static |
Definition at line 362 of file ffplay.c.
Referenced by checkasm_check_synth_filter(), do_exit(), ff_ac3_float_mdct_init(), ff_mpa_synth_filter(), ff_mpadsp_apply_window(), ff_sine_window_init(), imdct_and_windowing_eld(), main(), toggle_full_screen(), transform(), video_open(), wmapro_window(), yae_reset(), and yae_xcorr_via_rdft().
|
static |
Definition at line 363 of file ffplay.c.
Referenced by do_exit(), fill_rectangle(), main(), realloc_texture(), video_audio_display(), video_display(), and video_image_display().
|
static |
Definition at line 364 of file ffplay.c.
Referenced by get_video_frame(), and main().
|
static |
Definition at line 365 of file ffplay.c.
Referenced by audio_open(), stream_component_close(), and stream_component_open().
|
static |
Referenced by get_sdl_pix_fmt_and_blendmode(), and get_video_frame().