57 #include <SDL_thread.h>
66 #define MAX_QUEUE_SIZE (15 * 1024 * 1024)
68 #define EXTERNAL_CLOCK_MIN_FRAMES 2
69 #define EXTERNAL_CLOCK_MAX_FRAMES 10
72 #define SDL_AUDIO_MIN_BUFFER_SIZE 512
74 #define SDL_AUDIO_MAX_CALLBACKS_PER_SEC 30
77 #define SDL_VOLUME_STEP (0.75)
80 #define AV_SYNC_THRESHOLD_MIN 0.04
82 #define AV_SYNC_THRESHOLD_MAX 0.1
84 #define AV_SYNC_FRAMEDUP_THRESHOLD 0.1
86 #define AV_NOSYNC_THRESHOLD 10.0
89 #define SAMPLE_CORRECTION_PERCENT_MAX 10
92 #define EXTERNAL_CLOCK_SPEED_MIN 0.900
93 #define EXTERNAL_CLOCK_SPEED_MAX 1.010
94 #define EXTERNAL_CLOCK_SPEED_STEP 0.001
97 #define AUDIO_DIFF_AVG_NB 20
100 #define REFRESH_RATE 0.01
104 #define SAMPLE_ARRAY_SIZE (8 * 65536)
106 #define CURSOR_HIDE_DELAY 1000000
108 #define USE_ONEPASS_SUBTITLE_RENDER 1
129 #define VIDEO_PICTURE_QUEUE_SIZE 3
130 #define SUBPICTURE_QUEUE_SIZE 16
131 #define SAMPLE_QUEUE_SIZE 9
132 #define FRAME_QUEUE_SIZE FFMAX(SAMPLE_QUEUE_SIZE, FFMAX(VIDEO_PICTURE_QUEUE_SIZE, SUBPICTURE_QUEUE_SIZE))
350 static const char **vfilters_list =
NULL;
351 static int nb_vfilters = 0;
352 static char *afilters =
NULL;
363 #define FF_QUIT_EVENT (SDL_USEREVENT + 2)
397 static int opt_add_vfilter(
void *optctx,
const char *opt,
const char *
arg)
400 vfilters_list[nb_vfilters - 1] =
arg;
410 if (channel_count1 == 1 && channel_count2 == 1)
413 return channel_count1 != channel_count2 || fmt1 != fmt2;
420 return channel_layout;
437 if (pkt == &flush_pkt)
450 SDL_CondSignal(q->
cond);
458 SDL_LockMutex(q->
mutex);
460 SDL_UnlockMutex(q->
mutex);
462 if (pkt != &flush_pkt && ret < 0)
482 q->
mutex = SDL_CreateMutex();
487 q->
cond = SDL_CreateCond();
500 SDL_LockMutex(q->
mutex);
501 for (pkt = q->
first_pkt; pkt; pkt = pkt1) {
511 SDL_UnlockMutex(q->
mutex);
517 SDL_DestroyMutex(q->
mutex);
518 SDL_DestroyCond(q->
cond);
523 SDL_LockMutex(q->
mutex);
527 SDL_CondSignal(q->
cond);
529 SDL_UnlockMutex(q->
mutex);
534 SDL_LockMutex(q->
mutex);
537 SDL_UnlockMutex(q->
mutex);
546 SDL_LockMutex(q->
mutex);
575 SDL_UnlockMutex(q->
mutex);
632 }
while (ret !=
AVERROR(EAGAIN));
659 if (got_frame && !pkt.
data) {
667 av_log(d->
avctx,
AV_LOG_ERROR,
"Receive_frame and send_packet both returned EAGAIN, which is an API violation.\n");
692 if (!(f->
mutex = SDL_CreateMutex())) {
696 if (!(f->
cond = SDL_CreateCond())) {
717 SDL_DestroyMutex(f->
mutex);
718 SDL_DestroyCond(f->
cond);
723 SDL_LockMutex(f->
mutex);
724 SDL_CondSignal(f->
cond);
725 SDL_UnlockMutex(f->
mutex);
746 SDL_LockMutex(f->
mutex);
751 SDL_UnlockMutex(f->
mutex);
762 SDL_LockMutex(f->
mutex);
767 SDL_UnlockMutex(f->
mutex);
779 SDL_LockMutex(f->
mutex);
781 SDL_CondSignal(f->
cond);
782 SDL_UnlockMutex(f->
mutex);
794 SDL_LockMutex(f->
mutex);
796 SDL_CondSignal(f->
cond);
797 SDL_UnlockMutex(f->
mutex);
833 SDL_RenderFillRect(
renderer, &rect);
836 static int realloc_texture(SDL_Texture **texture, Uint32 new_format,
int new_width,
int new_height, SDL_BlendMode blendmode,
int init_texture)
840 if (!*texture || SDL_QueryTexture(*texture, &format, &access, &w, &h) < 0 || new_width != w || new_height != h || new_format != format) {
844 SDL_DestroyTexture(*texture);
845 if (!(*texture = SDL_CreateTexture(
renderer, new_format, SDL_TEXTUREACCESS_STREAMING, new_width, new_height)))
847 if (SDL_SetTextureBlendMode(*texture, blendmode) < 0)
850 if (SDL_LockTexture(*texture,
NULL, &pixels, &pitch) < 0)
852 memset(pixels, 0, pitch * new_height);
853 SDL_UnlockTexture(*texture);
855 av_log(
NULL,
AV_LOG_VERBOSE,
"Created %dx%d texture with %s.\n", new_width, new_height, SDL_GetPixelFormatName(new_format));
861 int scr_xleft,
int scr_ytop,
int scr_width,
int scr_height,
862 int pic_width,
int pic_height,
AVRational pic_sar)
867 if (pic_sar.
num == 0)
870 aspect_ratio =
av_q2d(pic_sar);
872 if (aspect_ratio <= 0.0)
874 aspect_ratio *= (float)pic_width / (
float)pic_height;
878 width =
lrint(height * aspect_ratio) & ~1;
879 if (width > scr_width) {
881 height =
lrint(width / aspect_ratio) & ~1;
883 x = (scr_width -
width) / 2;
884 y = (scr_height -
height) / 2;
885 rect->x = scr_xleft + x;
886 rect->y = scr_ytop + y;
887 rect->w =
FFMAX(width, 1);
888 rect->h =
FFMAX(height, 1);
894 *sdl_blendmode = SDL_BLENDMODE_NONE;
895 *sdl_pix_fmt = SDL_PIXELFORMAT_UNKNOWN;
900 *sdl_blendmode = SDL_BLENDMODE_BLEND;
912 SDL_BlendMode sdl_blendmode;
914 if (
realloc_texture(tex, sdl_pix_fmt == SDL_PIXELFORMAT_UNKNOWN ? SDL_PIXELFORMAT_ARGB8888 : sdl_pix_fmt, frame->
width, frame->
height, sdl_blendmode, 0) < 0)
916 switch (sdl_pix_fmt) {
917 case SDL_PIXELFORMAT_UNKNOWN:
922 if (*img_convert_ctx !=
NULL) {
925 if (!SDL_LockTexture(*tex,
NULL, (
void **)pixels, pitch)) {
927 0, frame->
height, pixels, pitch);
928 SDL_UnlockTexture(*tex);
935 case SDL_PIXELFORMAT_IYUV:
962 #if SDL_VERSION_ATLEAST(2,0,8)
963 SDL_YUV_CONVERSION_MODE
mode = SDL_YUV_CONVERSION_AUTOMATIC;
966 mode = SDL_YUV_CONVERSION_JPEG;
968 mode = SDL_YUV_CONVERSION_BT709;
970 mode = SDL_YUV_CONVERSION_BT601;
972 SDL_SetYUVConversionMode(mode);
1002 sub_rect->
x = av_clip(sub_rect->
x, 0, sp->
width );
1003 sub_rect->
y = av_clip(sub_rect->
y, 0, sp->
height);
1004 sub_rect->
w = av_clip(sub_rect->
w, 0, sp->
width - sub_rect->
x);
1005 sub_rect->
h = av_clip(sub_rect->
h, 0, sp->
height - sub_rect->
y);
1015 if (!SDL_LockTexture(is->
sub_texture, (SDL_Rect *)sub_rect, (
void **)pixels, pitch)) {
1017 0, sub_rect->
h, pixels, pitch);
1041 #if USE_ONEPASS_SUBTITLE_RENDER
1045 double xratio = (double)rect.w / (
double)sp->
width;
1046 double yratio = (double)rect.h / (
double)sp->
height;
1048 SDL_Rect *sub_rect = (SDL_Rect*)sp->
sub.
rects[i];
1049 SDL_Rect target = {.
x = rect.x + sub_rect->x * xratio,
1050 .y = rect.y + sub_rect->y * yratio,
1051 .w = sub_rect->w * xratio,
1052 .h = sub_rect->h * yratio};
1061 return a < 0 ? a%b + b : a%
b;
1066 int i, i_start, x, y1, y, ys, delay,
n, nb_display_channels;
1069 int rdft_bits, nb_freq;
1071 for (rdft_bits = 1; (1 << rdft_bits) < 2 * s->
height; rdft_bits++)
1073 nb_freq = 1 << (rdft_bits - 1);
1079 int data_used= s->
show_mode == SHOW_MODE_WAVES ? s->
width : (2*nb_freq);
1091 delay += 2 * data_used;
1092 if (delay < data_used)
1098 for (i = 0; i < 1000; i +=
channels) {
1105 if (h < score && (b ^ c) < 0) {
1118 SDL_SetRenderDrawColor(
renderer, 255, 255, 255, 255);
1121 h = s->
height / nb_display_channels;
1124 for (ch = 0; ch < nb_display_channels; ch++) {
1126 y1 = s->
ytop + ch * h + (h / 2);
1127 for (x = 0; x < s->
width; x++) {
1142 SDL_SetRenderDrawColor(
renderer, 0, 0, 255, 255);
1144 for (ch = 1; ch < nb_display_channels; ch++) {
1145 y = s->
ytop + ch *
h;
1152 nb_display_channels=
FFMIN(nb_display_channels, 2);
1168 for (ch = 0; ch < nb_display_channels; ch++) {
1171 for (x = 0; x < 2 * nb_freq; x++) {
1172 double w = (x-nb_freq) * (1.0 / nb_freq);
1182 if (!SDL_LockTexture(s->
vis_texture, &rect, (
void **)&pixels, &pitch)) {
1184 pixels += pitch * s->
height;
1185 for (y = 0; y < s->
height; y++) {
1186 double w = 1 / sqrt(nb_freq);
1187 int a = sqrt(w * sqrt(data[0][2 * y + 0] * data[0][2 * y + 0] + data[0][2 * y + 1] * data[0][2 * y + 1]));
1188 int b = (nb_display_channels == 2 ) ? sqrt(w *
hypot(data[1][2 * y + 0], data[1][2 * y + 1]))
1193 *pixels = (a << 16) + (b << 8) + ((a+b) >> 1);
1211 if (stream_index < 0 || stream_index >= ic->
nb_streams)
1308 SDL_DestroyWindow(
window);
1350 SDL_SetWindowSize(
window, w, h);
1353 SDL_SetWindowFullscreen(
window, SDL_WINDOW_FULLSCREEN_DESKTOP);
1368 SDL_SetRenderDrawColor(
renderer, 0, 0, 0, 255);
1515 double volume_level = is->
audio_volume ? (20 * log(is->
audio_volume / (
double)SDL_MIX_MAXVOLUME) / log(10)) : -1000.0;
1516 int new_volume =
lrint(SDL_MIX_MAXVOLUME * pow(10.0, (volume_level + sign * step) / 20.0));
1530 double sync_threshold,
diff = 0;
1543 if (diff <= -sync_threshold)
1544 delay =
FFMAX(0, delay + diff);
1546 delay = delay +
diff;
1547 else if (diff >= sync_threshold)
1601 double last_duration,
duration, delay;
1624 if (time < is->frame_timer + delay) {
1668 if (!SDL_LockTexture(is->
sub_texture, (SDL_Rect *)sub_rect, (
void **)&pixels, &pitch)) {
1669 for (j = 0; j < sub_rect->
h; j++, pixels += pitch)
1670 memset(pixels, 0, sub_rect->
w << 2);
1695 static int64_t last_time;
1697 int aqsize, vqsize, sqsize;
1701 if (!last_time || (cur_time - last_time) >= 30000) {
1719 "%7.2f %s:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64
"/%"PRId64
" \r",
1730 last_time = cur_time;
1739 #if defined(DEBUG_SYNC)
1740 printf(
"frame_type=%c pts=%0.3f\n",
1810 if (!outputs || !inputs) {
1821 inputs->filter_ctx = sink_ctx;
1822 inputs->pad_idx = 0;
1823 inputs->next =
NULL;
1833 for (i = 0; i < graph->
nb_filters - nb_filters; i++)
1846 char sws_flags_str[512] =
"";
1847 char buffersrc_args[256];
1853 int nb_pix_fmts = 0;
1867 if (!strcmp(e->
key,
"sws_flags")) {
1868 av_strlcatf(sws_flags_str,
sizeof(sws_flags_str),
"%s=%s:",
"flags", e->
value);
1872 if (strlen(sws_flags_str))
1873 sws_flags_str[strlen(sws_flags_str)-1] =
'\0';
1877 snprintf(buffersrc_args,
sizeof(buffersrc_args),
1878 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
1883 av_strlcatf(buffersrc_args,
sizeof(buffersrc_args),
":frame_rate=%d/%d", fr.
num, fr.
den);
1887 "ffplay_buffer", buffersrc_args,
NULL,
1893 "ffplay_buffersink",
NULL,
NULL, graph);
1900 last_filter = filt_out;
1904 #define INSERT_FILT(name, arg) do { \
1905 AVFilterContext *filt_ctx; \
1907 ret = avfilter_graph_create_filter(&filt_ctx, \
1908 avfilter_get_by_name(name), \
1909 "ffplay_" name, arg, NULL, graph); \
1913 ret = avfilter_link(filt_ctx, 0, last_filter, 0); \
1917 last_filter = filt_ctx; \
1923 if (fabs(theta - 90) < 1.0) {
1924 INSERT_FILT(
"transpose",
"clock");
1925 }
else if (fabs(theta - 180) < 1.0) {
1926 INSERT_FILT(
"hflip",
NULL);
1927 INSERT_FILT(
"vflip",
NULL);
1928 }
else if (fabs(theta - 270) < 1.0) {
1929 INSERT_FILT(
"transpose",
"cclock");
1930 }
else if (fabs(theta) > 1.0) {
1931 char rotate_buf[64];
1932 snprintf(rotate_buf,
sizeof(rotate_buf),
"%f*PI/180", theta);
1933 INSERT_FILT(
"rotate", rotate_buf);
1940 is->in_video_filter = filt_src;
1941 is->out_video_filter = filt_out;
1947 static int configure_audio_filters(
VideoState *is,
const char *afilters,
int force_output_format)
1954 char aresample_swr_opts[512] =
"";
1956 char asrc_args[256];
1965 if (strlen(aresample_swr_opts))
1966 aresample_swr_opts[strlen(aresample_swr_opts)-1] =
'\0';
1967 av_opt_set(is->agraph,
"aresample_swr_opts", aresample_swr_opts, 0);
1969 ret =
snprintf(asrc_args,
sizeof(asrc_args),
1970 "sample_rate=%d:sample_fmt=%s:channels=%d:time_base=%d/%d",
1972 is->audio_filter_src.channels,
1973 1, is->audio_filter_src.freq);
1974 if (is->audio_filter_src.channel_layout)
1975 snprintf(asrc_args + ret,
sizeof(asrc_args) - ret,
1976 ":channel_layout=0x%"PRIx64, is->audio_filter_src.channel_layout);
1980 asrc_args,
NULL, is->agraph);
1996 if (force_output_format) {
2014 is->in_audio_filter = filt_asrc;
2015 is->out_audio_filter = filt_asink;
2030 int last_serial = -1;
2031 int64_t dec_channel_layout;
2052 cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels,
2054 is->audio_filter_src.channel_layout != dec_channel_layout ||
2055 is->audio_filter_src.freq != frame->
sample_rate ||
2059 char buf1[1024], buf2[1024];
2063 "Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n",
2064 is->audio_filter_src.freq, is->audio_filter_src.channels,
av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, last_serial,
2067 is->audio_filter_src.fmt = frame->
format;
2068 is->audio_filter_src.channels = frame->
channels;
2069 is->audio_filter_src.channel_layout = dec_channel_layout;
2073 if ((ret = configure_audio_filters(is, afilters, 1)) < 0)
2138 int last_serial = -1;
2139 int last_vfilter_idx = 0;
2162 if ( last_w != frame->
width
2163 || last_h != frame->
height
2164 || last_format != frame->
format
2166 || last_vfilter_idx != is->vfilter_idx) {
2168 "Video frame changed from size:%dx%d format:%s serial:%d to size:%dx%d format:%s serial:%d\n",
2175 if ((ret = configure_video_filters(graph, is, vfilters_list ? vfilters_list[is->vfilter_idx] :
NULL, frame)) < 0) {
2178 event.user.data1 = is;
2179 SDL_PushEvent(&event);
2182 filt_in = is->in_video_filter;
2183 filt_out = is->out_video_filter;
2184 last_w = frame->
width;
2186 last_format = frame->
format;
2188 last_vfilter_idx = is->vfilter_idx;
2249 if (got_subtitle && sp->
sub.
format == 0) {
2260 }
else if (got_subtitle) {
2272 size = samples_size /
sizeof(short);
2290 int wanted_nb_samples = nb_samples;
2294 double diff, avg_diff;
2295 int min_nb_samples, max_nb_samples;
2312 wanted_nb_samples = av_clip(wanted_nb_samples, min_nb_samples, max_nb_samples);
2315 diff, avg_diff, wanted_nb_samples - nb_samples,
2326 return wanted_nb_samples;
2338 int data_size, resampled_data_size;
2339 int64_t dec_channel_layout;
2341 int wanted_nb_samples;
2364 dec_channel_layout =
2380 "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
2417 if (len2 == out_count) {
2426 resampled_data_size = data_size;
2438 static double last_clock;
2439 printf(
"audio: delay=%0.3f clock=%0.3f clock0=%0.3f\n",
2445 return resampled_data_size;
2452 int audio_size, len1;
2459 if (audio_size < 0) {
2476 memset(stream, 0, len1);
2492 static int audio_open(
void *opaque, int64_t wanted_channel_layout,
int wanted_nb_channels,
int wanted_sample_rate,
struct AudioParams *audio_hw_params)
2494 SDL_AudioSpec wanted_spec, spec;
2496 static const int next_nb_channels[] = {0, 0, 1, 6, 2, 6, 4, 6};
2497 static const int next_sample_rates[] = {0, 44100, 48000, 96000, 192000};
2498 int next_sample_rate_idx =
FF_ARRAY_ELEMS(next_sample_rates) - 1;
2500 env = SDL_getenv(
"SDL_AUDIO_CHANNELS");
2502 wanted_nb_channels = atoi(env);
2510 wanted_spec.channels = wanted_nb_channels;
2511 wanted_spec.freq = wanted_sample_rate;
2512 if (wanted_spec.freq <= 0 || wanted_spec.channels <= 0) {
2516 while (next_sample_rate_idx && next_sample_rates[next_sample_rate_idx] >= wanted_spec.freq)
2517 next_sample_rate_idx--;
2518 wanted_spec.format = AUDIO_S16SYS;
2519 wanted_spec.silence = 0;
2522 wanted_spec.userdata = opaque;
2523 while (!(
audio_dev = SDL_OpenAudioDevice(
NULL, 0, &wanted_spec, &spec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE))) {
2525 wanted_spec.channels, wanted_spec.freq, SDL_GetError());
2526 wanted_spec.channels = next_nb_channels[
FFMIN(7, wanted_spec.channels)];
2527 if (!wanted_spec.channels) {
2528 wanted_spec.freq = next_sample_rates[next_sample_rate_idx--];
2529 wanted_spec.channels = wanted_nb_channels;
2530 if (!wanted_spec.freq) {
2532 "No more combinations to try, audio open failed\n");
2538 if (spec.format != AUDIO_S16SYS) {
2540 "SDL advised audio format %d is not supported!\n", spec.format);
2543 if (spec.channels != wanted_spec.channels) {
2545 if (!wanted_channel_layout) {
2547 "SDL advised channel count %d is not supported!\n", spec.channels);
2553 audio_hw_params->
freq = spec.freq;
2555 audio_hw_params->
channels = spec.channels;
2571 const char *forced_codec_name =
NULL;
2575 int64_t channel_layout;
2577 int stream_lowres =
lowres;
2579 if (stream_index < 0 || stream_index >= ic->
nb_streams)
2598 if (forced_codec_name)
2602 "No codec could be found with name '%s'\n", forced_codec_name);
2615 avctx->
lowres = stream_lowres;
2645 is->audio_filter_src.channels = avctx->
channels;
2647 is->audio_filter_src.fmt = avctx->
sample_fmt;
2648 if ((ret = configure_audio_filters(is, afilters, 0)) < 0)
2650 sink = is->out_audio_filter;
2725 return stream_id < 0 ||
2739 if(s->
pb && ( !strncmp(s->
url,
"rtp:", 4)
2740 || !strncmp(s->
url,
"udp:", 4)
2755 int64_t stream_start_time;
2756 int pkt_in_play_range = 0;
2758 SDL_mutex *wait_mutex = SDL_CreateMutex();
2759 int scan_all_pmts_set = 0;
2768 memset(st_index, -1,
sizeof(st_index));
2784 scan_all_pmts_set = 1;
2792 if (scan_all_pmts_set)
2813 for (i = 0; i < orig_nb_streams; i++)
2819 "%s: could not find codec parameters\n", is->
filename);
2867 st_index[i] = INT_MAX;
2879 st_index[AVMEDIA_TYPE_VIDEO],
2885 (st_index[AVMEDIA_TYPE_AUDIO] >= 0 ?
2886 st_index[AVMEDIA_TYPE_AUDIO] :
2887 st_index[AVMEDIA_TYPE_VIDEO]),
2891 if (st_index[AVMEDIA_TYPE_VIDEO] >= 0) {
2895 if (codecpar->
width)
2900 if (st_index[AVMEDIA_TYPE_AUDIO] >= 0) {
2905 if (st_index[AVMEDIA_TYPE_VIDEO] >= 0) {
2909 is->
show_mode = ret >= 0 ? SHOW_MODE_VIDEO : SHOW_MODE_RDFT;
2911 if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) {
2922 if (infinite_buffer < 0 && is->realtime)
2935 #if CONFIG_RTSP_DEMUXER || CONFIG_MMSH_PROTOCOL
2946 int64_t seek_target = is->
seek_pos;
2947 int64_t seek_min = is->
seek_rel > 0 ? seek_target - is->
seek_rel + 2: INT64_MIN;
2948 int64_t seek_max = is->
seek_rel < 0 ? seek_target - is->
seek_rel - 2: INT64_MAX;
2955 "%s: error while seeking\n", is->
ic->
url);
2999 SDL_LockMutex(wait_mutex);
3001 SDL_UnlockMutex(wait_mutex);
3027 SDL_LockMutex(wait_mutex);
3029 SDL_UnlockMutex(wait_mutex);
3038 (pkt_ts - (stream_start_time !=
AV_NOPTS_VALUE ? stream_start_time : 0)) *
3063 event.user.data1 = is;
3064 SDL_PushEvent(&event);
3066 SDL_DestroyMutex(wait_mutex);
3128 int start_index, stream_index;
3144 stream_index = start_index;
3150 for (start_index = 0; start_index <
nb_streams; start_index++)
3153 if (start_index == nb_streams)
3155 stream_index = start_index;
3160 if (++stream_index >= nb_streams)
3168 if (start_index == -1)
3172 if (stream_index == start_index)
3177 switch (codec_type) {
3192 if (p && stream_index != -1)
3214 next = (next + 1) % SHOW_MODE_NB;
3215 }
while (next != is->
show_mode && (next == SHOW_MODE_VIDEO && !is->
video_st || next != SHOW_MODE_VIDEO && !is->
audio_st));
3223 double remaining_time = 0.0;
3225 while (!SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) {
3230 if (remaining_time > 0.0)
3231 av_usleep((int64_t)(remaining_time * 1000000.0));
3270 double incr, pos, frac;
3275 switch (event.type) {
3277 if (
exit_on_keydown || event.key.keysym.sym == SDLK_ESCAPE || event.key.keysym.sym == SDLK_q) {
3282 if (!cur_stream->
width)
3284 switch (event.key.keysym.sym) {
3296 case SDLK_KP_MULTIPLY:
3300 case SDLK_KP_DIVIDE:
3323 if (cur_stream->
show_mode == SHOW_MODE_VIDEO && cur_stream->vfilter_idx < nb_vfilters - 1) {
3324 if (++cur_stream->vfilter_idx >= nb_vfilters)
3325 cur_stream->vfilter_idx = 0;
3327 cur_stream->vfilter_idx = 0;
3388 case SDL_MOUSEBUTTONDOWN:
3393 if (event.button.button == SDL_BUTTON_LEFT) {
3394 static int64_t last_mouse_left_click = 0;
3398 last_mouse_left_click = 0;
3403 case SDL_MOUSEMOTION:
3409 if (event.type == SDL_MOUSEBUTTONDOWN) {
3410 if (event.button.button != SDL_BUTTON_RIGHT)
3414 if (!(event.motion.state & SDL_BUTTON_RMASK))
3424 int tns, thh, tmm, tss;
3427 tmm = (tns % 3600) / 60;
3429 frac = x / cur_stream->
width;
3432 mm = (ns % 3600) / 60;
3435 "Seek to %2.0f%% (%2d:%02d:%02d) of total duration (%2d:%02d:%02d) \n", frac*100,
3436 hh, mm, ss, thh, tmm, tss);
3443 case SDL_WINDOWEVENT:
3444 switch (event.window.event) {
3445 case SDL_WINDOWEVENT_RESIZED:
3452 case SDL_WINDOWEVENT_EXPOSED:
3487 if (!file_iformat) {
3502 if (!strcmp(arg,
"audio"))
3504 else if (!strcmp(arg,
"video"))
3506 else if (!strcmp(arg,
"ext"))
3529 show_mode = !strcmp(arg,
"video") ? SHOW_MODE_VIDEO :
3530 !strcmp(arg,
"waves") ? SHOW_MODE_WAVES :
3531 !strcmp(arg,
"rdft" ) ? SHOW_MODE_RDFT :
3540 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
3544 if (!strcmp(filename,
"-"))
3551 const char *spec = strchr(opt,
':');
3554 "No media specifier was specified in '%s' in option '%s'\n",
3565 "Invalid media specifier '%s' in option '%s'\n", spec, opt);
3575 {
"x",
HAS_ARG, { .func_arg =
opt_width },
"force displayed width",
"width" },
3576 {
"y",
HAS_ARG, { .func_arg =
opt_height },
"force displayed height",
"height" },
3585 {
"ss",
HAS_ARG, { .func_arg =
opt_seek },
"seek to a given position in seconds",
"pos" },
3586 {
"t",
HAS_ARG, { .func_arg =
opt_duration },
"play \"duration\" seconds of audio/video",
"duration" },
3599 {
"sync",
HAS_ARG |
OPT_EXPERT, { .func_arg =
opt_sync },
"set audio-video sync. type (type=audio/video/ext)",
"type" },
3610 {
"vf",
OPT_EXPERT |
HAS_ARG, { .func_arg = opt_add_vfilter },
"set video filters",
"filter_graph" },
3611 {
"af",
OPT_STRING |
HAS_ARG, { &afilters },
"set audio filters",
"filter_graph" },
3614 {
"showmode",
HAS_ARG, { .func_arg =
opt_show_mode},
"select show mode (0 = video, 1 = waves, 2 = RDFT)",
"mode" },
3616 {
"i",
OPT_BOOL, { &dummy},
"read specified file",
"input_file"},
3617 {
"codec",
HAS_ARG, { .func_arg =
opt_codec},
"force decoder",
"decoder_name" },
3623 "read and decode the streams to fill missing information with heuristics" },
3643 #if !CONFIG_AVFILTER
3648 printf(
"\nWhile playing:\n"
3650 "f toggle full screen\n"
3653 "9, 0 decrease and increase volume respectively\n"
3654 "/, * decrease and increase volume respectively\n"
3655 "a cycle audio channel in the current program\n"
3656 "v cycle video channel\n"
3657 "t cycle subtitle channel in the current program\n"
3659 "w cycle video filters or show modes\n"
3660 "s activate frame-step mode\n"
3661 "left/right seek backward/forward 10 seconds or to custom interval if -seek_interval is set\n"
3662 "down/up seek backward/forward 1 minute\n"
3663 "page down/page up seek backward/forward 10 minutes\n"
3664 "right mouse click seek to percentage in file corresponding to fraction of width\n"
3665 "left double-click toggle full screen\n"
3699 "Use -h to get full help or, even better, run 'man %s'\n",
program_name);
3706 flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
3708 flags &= ~SDL_INIT_AUDIO;
3712 if (!SDL_getenv(
"SDL_AUDIO_ALSA_SET_BUFFER_SIZE"))
3713 SDL_setenv(
"SDL_AUDIO_ALSA_SET_BUFFER_SIZE",
"1", 1);
3716 flags &= ~SDL_INIT_VIDEO;
3717 if (SDL_Init (flags)) {
3723 SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
3724 SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
3730 int flags = SDL_WINDOW_HIDDEN;
3732 flags |= SDL_WINDOW_BORDERLESS;
3734 flags |= SDL_WINDOW_RESIZABLE;
3736 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,
"linear");
3738 renderer = SDL_CreateRenderer(
window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
unsigned int nb_chapters
Number of chapters in AVChapter array.
#define EXTERNAL_CLOCK_SPEED_STEP
AVFilterContext ** filters
static void packet_queue_abort(PacketQueue *q)
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
static int opt_show_mode(void *optctx, const char *opt, const char *arg)
void init_dynload(void)
Initialize dynamic library loading.
static void frame_queue_push(FrameQueue *f)
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
static SDL_AudioDeviceID audio_dev
static void video_image_display(VideoState *is)
const char const char void * val
static void packet_queue_flush(PacketQueue *q)
static double get_clock(Clock *c)
int64_t avio_size(AVIOContext *s)
Get the filesize.
static int opt_height(void *optctx, const char *opt, const char *arg)
static const struct TextureFormatEntry sdl_texture_format_map[]
const int program_birth_year
program birth year, defined by the program for show_banner()
static void copy(const float *p1, float *p2, const int length)
static const char * format[]
int64_t pts_correction_num_faulty_dts
Number of incorrect PTS values so far.
static int audio_open(void *opaque, int64_t wanted_channel_layout, int wanted_nb_channels, int wanted_sample_rate, struct AudioParams *audio_hw_params)
#define EXTERNAL_CLOCK_SPEED_MIN
This structure describes decoded (raw) audio or video data.
#define VIDEO_PICTURE_QUEUE_SIZE
static SDL_Renderer * renderer
int x
top left corner of pict, undefined when pict is not set
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
ptrdiff_t const GLvoid * data
static AVInputFormat * file_iformat
static void opt_input_file(void *optctx, const char *filename)
double get_rotation(AVStream *st)
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
static int opt_format(void *optctx, const char *opt, const char *arg)
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
#define AV_LOG_WARNING
Something somehow does not look correct.
static int get_master_sync_type(VideoState *is)
Main libavfilter public API header.
packed RGB 8:8:8, 24bpp, RGBRGB...
#define AV_SYNC_FRAMEDUP_THRESHOLD
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
static int default_height
Memory buffer source API.
double frame_last_filter_delay
enum VideoState::ShowMode show_mode
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
AVRational sample_aspect_ratio
Video only.
struct AVFilterInOut * next
next input/input in the list, NULL if this is the last
#define av_opt_set_int_list(obj, name, val, term, flags)
Set a binary option to an integer list.
AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame)
Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio...
static void stream_cycle_channel(VideoState *is, int codec_type)
static int opt_frame_pix_fmt(void *optctx, const char *opt, const char *arg)
static void stream_toggle_pause(VideoState *is)
MyAVPacketList * first_pkt
static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int seek_by_bytes)
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
enum AVMediaType codec_type
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
static int opt_codec(void *optctx, const char *opt, const char *arg)
static AVStream * video_stream
static unsigned sws_flags
AVS_VideoFrame int int int int new_height
static void set_clock_at(Clock *c, double pts, int serial, double time)
static void toggle_pause(VideoState *is)
double audio_diff_threshold
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int av_usleep(unsigned usec)
Sleep for a period of time.
const AVClass * sws_get_class(void)
Get the AVClass for swsContext.
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)
Decode a subtitle message.
#define AV_PIX_FMT_RGB444
static const char * audio_codec_name
static void seek_chapter(VideoState *is, int incr)
#define CMDUTILS_COMMON_OPTIONS
AVDictionary * filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, AVCodec *codec)
Filter out options for given codec.
This struct describes the properties of an encoded stream.
functionally identical to above
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
static VideoState * stream_open(const char *filename, AVInputFormat *iformat)
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
struct SwsContext * img_convert_ctx
static void toggle_audio_display(VideoState *is)
AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
memory buffer sink API for audio and video
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
unsigned int nb_stream_indexes
#define AV_LOG_QUIET
Print no output.
int w
width of pict, undefined when pict is not set
int av_buffersink_get_sample_rate(const AVFilterContext *ctx)
double audio_diff_avg_coef
static int read_thread(void *arg)
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance)
Activate resampling compensation ("soft" compensation).
static Frame * frame_queue_peek(FrameQueue *f)
static int64_t start_time
enum AVSampleFormat sample_fmt
audio sample format
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int opt_default(void *optctx, const char *opt, const char *arg)
Fallback for options that are not explicitly handled, these will be parsed through AVOptions...
8 bits with AV_PIX_FMT_RGB32 palette
static void stream_component_close(VideoState *is, int stream_index)
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
static int decode_interrupt_cb(void *ctx)
struct SwrContext * swr_ctx
static av_cold int end(AVCodecContext *avctx)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
static void event_loop(VideoState *cur_stream)
static int cmp_audio_fmts(enum AVSampleFormat fmt1, int64_t channel_count1, enum AVSampleFormat fmt2, int64_t channel_count2)
int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the stream st contained in s is matched by the stream specifier spec.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static void packet_queue_destroy(PacketQueue *q)
SDL_Texture * vis_texture
void init_opts(void)
Initialize the cmdutils option system, in particular allocate the *_opts contexts.
AVStream ** streams
A list of all streams in the file.
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
Create and add a filter instance into an existing graph.
static float seek_interval
AVRational av_buffersink_get_frame_rate(const AVFilterContext *ctx)
static int64_t audio_callback_time
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
static int64_t get_valid_channel_layout(int64_t channel_layout, int channels)
int flags
Flags modifying the (de)muxer behaviour.
static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block, int *serial)
static void sigterm_handler(int sig)
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, void(*parse_arg_function)(void *, const char *))
static double av_q2d(AVRational a)
Convert an AVRational to a double.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
int avformat_network_init(void)
Do global initialization of network libraries.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
Frame queue[FRAME_QUEUE_SIZE]
#define AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the '-loglevel' option in the command line args and apply it.
#define AV_NOSYNC_THRESHOLD
int h
height of pict, undefined when pict is not set
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags, int alt_flags)
Print help for all options matching specified flags.
unsigned int * stream_index
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
AVDictionary ** setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts)
Setup AVCodecContext options for avformat_find_stream_info().
AVDictionary * format_opts
static int realloc_texture(SDL_Texture **texture, Uint32 new_format, int new_width, int new_height, SDL_BlendMode blendmode, int init_texture)
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
#define SAMPLE_ARRAY_SIZE
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static void toggle_mute(VideoState *is)
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.
Main libavdevice API header.
int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec **decoder_ret, int flags)
Find the "best" stream in the file.
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
libswresample public header
AVProgram * av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
Find the programs which belong to a given stream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
AVDictionary * metadata
Metadata that applies to the whole file.
#define AV_PIX_FMT_BGR32_1
#define AV_PIX_FMT_NE(be, le)
static void video_refresh(void *opaque, double *remaining_time)
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
int y
top left corner of pict, undefined when pict is not set
static AVStream * audio_stream
static void frame_queue_next(FrameQueue *f)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
The libswresample context.
static int decoder_start(Decoder *d, int(*fn)(void *), void *arg)
static int frame_queue_nb_remaining(FrameQueue *f)
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
#define EXTERNAL_CLOCK_MAX_FRAMES
char * url
input or output URL.
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder.
static int packet_queue_put_nullpacket(PacketQueue *q, int stream_index)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define CURSOR_HIDE_DELAY
int av_read_play(AVFormatContext *s)
Start playing a network-based stream (e.g.
static double compute_target_delay(double delay, VideoState *is)
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
enum AVMediaType codec_type
General type of the encoded data.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
enum AVColorSpace colorspace
YUV colorspace type.
static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt)
#define AV_LOG_SKIP_REPEATED
Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 woul...
simple assert() macros that are a bit more flexible than ISO C assert().
static void stream_close(VideoState *is)
static int find_stream_info
#define AV_PIX_FMT_0BGR32
static int video_open(VideoState *is)
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
static void init_clock(Clock *c, int *queue_serial)
static void get_sdl_pix_fmt_and_blendmode(int format, Uint32 *sdl_pix_fmt, SDL_BlendMode *sdl_blendmode)
static enum ShowMode show_mode
New fields can be added to the end with minor version bumps.
static void packet_queue_start(PacketQueue *q)
static const OptionDef options[]
int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
Get a frame with filtered data from sink and put it in frame.
enum AVPixelFormat format
uint64_t channel_layout
Audio channel layout.
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare two timestamps each in its own time base.
static int opt_sync(void *optctx, const char *opt, const char *arg)
struct SwsContext * sws_getCachedContext(struct SwsContext *context, int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Check if context can be reused, otherwise reallocate a new one.
static void update_sample_display(VideoState *is, short *samples, int samples_size)
void av_rdft_calc(RDFTContext *s, FFTSample *data)
uint32_t end_display_time
static void decoder_destroy(Decoder *d)
int64_t pts
Same as packet pts, in AV_TIME_BASE.
static AVPacket flush_pkt
uint64_t channel_layout
Channel layout of the audio data.
double frame_last_returned_time
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
char * av_asprintf(const char *fmt,...)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
static const char * subtitle_codec_name
static int subtitle_disable
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static SDL_Window * window
const char program_name[]
program name, defined by the program for show_version().
int av_read_pause(AVFormatContext *s)
Pause a network-based stream (e.g.
static av_const double hypot(double x, double y)
#define ss(width, name, subs,...)
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
#define SAMPLE_QUEUE_SIZE
int channels
number of audio channels, only used for audio.
#define SUBPICTURE_QUEUE_SIZE
enum AVPictureType pict_type
Picture type of the frame.
struct MyAVPacketList * next
#define AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_TIME_BASE
Internal time base represented as integer.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
static void decoder_init(Decoder *d, AVCodecContext *avctx, PacketQueue *queue, SDL_cond *empty_queue_cond)
int width
picture width / height.
int main(int argc, char **argv)
static void show_usage(void)
static int opt_width(void *optctx, const char *opt, const char *arg)
static int get_video_frame(VideoState *is, AVFrame *frame)
struct AudioParams audio_src
static void refresh_loop_wait_event(VideoState *is, SDL_Event *event)
static void set_clock_speed(Clock *c, double speed)
#define SDL_AUDIO_MAX_CALLBACKS_PER_SEC
struct SwrContext * swr_alloc_set_opts(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
Allocate SwrContext if needed and set/reset common parameters.
void sws_freeContext(struct SwsContext *swsContext)
Free the swscaler context swsContext.
MyAVPacketList * last_pkt
void av_rdft_end(RDFTContext *s)
static void step_to_next_frame(VideoState *is)
packed RGB 8:8:8, 24bpp, BGRBGR...
static int audio_decode_frame(VideoState *is)
Decode one audio frame and return its uncompressed size.
RDFTContext * av_rdft_init(int nbits, enum RDFTransformType trans)
Set up a real FFT.
static int is_full_screen
#define AV_SYNC_THRESHOLD_MAX
static void fill_rectangle(int x, int y, int w, int h)
static int stream_has_enough_packets(AVStream *st, int stream_id, PacketQueue *queue)
static int startup_volume
#define SDL_AUDIO_MIN_BUFFER_SIZE
static const AVFilterPad inputs[]
static int packet_queue_init(PacketQueue *q)
uint8_t * data[4]
data+linesize for the bitmap of this subtitle.
static int decoder_reorder_pts
#define AUDIO_DIFF_AVG_NB
static void set_clock(Clock *c, double pts, int serial)
int16_t sample_array[SAMPLE_ARRAY_SIZE]
AVFilterContext * filter_ctx
filter context associated to this input/output
static const char * input_filename
static const AVFilterPad outputs[]
#define FF_ARRAY_ELEMS(a)
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
the normal 2^n-1 "JPEG" YUV ranges
static Frame * frame_queue_peek_last(FrameQueue *f)
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
void avcodec_flush_buffers(AVCodecContext *avctx)
Reset the internal decoder state / flush internal buffers.
const AVClass * avfilter_get_class(void)
A linked-list of the inputs/outputs of the filter chain.
#define SAMPLE_CORRECTION_PERCENT_MAX
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
#define AV_PIX_FMT_BGR555
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
static int opt_duration(void *optctx, const char *opt, const char *arg)
static AVInputFormat * iformat
#define AV_LOG_INFO
Standard information.
char * av_strdup(const char *s)
Duplicate a string.
enum AVMediaType codec_type
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)
AVSampleFormat
Audio sample formats.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer...
static void do_exit(VideoState *is)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int sample_rate
samples per second
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
AVIOContext * pb
I/O context.
#define AV_CODEC_FLAG2_FAST
Allow non spec compliant speedup tricks.
static int exit_on_keydown
uint64_t av_buffersink_get_channel_layout(const AVFilterContext *ctx)
main external API structure.
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.