#include <math.h>#include <limits.h>#include "libavutil/avstring.h"#include "libavformat/avformat.h"#include "libavformat/rtsp.h"#include "libavdevice/avdevice.h"#include "libswscale/swscale.h"#include "libavcodec/audioconvert.h"#include "libavcodec/opt.h"#include "cmdutils.h"#include <SDL.h>#include <SDL_thread.h>Go to the source code of this file.
| Data Structures | |
| struct | PacketQueue | 
| struct | VideoPicture | 
| struct | SubPicture | 
| struct | VideoState | 
| Defines | |
| #define | MAX_VIDEOQ_SIZE (5 * 256 * 1024) | 
| #define | MAX_AUDIOQ_SIZE (5 * 16 * 1024) | 
| #define | MAX_SUBTITLEQ_SIZE (5 * 16 * 1024) | 
| #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 1 | 
| #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 | SCALEBITS 10 | 
| #define | ONE_HALF (1 << (SCALEBITS - 1)) | 
| #define | FIX(x) ((int) ((x) * (1<<SCALEBITS) + 0.5)) | 
| #define | RGB_TO_Y_CCIR(r, g, b) | 
| #define | RGB_TO_U_CCIR(r1, g1, b1, shift) | 
| #define | RGB_TO_V_CCIR(r1, g1, b1, shift) | 
| #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 void | show_help (void) | 
| static int | audio_write_get_buf_size (VideoState *is) | 
| static void | packet_queue_init (PacketQueue *q) | 
| static void | packet_queue_flush (PacketQueue *q) | 
| static void | packet_queue_end (PacketQueue *q) | 
| static int | packet_queue_put (PacketQueue *q, AVPacket *pkt) | 
| static void | packet_queue_abort (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 int | video_open (VideoState *is) | 
| static void | video_display (VideoState *is) | 
| static Uint32 | sdl_refresh_timer_cb (Uint32 interval, void *opaque) | 
| static void | schedule_refresh (VideoState *is, int delay) | 
| 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, int rel) | 
| static void | stream_pause (VideoState *is) | 
| static double | compute_frame_delay (double frame_current_pts, VideoState *is) | 
| static void | video_refresh_timer (void *opaque) | 
| static void | alloc_picture (void *opaque) | 
| static int | queue_picture (VideoState *is, AVFrame *src_frame, double pts) | 
| static int | output_picture2 (VideoState *is, AVFrame *src_frame, double pts1) | 
| compute the exact PTS for the picture if it is omitted in the stream | |
| 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, short *samples, int samples_size1, double pts) | 
| 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 void | dump_stream_info (const AVFormatContext *s) | 
| static int | decode_interrupt_cb (void) | 
| static int | decode_thread (void *arg) | 
| static VideoState * | stream_open (const char *filename, AVInputFormat *iformat) | 
| static void | stream_close (VideoState *is) | 
| static void | stream_cycle_channel (VideoState *is, int codec_type) | 
| static void | toggle_full_screen (void) | 
| static void | toggle_pause (void) | 
| static void | step_to_next_frame (void) | 
| static void | do_exit (void) | 
| static void | toggle_audio_display (void) | 
| static void | event_loop (void) | 
| static void | opt_frame_size (const char *arg) | 
| static int | opt_width (const char *opt, const char *arg) | 
| static int | opt_height (const char *opt, const char *arg) | 
| static void | opt_format (const char *arg) | 
| static void | opt_frame_pix_fmt (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_debug (const char *opt, const char *arg) | 
| static int | opt_vismv (const char *opt, const char *arg) | 
| static int | opt_thread_count (const char *opt, const char *arg) | 
| static void | opt_input_file (const char *filename) | 
| 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 int | fs_screen_width | 
| static int | fs_screen_height | 
| static int | screen_width = 0 | 
| static int | screen_height = 0 | 
| static int | frame_width = 0 | 
| static int | frame_height = 0 | 
| static enum PixelFormat | frame_pix_fmt = PIX_FMT_NONE | 
| static int | audio_disable | 
| static int | video_disable | 
| static int | wanted_audio_stream = 0 | 
| static int | wanted_video_stream = 0 | 
| static int | wanted_subtitle_stream = -1 | 
| static int | seek_by_bytes | 
| static int | display_disable | 
| static int | show_status | 
| static int | av_sync_type = AV_SYNC_AUDIO_MASTER | 
| static int64_t | start_time = AV_NOPTS_VALUE | 
| static int | debug = 0 | 
| static int | debug_mv = 0 | 
| static int | step = 0 | 
| static int | thread_count = 1 | 
| 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_recognition = FF_ER_CAREFUL | 
| static int | error_concealment = 3 | 
| static int | decoder_reorder_pts = 0 | 
| static int | is_full_screen | 
| static VideoState * | cur_stream | 
| static int64_t | audio_callback_time | 
| static AVPacket | flush_pkt | 
| static SDL_Surface * | screen | 
| static VideoState * | global_video_state | 
| static const OptionDef | options [] | 
| #define ALPHA_BLEND | ( | a, | |||
| oldp, | |||||
| newp, | |||||
| s | ) | ((((oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s)) | 
| #define AUDIO_DIFF_AVG_NB 20 | 
Definition at line 65 of file ffplay.c.
Referenced by stream_component_open(), and synchronize_audio().
| #define AV_NOSYNC_THRESHOLD 10.0 | 
Definition at line 59 of file ffplay.c.
Referenced by compute_frame_delay(), and synchronize_audio().
| #define AV_SYNC_THRESHOLD 0.01 | 
| #define BPP 1 | 
| #define FF_ALLOC_EVENT (SDL_USEREVENT) | 
| #define FF_QUIT_EVENT (SDL_USEREVENT + 2) | 
| #define FF_REFRESH_EVENT (SDL_USEREVENT + 1) | 
| #define MAX_AUDIOQ_SIZE (5 * 16 * 1024) | 
| #define MAX_SUBTITLEQ_SIZE (5 * 16 * 1024) | 
| #define MAX_VIDEOQ_SIZE (5 * 256 * 1024) | 
| #define RGB_TO_U_CCIR | ( | r1, | |||
| g1, | |||||
| b1, | |||||
| shift | ) | 
| #define RGB_TO_V_CCIR | ( | r1, | |||
| g1, | |||||
| b1, | |||||
| shift | ) | 
| #define RGB_TO_Y_CCIR | ( | r, | |||
| g, | |||||
| b | ) | 
| #define RGBA_IN | ( | r, | |||
| g, | |||||
| b, | |||||
| a, | |||||
| s | ) | 
Value:
{\
    unsigned int v = ((const uint32_t *)(s))[0];\
    a = (v >> 24) & 0xff;\
    r = (v >> 16) & 0xff;\
    g = (v >> 8) & 0xff;\
    b = v & 0xff;\
}
Definition at line 410 of file ffplay.c.
Referenced by glue(), and subtitle_thread().
| #define SAMPLE_ARRAY_SIZE (2*65536) | 
Definition at line 68 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 1 | 
Definition at line 81 of file ffplay.c.
Referenced by queue_picture(), stream_close(), and video_refresh_timer().
| #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 419 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 428 of file ffplay.c.
Referenced by subtitle_thread().
| anonymous enum | 
| static void alloc_picture | ( | void * | opaque | ) |  [static] | 
Definition at line 1181 of file ffplay.c.
Referenced by event_loop(), load_input_picture(), MPV_frame_start(), open_video(), and select_input_picture().
| static int audio_decode_frame | ( | VideoState * | is, | |
| double * | pts_ptr | |||
| ) |  [static] | 
| static int audio_write_get_buf_size | ( | VideoState * | is | ) |  [static] | 
Definition at line 1678 of file ffplay.c.
Referenced by get_audio_clock(), and video_audio_display().
| static void blend_subrect | ( | AVPicture * | dst, | |
| const AVSubtitleRect * | rect, | |||
| int | imgw, | |||
| int | imgh | |||
| ) |  [static] | 
| static double compute_frame_delay | ( | double | frame_current_pts, | |
| VideoState * | is | |||
| ) |  [static] | 
| static int compute_mod | ( | int | a, | |
| int | b | |||
| ) |  [inline, static] | 
| static int decode_thread | ( | void * | arg | ) |  [static] | 
| static void do_exit | ( | void | ) |  [static] | 
| static void dump_stream_info | ( | const AVFormatContext * | s | ) |  [static] | 
| static void event_loop | ( | void | ) |  [static] | 
| static void fill_rectangle | ( | SDL_Surface * | screen, | |
| int | x, | |||
| int | y, | |||
| int | w, | |||
| int | h, | |||
| int | color | |||
| ) |  [inline, static] | 
Definition at line 340 of file ffplay.c.
Referenced by decode_cabac_residual_internal(), decode_mb_cabac(), decode_mb_cavlc(), decode_mb_skip(), fill_caches(), hl_decode_mb_internal(), pred_direct_motion(), rv34_decode_macroblock(), rv34_decode_mb_header(), rv34_decode_mv(), rv34_output_macroblock(), rv34_pred_mv_b(), svq3_mc_dir(), video_audio_display(), video_image_display(), and write_back_motion().
| static void free_subpicture | ( | SubPicture * | sp | ) |  [static] | 
| static double get_audio_clock | ( | VideoState * | is | ) |  [static] | 
Definition at line 929 of file ffplay.c.
Referenced by get_master_clock(), synchronize_audio(), and video_refresh_timer().
| static double get_external_clock | ( | VideoState * | is | ) |  [static] | 
| static double get_master_clock | ( | VideoState * | is | ) |  [static] | 
Definition at line 966 of file ffplay.c.
Referenced by compute_frame_delay(), event_loop(), synchronize_audio(), and video_refresh_timer().
| static double get_video_clock | ( | VideoState * | is | ) |  [static] | 
Definition at line 946 of file ffplay.c.
Referenced by get_master_clock(), stream_pause(), and video_refresh_timer().
| static int opt_debug | ( | const char * | opt, | |
| const char * | arg | |||
| ) |  [static] | 
| static void opt_frame_pix_fmt | ( | const char * | arg | ) |  [static] | 
| static int opt_height | ( | const char * | opt, | |
| const char * | arg | |||
| ) |  [static] | 
| static void opt_input_file | ( | const char * | filename | ) |  [static] | 
| static int opt_seek | ( | const char * | opt, | |
| const char * | arg | |||
| ) |  [static] | 
| static int opt_sync | ( | const char * | opt, | |
| const char * | arg | |||
| ) |  [static] | 
| static int opt_thread_count | ( | const char * | opt, | |
| const char * | arg | |||
| ) |  [static] | 
| static int opt_vismv | ( | const char * | opt, | |
| const char * | arg | |||
| ) |  [static] | 
| static int opt_width | ( | const char * | opt, | |
| const char * | arg | |||
| ) |  [static] | 
| static int output_picture2 | ( | VideoState * | is, | |
| AVFrame * | src_frame, | |||
| double | pts1 | |||
| ) |  [static] | 
compute the exact PTS for the picture if it is omitted in the stream
| pts1 | the dts of the pkt / pts of the frame | 
Definition at line 1314 of file ffplay.c.
Referenced by video_thread().
| static void packet_queue_abort | ( | PacketQueue * | q | ) |  [static] | 
| static void packet_queue_end | ( | PacketQueue * | q | ) |  [static] | 
| static void packet_queue_flush | ( | PacketQueue * | q | ) |  [static] | 
| static int packet_queue_get | ( | PacketQueue * | q, | |
| AVPacket * | pkt, | |||
| int | block | |||
| ) |  [static] | 
Definition at line 305 of file ffplay.c.
Referenced by audio_decode_frame(), subtitle_thread(), and video_thread().
| static void packet_queue_init | ( | PacketQueue * | q | ) |  [static] | 
| static int packet_queue_put | ( | PacketQueue * | q, | |
| AVPacket * | pkt | |||
| ) |  [static] | 
| static int queue_picture | ( | VideoState * | is, | |
| AVFrame * | src_frame, | |||
| double | pts | |||
| ) |  [static] | 
| pts | the dts of the pkt / pts of the frame and guessed if not known | 
Definition at line 1225 of file ffplay.c.
Referenced by output_picture2().
| static void schedule_refresh | ( | VideoState * | is, | |
| int | delay | |||
| ) |  [static] | 
| static void sdl_audio_callback | ( | void * | opaque, | |
| Uint8 * | stream, | |||
| int | len | |||
| ) |  [static] | 
| static Uint32 sdl_refresh_timer_cb | ( | Uint32 | interval, | |
| void * | opaque | |||
| ) |  [static] | 
| static void step_to_next_frame | ( | void | ) |  [static] | 
| static void stream_close | ( | VideoState * | is | ) |  [static] | 
| static void stream_component_close | ( | VideoState * | is, | |
| int | stream_index | |||
| ) |  [static] | 
Definition at line 1824 of file ffplay.c.
Referenced by decode_thread(), and stream_cycle_channel().
| static int stream_component_open | ( | VideoState * | is, | |
| int | stream_index | |||
| ) |  [static] | 
Definition at line 1721 of file ffplay.c.
Referenced by decode_thread(), and stream_cycle_channel().
| static void stream_cycle_channel | ( | VideoState * | is, | |
| int | codec_type | |||
| ) |  [static] | 
| static VideoState* stream_open | ( | const char * | filename, | |
| AVInputFormat * | iformat | |||
| ) |  [static] | 
| static void stream_pause | ( | VideoState * | is | ) |  [static] | 
Definition at line 999 of file ffplay.c.
Referenced by step_to_next_frame(), toggle_pause(), and video_thread().
| static void stream_seek | ( | VideoState * | is, | |
| int64_t | pos, | |||
| int | rel | |||
| ) |  [static] | 
| static int subtitle_thread | ( | void * | arg | ) |  [static] | 
| static int synchronize_audio | ( | VideoState * | is, | |
| short * | samples, | |||
| int | samples_size1, | |||
| double | pts | |||
| ) |  [static] | 
| static void toggle_audio_display | ( | void | ) |  [static] | 
| static void toggle_full_screen | ( | void | ) |  [static] | 
| static void toggle_pause | ( | void | ) |  [static] | 
| static void update_sample_display | ( | VideoState * | is, | |
| short * | samples, | |||
| int | samples_size | |||
| ) |  [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 | ) |  [static] | 
Definition at line 863 of file ffplay.c.
Referenced by event_loop(), toggle_full_screen(), and video_display().
| static void video_refresh_timer | ( | void * | opaque | ) |  [static] | 
| static int video_thread | ( | void * | arg | ) |  [static] | 
| int64_t audio_callback_time  [static] | 
| int audio_disable  [static] | 
| int av_sync_type = AV_SYNC_AUDIO_MASTER  [static] | 
| VideoState* cur_stream  [static] | 
| int debug = 0  [static] | 
| int decoder_reorder_pts = 0  [static] | 
| int display_disable  [static] | 
| int error_concealment = 3  [static] | 
| int error_recognition = FF_ER_CAREFUL  [static] | 
| AVInputFormat* file_iformat  [static] | 
| int frame_height = 0  [static] | 
| enum PixelFormat frame_pix_fmt = PIX_FMT_NONE  [static] | 
| int frame_width = 0  [static] | 
| int fs_screen_height  [static] | 
| int fs_screen_width  [static] | 
| int genpts = 0  [static] | 
| VideoState* global_video_state  [static] | 
| int idct = FF_IDCT_AUTO  [static] | 
Definition at line 208 of file ffplay.c.
Referenced by 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(), and idct_put().
| const char* input_filename  [static] | 
| int is_full_screen  [static] | 
| int lowres = 0  [static] | 
Definition at line 207 of file ffplay.c.
Referenced by chroma_4mv_motion_lowres(), hpel_motion_lowres(), mpeg_decode_slice(), mpeg_motion_lowres(), and MPV_motion_lowres().
| const int program_birth_year = 2003 | 
program birth year, defined by the program for show_banner()
| const char program_name[] = "FFplay" | 
| int screen_height = 0  [static] | 
| int screen_width = 0  [static] | 
| int seek_by_bytes  [static] | 
| int show_status  [static] | 
| enum AVDiscard skip_frame = AVDISCARD_DEFAULT  [static] | 
| enum AVDiscard skip_loop_filter = AVDISCARD_DEFAULT  [static] | 
| int64_t start_time = AV_NOPTS_VALUE  [static] | 
| int step = 0  [static] | 
Definition at line 202 of file ffplay.c.
Referenced by av_gen_search(), backup_mb_border(), encode_residual(), filter_mb_fast(), init_pass2(), read_line(), vorbis_residue_decode_internal(), xchg_mb_border(), and yuv2rgbXinC_full().
| int thread_count = 1  [static] | 
| int video_disable  [static] | 
| int wanted_audio_stream = 0  [static] | 
| int wanted_subtitle_stream = -1  [static] | 
| int wanted_video_stream = 0  [static] | 
| int workaround_bugs = 1  [static] | 
 1.5.8
 1.5.8