#include "config.h"
#include <inttypes.h>
#include <math.h>
#include <limits.h>
#include <signal.h>
#include "libavutil/avstring.h"
#include "libavutil/colorspace.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 "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 <unistd.h>
#include <assert.h>
#include "cmdutils_common_opts.h"
Go to the source code of this file.
Data Structures | |
struct | PacketQueue |
struct | VideoPicture |
struct | SubPicture |
struct | VideoState |
struct | AllocEventProps |
Defines | |
#define | MAX_QUEUE_SIZE (15 * 1024 * 1024) |
#define | MIN_FRAMES 5 |
#define | SDL_AUDIO_BUFFER_SIZE 1024 |
#define | AV_SYNC_THRESHOLD 0.01 |
#define | AV_NOSYNC_THRESHOLD 10.0 |
#define | SAMPLE_CORRECTION_PERCENT_MAX 10 |
#define | AUDIO_DIFF_AVG_NB 20 |
#define | SAMPLE_ARRAY_SIZE (2 * 65536) |
#define | VIDEO_PICTURE_QUEUE_SIZE 2 |
#define | SUBPICTURE_QUEUE_SIZE 4 |
#define | FF_ALLOC_EVENT (SDL_USEREVENT) |
#define | FF_REFRESH_EVENT (SDL_USEREVENT + 1) |
#define | FF_QUIT_EVENT (SDL_USEREVENT + 2) |
#define | ALPHA_BLEND(a, oldp, newp, s) ((((oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s)) |
#define | RGBA_IN(r, g, b, a, s) |
#define | YUVA_IN(y, u, v, a, s, pal) |
#define | YUVA_OUT(d, y, u, v, a) |
#define | BPP 1 |
Enumerations | |
enum | { AV_SYNC_AUDIO_MASTER, AV_SYNC_VIDEO_MASTER, AV_SYNC_EXTERNAL_CLOCK } |
Functions | |
static int | opt_help (const char *opt, const char *arg) |
void av_noreturn | exit_program (int ret) |
Do all the necessary cleanup and abort. | |
static int | packet_queue_put_private (PacketQueue *q, AVPacket *pkt) |
static int | packet_queue_put (PacketQueue *q, AVPacket *pkt) |
static void | 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) |
static void | fill_rectangle (SDL_Surface *screen, int x, int y, int w, int h, int color) |
static void | blend_subrect (AVPicture *dst, const AVSubtitleRect *rect, int imgw, int imgh) |
static void | free_subpicture (SubPicture *sp) |
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_close (VideoState *is) |
static void | do_exit (VideoState *is) |
static void | sigterm_handler (int sig) |
static int | video_open (VideoState *is, int force_set_video_mode) |
static void | video_display (VideoState *is) |
static int | refresh_thread (void *opaque) |
static double | get_audio_clock (VideoState *is) |
static double | get_video_clock (VideoState *is) |
static double | get_external_clock (VideoState *is) |
static double | get_master_clock (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 double | compute_target_delay (double delay, VideoState *is) |
static void | pictq_next_picture (VideoState *is) |
static void | update_video_pts (VideoState *is, double pts, int64_t pos) |
static void | video_refresh (void *opaque) |
static void | alloc_picture (AllocEventProps *event_props) |
static int | queue_picture (VideoState *is, AVFrame *src_frame, double pts1, int64_t pos) |
static int | get_video_frame (VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt) |
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, double *pts_ptr) |
static void | sdl_audio_callback (void *opaque, Uint8 *stream, int len) |
static int | stream_component_open (VideoState *is, int stream_index) |
static void | stream_component_close (VideoState *is, int stream_index) |
static int | decode_interrupt_cb (void *ctx) |
static int | read_thread (void *arg) |
static VideoState * | stream_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_pause (VideoState *is) |
static void | step_to_next_frame (VideoState *is) |
static void | toggle_audio_display (VideoState *is) |
static void | event_loop (VideoState *cur_stream) |
static int | opt_frame_size (const char *opt, const char *arg) |
static int | opt_width (const char *opt, const char *arg) |
static int | opt_height (const char *opt, const char *arg) |
static int | opt_format (const char *opt, const char *arg) |
static int | opt_frame_pix_fmt (const char *opt, const char *arg) |
static int | opt_sync (const char *opt, const char *arg) |
static int | opt_seek (const char *opt, const char *arg) |
static int | opt_duration (const char *opt, const char *arg) |
static int | opt_show_mode (const char *opt, const char *arg) |
static void | opt_input_file (void *optctx, const char *filename) |
static int | opt_codec (void *o, const char *opt, const char *arg) |
static void | show_usage (void) |
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(). | |
const int | program_birth_year = 2003 |
program birth year, defined by the program for show_banner() | |
static int | sws_flags = SWS_BICUBIC |
static AVInputFormat * | file_iformat |
static const char * | input_filename |
static const char * | window_title |
static int | fs_screen_width |
static int | fs_screen_height |
static int | screen_width = 0 |
static int | screen_height = 0 |
static int | audio_disable |
static int | video_disable |
static int | wanted_stream [AVMEDIA_TYPE_NB] |
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 | workaround_bugs = 1 |
static int | fast = 0 |
static int | genpts = 0 |
static int | lowres = 0 |
static int | idct = FF_IDCT_AUTO |
static enum AVDiscard | skip_frame = AVDISCARD_DEFAULT |
static enum AVDiscard | skip_idct = AVDISCARD_DEFAULT |
static enum AVDiscard | skip_loop_filter = AVDISCARD_DEFAULT |
static int | error_concealment = 3 |
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 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 |
static int | rdftspeed = 20 |
static int | is_full_screen |
static int64_t | audio_callback_time |
static AVPacket | flush_pkt |
static SDL_Surface * | screen |
static int | dummy |
static const OptionDef | options [] |
Definition in file ffplay.c.
#define ALPHA_BLEND | ( | a, | |||
oldp, | |||||
newp, | |||||
s | ) | ((((oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s)) |
#define AUDIO_DIFF_AVG_NB 20 |
Definition at line 81 of file ffplay.c.
Referenced by stream_component_open(), and synchronize_audio().
#define AV_NOSYNC_THRESHOLD 10.0 |
Definition at line 75 of file ffplay.c.
Referenced by compute_target_delay(), get_video_frame(), synchronize_audio(), and video_thread().
#define AV_SYNC_THRESHOLD 0.01 |
#define BPP 1 |
#define FF_ALLOC_EVENT (SDL_USEREVENT) |
#define FF_QUIT_EVENT (SDL_USEREVENT + 2) |
Definition at line 298 of file ffplay.c.
Referenced by event_loop(), read_thread(), and video_thread().
#define FF_REFRESH_EVENT (SDL_USEREVENT + 1) |
#define MAX_QUEUE_SIZE (15 * 1024 * 1024) |
#define MIN_FRAMES 5 |
#define RGBA_IN | ( | r, | |||
g, | |||||
b, | |||||
a, | |||||
s | ) |
#define SAMPLE_ARRAY_SIZE (2 * 65536) |
Definition at line 84 of file ffplay.c.
Referenced by update_sample_display(), and video_audio_display().
#define SAMPLE_CORRECTION_PERCENT_MAX 10 |
#define SDL_AUDIO_BUFFER_SIZE 1024 |
#define SUBPICTURE_QUEUE_SIZE 4 |
#define VIDEO_PICTURE_QUEUE_SIZE 2 |
Definition at line 97 of file ffplay.c.
Referenced by get_video_frame(), pictq_next_picture(), queue_picture(), stream_close(), toggle_full_screen(), and video_refresh().
#define YUVA_IN | ( | y, | |||
u, | |||||
v, | |||||
a, | |||||
s, | |||||
pal | ) |
Value:
{\ unsigned int val = ((const uint32_t *)(pal))[*(const uint8_t*)(s)];\ a = (val >> 24) & 0xff;\ y = (val >> 16) & 0xff;\ u = (val >> 8) & 0xff;\ v = val & 0xff;\ }
Definition at line 461 of file ffplay.c.
Referenced by blend_subrect().
#define YUVA_OUT | ( | d, | |||
y, | |||||
u, | |||||
v, | |||||
a | ) |
Value:
{\ ((uint32_t *)(d))[0] = (a << 24) | (y << 16) | (u << 8) | v;\ }
Definition at line 470 of file ffplay.c.
Referenced by subtitle_thread().
anonymous enum |
static void alloc_picture | ( | AllocEventProps * | event_props | ) | [static] |
static int audio_decode_frame | ( | VideoState * | is, | |
double * | pts_ptr | |||
) | [static] |
static void blend_subrect | ( | AVPicture * | dst, | |
const AVSubtitleRect * | rect, | |||
int | imgw, | |||
int | imgh | |||
) | [static] |
static int compute_mod | ( | int | a, | |
int | b | |||
) | [inline, static] |
static double compute_target_delay | ( | double | delay, | |
VideoState * | is | |||
) | [static] |
static void do_exit | ( | VideoState * | is | ) | [static] |
Definition at line 929 of file ffplay.c.
Referenced by alloc_picture(), event_loop(), main(), and video_open().
static void event_loop | ( | VideoState * | cur_stream | ) | [static] |
void av_noreturn exit_program | ( | int | ret | ) |
static void fill_rectangle | ( | SDL_Surface * | screen, | |
int | x, | |||
int | y, | |||
int | w, | |||
int | h, | |||
int | color | |||
) | [inline, static] |
Definition at line 438 of file ffplay.c.
Referenced by decode_cabac_luma_residual(), decode_cabac_residual_internal(), decode_cabac_residual_nondc(), decode_luma_residual(), decode_mb(), ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), fill_decode_caches(), fill_filter_caches_inter(), hl_decode_mb_444_internal(), hl_decode_mb_internal(), 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(), toggle_audio_display(), video_audio_display(), write_back_motion(), and ZERO8x2().
static void free_subpicture | ( | SubPicture * | sp | ) | [static] |
static double get_audio_clock | ( | VideoState * | is | ) | [static] |
Definition at line 1021 of file ffplay.c.
Referenced by get_master_clock(), synchronize_audio(), and video_refresh().
static double get_external_clock | ( | VideoState * | is | ) | [static] |
static double get_master_clock | ( | VideoState * | is | ) | [static] |
Definition at line 1049 of file ffplay.c.
Referenced by compute_target_delay(), event_loop(), get_video_frame(), synchronize_audio(), and video_refresh().
static double get_video_clock | ( | VideoState * | is | ) | [static] |
Definition at line 1031 of file ffplay.c.
Referenced by compute_target_delay(), get_master_clock(), get_video_frame(), and video_refresh().
static int get_video_frame | ( | VideoState * | is, | |
AVFrame * | frame, | |||
int64_t * | pts, | |||
AVPacket * | pkt | |||
) | [static] |
static int lockmgr | ( | void ** | mtx, | |
enum AVLockOp | op | |||
) | [static] |
static int opt_codec | ( | void * | o, | |
const char * | opt, | |||
const char * | arg | |||
) | [static] |
static int opt_duration | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static int opt_format | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static int opt_frame_pix_fmt | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static int opt_frame_size | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static int opt_height | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static int opt_help | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static void opt_input_file | ( | void * | optctx, | |
const char * | filename | |||
) | [static] |
static int opt_seek | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static int opt_show_mode | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static int opt_sync | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static int opt_width | ( | const char * | opt, | |
const char * | arg | |||
) | [static] |
static void packet_queue_abort | ( | PacketQueue * | q | ) | [static] |
static void packet_queue_destroy | ( | PacketQueue * | q | ) | [static] |
static void packet_queue_flush | ( | PacketQueue * | q | ) | [static] |
Definition at line 359 of file ffplay.c.
Referenced by packet_queue_destroy(), read_thread(), and stream_component_close().
static int packet_queue_get | ( | PacketQueue * | q, | |
AVPacket * | pkt, | |||
int | block | |||
) | [static] |
Definition at line 403 of file ffplay.c.
Referenced by audio_decode_frame(), get_video_frame(), and subtitle_thread().
static void packet_queue_init | ( | PacketQueue * | q | ) | [static] |
static int packet_queue_put | ( | PacketQueue * | q, | |
AVPacket * | pkt | |||
) | [static] |
static int packet_queue_put_private | ( | PacketQueue * | q, | |
AVPacket * | pkt | |||
) | [static] |
Definition at line 307 of file ffplay.c.
Referenced by packet_queue_put(), and packet_queue_start().
static void packet_queue_start | ( | PacketQueue * | q | ) | [static] |
static void pictq_next_picture | ( | VideoState * | is | ) | [static] |
static int queue_picture | ( | VideoState * | is, | |
AVFrame * | src_frame, | |||
double | pts1, | |||
int64_t | pos | |||
) | [static] |
static int read_thread | ( | void * | arg | ) | [static] |
static int refresh_thread | ( | void * | opaque | ) | [static] |
static void sdl_audio_callback | ( | void * | opaque, | |
Uint8 * | stream, | |||
int | len | |||
) | [static] |
static void step_to_next_frame | ( | VideoState * | is | ) | [static] |
static void stream_close | ( | VideoState * | is | ) | [static] |
static void stream_component_close | ( | VideoState * | is, | |
int | stream_index | |||
) | [static] |
static int stream_component_open | ( | VideoState * | is, | |
int | stream_index | |||
) | [static] |
static void stream_cycle_channel | ( | VideoState * | is, | |
int | codec_type | |||
) | [static] |
static VideoState* stream_open | ( | const char * | filename, | |
AVInputFormat * | iformat | |||
) | [static] |
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 1083 of file ffplay.c.
Referenced by step_to_next_frame(), toggle_pause(), and video_thread().
static int subtitle_thread | ( | void * | arg | ) | [static] |
static int synchronize_audio | ( | VideoState * | is, | |
int | nb_samples | |||
) | [static] |
static void toggle_audio_display | ( | VideoState * | is | ) | [static] |
static void toggle_full_screen | ( | VideoState * | is | ) | [static] |
static void toggle_pause | ( | VideoState * | is | ) | [static] |
static void update_sample_display | ( | VideoState * | is, | |
short * | samples, | |||
int | samples_size | |||
) | [static] |
static void update_video_pts | ( | VideoState * | is, | |
double | pts, | |||
int64_t | pos | |||
) | [static] |
static void video_audio_display | ( | VideoState * | s | ) | [static] |
static void video_display | ( | VideoState * | is | ) | [static] |
static void video_image_display | ( | VideoState * | is | ) | [static] |
static int video_open | ( | VideoState * | is, | |
int | force_set_video_mode | |||
) | [static] |
Definition at line 952 of file ffplay.c.
Referenced by alloc_picture(), toggle_full_screen(), and video_display().
static void video_refresh | ( | void * | opaque | ) | [static] |
static int video_thread | ( | void * | arg | ) | [static] |
int64_t audio_callback_time [static] |
Definition at line 292 of file ffplay.c.
Referenced by sdl_audio_callback(), and video_audio_display().
const char* audio_codec_name [static] |
int audio_disable [static] |
Definition at line 253 of file ffplay.c.
Referenced by main(), opt_output_file(), and read_thread().
int autoexit [static] |
int av_sync_type = AV_SYNC_AUDIO_MASTER [static] |
int decoder_reorder_pts = -1 [static] |
int display_disable [static] |
int dummy [static] |
Definition at line 3111 of file ffplay.c.
Referenced by dct_quantize_TMPL(), draw_glyphs(), draw_text(), init(), libAVMemInputPin_Receive(), nut_write_packet(), read_seek(), test_motion(), yuv2bgr24_X_ar_TMPL(), yuv2bgr24_X_TMPL(), yuv2rgb32_X_ar_TMPL(), yuv2rgb32_X_TMPL(), yuv2rgb555_X_ar_TMPL(), yuv2rgb555_X_TMPL(), yuv2rgb565_X_ar_TMPL(), yuv2rgb565_X_TMPL(), yuv2yuyv422_X_ar_TMPL(), and yuv2yuyv422_X_TMPL().
int64_t duration = AV_NOPTS_VALUE [static] |
Definition at line 265 of file ffplay.c.
Referenced by asf_write_header1(), ass_decode_frame(), avformat_find_stream_info(), avpriv_vorbis_parse_frame(), bluray_open(), compute_pkt_fields(), dca_parse(), do_video_out(), estimate_timings_from_bit_rate(), estimate_timings_from_pts(), ff_ass_add_rect(), ffm_read_packet(), hls_read_header(), hls_read_seek(), init(), main(), mkv_write_ass_blocks(), mkv_write_packet_internal(), mkv_write_srt_blocks(), mov_flush_fragment(), mov_read_ctts(), mov_read_elst(), mov_read_stts(), mov_write_ctts_tag(), mov_write_edts_tag(), mov_write_stts_tag(), mov_write_tkhd_tag(), nsv_parse_NSVf_header(), oggvorbis_encode_frame(), opt_duration(), output_packet(), parse_playlist(), qdm2_decode_fft_packets(), read_braindead_odml_indx(), read_frame(), read_thread(), rm_read_header(), rv10_write_header(), smjpeg_read_header(), srt_get_duration(), swr_next_pts(), theora_packet(), update_stream_timings(), video_refresh(), vorbis_packet(), and wavesynth_decode().
int error_concealment = 3 [static] |
int exit_on_keydown [static] |
int exit_on_mousedown [static] |
int fast = 0 [static] |
AVInputFormat* file_iformat [static] |
int framedrop = -1 [static] |
int fs_screen_height [static] |
int fs_screen_width [static] |
int genpts = 0 [static] |
int idct = FF_IDCT_AUTO [static] |
Definition at line 270 of file ffplay.c.
Referenced by draw_basis(), ff_simple_idct_add_mmx(), ff_simple_idct_mmx(), ff_simple_idct_put_mmx(), ff_vp3_idct_add_c(), ff_vp3_idct_c(), ff_vp3_idct_put_c(), idct_put(), and stream_component_open().
const char* input_filename [static] |
Definition at line 247 of file ffplay.c.
Referenced by main(), open_input_stream(), opt_input_file(), read_thread(), and video_open().
int is_full_screen [static] |
int loop = 1 [static] |
int lowres = 0 [static] |
Definition at line 269 of file ffplay.c.
Referenced by chroma_4mv_motion_lowres(), hpel_motion_lowres(), mpeg_decode_slice(), mpeg_motion_lowres(), MPV_motion_lowres(), and stream_component_open().
const int program_birth_year = 2003 |
program birth year, defined by the program for show_banner()
const char program_name[] = "ffplay" |
int rdftspeed = 20 [static] |
SDL_Surface* screen [static] |
Definition at line 300 of file ffplay.c.
Referenced by alloc_picture(), event_loop(), toggle_audio_display(), video_audio_display(), video_display(), video_open(), x11grab_draw_region_win(), x11grab_read_header(), x11grab_read_packet(), and x11grab_region_win_init().
int screen_height = 0 [static] |
Definition at line 252 of file ffplay.c.
Referenced by event_loop(), opt_height(), and video_open().
int screen_width = 0 [static] |
int seek_by_bytes = -1 [static] |
enum ShowMode show_mode = SHOW_MODE_NONE [static] |
int show_status = 1 [static] |
Definition at line 262 of file ffplay.c.
Referenced by do_exit(), read_thread(), and video_refresh().
enum AVDiscard skip_frame = AVDISCARD_DEFAULT [static] |
Definition at line 272 of file ffplay.c.
Referenced by MPV_decode_mb_internal(), and stream_component_open().
enum AVDiscard skip_loop_filter = AVDISCARD_DEFAULT [static] |
Definition at line 273 of file ffplay.c.
Referenced by stream_component_open(), and update_context_from_user().
int64_t start_time = AV_NOPTS_VALUE [static] |
Definition at line 264 of file ffplay.c.
Referenced by asf_read_stream_properties(), gxf_seek(), libAVFilter_Run(), main(), opt_seek(), put_image(), read_thread(), rm_read_header(), skeleton_header(), and update_stream_timings().
const char* subtitle_codec_name [static] |
const char* video_codec_name [static] |
int video_disable [static] |
Definition at line 254 of file ffplay.c.
Referenced by main(), opt_output_file(), and read_thread().
int wanted_stream[AVMEDIA_TYPE_NB] [static] |
Initial value:
{ [AVMEDIA_TYPE_AUDIO] = -1, [AVMEDIA_TYPE_VIDEO] = -1, [AVMEDIA_TYPE_SUBTITLE] = -1, }
Definition at line 255 of file ffplay.c.
Referenced by read_thread().
const char* window_title [static] |
int workaround_bugs = 1 [static] |