/*common.h中使用*/
#ifndef INT64_C
#define INT64_C(c) (c ## LL)
#define UINT64_C(c) (c ## ULL)
#endif
#if !defined(isnan)
#define isnan(val) _isnan(val)
#endif
extern "C" {
/*导入ffmpeg相关包*/
#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 "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"
/*导入SDL相关包*/
#include "SDL\SDL.h"
#include "SDL\SDL_thread.h"
#include <assert.h>
}
/*系统包*/
#pragma comment(lib,"winmm.lib")
#pragma comment(lib, "wsock32.lib")
#include <tchar.h>
#include <float.h>
#include <Windows.h>
#include <stdint.h>
#include <math.h>
#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
#define MIN_FRAMES 5
/* SDL audio buffer size, in samples. Should be small to have precise
A/V sync as SDL does not have hardware buffer fullness info. */
#define SDL_AUDIO_BUFFER_SIZE 1024
/* no AV sync correction is done if below the minimum AV sync threshold */
#define AV_SYNC_THRESHOLD_MIN 0.01
/* AV sync correction is done if above the maximum AV sync threshold */
#define AV_SYNC_THRESHOLD_MAX 0.1
/* If a frame duration is longer than this, it will not be duplicated to compensate AV sync */
#define AV_SYNC_FRAMEDUP_THRESHOLD 0.1
/* no AV correction is done if too big error */
#define AV_NOSYNC_THRESHOLD 10.0
/* maximum audio speed change to get correct sync */
#define SAMPLE_CORRECTION_PERCENT_MAX 10
/* external clock speed adjustment constants for realtime sources based on buffer fullness */
#define EXTERNAL_CLOCK_SPEED_MIN 0.900
#define EXTERNAL_CLOCK_SPEED_MAX 1.010
#define EXTERNAL_CLOCK_SPEED_STEP 0.001
/* we use about AUDIO_DIFF_AVG_NB A-V differences to make the average */
#define AUDIO_DIFF_AVG_NB 20
/* polls for possible required screen refresh at least this often, should be less than 1/fps */
#define REFRESH_RATE 0.01
/* NOTE: the size must be big enough to compensate the hardware audio buffersize size */
/* TODO: We assume that a decoded and resampled frame fits into this buffer */
#define SAMPLE_ARRAY_SIZE (8 * 65536)
#define CURSOR_HIDE_DELAY 1000000
static int64_t sws_flags = SWS_BICUBIC;
typedef struct MyAVPacketList {
AVPacket pkt;
struct MyAVPacketList *next;
int serial;
} MyAVPacketList;
typedef struct PacketQueue {
MyAVPacketList *first_pkt, *last_pkt;
int nb_packets;
int size;
int abort_request;
int serial;
SDL_mutex *mutex;
SDL_cond *cond;
} PacketQueue;
#define VIDEO_PICTURE_QUEUE_SIZE 3
#define SUBPICTURE_QUEUE_SIZE 4
typedef struct VideoPicture {
double pts; // presentation timestamp for this picture
int64_t pos; // byte position in file
SDL_Overlay *bmp;
int width, height; /* source height & width */
int allocated;
int reallocate;
int serial;
AVRational sar;
} VideoPicture;
typedef struct SubPicture {
double pts; /* presentation time stamp for this picture */
AVSubtitle sub;
int serial;
} SubPicture;
typedef struct AudioParams {
int freq;
int channels;
int64_t channel_layout;
enum AVSampleFormat fmt;
} AudioParams;
typedef struct Clock {
double pts; /* clock base */
double pts_drift; /* clock base minus time at which we updated the clock */
double last_updated;
double speed;
int serial; /* clock is based on a packet with this serial */
int paused;
int *queue_serial; /* pointer to the current packet queue serial, used for obsolete clock detection */
} Clock;
enum {
AV_SYNC_AUDIO_MASTER, /* default choice */
AV_SYNC_VIDEO_MASTER,
AV_SYNC_EXTERNAL_CLOCK, /* synchronize to an external clock */
};
enum ShowMode {
SHOW_MODE_NONE = -1, SHOW_MODE_VIDEO = 0, SHOW_MODE_WAVES, SHOW_MODE_RDFT, SHOW_MODE_NB
} ShowMode;
typedef struct VideoState {
SDL_Thread *read_tid;
SDL_Thread *video_tid;
AVInputFormat *iformat;
AVDictionary *format_opts;
int no_background;
int abort_request;
int force_refresh;
int paused;
int last_paused;
int queue_attachments_req;
int seek_req;
int seek_flags;
int64_t seek_pos;
int64_t seek_rel;
int read_pause_return;
AVFormatContext *ic;
int realtime;
Clock audclk;
Clock vidclk;
Clock extclk;
int audio_stream;
int av_sync_type;
double audio_clock;
int audio_clock_serial;
double audio_diff_cum; /* used for AV difference average computation */
double audio_diff_avg_coef;
double audio_diff_threshold;
int audio_diff_avg_count;
AVStream *audio_st;
PacketQueue audioq;
int audio_hw_buf_size;
uint8_t silence_buf[SDL_AUDIO_BUFFER_SIZE];
uint8_t *audio_buf;
uint8_t *audio_buf1;
unsigned int audio_buf_size; /* in bytes */
unsigned int audio_buf1_size;
int audio_buf_index; /* in bytes */
int audio_write_buf_size;
int audio_buf_frames_pending;
AVPacket audio_pkt_temp;
AVPacket audio_pkt;
int audio_pkt_temp_serial;
int audio_last_serial;
struct AudioParams audio_src;
struct AudioParams audio_tgt;
struct SwrContext *swr_ctx;
int frame_drops_early;
int frame_drops_late;
AVFrame *frame;
int show_mode;
int16_t sample_array[SAMPLE_ARRAY_SIZE];
int sample_array_index;
int last_i_start;
RDFTContext *rdft;
int rdft_bits;
FFTSample *rdft_data;
int xpos;
double last_vis_time;
SDL_Thread *subtitle_tid;
int subtitle_stream;
AVStream *subtitle_st;
PacketQueue subtitleq;
SubPicture subpq[SUBPICTURE_QUEUE_SIZE];
int subpq_size, subpq_rindex, subpq_windex;
SDL_mutex *subpq_mutex;
SDL_cond *subpq_cond;
double frame_timer;
double frame_last_pts;
double frame_last_duration;
double frame_last_dropped_pts;
double frame_last_returned_time;
double frame_last_filter_delay;
int64_t frame_last_dropped_pos;
int frame_last_dropped_serial;
int video_stream;
AVStream *video_st;
PacketQueue videoq;
int64_t video_current_pos; // current displayed file pos
double max_frame_duration; // maximum duration of a frame - above this, we consider the jump a timestamp discontinuity
VideoPicture pictq[VIDEO_PICTURE_QUEUE_SIZE];
int pictq_size, pictq_rindex, pictq_windex;
SDL_mutex *pictq_mutex;
SDL_cond *pictq_cond;
struct SwsContext *img_convert_ctx;
SDL_Rect last_display_rect;
char filename[1024];
int width, height, xleft, ytop;
int step;
int last_video_stream, last_audio_stream, last_subtitle_stream;
SDL_cond *continue_read_thread;
} VideoState;
/* options specified by the user */
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 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 int wanted_stream[AVMEDIA_TYPE_NB] = { -1, -1,-1,};
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;
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ffmpeg最新版本编译的ffplay (135个子文件)
libgcc.a 3.04MB
libavcodec.a 1.86MB
libSDL.a 1.34MB
libavformat.a 1.34MB
libswscale.a 433KB
libmingwex.a 317KB
libavutil.a 225KB
libavfilter.a 116KB
libswresample.a 98KB
libpthreadGC2.a 91KB
libavdevice.a 2KB
ffplay.cpp 98KB
NPlayer.vcxproj.filters 944B
SDL_opengl.h 329KB
avcodec.h 165KB
avformat.h 80KB
avfilter.h 53KB
SDL_video.h 37KB
opt.h 31KB
pixfmt.h 24KB
frame.h 18KB
intreadwrite.h 18KB
avio.h 17KB
SDL_stdinc.h 16KB
avresample.h 16KB
old_pix_fmts.h 14KB
common.h 13KB
SDL_events.h 13KB
swscale.h 12KB
swresample.h 11KB
SDL_audio.h 11KB
mem.h 11KB
old_codec_ids.h 10KB
pixdesc.h 10KB
samplefmt.h 10KB
avstring.h 10KB
buffer.h 10KB
SDL_config.h 9KB
channel_layout.h 9KB
inttypes.h 8KB
avutil.h 8KB
stdint.h 8KB
imgutils.h 8KB
SDL_keysym.h 7KB
bprint.h 7KB
log.h 7KB
buffersink.h 7KB
audio_data.h 7KB
parseutils.h 7KB
SDL_syswm.h 6KB
SDL_endian.h 6KB
SDL_cdrom.h 6KB
xvmc.h 6KB
SDL_mutex.h 6KB
dict.h 6KB
internal.h 6KB
SDL_joystick.h 5KB
timecode.h 5KB
eval.h 5KB
begin_code.h 5KB
SDL_rwops.h 5KB
error.h 5KB
SDL_mouse.h 5KB
mathematics.h 5KB
buffersrc.h 5KB
fifo.h 5KB
SDL_timer.h 4KB
vdpau.h 4KB
audio_fifo.h 4KB
cpu.h 4KB
SDL_thread.h 4KB
SDL_keyboard.h 4KB
audio_convert.h 4KB
version.h 4KB
vaapi.h 4KB
vda.h 4KB
rational.h 4KB
attributes.h 4KB
avcodec.h 4KB
colorspace.h 4KB
asrc_abuffer.h 3KB
audio_mix.h 3KB
version.h 3KB
SDL.h 3KB
version.h 3KB
dither.h 3KB
avfft.h 3KB
version.h 3KB
hmac.h 3KB
SDL_main.h 3KB
bswap.h 3KB
SDL_loadso.h 3KB
SDL_platform.h 3KB
crc.h 3KB
SDL_version.h 3KB
timestamp.h 2KB
file.h 2KB
blowfish.h 2KB
dxva2.h 2KB
resample.h 2KB
共 135 条
- 1
- 2
xjstddj
- 粉丝: 4
- 资源: 18
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页