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

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>
#include "cmdutils_common_opts.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
 

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   (SDL_MIX_MAXVOLUME / 50)
 
#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_ALLOC_EVENT   (SDL_USEREVENT)
 
#define FF_QUIT_EVENT   (SDL_USEREVENT + 2)
 

Enumerations

enum  { AV_SYNC_AUDIO_MASTER, AV_SYNC_VIDEO_MASTER, AV_SYNC_EXTERNAL_CLOCK }
 

Functions

static int cmp_audio_fmts (enum AVSampleFormat fmt1, int64_t channel_count1, enum AVSampleFormat fmt2, int64_t channel_count2)
 
static int64_t get_valid_channel_layout (int64_t channel_layout, int channels)
 
static void free_picture (Frame *vp)
 
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, 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 void 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_destory (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 int upload_texture (SDL_Texture *tex, AVFrame *frame, struct SwsContext **img_convert_ctx)
 
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, Frame *vp)
 
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 seek_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, int 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, int64_t pos, int serial)
 
static void video_refresh (void *opaque, double *remaining_time)
 
static void alloc_picture (VideoState *is)
 
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 audio_thread (void *arg)
 
static int decoder_start (Decoder *d, int(*fn)(void *), 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, int64_t wanted_channel_layout, int wanted_nb_channels, 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, 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_frame_size (void *optctx, const char *opt, const char *arg)
 
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_frame_pix_fmt (void *optctx, const char *opt, const char *arg)
 
static int opt_sync (void *optctx, const char *opt, const char *arg)
 
static int opt_seek (void *optctx, const char *opt, const char *arg)
 
static int opt_duration (void *optctx, const char *opt, const char *arg)
 
static int opt_show_mode (void *optctx, const char *opt, const char *arg)
 
static void 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...
 
static int lockmgr (void **mtx, enum AVLockOp op)
 
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 unsigned sws_flags = SWS_BICUBIC
 
static 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 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 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 is_full_screen
 
static int64_t audio_callback_time
 
static AVPacket flush_pkt
 
static SDL_Window * window
 
static SDL_Renderer * renderer
 
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

#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   (SDL_MIX_MAXVOLUME / 50)

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 USE_ONEPASS_SUBTITLE_RENDER   1

Definition at line 108 of file ffplay.c.

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

Definition at line 132 of file ffplay.c.

Referenced by frame_queue_init().

#define FF_ALLOC_EVENT   (SDL_USEREVENT)

Definition at line 358 of file ffplay.c.

Referenced by event_loop(), and queue_picture().

#define FF_QUIT_EVENT   (SDL_USEREVENT + 2)

Definition at line 359 of file ffplay.c.

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

Enumeration Type Documentation

anonymous enum
Enumerator
AV_SYNC_AUDIO_MASTER 
AV_SYNC_VIDEO_MASTER 
AV_SYNC_EXTERNAL_CLOCK 

Definition at line 183 of file ffplay.c.

Function Documentation

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

Definition at line 374 of file ffplay.c.

Referenced by audio_thread().

static int64_t get_valid_channel_layout ( int64_t  channel_layout,
int  channels 
)
inlinestatic

Definition at line 385 of file ffplay.c.

Referenced by audio_thread(), and stream_component_open().

static void free_picture ( Frame vp)
static

Definition at line 799 of file ffplay.c.

Referenced by frame_queue_destory().

static int packet_queue_put_private ( PacketQueue q,
AVPacket pkt 
)
static

Definition at line 395 of file ffplay.c.

Referenced by packet_queue_put(), and packet_queue_start().

static int packet_queue_put ( PacketQueue q,
AVPacket pkt 
)
static

Definition at line 424 of file ffplay.c.

Referenced by packet_queue_put_nullpacket(), and read_thread().

static int packet_queue_put_nullpacket ( PacketQueue q,
int  stream_index 
)
static

Definition at line 438 of file ffplay.c.

Referenced by read_thread().

static int packet_queue_init ( PacketQueue q)
static

Definition at line 449 of file ffplay.c.

Referenced by stream_open().

static void packet_queue_flush ( PacketQueue q)
static

Definition at line 466 of file ffplay.c.

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

static void packet_queue_destroy ( PacketQueue q)
static

Definition at line 484 of file ffplay.c.

Referenced by stream_close().

static void packet_queue_abort ( PacketQueue q)
static

Definition at line 491 of file ffplay.c.

Referenced by decoder_abort().

static void packet_queue_start ( PacketQueue q)
static

Definition at line 502 of file ffplay.c.

Referenced by decoder_start().

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

Definition at line 511 of file ffplay.c.

Referenced by decoder_decode_frame().

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

Definition at line 549 of file ffplay.c.

Referenced by stream_component_open().

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

Definition at line 557 of file ffplay.c.

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

static void decoder_destroy ( Decoder d)
static

Definition at line 639 of file ffplay.c.

Referenced by stream_component_close().

static void frame_queue_unref_item ( Frame vp)
static

Definition at line 644 of file ffplay.c.

Referenced by frame_queue_destory(), and frame_queue_next().

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

Definition at line 650 of file ffplay.c.

Referenced by stream_open().

static void frame_queue_destory ( FrameQueue f)
static

Definition at line 671 of file ffplay.c.

Referenced by stream_close().

static void frame_queue_signal ( FrameQueue f)
static

Definition at line 684 of file ffplay.c.

Referenced by decoder_abort().

static Frame* frame_queue_peek ( FrameQueue f)
static

Definition at line 691 of file ffplay.c.

Referenced by video_image_display(), and video_refresh().

static Frame* frame_queue_peek_next ( FrameQueue f)
static

Definition at line 696 of file ffplay.c.

Referenced by video_refresh().

static Frame* frame_queue_peek_last ( FrameQueue f)
static

Definition at line 701 of file ffplay.c.

Referenced by video_image_display(), and video_refresh().

static Frame* frame_queue_peek_writable ( FrameQueue f)
static

Definition at line 706 of file ffplay.c.

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

static Frame* frame_queue_peek_readable ( FrameQueue f)
static

Definition at line 722 of file ffplay.c.

Referenced by audio_decode_frame().

static void frame_queue_push ( FrameQueue f)
static

Definition at line 738 of file ffplay.c.

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

static void frame_queue_next ( FrameQueue f)
static

Definition at line 748 of file ffplay.c.

Referenced by audio_decode_frame(), and video_refresh().

static int frame_queue_nb_remaining ( FrameQueue f)
static

Definition at line 764 of file ffplay.c.

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

static int64_t frame_queue_last_pos ( FrameQueue f)
static

Definition at line 770 of file ffplay.c.

Referenced by event_loop().

static void decoder_abort ( Decoder d,
FrameQueue fq 
)
static

Definition at line 779 of file ffplay.c.

Referenced by stream_component_close().

static void fill_rectangle ( int  x,
int  y,
int  w,
int  h 
)
inlinestatic
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 807 of file ffplay.c.

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

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 829 of file ffplay.c.

Referenced by set_default_window_size(), and video_image_display().

static int upload_texture ( SDL_Texture *  tex,
AVFrame frame,
struct SwsContext **  img_convert_ctx 
)
static

Definition at line 860 of file ffplay.c.

Referenced by video_image_display().

static void video_image_display ( VideoState is)
static

Definition at line 893 of file ffplay.c.

Referenced by video_display().

static int compute_mod ( int  a,
int  b 
)
inlinestatic

Definition at line 975 of file ffplay.c.

Referenced by video_audio_display().

static void video_audio_display ( VideoState s)
static

Definition at line 980 of file ffplay.c.

Referenced by video_display().

static void stream_component_close ( VideoState is,
int  stream_index 
)
static

Definition at line 1122 of file ffplay.c.

Referenced by stream_close(), and stream_cycle_channel().

static void stream_close ( VideoState is)
static

Definition at line 1179 of file ffplay.c.

Referenced by do_exit(), and stream_open().

static void do_exit ( VideoState is)
static

Definition at line 1214 of file ffplay.c.

Referenced by alloc_picture(), event_loop(), main(), and video_open().

static void sigterm_handler ( int  sig)
static

Definition at line 1236 of file ffplay.c.

Referenced by main().

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

Definition at line 1241 of file ffplay.c.

Referenced by read_thread(), and video_open().

static int video_open ( VideoState is,
Frame vp 
)
static

Definition at line 1249 of file ffplay.c.

Referenced by alloc_picture(), and video_display().

static void video_display ( VideoState is)
static

Definition at line 1296 of file ffplay.c.

Referenced by video_refresh().

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

Definition at line 1322 of file ffplay.c.

Referenced by sdl_audio_callback(), and set_clock().

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

Definition at line 1336 of file ffplay.c.

Referenced by check_external_clock_speed().

static void init_clock ( Clock c,
int *  queue_serial 
)
static

Definition at line 1342 of file ffplay.c.

Referenced by stream_open().

static void sync_clock_to_slave ( Clock c,
Clock slave 
)
static

Definition at line 1350 of file ffplay.c.

Referenced by sdl_audio_callback(), and update_video_pts().

static int get_master_sync_type ( VideoState is)
static
static double get_master_clock ( VideoState is)
static
static void check_external_clock_speed ( VideoState is)
static

Definition at line 1393 of file ffplay.c.

Referenced by video_refresh().

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

Definition at line 1422 of file ffplay.c.

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

static void toggle_pause ( VideoState is)
static

Definition at line 1435 of file ffplay.c.

Referenced by event_loop().

static void toggle_mute ( VideoState is)
static

Definition at line 1441 of file ffplay.c.

Referenced by event_loop().

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

Definition at line 1446 of file ffplay.c.

Referenced by event_loop().

static void step_to_next_frame ( VideoState is)
static

Definition at line 1451 of file ffplay.c.

Referenced by event_loop(), and read_thread().

static double compute_target_delay ( double  delay,
VideoState is 
)
static

Definition at line 1459 of file ffplay.c.

Referenced by video_refresh().

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

Definition at line 1489 of file ffplay.c.

Referenced by video_refresh().

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

Definition at line 1501 of file ffplay.c.

Referenced by video_refresh().

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

Definition at line 1508 of file ffplay.c.

Referenced by refresh_loop_wait_event().

static void alloc_picture ( VideoState is)
static

Definition at line 1668 of file ffplay.c.

Referenced by event_loop().

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

Definition at line 1698 of file ffplay.c.

Referenced by video_thread().

static int get_video_frame ( VideoState is,
AVFrame frame 
)
static

Definition at line 1761 of file ffplay.c.

Referenced by video_thread().

static int audio_thread ( void arg)
static

Definition at line 2007 of file ffplay.c.

Referenced by stream_component_open().

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

Definition at line 2094 of file ffplay.c.

Referenced by stream_component_open().

static int video_thread ( void arg)
static

Definition at line 2105 of file ffplay.c.

Referenced by stream_component_open().

static int subtitle_thread ( void arg)
static

Definition at line 2214 of file ffplay.c.

Referenced by stream_component_open().

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

Definition at line 2249 of file ffplay.c.

Referenced by sdl_audio_callback().

static int synchronize_audio ( VideoState is,
int  nb_samples 
)
static

Definition at line 2269 of file ffplay.c.

Referenced by 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 2317 of file ffplay.c.

Referenced by sdl_audio_callback().

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

Definition at line 2430 of file ffplay.c.

Referenced by audio_open().

static int audio_open ( void opaque,
int64_t  wanted_channel_layout,
int  wanted_nb_channels,
int  wanted_sample_rate,
struct AudioParams audio_hw_params 
)
static

Definition at line 2473 of file ffplay.c.

Referenced by stream_component_open().

static int stream_component_open ( VideoState is,
int  stream_index 
)
static

Definition at line 2547 of file ffplay.c.

Referenced by read_thread(), and stream_cycle_channel().

static int decode_interrupt_cb ( void ctx)
static

Definition at line 2706 of file ffplay.c.

Referenced by read_thread().

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

Definition at line 2712 of file ffplay.c.

Referenced by read_thread().

static int is_realtime ( AVFormatContext s)
static

Definition at line 2719 of file ffplay.c.

Referenced by read_thread().

static int read_thread ( void arg)
static

Definition at line 2736 of file ffplay.c.

Referenced by stream_open().

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

Definition at line 3058 of file ffplay.c.

Referenced by main().

static void stream_cycle_channel ( VideoState is,
int  codec_type 
)
static

Definition at line 3107 of file ffplay.c.

Referenced by event_loop().

static void toggle_full_screen ( VideoState is)
static

Definition at line 3186 of file ffplay.c.

Referenced by event_loop().

static void toggle_audio_display ( VideoState is)
static

Definition at line 3192 of file ffplay.c.

Referenced by event_loop().

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

Definition at line 3204 of file ffplay.c.

Referenced by event_loop().

static void seek_chapter ( VideoState is,
int  incr 
)
static

Definition at line 3221 of file ffplay.c.

Referenced by event_loop().

static void event_loop ( VideoState cur_stream)
static

Definition at line 3249 of file ffplay.c.

Referenced by main().

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

Definition at line 3452 of file ffplay.c.

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

Definition at line 3458 of file ffplay.c.

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

Definition at line 3464 of file ffplay.c.

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

Definition at line 3470 of file ffplay.c.

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

Definition at line 3480 of file ffplay.c.

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

Definition at line 3486 of file ffplay.c.

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

Definition at line 3501 of file ffplay.c.

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

Definition at line 3507 of file ffplay.c.

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

Definition at line 3513 of file ffplay.c.

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

Definition at line 3522 of file ffplay.c.

Referenced by main().

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

Definition at line 3535 of file ffplay.c.

static void show_usage ( void  )
static

Definition at line 3606 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().

Definition at line 3613 of file ffplay.c.

static int lockmgr ( void **  mtx,
enum AVLockOp  op 
)
static

Definition at line 3648 of file ffplay.c.

Referenced by main().

int main ( int  argc,
char **  argv 
)

Definition at line 3670 of file ffplay.c.

Variable Documentation

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

Definition at line 64 of file ffplay.c.

unsigned sws_flags = SWS_BICUBIC
static

Definition at line 110 of file ffplay.c.

Referenced by upload_texture().

AVInputFormat* file_iformat
static

Definition at line 311 of file ffplay.c.

Referenced by open_input_file().

const char* input_filename
static
Examples:
avio_reading.c.

Definition at line 312 of file ffplay.c.

Referenced by main(), open_input_stream(), opt_input_file(), read_thread(), and video_open().

const char* window_title
static

Definition at line 313 of file ffplay.c.

Referenced by read_thread(), and video_open().

int default_width = 640
static

Definition at line 314 of file ffplay.c.

Referenced by set_default_window_size(), and video_open().

int default_height = 480
static

Definition at line 315 of file ffplay.c.

Referenced by set_default_window_size(), and video_open().

int screen_width = 0
static

Definition at line 316 of file ffplay.c.

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

int screen_height = 0
static

Definition at line 317 of file ffplay.c.

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

int audio_disable
static

Definition at line 318 of file ffplay.c.

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

int video_disable
static

Definition at line 319 of file ffplay.c.

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

int subtitle_disable
static

Definition at line 320 of file ffplay.c.

Referenced by read_thread().

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

Definition at line 321 of file ffplay.c.

Referenced by read_thread().

int seek_by_bytes = -1
static

Definition at line 322 of file ffplay.c.

Referenced by event_loop(), and read_thread().

int display_disable
static

Definition at line 323 of file ffplay.c.

Referenced by main(), and video_refresh().

int show_status = 1
static

Definition at line 324 of file ffplay.c.

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

int av_sync_type = AV_SYNC_AUDIO_MASTER
static

Definition at line 325 of file ffplay.c.

Referenced by opt_sync(), and stream_open().

int64_t start_time = AV_NOPTS_VALUE
static
int64_t duration = AV_NOPTS_VALUE
static
int fast = 0
static

Definition at line 328 of file ffplay.c.

Referenced by stream_component_open().

int genpts = 0
static

Definition at line 329 of file ffplay.c.

Referenced by av_read_frame(), and read_thread().

int lowres = 0
static
int decoder_reorder_pts = -1
static

Definition at line 331 of file ffplay.c.

Referenced by decoder_decode_frame().

int autoexit
static

Definition at line 332 of file ffplay.c.

Referenced by read_thread().

int exit_on_keydown
static

Definition at line 333 of file ffplay.c.

Referenced by event_loop().

int exit_on_mousedown
static

Definition at line 334 of file ffplay.c.

Referenced by event_loop().

int loop = 1
static
int framedrop = -1
static

Definition at line 336 of file ffplay.c.

Referenced by get_video_frame(), and video_refresh().

int infinite_buffer = -1
static

Definition at line 337 of file ffplay.c.

Referenced by read_thread().

enum ShowMode show_mode = SHOW_MODE_NONE
static

Definition at line 338 of file ffplay.c.

Referenced by opt_show_mode(), and read_thread().

const char* audio_codec_name
static

Definition at line 339 of file ffplay.c.

Referenced by compute_status(), open_input_file(), opt_codec(), and stream_component_open().

const char* subtitle_codec_name
static

Definition at line 340 of file ffplay.c.

Referenced by open_input_file(), open_output_file(), opt_codec(), and stream_component_open().

const char* video_codec_name
static

Definition at line 341 of file ffplay.c.

Referenced by compute_status(), open_input_file(), opt_codec(), and stream_component_open().

double rdftspeed = 0.02

Definition at line 342 of file ffplay.c.

Referenced by video_refresh().

int64_t cursor_last_shown
static

Definition at line 343 of file ffplay.c.

Referenced by event_loop(), and refresh_loop_wait_event().

int cursor_hidden = 0
static

Definition at line 344 of file ffplay.c.

Referenced by event_loop(), and refresh_loop_wait_event().

int autorotate = 1
static

Definition at line 350 of file ffplay.c.

Referenced by add_input_streams().

int is_full_screen
static

Definition at line 353 of file ffplay.c.

Referenced by toggle_full_screen(), and video_open().

int64_t audio_callback_time
static

Definition at line 354 of file ffplay.c.

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

AVPacket flush_pkt
static

Definition at line 356 of file ffplay.c.

Referenced by parse_packet().

SDL_Window* window
static
SDL_Renderer* renderer
static
int dummy
static

Definition at line 3557 of file ffplay.c.

const OptionDef options[]
static

Definition at line 3559 of file ffplay.c.