hvirtual/quicktime/ffmpeg/ffplay.c File Reference

#include "avformat.h"
#include "cmdutils.h"
#include <SDL.h>
#include <SDL_thread.h>

Include dependency graph for ffplay.c:

Go to the source code of this file.

Data Structures

struct  PacketQueue
struct  VideoPicture
struct  VideoState

Defines

#define HAVE_AV_CONFIG_H
#define MAX_VIDEOQ_SIZE   (5 * 256 * 1024)
#define MAX_AUDIOQ_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 FF_ALLOC_EVENT   (SDL_USEREVENT)
#define FF_REFRESH_EVENT   (SDL_USEREVENT + 1)
#define FF_QUIT_EVENT   (SDL_USEREVENT + 2)

Enumerations

enum  { AV_SYNC_AUDIO_MASTER, AV_SYNC_VIDEO_MASTER, AV_SYNC_EXTERNAL_CLOCK }

Functions

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 video_image_display (VideoState *is)
static int compute_mod (int a, int b)
static void video_audio_display (VideoState *s)
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 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)
static int video_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, uint8_t *audio_buf, double *pts_ptr)
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)
void dump_stream_info (AVFormatContext *s)
static int decode_interrupt_cb (void)
static int decode_thread (void *arg)
static VideoStatestream_open (const char *filename, AVInputFormat *iformat)
static void stream_close (VideoState *is)
void stream_cycle_channel (VideoState *is, int codec_type)
void toggle_full_screen (void)
void toggle_pause (void)
void step_to_next_frame (void)
void do_exit (void)
void toggle_audio_display (void)
void event_loop (void)
void opt_width (const char *arg)
void opt_height (const char *arg)
static void opt_format (const char *arg)
static void opt_image_format (const char *arg)
void opt_sync (const char *arg)
void opt_seek (const char *arg)
static void opt_debug (const char *arg)
static void opt_vismv (const char *arg)
static void opt_thread_count (const char *arg)
void parse_arg_file (const char *filename)
int main (int argc, char **argv)

Variables

static AVInputFormat * file_iformat
static AVImageFormat * image_format
static const char * input_filename
static int fs_screen_width
static int fs_screen_height
static int screen_width = 640
static int screen_height = 480
static int audio_disable
static int video_disable
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 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_resilience = FF_ER_CAREFUL
static int error_concealment = 3
static int is_full_screen
static VideoStatecur_stream
static int64_t audio_callback_time
SDL_Surface * screen
static VideoStateglobal_video_state
const OptionDef options []


Define Documentation

#define AUDIO_DIFF_AVG_NB   20

Definition at line 74 of file ffplay.c.

Referenced by stream_component_open(), and synchronize_audio().

#define AV_NOSYNC_THRESHOLD   10.0

Definition at line 68 of file ffplay.c.

Referenced by synchronize_audio(), and video_refresh_timer().

#define AV_SYNC_THRESHOLD   0.01

Definition at line 66 of file ffplay.c.

Referenced by video_refresh_timer().

#define FF_ALLOC_EVENT   (SDL_USEREVENT)

Definition at line 208 of file ffplay.c.

Referenced by event_loop(), and queue_picture().

#define FF_QUIT_EVENT   (SDL_USEREVENT + 2)

Definition at line 210 of file ffplay.c.

Referenced by decode_thread(), and event_loop().

#define FF_REFRESH_EVENT   (SDL_USEREVENT + 1)

Definition at line 209 of file ffplay.c.

Referenced by event_loop(), and sdl_refresh_timer_cb().

#define HAVE_AV_CONFIG_H

Definition at line 19 of file ffplay.c.

#define MAX_AUDIOQ_SIZE   (5 * 16 * 1024)

Definition at line 59 of file ffplay.c.

Referenced by decode_thread().

#define MAX_VIDEOQ_SIZE   (5 * 256 * 1024)

Definition at line 58 of file ffplay.c.

Referenced by decode_thread().

#define SAMPLE_ARRAY_SIZE   (2*65536)

Definition at line 77 of file ffplay.c.

Referenced by update_sample_display(), and video_audio_display().

#define SAMPLE_CORRECTION_PERCENT_MAX   10

Definition at line 71 of file ffplay.c.

Referenced by synchronize_audio().

#define SDL_AUDIO_BUFFER_SIZE   1024

Definition at line 63 of file ffplay.c.

Referenced by stream_component_open().

#define VIDEO_PICTURE_QUEUE_SIZE   1

Definition at line 88 of file ffplay.c.

Referenced by queue_picture(), stream_close(), and video_refresh_timer().


Enumeration Type Documentation

anonymous enum

Enumerator:
AV_SYNC_AUDIO_MASTER 
AV_SYNC_VIDEO_MASTER 
AV_SYNC_EXTERNAL_CLOCK 

Definition at line 97 of file ffplay.c.


Function Documentation

static void alloc_picture ( void *  opaque  )  [static]

static int audio_decode_frame ( VideoState is,
uint8_t *  audio_buf,
double *  pts_ptr 
) [static]

static int audio_write_get_buf_size ( VideoState is  )  [static]

Definition at line 1115 of file ffplay.c.

References VideoState::audio_buf_index, and VideoState::audio_hw_buf_size.

Referenced by get_audio_clock(), and video_audio_display().

static int compute_mod ( int  a,
int  b 
) [inline, static]

Definition at line 456 of file ffplay.c.

Referenced by video_audio_display().

static int decode_interrupt_cb ( void   )  [static]

Definition at line 1313 of file ffplay.c.

References VideoState::abort_request.

static int decode_thread ( void *  arg  )  [static]

void do_exit ( void   ) 

Definition at line 1660 of file ffplay.c.

References NULL, show_status, and stream_close().

Referenced by event_loop().

Here is the call graph for this function:

void dump_stream_info ( AVFormatContext *  s  ) 

Definition at line 1293 of file ffplay.c.

References fprintf.

Referenced by decode_thread().

void event_loop ( void   ) 

static void fill_rectangle ( SDL_Surface *  screen,
int  x,
int  y,
int  w,
int  h,
int  color 
) [inline, static]

static double get_audio_clock ( VideoState is  )  [static]

Definition at line 562 of file ffplay.c.

References VideoState::audio_clock, VideoState::audio_st, and audio_write_get_buf_size().

Referenced by get_master_clock(), synchronize_audio(), and video_refresh_timer().

Here is the call graph for this function:

static double get_external_clock ( VideoState is  )  [static]

Definition at line 591 of file ffplay.c.

References e, VideoState::external_clock, and VideoState::external_clock_time.

Referenced by get_master_clock().

static double get_master_clock ( VideoState is  )  [static]

static double get_video_clock ( VideoState is  )  [static]

int main ( int  argc,
char **  argv 
)

static void opt_debug ( const char *  arg  )  [static]

Definition at line 1838 of file ffplay.c.

References debug.

static void opt_format ( const char *  arg  )  [static]

Definition at line 1789 of file ffplay.c.

References file_iformat, and fprintf.

void opt_height ( const char *  arg  ) 

Definition at line 1784 of file ffplay.c.

References screen_height.

static void opt_image_format ( const char *  arg  )  [static]

Definition at line 1798 of file ffplay.c.

References fprintf, image_format, and NULL.

void opt_seek ( const char *  arg  ) 

Definition at line 1833 of file ffplay.c.

References start_time.

void opt_sync ( const char *  arg  ) 

Definition at line 1821 of file ffplay.c.

References AV_SYNC_AUDIO_MASTER, AV_SYNC_EXTERNAL_CLOCK, av_sync_type, AV_SYNC_VIDEO_MASTER, and show_help().

Here is the call graph for this function:

static void opt_thread_count ( const char *  arg  )  [static]

Definition at line 1848 of file ffplay.c.

References fprintf, and thread_count.

static void opt_vismv ( const char *  arg  )  [static]

Definition at line 1843 of file ffplay.c.

References debug_mv.

void opt_width ( const char *  arg  ) 

Definition at line 1779 of file ffplay.c.

References screen_width.

static int output_picture2 ( VideoState is,
AVFrame src_frame,
double  pts1 
) [static]

Definition at line 873 of file ffplay.c.

References av_q2d(), FF_B_TYPE, FF_I_TYPE, queue_picture(), VideoState::video_clock, and VideoState::video_st.

Referenced by video_thread().

Here is the call graph for this function:

static void packet_queue_abort ( PacketQueue q  )  [static]

Definition at line 278 of file ffplay.c.

References PacketQueue::abort_request, PacketQueue::cond, and PacketQueue::mutex.

Referenced by stream_component_close().

static void packet_queue_end ( PacketQueue q  )  [static]

Definition at line 239 of file ffplay.c.

References PacketQueue::cond, PacketQueue::mutex, and packet_queue_flush().

Referenced by stream_component_close().

Here is the call graph for this function:

static void packet_queue_flush ( PacketQueue q  )  [static]

Definition at line 222 of file ffplay.c.

References av_freep(), PacketQueue::first_pkt, PacketQueue::last_pkt, PacketQueue::mutex, PacketQueue::nb_packets, NULL, and PacketQueue::size.

Referenced by decode_thread(), and packet_queue_end().

Here is the call graph for this function:

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

static void packet_queue_init ( PacketQueue q  )  [static]

Definition at line 215 of file ffplay.c.

References PacketQueue::cond, and PacketQueue::mutex.

Referenced by stream_component_open().

static int packet_queue_put ( PacketQueue q,
AVPacket *  pkt 
) [static]

Definition at line 246 of file ffplay.c.

References av_malloc(), PacketQueue::cond, PacketQueue::first_pkt, PacketQueue::last_pkt, PacketQueue::mutex, PacketQueue::nb_packets, NULL, and PacketQueue::size.

Referenced by decode_thread().

Here is the call graph for this function:

void parse_arg_file ( const char *  filename  ) 

Definition at line 1914 of file ffplay.c.

References input_filename.

Referenced by parse_options().

static int queue_picture ( VideoState is,
AVFrame src_frame,
double  pts 
) [static]

static void schedule_refresh ( VideoState is,
int  delay 
) [static]

Definition at line 556 of file ffplay.c.

References sdl_refresh_timer_cb().

Referenced by stream_open(), and video_refresh_timer().

Here is the call graph for this function:

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

static Uint32 sdl_refresh_timer_cb ( Uint32  interval,
void *  opaque 
) [static]

Definition at line 546 of file ffplay.c.

References FF_REFRESH_EVENT.

Referenced by schedule_refresh().

void show_help ( void   ) 

Definition at line 1890 of file ffplay.c.

References FFMPEG_VERSION, OPT_EXPERT, and show_help_options().

Here is the call graph for this function:

void step_to_next_frame ( void   ) 

Definition at line 1650 of file ffplay.c.

References get_video_clock(), VideoState::paused, step, and VideoState::video_current_pts.

Referenced by event_loop().

Here is the call graph for this function:

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]

Definition at line 1158 of file ffplay.c.

References VideoState::audio_buf_index, VideoState::audio_buf_size, VideoState::audio_diff_avg_coef, VideoState::audio_diff_avg_count, AUDIO_DIFF_AVG_NB, VideoState::audio_diff_threshold, VideoState::audio_hw_buf_size, VideoState::audio_pkt, VideoState::audio_st, VideoState::audio_stream, VideoState::audioq, AV_LOG_DEBUG, av_log_set_level(), avcodec_find_decoder(), avcodec_open(), avcodec_thread_init(), AVCodecContext::channels, AVCodecContext::codec, CODEC_FLAG2_FAST, CODEC_FLAG_EMU_EDGE, AVCodecContext::codec_id, AVCodecContext::codec_type, CODEC_TYPE_AUDIO, CODEC_TYPE_VIDEO, debug, AVCodecContext::debug, debug_mv, AVCodecContext::debug_mv, e, error_concealment, AVCodecContext::error_concealment, error_resilience, AVCodecContext::error_resilience, fast, AVCodecContext::flags, AVCodecContext::flags2, fprintf, VideoState::frame_last_delay, VideoState::frame_timer, VideoState::ic, idct, AVCodecContext::idct_algo, lowres, AVCodecContext::lowres, packet_queue_init(), AVCodecContext::sample_rate, SDL_AUDIO_BUFFER_SIZE, sdl_audio_callback(), skip_frame, AVCodecContext::skip_frame, skip_idct, AVCodecContext::skip_idct, skip_loop_filter, AVCodecContext::skip_loop_filter, AVCodecContext::thread_count, thread_count, VideoState::video_current_pts_time, VideoState::video_st, VideoState::video_stream, video_thread(), VideoState::video_tid, VideoState::videoq, workaround_bugs, and AVCodecContext::workaround_bugs.

Referenced by decode_thread(), and stream_cycle_channel().

Here is the call graph for this function:

void stream_cycle_channel ( VideoState is,
int  codec_type 
)

Definition at line 1578 of file ffplay.c.

References VideoState::audio_stream, CODEC_TYPE_AUDIO, CODEC_TYPE_VIDEO, VideoState::ic, stream_component_close(), stream_component_open(), and VideoState::video_stream.

Referenced by event_loop().

Here is the call graph for this function:

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

static void stream_pause ( VideoState is  )  [static]

Definition at line 630 of file ffplay.c.

References get_video_clock(), VideoState::paused, and VideoState::video_current_pts.

Referenced by toggle_pause(), and video_thread().

Here is the call graph for this function:

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

Definition at line 620 of file ffplay.c.

References VideoState::seek_flags, VideoState::seek_pos, and VideoState::seek_req.

Referenced by event_loop().

static int synchronize_audio ( VideoState is,
short *  samples,
int  samples_size1,
double  pts 
) [static]

void toggle_audio_display ( void   ) 

Definition at line 1672 of file ffplay.c.

References VideoState::show_audio.

Referenced by event_loop().

void toggle_full_screen ( void   ) 

void toggle_pause ( void   ) 

Definition at line 1643 of file ffplay.c.

References step, and stream_pause().

Referenced by event_loop().

Here is the call graph for this function:

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]

Definition at line 538 of file ffplay.c.

References VideoState::audio_st, VideoState::show_audio, video_audio_display(), video_image_display(), and VideoState::video_st.

Referenced by video_refresh_timer().

Here is the call graph for this function:

static void video_image_display ( VideoState is  )  [static]

static void video_refresh_timer ( void *  opaque  )  [static]

static int video_thread ( void *  arg  )  [static]


Variable Documentation

int64_t audio_callback_time [static]

Definition at line 206 of file ffplay.c.

Referenced by sdl_audio_callback(), and video_audio_display().

int audio_disable [static]

Definition at line 183 of file ffplay.c.

int av_sync_type = AV_SYNC_AUDIO_MASTER [static]

Definition at line 187 of file ffplay.c.

Referenced by opt_sync(), and stream_open().

Definition at line 205 of file ffplay.c.

int debug = 0 [static]

Definition at line 189 of file ffplay.c.

int debug_mv = 0 [static]

Definition at line 190 of file ffplay.c.

int display_disable [static]

Definition at line 185 of file ffplay.c.

Referenced by decode_thread(), and main().

int error_concealment = 3 [static]

Definition at line 201 of file ffplay.c.

int error_resilience = FF_ER_CAREFUL [static]

Definition at line 200 of file ffplay.c.

int fast = 0 [static]

Definition at line 194 of file ffplay.c.

Referenced by stream_component_open().

AVInputFormat* file_iformat [static]

Definition at line 176 of file ffplay.c.

int fs_screen_height [static]

Definition at line 180 of file ffplay.c.

Referenced by main(), and toggle_full_screen().

int fs_screen_width [static]

Definition at line 179 of file ffplay.c.

Referenced by main(), and toggle_full_screen().

Definition at line 1311 of file ffplay.c.

int idct = FF_IDCT_AUTO [static]

AVImageFormat* image_format [static]

Definition at line 177 of file ffplay.c.

const char* input_filename [static]

Definition at line 178 of file ffplay.c.

Referenced by main(), open_input_stream(), and parse_arg_file().

int is_full_screen [static]

Definition at line 204 of file ffplay.c.

Referenced by main(), and toggle_full_screen().

int lowres = 0 [static]

Definition at line 195 of file ffplay.c.

const OptionDef options[]

Definition at line 1856 of file ffplay.c.

SDL_Surface* screen

int screen_height = 480 [static]

Definition at line 182 of file ffplay.c.

Referenced by main(), opt_height(), and toggle_full_screen().

int screen_width = 640 [static]

Definition at line 181 of file ffplay.c.

Referenced by main(), opt_width(), and toggle_full_screen().

int show_status [static]

Definition at line 186 of file ffplay.c.

Referenced by decode_thread(), do_exit(), and video_refresh_timer().

enum AVDiscard skip_frame = AVDISCARD_DEFAULT [static]

Definition at line 197 of file ffplay.c.

Referenced by main(), and stream_component_open().

enum AVDiscard skip_idct = AVDISCARD_DEFAULT [static]

Definition at line 198 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 199 of file ffplay.c.

Referenced by stream_component_open().

int64_t start_time = AV_NOPTS_VALUE [static]

Definition at line 188 of file ffplay.c.

int step = 0 [static]

int thread_count = 1 [static]

Definition at line 192 of file ffplay.c.

int video_disable [static]

Definition at line 184 of file ffplay.c.

int workaround_bugs = 1 [static]

Definition at line 193 of file ffplay.c.


Generated on Mon Apr 28 14:03:01 2008 for Cinelerra by  doxygen 1.5.5