FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
ffplay.c File Reference
#include "config.h"
#include "config_components.h"
#include <inttypes.h>
#include <math.h>
#include <limits.h>
#include <signal.h>
#include <stdint.h>
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/eval.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/dict.h"
#include "libavutil/fifo.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/time.h"
#include "libavutil/bprint.h"
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
#include "libavutil/opt.h"
#include "libavutil/tx.h"
#include "libswresample/swresample.h"
#include "libavfilter/avfilter.h"
#include "libavfilter/buffersink.h"
#include "libavfilter/buffersrc.h"
#include <SDL.h>
#include <SDL_thread.h>
#include "cmdutils.h"
#include "opt_common.h"

Go to the source code of this file.

Data Structures

struct  MyAVPacketList
 
struct  PacketQueue
 
struct  AudioParams
 
struct  Clock
 
struct  FrameData
 
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)
 
#define INSERT_FILT(name, arg)
 

Enumerations

enum  { AV_SYNC_AUDIO_MASTER, AV_SYNC_VIDEO_MASTER, AV_SYNC_EXTERNAL_CLOCK }
 

Functions

static int opt_add_vfilter (void *optctx, const char *opt, const char *arg)
 
static int cmp_audio_fmts (enum AVSampleFormat fmt1, int64_t channel_count1, enum AVSampleFormat fmt2, int64_t channel_count2)
 
static int packet_queue_put_private (PacketQueue *q, AVPacket *pkt)
 
static int packet_queue_put (PacketQueue *q, AVPacket *pkt)
 
static int packet_queue_put_nullpacket (PacketQueue *q, AVPacket *pkt, int stream_index)
 
static int packet_queue_init (PacketQueue *q)
 
static void packet_queue_flush (PacketQueue *q)
 
static void packet_queue_destroy (PacketQueue *q)
 
static void packet_queue_abort (PacketQueue *q)
 
static void packet_queue_start (PacketQueue *q)
 
static int packet_queue_get (PacketQueue *q, AVPacket *pkt, int block, int *serial)
 
static int decoder_init (Decoder *d, AVCodecContext *avctx, PacketQueue *queue, SDL_cond *empty_queue_cond)
 
static int decoder_decode_frame (Decoder *d, AVFrame *frame, AVSubtitle *sub)
 
static void decoder_destroy (Decoder *d)
 
static void frame_queue_unref_item (Frame *vp)
 
static int frame_queue_init (FrameQueue *f, PacketQueue *pktq, int max_size, int keep_last)
 
static void frame_queue_destroy (FrameQueue *f)
 
static void frame_queue_signal (FrameQueue *f)
 
static Frameframe_queue_peek (FrameQueue *f)
 
static Frameframe_queue_peek_next (FrameQueue *f)
 
static Frameframe_queue_peek_last (FrameQueue *f)
 
static Frameframe_queue_peek_writable (FrameQueue *f)
 
static Frameframe_queue_peek_readable (FrameQueue *f)
 
static void frame_queue_push (FrameQueue *f)
 
static void frame_queue_next (FrameQueue *f)
 
static int frame_queue_nb_remaining (FrameQueue *f)
 
static int64_t frame_queue_last_pos (FrameQueue *f)
 
static void decoder_abort (Decoder *d, FrameQueue *fq)
 
static void fill_rectangle (int x, int y, int w, int h)
 
static int realloc_texture (SDL_Texture **texture, Uint32 new_format, int new_width, int new_height, SDL_BlendMode blendmode, int init_texture)
 
static void calculate_display_rect (SDL_Rect *rect, int scr_xleft, int scr_ytop, int scr_width, int scr_height, int pic_width, int pic_height, AVRational pic_sar)
 
static void get_sdl_pix_fmt_and_blendmode (int format, Uint32 *sdl_pix_fmt, SDL_BlendMode *sdl_blendmode)
 
static int upload_texture (SDL_Texture **tex, AVFrame *frame)
 
static void set_sdl_yuv_conversion_mode (AVFrame *frame)
 
static void video_image_display (VideoState *is)
 
static int compute_mod (int a, int b)
 
static void video_audio_display (VideoState *s)
 
static void stream_component_close (VideoState *is, int stream_index)
 
static void stream_close (VideoState *is)
 
static void do_exit (VideoState *is)
 
static void sigterm_handler (int sig)
 
static void set_default_window_size (int width, int height, AVRational sar)
 
static int video_open (VideoState *is)
 
static void video_display (VideoState *is)
 
static double get_clock (Clock *c)
 
static void set_clock_at (Clock *c, double pts, int serial, double time)
 
static void set_clock (Clock *c, double pts, int serial)
 
static void set_clock_speed (Clock *c, double speed)
 
static void init_clock (Clock *c, int *queue_serial)
 
static void sync_clock_to_slave (Clock *c, Clock *slave)
 
static int get_master_sync_type (VideoState *is)
 
static double get_master_clock (VideoState *is)
 
static void check_external_clock_speed (VideoState *is)
 
static void stream_seek (VideoState *is, int64_t pos, int64_t rel, int by_bytes)
 
static void stream_toggle_pause (VideoState *is)
 
static void toggle_pause (VideoState *is)
 
static void toggle_mute (VideoState *is)
 
static void update_volume (VideoState *is, int sign, double step)
 
static void step_to_next_frame (VideoState *is)
 
static double compute_target_delay (double delay, VideoState *is)
 
static double vp_duration (VideoState *is, Frame *vp, Frame *nextvp)
 
static void update_video_pts (VideoState *is, double pts, int serial)
 
static void video_refresh (void *opaque, double *remaining_time)
 
static int queue_picture (VideoState *is, AVFrame *src_frame, double pts, double duration, int64_t pos, int serial)
 
static int get_video_frame (VideoState *is, AVFrame *frame)
 
static int configure_filtergraph (AVFilterGraph *graph, const char *filtergraph, AVFilterContext *source_ctx, AVFilterContext *sink_ctx)
 
static int configure_video_filters (AVFilterGraph *graph, VideoState *is, const char *vfilters, AVFrame *frame)
 
static int configure_audio_filters (VideoState *is, const char *afilters, int force_output_format)
 
static int audio_thread (void *arg)
 
static int decoder_start (Decoder *d, int(*fn)(void *), const char *thread_name, void *arg)
 
static int video_thread (void *arg)
 
static int subtitle_thread (void *arg)
 
static void update_sample_display (VideoState *is, short *samples, int samples_size)
 
static int synchronize_audio (VideoState *is, int nb_samples)
 
static int audio_decode_frame (VideoState *is)
 Decode one audio frame and return its uncompressed size. More...
 
static void sdl_audio_callback (void *opaque, Uint8 *stream, int len)
 
static int audio_open (void *opaque, AVChannelLayout *wanted_channel_layout, int wanted_sample_rate, struct AudioParams *audio_hw_params)
 
static int stream_component_open (VideoState *is, int stream_index)
 
static int decode_interrupt_cb (void *ctx)
 
static int stream_has_enough_packets (AVStream *st, int stream_id, PacketQueue *queue)
 
static int is_realtime (AVFormatContext *s)
 
static int read_thread (void *arg)
 
static VideoStatestream_open (const char *filename, const AVInputFormat *iformat)
 
static void stream_cycle_channel (VideoState *is, int codec_type)
 
static void toggle_full_screen (VideoState *is)
 
static void toggle_audio_display (VideoState *is)
 
static void refresh_loop_wait_event (VideoState *is, SDL_Event *event)
 
static void seek_chapter (VideoState *is, int incr)
 
static void event_loop (VideoState *cur_stream)
 
static int opt_width (void *optctx, const char *opt, const char *arg)
 
static int opt_height (void *optctx, const char *opt, const char *arg)
 
static int opt_format (void *optctx, const char *opt, const char *arg)
 
static int opt_sync (void *optctx, const char *opt, const char *arg)
 
static int opt_show_mode (void *optctx, const char *opt, const char *arg)
 
static int opt_input_file (void *optctx, const char *filename)
 
static int opt_codec (void *optctx, const char *opt, const char *arg)
 
static void show_usage (void)
 
void show_help_default (const char *opt, const char *arg)
 Per-fftool specific help handler. More...
 
int main (int argc, char **argv)
 

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 const AVInputFormatfile_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 screen_left = SDL_WINDOWPOS_CENTERED
 
static int screen_top = SDL_WINDOWPOS_CENTERED
 
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 float seek_interval = 10
 
static int display_disable
 
static int borderless
 
static int alwaysontop
 
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 const char ** vfilters_list = NULL
 
static int nb_vfilters = 0
 
static char * afilters = NULL
 
static int autorotate = 1
 
static int find_stream_info = 1
 
static int filter_nbthreads = 0
 
static int is_full_screen
 
static int64_t audio_callback_time
 
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 []
 

Detailed Description

simple media player based on the FFmpeg libraries

Definition in file ffplay.c.

Macro Definition Documentation

◆ MAX_QUEUE_SIZE

#define MAX_QUEUE_SIZE   (15 * 1024 * 1024)

Definition at line 66 of file ffplay.c.

◆ MIN_FRAMES

#define MIN_FRAMES   25

Definition at line 67 of file ffplay.c.

◆ EXTERNAL_CLOCK_MIN_FRAMES

#define EXTERNAL_CLOCK_MIN_FRAMES   2

Definition at line 68 of file ffplay.c.

◆ EXTERNAL_CLOCK_MAX_FRAMES

#define EXTERNAL_CLOCK_MAX_FRAMES   10

Definition at line 69 of file ffplay.c.

◆ SDL_AUDIO_MIN_BUFFER_SIZE

#define SDL_AUDIO_MIN_BUFFER_SIZE   512

Definition at line 72 of file ffplay.c.

◆ SDL_AUDIO_MAX_CALLBACKS_PER_SEC

#define SDL_AUDIO_MAX_CALLBACKS_PER_SEC   30

Definition at line 74 of file ffplay.c.

◆ SDL_VOLUME_STEP

#define SDL_VOLUME_STEP   (0.75)

Definition at line 77 of file ffplay.c.

◆ AV_SYNC_THRESHOLD_MIN

#define AV_SYNC_THRESHOLD_MIN   0.04

Definition at line 80 of file ffplay.c.

◆ AV_SYNC_THRESHOLD_MAX

#define AV_SYNC_THRESHOLD_MAX   0.1

Definition at line 82 of file ffplay.c.

◆ AV_SYNC_FRAMEDUP_THRESHOLD

#define AV_SYNC_FRAMEDUP_THRESHOLD   0.1

Definition at line 84 of file ffplay.c.

◆ AV_NOSYNC_THRESHOLD

#define AV_NOSYNC_THRESHOLD   10.0

Definition at line 86 of file ffplay.c.

◆ SAMPLE_CORRECTION_PERCENT_MAX

#define SAMPLE_CORRECTION_PERCENT_MAX   10

Definition at line 89 of file ffplay.c.

◆ EXTERNAL_CLOCK_SPEED_MIN

#define EXTERNAL_CLOCK_SPEED_MIN   0.900

Definition at line 92 of file ffplay.c.

◆ EXTERNAL_CLOCK_SPEED_MAX

#define EXTERNAL_CLOCK_SPEED_MAX   1.010

Definition at line 93 of file ffplay.c.

◆ EXTERNAL_CLOCK_SPEED_STEP

#define EXTERNAL_CLOCK_SPEED_STEP   0.001

Definition at line 94 of file ffplay.c.

◆ AUDIO_DIFF_AVG_NB

#define AUDIO_DIFF_AVG_NB   20

Definition at line 97 of file ffplay.c.

◆ REFRESH_RATE

#define REFRESH_RATE   0.01

Definition at line 100 of file ffplay.c.

◆ SAMPLE_ARRAY_SIZE

#define SAMPLE_ARRAY_SIZE   (8 * 65536)

Definition at line 104 of file ffplay.c.

◆ CURSOR_HIDE_DELAY

#define CURSOR_HIDE_DELAY   1000000

Definition at line 106 of file ffplay.c.

◆ USE_ONEPASS_SUBTITLE_RENDER

#define USE_ONEPASS_SUBTITLE_RENDER   1

Definition at line 108 of file ffplay.c.

◆ VIDEO_PICTURE_QUEUE_SIZE

#define VIDEO_PICTURE_QUEUE_SIZE   3

Definition at line 126 of file ffplay.c.

◆ SUBPICTURE_QUEUE_SIZE

#define SUBPICTURE_QUEUE_SIZE   16

Definition at line 127 of file ffplay.c.

◆ SAMPLE_QUEUE_SIZE

#define SAMPLE_QUEUE_SIZE   9

Definition at line 128 of file ffplay.c.

◆ FRAME_QUEUE_SIZE

Definition at line 129 of file ffplay.c.

◆ FF_QUIT_EVENT

#define FF_QUIT_EVENT   (SDL_USEREVENT + 2)

Definition at line 358 of file ffplay.c.

◆ INSERT_FILT

#define INSERT_FILT (   name,
  arg 
)
Value:
do { \
AVFilterContext *filt_ctx; \
\
ret = avfilter_graph_create_filter(&filt_ctx, \
"ffplay_" name, arg, NULL, graph); \
if (ret < 0) \
goto fail; \
\
ret = avfilter_link(filt_ctx, 0, last_filter, 0); \
if (ret < 0) \
goto fail; \
\
last_filter = filt_ctx; \
} while (0)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
AV_SYNC_AUDIO_MASTER 
AV_SYNC_VIDEO_MASTER 
AV_SYNC_EXTERNAL_CLOCK 

Definition at line 182 of file ffplay.c.

Function Documentation

◆ opt_add_vfilter()

static int opt_add_vfilter ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 391 of file ffplay.c.

◆ cmp_audio_fmts()

static int cmp_audio_fmts ( enum AVSampleFormat  fmt1,
int64_t  channel_count1,
enum AVSampleFormat  fmt2,
int64_t  channel_count2 
)
inlinestatic

Definition at line 402 of file ffplay.c.

Referenced by audio_thread().

◆ packet_queue_put_private()

static int packet_queue_put_private ( PacketQueue q,
AVPacket pkt 
)
static

Definition at line 412 of file ffplay.c.

Referenced by packet_queue_put().

◆ packet_queue_put()

static int packet_queue_put ( PacketQueue q,
AVPacket pkt 
)
static

Definition at line 435 of file ffplay.c.

Referenced by packet_queue_put_nullpacket(), and read_thread().

◆ packet_queue_put_nullpacket()

static int packet_queue_put_nullpacket ( PacketQueue q,
AVPacket pkt,
int  stream_index 
)
static

Definition at line 457 of file ffplay.c.

Referenced by read_thread().

◆ packet_queue_init()

static int packet_queue_init ( PacketQueue q)
static

Definition at line 464 of file ffplay.c.

Referenced by stream_open().

◆ packet_queue_flush()

static void packet_queue_flush ( PacketQueue q)
static

Definition at line 484 of file ffplay.c.

Referenced by decoder_abort(), packet_queue_destroy(), and read_thread().

◆ packet_queue_destroy()

static void packet_queue_destroy ( PacketQueue q)
static

Definition at line 498 of file ffplay.c.

Referenced by stream_close().

◆ packet_queue_abort()

static void packet_queue_abort ( PacketQueue q)
static

Definition at line 506 of file ffplay.c.

Referenced by decoder_abort().

◆ packet_queue_start()

static void packet_queue_start ( PacketQueue q)
static

Definition at line 517 of file ffplay.c.

Referenced by decoder_start().

◆ packet_queue_get()

static int packet_queue_get ( PacketQueue q,
AVPacket pkt,
int  block,
int serial 
)
static

Definition at line 526 of file ffplay.c.

Referenced by decoder_decode_frame().

◆ decoder_init()

static int decoder_init ( Decoder d,
AVCodecContext avctx,
PacketQueue queue,
SDL_cond *  empty_queue_cond 
)
static

Definition at line 560 of file ffplay.c.

Referenced by stream_component_open().

◆ decoder_decode_frame()

static int decoder_decode_frame ( Decoder d,
AVFrame frame,
AVSubtitle sub 
)
static

Definition at line 573 of file ffplay.c.

Referenced by audio_thread(), get_video_frame(), and subtitle_thread().

◆ decoder_destroy()

static void decoder_destroy ( Decoder d)
static

Definition at line 672 of file ffplay.c.

Referenced by stream_component_close().

◆ frame_queue_unref_item()

static void frame_queue_unref_item ( Frame vp)
static

Definition at line 677 of file ffplay.c.

Referenced by frame_queue_destroy(), and frame_queue_next().

◆ frame_queue_init()

static int frame_queue_init ( FrameQueue f,
PacketQueue pktq,
int  max_size,
int  keep_last 
)
static

Definition at line 683 of file ffplay.c.

Referenced by stream_open().

◆ frame_queue_destroy()

static void frame_queue_destroy ( FrameQueue f)
static

Definition at line 704 of file ffplay.c.

Referenced by stream_close().

◆ frame_queue_signal()

static void frame_queue_signal ( FrameQueue f)
static

Definition at line 716 of file ffplay.c.

Referenced by decoder_abort().

◆ frame_queue_peek()

static Frame* frame_queue_peek ( FrameQueue f)
static

Definition at line 723 of file ffplay.c.

Referenced by video_image_display(), and video_refresh().

◆ frame_queue_peek_next()

static Frame* frame_queue_peek_next ( FrameQueue f)
static

Definition at line 728 of file ffplay.c.

Referenced by video_refresh().

◆ frame_queue_peek_last()

static Frame* frame_queue_peek_last ( FrameQueue f)
static

Definition at line 733 of file ffplay.c.

Referenced by video_image_display(), and video_refresh().

◆ frame_queue_peek_writable()

static Frame* frame_queue_peek_writable ( FrameQueue f)
static

Definition at line 738 of file ffplay.c.

Referenced by audio_thread(), queue_picture(), and subtitle_thread().

◆ frame_queue_peek_readable()

static Frame* frame_queue_peek_readable ( FrameQueue f)
static

Definition at line 754 of file ffplay.c.

Referenced by audio_decode_frame().

◆ frame_queue_push()

static void frame_queue_push ( FrameQueue f)
static

Definition at line 770 of file ffplay.c.

Referenced by audio_thread(), queue_picture(), and subtitle_thread().

◆ frame_queue_next()

static void frame_queue_next ( FrameQueue f)
static

Definition at line 780 of file ffplay.c.

Referenced by audio_decode_frame(), and video_refresh().

◆ frame_queue_nb_remaining()

static int frame_queue_nb_remaining ( FrameQueue f)
static

Definition at line 796 of file ffplay.c.

Referenced by audio_decode_frame(), read_thread(), video_image_display(), and video_refresh().

◆ frame_queue_last_pos()

static int64_t frame_queue_last_pos ( FrameQueue f)
static

Definition at line 802 of file ffplay.c.

Referenced by event_loop().

◆ decoder_abort()

static void decoder_abort ( Decoder d,
FrameQueue fq 
)
static

Definition at line 811 of file ffplay.c.

Referenced by stream_component_close().

◆ fill_rectangle()

static void fill_rectangle ( int  x,
int  y,
int  w,
int  h 
)
inlinestatic

◆ realloc_texture()

static int realloc_texture ( SDL_Texture **  texture,
Uint32  new_format,
int  new_width,
int  new_height,
SDL_BlendMode  blendmode,
int  init_texture 
)
static

Definition at line 831 of file ffplay.c.

Referenced by upload_texture(), video_audio_display(), and video_image_display().

◆ calculate_display_rect()

static void calculate_display_rect ( SDL_Rect *  rect,
int  scr_xleft,
int  scr_ytop,
int  scr_width,
int  scr_height,
int  pic_width,
int  pic_height,
AVRational  pic_sar 
)
static

Definition at line 855 of file ffplay.c.

Referenced by set_default_window_size(), and video_image_display().

◆ get_sdl_pix_fmt_and_blendmode()

static void get_sdl_pix_fmt_and_blendmode ( int  format,
Uint32 *  sdl_pix_fmt,
SDL_BlendMode *  sdl_blendmode 
)
static

Definition at line 882 of file ffplay.c.

Referenced by upload_texture().

◆ upload_texture()

static int upload_texture ( SDL_Texture **  tex,
AVFrame frame 
)
static

Definition at line 900 of file ffplay.c.

Referenced by video_image_display().

◆ set_sdl_yuv_conversion_mode()

static void set_sdl_yuv_conversion_mode ( AVFrame frame)
static

Definition at line 934 of file ffplay.c.

Referenced by video_image_display().

◆ video_image_display()

static void video_image_display ( VideoState is)
static

Definition at line 950 of file ffplay.c.

Referenced by video_display().

◆ compute_mod()

static int compute_mod ( int  a,
int  b 
)
inlinestatic

Definition at line 1035 of file ffplay.c.

Referenced by video_audio_display().

◆ video_audio_display()

static void video_audio_display ( VideoState s)
static

Definition at line 1040 of file ffplay.c.

Referenced by video_display().

◆ stream_component_close()

static void stream_component_close ( VideoState is,
int  stream_index 
)
static

Definition at line 1191 of file ffplay.c.

Referenced by stream_close(), and stream_cycle_channel().

◆ stream_close()

static void stream_close ( VideoState is)
static

Definition at line 1249 of file ffplay.c.

Referenced by do_exit(), and stream_open().

◆ do_exit()

static void do_exit ( VideoState is)
static

Definition at line 1285 of file ffplay.c.

Referenced by event_loop(), and main().

◆ sigterm_handler()

static void sigterm_handler ( int  sig)
static

Definition at line 1304 of file ffplay.c.

Referenced by main().

◆ set_default_window_size()

static void set_default_window_size ( int  width,
int  height,
AVRational  sar 
)
static

Definition at line 1309 of file ffplay.c.

Referenced by queue_picture(), and read_thread().

◆ video_open()

static int video_open ( VideoState is)
static

Definition at line 1321 of file ffplay.c.

Referenced by video_display().

◆ video_display()

static void video_display ( VideoState is)
static

Definition at line 1345 of file ffplay.c.

Referenced by video_refresh().

◆ get_clock()

static double get_clock ( Clock c)
static

◆ set_clock_at()

static void set_clock_at ( Clock c,
double  pts,
int  serial,
double  time 
)
static

Definition at line 1371 of file ffplay.c.

Referenced by sdl_audio_callback(), and set_clock().

◆ set_clock()

static void set_clock ( Clock c,
double  pts,
int  serial 
)
static

◆ set_clock_speed()

static void set_clock_speed ( Clock c,
double  speed 
)
static

Definition at line 1385 of file ffplay.c.

Referenced by check_external_clock_speed().

◆ init_clock()

static void init_clock ( Clock c,
int queue_serial 
)
static

Definition at line 1391 of file ffplay.c.

Referenced by stream_open().

◆ sync_clock_to_slave()

static void sync_clock_to_slave ( Clock c,
Clock slave 
)
static

Definition at line 1399 of file ffplay.c.

Referenced by sdl_audio_callback(), and update_video_pts().

◆ get_master_sync_type()

static int get_master_sync_type ( VideoState is)
static

◆ get_master_clock()

static double get_master_clock ( VideoState is)
static

◆ check_external_clock_speed()

static void check_external_clock_speed ( VideoState is)
static

Definition at line 1442 of file ffplay.c.

Referenced by video_refresh().

◆ stream_seek()

static void stream_seek ( VideoState is,
int64_t  pos,
int64_t  rel,
int  by_bytes 
)
static

Definition at line 1457 of file ffplay.c.

Referenced by event_loop(), read_thread(), and seek_chapter().

◆ stream_toggle_pause()

static void stream_toggle_pause ( VideoState is)
static

Definition at line 1471 of file ffplay.c.

Referenced by step_to_next_frame(), toggle_pause(), and video_refresh().

◆ toggle_pause()

static void toggle_pause ( VideoState is)
static

Definition at line 1484 of file ffplay.c.

Referenced by event_loop().

◆ toggle_mute()

static void toggle_mute ( VideoState is)
static

Definition at line 1490 of file ffplay.c.

Referenced by event_loop().

◆ update_volume()

static void update_volume ( VideoState is,
int  sign,
double  step 
)
static

Definition at line 1495 of file ffplay.c.

Referenced by event_loop().

◆ step_to_next_frame()

static void step_to_next_frame ( VideoState is)
static

Definition at line 1502 of file ffplay.c.

Referenced by event_loop(), and read_thread().

◆ compute_target_delay()

static double compute_target_delay ( double  delay,
VideoState is 
)
static

Definition at line 1510 of file ffplay.c.

Referenced by video_refresh().

◆ vp_duration()

static double vp_duration ( VideoState is,
Frame vp,
Frame nextvp 
)
static

Definition at line 1540 of file ffplay.c.

Referenced by video_refresh().

◆ update_video_pts()

static void update_video_pts ( VideoState is,
double  pts,
int  serial 
)
static

Definition at line 1552 of file ffplay.c.

Referenced by video_refresh().

◆ video_refresh()

static void video_refresh ( void *  opaque,
double remaining_time 
)
static

Definition at line 1560 of file ffplay.c.

Referenced by refresh_loop_wait_event().

◆ queue_picture()

static int queue_picture ( VideoState is,
AVFrame src_frame,
double  pts,
double  duration,
int64_t  pos,
int  serial 
)
static

Definition at line 1729 of file ffplay.c.

Referenced by video_thread().

◆ get_video_frame()

static int get_video_frame ( VideoState is,
AVFrame frame 
)
static

Definition at line 1760 of file ffplay.c.

Referenced by video_thread().

◆ configure_filtergraph()

static int configure_filtergraph ( AVFilterGraph graph,
const char *  filtergraph,
AVFilterContext source_ctx,
AVFilterContext sink_ctx 
)
static

Definition at line 1793 of file ffplay.c.

Referenced by configure_audio_filters(), and configure_video_filters().

◆ configure_video_filters()

static int configure_video_filters ( AVFilterGraph graph,
VideoState is,
const char *  vfilters,
AVFrame frame 
)
static

Definition at line 1836 of file ffplay.c.

Referenced by video_thread().

◆ configure_audio_filters()

static int configure_audio_filters ( VideoState is,
const char *  afilters,
int  force_output_format 
)
static

Definition at line 1952 of file ffplay.c.

Referenced by audio_thread(), and stream_component_open().

◆ audio_thread()

static int audio_thread ( void *  arg)
static

Definition at line 2028 of file ffplay.c.

Referenced by stream_component_open().

◆ decoder_start()

static int decoder_start ( Decoder d,
int(*)(void *)  fn,
const char *  thread_name,
void *  arg 
)
static

Definition at line 2106 of file ffplay.c.

Referenced by stream_component_open().

◆ video_thread()

static int video_thread ( void *  arg)
static

Definition at line 2117 of file ffplay.c.

Referenced by stream_component_open().

◆ subtitle_thread()

static int subtitle_thread ( void *  arg)
static

Definition at line 2220 of file ffplay.c.

Referenced by stream_component_open().

◆ update_sample_display()

static void update_sample_display ( VideoState is,
short samples,
int  samples_size 
)
static

Definition at line 2255 of file ffplay.c.

Referenced by sdl_audio_callback().

◆ synchronize_audio()

static int synchronize_audio ( VideoState is,
int  nb_samples 
)
static

Definition at line 2275 of file ffplay.c.

Referenced by audio_decode_frame().

◆ audio_decode_frame()

static int audio_decode_frame ( VideoState is)
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 2323 of file ffplay.c.

Referenced by sdl_audio_callback().

◆ sdl_audio_callback()

static void sdl_audio_callback ( void *  opaque,
Uint8 *  stream,
int  len 
)
static

Definition at line 2432 of file ffplay.c.

Referenced by audio_open().

◆ audio_open()

static int audio_open ( void *  opaque,
AVChannelLayout wanted_channel_layout,
int  wanted_sample_rate,
struct AudioParams audio_hw_params 
)
static

Definition at line 2475 of file ffplay.c.

Referenced by stream_component_open().

◆ stream_component_open()

static int stream_component_open ( VideoState is,
int  stream_index 
)
static

Definition at line 2552 of file ffplay.c.

Referenced by read_thread(), and stream_cycle_channel().

◆ decode_interrupt_cb()

static int decode_interrupt_cb ( void *  ctx)
static

Definition at line 2709 of file ffplay.c.

Referenced by read_thread().

◆ stream_has_enough_packets()

static int stream_has_enough_packets ( AVStream st,
int  stream_id,
PacketQueue queue 
)
static

Definition at line 2715 of file ffplay.c.

Referenced by read_thread().

◆ is_realtime()

static int is_realtime ( AVFormatContext s)
static

Definition at line 2722 of file ffplay.c.

Referenced by read_thread().

◆ read_thread()

static int read_thread ( void *  arg)
static

Definition at line 2739 of file ffplay.c.

Referenced by stream_open().

◆ stream_open()

static VideoState* stream_open ( const char *  filename,
const AVInputFormat iformat 
)
static

Definition at line 3070 of file ffplay.c.

Referenced by main().

◆ stream_cycle_channel()

static void stream_cycle_channel ( VideoState is,
int  codec_type 
)
static

Definition at line 3129 of file ffplay.c.

Referenced by event_loop().

◆ toggle_full_screen()

static void toggle_full_screen ( VideoState is)
static

Definition at line 3208 of file ffplay.c.

Referenced by event_loop().

◆ toggle_audio_display()

static void toggle_audio_display ( VideoState is)
static

Definition at line 3214 of file ffplay.c.

Referenced by event_loop().

◆ refresh_loop_wait_event()

static void refresh_loop_wait_event ( VideoState is,
SDL_Event *  event 
)
static

Definition at line 3226 of file ffplay.c.

Referenced by event_loop().

◆ seek_chapter()

static void seek_chapter ( VideoState is,
int  incr 
)
static

Definition at line 3243 of file ffplay.c.

Referenced by event_loop().

◆ event_loop()

static void event_loop ( VideoState cur_stream)
static

Definition at line 3271 of file ffplay.c.

Referenced by main().

◆ opt_width()

static int opt_width ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 3466 of file ffplay.c.

◆ opt_height()

static int opt_height ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 3477 of file ffplay.c.

◆ opt_format()

static int opt_format ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 3488 of file ffplay.c.

◆ opt_sync()

static int opt_sync ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 3498 of file ffplay.c.

◆ opt_show_mode()

static int opt_show_mode ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 3513 of file ffplay.c.

◆ opt_input_file()

static int opt_input_file ( void *  optctx,
const char *  filename 
)
static

Definition at line 3529 of file ffplay.c.

Referenced by main().

◆ opt_codec()

static int opt_codec ( void *  optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 3544 of file ffplay.c.

◆ show_usage()

static void show_usage ( void  )
static

Definition at line 3619 of file ffplay.c.

Referenced by main(), and show_help_default().

◆ 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().

Definition at line 3626 of file ffplay.c.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 3658 of file ffplay.c.

Variable Documentation

◆ program_name

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().

◆ program_birth_year

const int program_birth_year = 2003

program birth year, defined by the program for show_banner()

Definition at line 64 of file ffplay.c.

◆ file_iformat

const AVInputFormat* file_iformat
static

Definition at line 307 of file ffplay.c.

Referenced by ifile_open(), main(), and opt_format().

◆ input_filename

const char* input_filename
static

◆ window_title

const char* window_title
static

Definition at line 309 of file ffplay.c.

Referenced by read_thread(), and video_open().

◆ default_width

int default_width = 640
static

Definition at line 310 of file ffplay.c.

Referenced by main(), set_default_window_size(), and video_open().

◆ default_height

int default_height = 480
static

Definition at line 311 of file ffplay.c.

Referenced by main(), set_default_window_size(), and video_open().

◆ screen_width

int screen_width = 0
static

Definition at line 312 of file ffplay.c.

Referenced by event_loop(), opt_width(), set_default_window_size(), and video_open().

◆ screen_height

int screen_height = 0
static

Definition at line 313 of file ffplay.c.

Referenced by event_loop(), opt_height(), set_default_window_size(), and video_open().

◆ screen_left

int screen_left = SDL_WINDOWPOS_CENTERED
static

Definition at line 314 of file ffplay.c.

Referenced by video_open().

◆ screen_top

int screen_top = SDL_WINDOWPOS_CENTERED
static

Definition at line 315 of file ffplay.c.

Referenced by video_open().

◆ audio_disable

int audio_disable
static

Definition at line 316 of file ffplay.c.

Referenced by main(), map_manual(), and read_thread().

◆ video_disable

int video_disable
static

Definition at line 317 of file ffplay.c.

Referenced by main(), map_manual(), and read_thread().

◆ subtitle_disable

int subtitle_disable
static

Definition at line 318 of file ffplay.c.

Referenced by read_thread().

◆ wanted_stream_spec

const char* wanted_stream_spec[AVMEDIA_TYPE_NB] = {0}
static

Definition at line 319 of file ffplay.c.

Referenced by read_thread().

◆ seek_by_bytes

int seek_by_bytes = -1
static

Definition at line 320 of file ffplay.c.

Referenced by event_loop(), and read_thread().

◆ seek_interval

float seek_interval = 10
static

Definition at line 321 of file ffplay.c.

Referenced by event_loop().

◆ display_disable

int display_disable
static

Definition at line 322 of file ffplay.c.

Referenced by main(), and video_refresh().

◆ borderless

int borderless
static

Definition at line 323 of file ffplay.c.

Referenced by main().

◆ alwaysontop

int alwaysontop
static

Definition at line 324 of file ffplay.c.

Referenced by main().

◆ startup_volume

int startup_volume = 100
static

Definition at line 325 of file ffplay.c.

Referenced by stream_open().

◆ show_status

int show_status = -1
static

Definition at line 326 of file ffplay.c.

Referenced by do_exit(), read_thread(), and video_refresh().

◆ av_sync_type

int av_sync_type = AV_SYNC_AUDIO_MASTER
static

Definition at line 327 of file ffplay.c.

Referenced by opt_sync(), and stream_open().

◆ start_time

int64_t start_time = AV_NOPTS_VALUE
static

◆ duration

int64_t duration = AV_NOPTS_VALUE
static

Definition at line 329 of file ffplay.c.

Referenced by queue_picture(), read_thread(), video_refresh(), video_thread(), and vp_duration().

◆ fast

int fast = 0
static

Definition at line 330 of file ffplay.c.

Referenced by stream_component_open().

◆ genpts

int genpts = 0
static

Definition at line 331 of file ffplay.c.

Referenced by av_read_frame(), and read_thread().

◆ lowres

int lowres = 0
static

◆ decoder_reorder_pts

int decoder_reorder_pts = -1
static

Definition at line 333 of file ffplay.c.

Referenced by decoder_decode_frame().

◆ autoexit

int autoexit
static

Definition at line 334 of file ffplay.c.

Referenced by read_thread().

◆ exit_on_keydown

int exit_on_keydown
static

Definition at line 335 of file ffplay.c.

Referenced by event_loop().

◆ exit_on_mousedown

int exit_on_mousedown
static

Definition at line 336 of file ffplay.c.

Referenced by event_loop().

◆ loop

int loop = 1
static

◆ framedrop

int framedrop = -1
static

Definition at line 338 of file ffplay.c.

Referenced by get_video_frame(), and video_refresh().

◆ infinite_buffer

int infinite_buffer = -1
static

Definition at line 339 of file ffplay.c.

Referenced by read_thread().

◆ show_mode

enum ShowMode show_mode = SHOW_MODE_NONE
static

Definition at line 340 of file ffplay.c.

Referenced by opt_show_mode(), and read_thread().

◆ audio_codec_name

const char* audio_codec_name
static

Definition at line 341 of file ffplay.c.

Referenced by ifile_open(), opt_codec(), and stream_component_open().

◆ subtitle_codec_name

const char* subtitle_codec_name
static

Definition at line 342 of file ffplay.c.

Referenced by ifile_open(), map_auto_subtitle(), opt_codec(), and stream_component_open().

◆ video_codec_name

const char* video_codec_name
static

Definition at line 343 of file ffplay.c.

Referenced by ifile_open(), opt_codec(), and stream_component_open().

◆ rdftspeed

double rdftspeed = 0.02

Definition at line 344 of file ffplay.c.

Referenced by video_refresh().

◆ cursor_last_shown

int64_t cursor_last_shown
static

Definition at line 345 of file ffplay.c.

Referenced by event_loop(), and refresh_loop_wait_event().

◆ cursor_hidden

int cursor_hidden = 0
static

Definition at line 346 of file ffplay.c.

Referenced by event_loop(), and refresh_loop_wait_event().

◆ vfilters_list

const char** vfilters_list = NULL
static

Definition at line 347 of file ffplay.c.

Referenced by do_exit(), opt_add_vfilter(), and video_thread().

◆ nb_vfilters

int nb_vfilters = 0
static

Definition at line 348 of file ffplay.c.

Referenced by event_loop(), and opt_add_vfilter().

◆ afilters

char* afilters = NULL
static

Definition at line 349 of file ffplay.c.

Referenced by audio_thread(), configure_audio_filters(), and stream_component_open().

◆ autorotate

int autorotate = 1
static

Definition at line 350 of file ffplay.c.

Referenced by configure_video_filters(), and ist_add().

◆ find_stream_info

int find_stream_info = 1
static

Definition at line 351 of file ffplay.c.

Referenced by read_thread().

◆ filter_nbthreads

int filter_nbthreads = 0
static

Definition at line 352 of file ffplay.c.

Referenced by configure_audio_filters(), and video_thread().

◆ is_full_screen

int is_full_screen
static

Definition at line 355 of file ffplay.c.

Referenced by toggle_full_screen(), and video_open().

◆ audio_callback_time

int64_t audio_callback_time
static

Definition at line 356 of file ffplay.c.

Referenced by audio_decode_frame(), sdl_audio_callback(), and video_audio_display().

◆ window

SDL_Window* window
static

◆ renderer

SDL_Renderer* renderer
static

◆ renderer_info

SDL_RendererInfo renderer_info = {0}
static

Definition at line 362 of file ffplay.c.

Referenced by configure_video_filters(), and main().

◆ audio_dev

SDL_AudioDeviceID audio_dev
static

Definition at line 363 of file ffplay.c.

Referenced by audio_open(), stream_component_close(), and stream_component_open().

◆ sdl_texture_format_map

const struct TextureFormatEntry sdl_texture_format_map[]
static
Initial value:
= {
{ AV_PIX_FMT_RGB8, SDL_PIXELFORMAT_RGB332 },
{ AV_PIX_FMT_RGB444, SDL_PIXELFORMAT_RGB444 },
{ AV_PIX_FMT_RGB555, SDL_PIXELFORMAT_RGB555 },
{ AV_PIX_FMT_BGR555, SDL_PIXELFORMAT_BGR555 },
{ AV_PIX_FMT_RGB565, SDL_PIXELFORMAT_RGB565 },
{ AV_PIX_FMT_BGR565, SDL_PIXELFORMAT_BGR565 },
{ AV_PIX_FMT_RGB24, SDL_PIXELFORMAT_RGB24 },
{ AV_PIX_FMT_BGR24, SDL_PIXELFORMAT_BGR24 },
{ AV_PIX_FMT_0RGB32, SDL_PIXELFORMAT_RGB888 },
{ AV_PIX_FMT_0BGR32, SDL_PIXELFORMAT_BGR888 },
{ AV_PIX_FMT_NE(RGB0, 0BGR), SDL_PIXELFORMAT_RGBX8888 },
{ AV_PIX_FMT_NE(BGR0, 0RGB), SDL_PIXELFORMAT_BGRX8888 },
{ AV_PIX_FMT_RGB32, SDL_PIXELFORMAT_ARGB8888 },
{ AV_PIX_FMT_RGB32_1, SDL_PIXELFORMAT_RGBA8888 },
{ AV_PIX_FMT_BGR32, SDL_PIXELFORMAT_ABGR8888 },
{ AV_PIX_FMT_BGR32_1, SDL_PIXELFORMAT_BGRA8888 },
{ AV_PIX_FMT_YUV420P, SDL_PIXELFORMAT_IYUV },
{ AV_PIX_FMT_YUYV422, SDL_PIXELFORMAT_YUY2 },
{ AV_PIX_FMT_UYVY422, SDL_PIXELFORMAT_UYVY },
{ AV_PIX_FMT_NONE, SDL_PIXELFORMAT_UNKNOWN },
}

Referenced by configure_video_filters(), and get_sdl_pix_fmt_and_blendmode().

◆ dummy

int dummy
static

Definition at line 3566 of file ffplay.c.

◆ options

const OptionDef options[]
static

Definition at line 3568 of file ffplay.c.

Referenced by main(), and show_help_default().

name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
AV_PIX_FMT_BGR32
#define AV_PIX_FMT_BGR32
Definition: pixfmt.h:443
AV_PIX_FMT_RGB32_1
#define AV_PIX_FMT_RGB32_1
Definition: pixfmt.h:442
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
avfilter_graph_create_filter
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
Create and add a filter instance into an existing graph.
Definition: avfiltergraph.c:138
fail
#define fail()
Definition: checkasm.h:138
AV_PIX_FMT_0BGR32
#define AV_PIX_FMT_0BGR32
Definition: pixfmt.h:446
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
AV_PIX_FMT_BGR32_1
#define AV_PIX_FMT_BGR32_1
Definition: pixfmt.h:444
arg
const char * arg
Definition: jacosubdec.c:67
avfilter_get_by_name
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
Definition: allfilters.c:625
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
AV_PIX_FMT_RGB8
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:86
AV_PIX_FMT_NE
#define AV_PIX_FMT_NE(be, le)
Definition: pixfmt.h:438
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
avfilter_link
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
Definition: avfilter.c:149
AV_PIX_FMT_BGR555
#define AV_PIX_FMT_BGR555
Definition: pixfmt.h:461
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:441
AV_PIX_FMT_RGB555
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:456
AV_PIX_FMT_BGR565
#define AV_PIX_FMT_BGR565
Definition: pixfmt.h:460
AV_PIX_FMT_RGB565
#define AV_PIX_FMT_RGB565
Definition: pixfmt.h:455
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_0RGB32
#define AV_PIX_FMT_0RGB32
Definition: pixfmt.h:445
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_RGB444
#define AV_PIX_FMT_RGB444
Definition: pixfmt.h:457