56 #include <SDL_thread.h>
65 #define MAX_QUEUE_SIZE (15 * 1024 * 1024)
70 #define SDL_AUDIO_BUFFER_SIZE 1024
73 #define AV_SYNC_THRESHOLD 0.01
75 #define AV_NOSYNC_THRESHOLD 10.0
78 #define SAMPLE_CORRECTION_PERCENT_MAX 10
81 #define EXTERNAL_CLOCK_SPEED_MIN 0.900
82 #define EXTERNAL_CLOCK_SPEED_MAX 1.010
83 #define EXTERNAL_CLOCK_SPEED_STEP 0.001
86 #define AUDIO_DIFF_AVG_NB 20
89 #define REFRESH_RATE 0.01
93 #define SAMPLE_ARRAY_SIZE (8 * 65536)
95 #define CURSOR_HIDE_DELAY 1000000
115 #define VIDEO_PICTURE_QUEUE_SIZE 4
116 #define SUBPICTURE_QUEUE_SIZE 4
316 static char *vfilters =
NULL;
317 static char *afilters =
NULL;
326 #define FF_ALLOC_EVENT (SDL_USEREVENT)
327 #define FF_QUIT_EVENT (SDL_USEREVENT + 2)
336 if (channel_count1 == 1 && channel_count2 == 1)
339 return channel_count1 != channel_count2 || fmt1 != fmt2;
346 return channel_layout;
365 if (pkt == &flush_pkt)
377 SDL_CondSignal(q->
cond);
389 SDL_LockMutex(q->
mutex);
391 SDL_UnlockMutex(q->
mutex);
393 if (pkt != &flush_pkt && ret < 0)
403 q->
mutex = SDL_CreateMutex();
404 q->
cond = SDL_CreateCond();
412 SDL_LockMutex(q->
mutex);
422 SDL_UnlockMutex(q->
mutex);
428 SDL_DestroyMutex(q->
mutex);
429 SDL_DestroyCond(q->
cond);
434 SDL_LockMutex(q->
mutex);
438 SDL_CondSignal(q->
cond);
440 SDL_UnlockMutex(q->
mutex);
445 SDL_LockMutex(q->
mutex);
448 SDL_UnlockMutex(q->
mutex);
457 SDL_LockMutex(q->
mutex);
485 SDL_UnlockMutex(q->
mutex);
490 int x,
int y,
int w,
int h,
int color,
int update)
497 SDL_FillRect(screen, &rect, color);
498 if (update && w > 0 && h > 0)
499 SDL_UpdateRect(screen, x, y, w, h);
511 w2 = width - (x + w);
517 h2 = height - (y + h);
525 xleft + width - w2, ytop,
533 xleft + w1, ytop + height - h2,
538 #define ALPHA_BLEND(a, oldp, newp, s)\
539 ((((oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s))
541 #define RGBA_IN(r, g, b, a, s)\
543 unsigned int v = ((const uint32_t *)(s))[0];\
544 a = (v >> 24) & 0xff;\
545 r = (v >> 16) & 0xff;\
546 g = (v >> 8) & 0xff;\
550 #define YUVA_IN(y, u, v, a, s, pal)\
552 unsigned int val = ((const uint32_t *)(pal))[*(const uint8_t*)(s)];\
553 a = (val >> 24) & 0xff;\
554 y = (val >> 16) & 0xff;\
555 u = (val >> 8) & 0xff;\
559 #define YUVA_OUT(d, y, u, v, a)\
561 ((uint32_t *)(d))[0] = (a << 24) | (y << 16) | (u << 8) | v;\
569 int wrap, wrap3, width2, skip2;
570 int y,
u,
v,
a, u1, v1,
a1, w, h;
574 int dstx, dsty, dstw, dsth;
576 dstw = av_clip(rect->
w, 0, imgw);
577 dsth = av_clip(rect->
h, 0, imgh);
578 dstx = av_clip(rect->
x, 0, imgw - dstw);
579 dsty = av_clip(rect->
y, 0, imgh - dsth);
584 width2 = ((dstw + 1) >> 1) + (dstx & ~dstw & 1);
589 pal = (
const uint32_t *)rect->
pict.
data[1];
606 for (w = dstw - (dstx & 1); w >= 2; w -= 2) {
633 p += wrap3 - dstw *
BPP;
634 lum += wrap - dstw - dstx;
635 cb += dst->
linesize[1] - width2 - skip2;
636 cr += dst->
linesize[2] - width2 - skip2;
638 for (h = dsth - (dsty & 1); h >= 2; h -= 2) {
663 for (w = dstw - (dstx & 1); w >= 2; w -= 2) {
695 p += -wrap3 + 2 *
BPP;
718 p += wrap3 + (wrap3 - dstw *
BPP);
719 lum += wrap + (wrap - dstw - dstx);
720 cb += dst->
linesize[1] - width2 - skip2;
721 cr += dst->
linesize[2] - width2 - skip2;
739 for (w = dstw - (dstx & 1); w >= 2; w -= 2) {
782 if (aspect_ratio <= 0.0)
784 aspect_ratio *= (float)vp->
width / (
float)vp->
height;
788 width = ((int)
rint(height * aspect_ratio)) & ~1;
789 if (width > scr_width) {
791 height = ((int)
rint(width / aspect_ratio)) & ~1;
793 x = (scr_width -
width) / 2;
794 y = (scr_height -
height) / 2;
795 rect->x = scr_xleft + x;
796 rect->y = scr_ytop +
y;
797 rect->w =
FFMAX(width, 1);
798 rect->h =
FFMAX(height, 1);
816 SDL_LockYUVOverlay (vp->
bmp);
818 pict.
data[0] = vp->
bmp->pixels[0];
819 pict.
data[1] = vp->
bmp->pixels[2];
820 pict.
data[2] = vp->
bmp->pixels[1];
830 SDL_UnlockYUVOverlay (vp->
bmp);
837 SDL_DisplayYUVOverlay(vp->
bmp, &rect);
840 int bgcolor = SDL_MapRGB(
screen->format, 0x00, 0x00, 0x00);
849 return a < 0 ? a%b + b : a%
b;
854 int i, i_start, x, y1,
y, ys, delay,
n, nb_display_channels;
855 int ch, channels, h, h2, bgcolor, fgcolor;
857 int rdft_bits, nb_freq;
859 for (rdft_bits = 1; (1 << rdft_bits) < 2 * s->
height; rdft_bits++)
861 nb_freq = 1 << (rdft_bits - 1);
865 nb_display_channels = channels;
867 int data_used= s->
show_mode == SHOW_MODE_WAVES ? s->
width : (2*nb_freq);
879 delay += 2 * data_used;
880 if (delay < data_used)
886 for (i = 0; i < 1000; i += channels) {
893 if (h < score && (b ^ c) < 0) {
905 bgcolor = SDL_MapRGB(
screen->format, 0x00, 0x00, 0x00);
911 fgcolor = SDL_MapRGB(
screen->format, 0xff, 0xff, 0xff);
914 h = s->
height / nb_display_channels;
917 for (ch = 0; ch < nb_display_channels; ch++) {
919 y1 = s->
ytop + ch * h + (h / 2);
920 for (x = 0; x < s->
width; x++) {
929 s->
xleft + x, ys, 1, y,
937 fgcolor = SDL_MapRGB(
screen->format, 0x00, 0x00, 0xff);
939 for (ch = 1; ch < nb_display_channels; ch++) {
940 y = s->
ytop + ch * h;
947 nb_display_channels=
FFMIN(nb_display_channels, 2);
957 for (ch = 0; ch < nb_display_channels; ch++) {
958 data[ch] = s->
rdft_data + 2 * nb_freq * ch;
960 for (x = 0; x < 2 * nb_freq; x++) {
961 double w = (x-nb_freq) * (1.0 / nb_freq);
970 for (y = 0; y < s->
height; y++) {
971 double w = 1 / sqrt(nb_freq);
972 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]));
973 int b = (nb_display_channels == 2 ) ? sqrt(w * sqrt(data[1][2 * y + 0] * data[1][2 * y + 0]
974 + data[1][2 * y + 1] * data[1][2 * y + 1])) : a;
977 fgcolor = SDL_MapRGB(
screen->format, a, b, (a + b) / 2);
1007 SDL_FreeYUVOverlay(vp->
bmp);
1016 #if !CONFIG_AVFILTER
1047 int flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL;
1052 else flags |= SDL_RESIZABLE;
1054 if (vp && vp->
width) {
1073 screen = SDL_SetVideoMode(w, h, 0, flags);
1075 fprintf(stderr,
"SDL: could not set video mode - exiting\n");
1246 double sync_threshold,
diff;
1259 if (diff <= -sync_threshold)
1261 else if (diff >= sync_threshold)
1349 double last_duration,
duration, delay;
1364 if (!
isnan(last_duration) && last_duration > 0 && last_duration < is->max_frame_duration) {
1371 if (time < is->frame_timer + delay) {
1386 duration = nextvp->
pts - vp->
pts;
1453 static int64_t last_time;
1455 int aqsize, vqsize, sqsize;
1459 if (!last_time || (cur_time - last_time) >= 30000) {
1472 printf(
"%7.2f A-V:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64
"/%"PRId64
" \r",
1496 SDL_FreeYUVOverlay(vp->
bmp);
1503 if (!vp->
bmp || vp->
bmp->pitches[0] < vp->
width) {
1506 fprintf(stderr,
"Error: the video system does not support an image\n"
1507 "size of %dx%d pixels. Try using -lowres or -vf \"scale=w:h\"\n"
1508 "to reduce the image size.\n", vp->
width, vp->
height );
1521 for (i = 0; i < 3; i++) {
1528 if (bmp->pitches[i] > width) {
1529 maxp = bmp->pixels[i] + bmp->pitches[i] * height - 1;
1530 for (p = bmp->pixels[i] + width - 1; p < maxp; p += bmp->pitches[i])
1540 #if defined(DEBUG_SYNC) && 0
1541 printf(
"frame_type=%c pts=%0.3f\n",
1576 event.user.data1 = is;
1577 SDL_PushEvent(&event);
1601 SDL_LockYUVOverlay (vp->
bmp);
1603 pict.
data[0] = vp->
bmp->pixels[0];
1604 pict.
data[1] = vp->
bmp->pixels[2];
1605 pict.
data[2] = vp->
bmp->pixels[1];
1621 fprintf(stderr,
"Cannot initialize the conversion context\n");
1630 SDL_UnlockYUVOverlay(vp->
bmp);
1725 if (!outputs || !inputs) {
1736 inputs->filter_ctx = sink_ctx;
1737 inputs->pad_idx = 0;
1738 inputs->next =
NULL;
1757 char sws_flags_str[128];
1758 char buffersrc_args[256];
1768 snprintf(buffersrc_args,
sizeof(buffersrc_args),
1769 "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
1774 av_strlcatf(buffersrc_args,
sizeof(buffersrc_args),
":frame_rate=%d/%d", fr.
num, fr.
den);
1778 "ffplay_buffer", buffersrc_args,
NULL,
1784 "ffplay_buffersink",
NULL,
NULL, graph);
1795 "ffplay_crop",
"floor(in_w/2)*2:floor(in_h/2)*2",
NULL, graph)) < 0)
1803 is->in_video_filter = filt_src;
1804 is->out_video_filter = filt_out;
1810 static int configure_audio_filters(
VideoState *is,
const char *afilters,
int force_output_format)
1814 int64_t channel_layouts[2] = { 0, -1 };
1815 int channels[2] = { 0, -1 };
1817 char asrc_args[256];
1824 ret =
snprintf(asrc_args,
sizeof(asrc_args),
1825 "sample_rate=%d:sample_fmt=%s:channels=%d:time_base=%d/%d",
1827 is->audio_filter_src.channels,
1828 1, is->audio_filter_src.freq);
1829 if (is->audio_filter_src.channel_layout)
1830 snprintf(asrc_args + ret,
sizeof(asrc_args) - ret,
1831 ":channel_layout=0x%"PRIx64, is->audio_filter_src.channel_layout);
1835 asrc_args,
NULL, is->agraph);
1851 if (force_output_format) {
1869 is->in_audio_filter = filt_asrc;
1870 is->out_audio_filter = filt_asink;
1894 int last_serial = -1;
1911 if ( last_w != frame->
width
1912 || last_h != frame->
height
1913 || last_format != frame->
format
1914 || last_serial != serial) {
1916 "Video frame changed from size:%dx%d format:%s serial:%d to size:%dx%d format:%s serial:%d\n",
1923 if ((ret = configure_video_filters(graph, is, vfilters, frame)) < 0) {
1926 event.user.data1 = is;
1927 SDL_PushEvent(&event);
1931 filt_in = is->in_video_filter;
1932 filt_out = is->out_video_filter;
1933 last_w = frame->
width;
1935 last_format = frame->
format;
1936 last_serial = serial;
2022 &got_subtitle, pkt);
2023 if (got_subtitle && sp->
sub.
format == 0) {
2057 size = samples_size /
sizeof(short);
2079 double diff, avg_diff;
2080 int min_nb_samples, max_nb_samples;
2094 wanted_nb_samples = nb_samples + (int)(diff * is->
audio_src.
freq);
2097 wanted_nb_samples =
FFMIN(
FFMAX(wanted_nb_samples, min_nb_samples), max_nb_samples);
2099 av_dlog(
NULL,
"diff=%f adiff=%f sample_diff=%d apts=%0.3f %f\n",
2100 diff, avg_diff, wanted_nb_samples - nb_samples,
2111 return wanted_nb_samples;
2126 int len1, data_size, resampled_data_size;
2127 int64_t dec_channel_layout;
2131 int flush_complete = 0;
2132 int wanted_nb_samples;
2165 pkt_temp->
data += len1;
2166 pkt_temp->
size -= len1;
2187 cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels,
2189 is->audio_filter_src.channel_layout != dec_channel_layout ||
2194 char buf1[1024], buf2[1024];
2198 "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",
2204 is->audio_filter_src.channel_layout = dec_channel_layout;
2208 if ((ret = configure_audio_filters(is, afilters, 1)) < 0)
2226 tb = is->out_audio_filter->inputs[0]->time_base;
2233 dec_channel_layout =
2248 fprintf(stderr,
"Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
2266 fprintf(stderr,
"av_samples_get_buffer_size() failed\n");
2272 fprintf(stderr,
"swr_set_compensation() failed\n");
2281 fprintf(stderr,
"swr_convert() failed\n");
2284 if (len2 == out_count) {
2285 fprintf(stderr,
"warning: audio buffer is probably too small\n");
2292 resampled_data_size = data_size;
2303 static double last_clock;
2304 printf(
"audio: delay=%0.3f clock=%0.3f clock0=%0.3f\n",
2310 return resampled_data_size;
2316 memset(pkt_temp, 0,
sizeof(*pkt_temp));
2352 if (audio_size < 0) {
2380 static int audio_open(
void *opaque, int64_t wanted_channel_layout,
int wanted_nb_channels,
int wanted_sample_rate,
struct AudioParams *audio_hw_params)
2382 SDL_AudioSpec wanted_spec, spec;
2384 const int next_nb_channels[] = {0, 0, 1, 6, 2, 6, 4, 6};
2386 env = SDL_getenv(
"SDL_AUDIO_CHANNELS");
2388 wanted_nb_channels = atoi(env);
2396 wanted_spec.freq = wanted_sample_rate;
2397 if (wanted_spec.freq <= 0 || wanted_spec.channels <= 0) {
2398 fprintf(stderr,
"Invalid sample rate or channel count!\n");
2401 wanted_spec.format = AUDIO_S16SYS;
2402 wanted_spec.silence = 0;
2405 wanted_spec.userdata = opaque;
2406 while (SDL_OpenAudio(&wanted_spec, &spec) < 0) {
2407 fprintf(stderr,
"SDL_OpenAudio (%d channels): %s\n", wanted_spec.channels, SDL_GetError());
2408 wanted_spec.channels = next_nb_channels[
FFMIN(7, wanted_spec.channels)];
2409 if (!wanted_spec.channels) {
2410 fprintf(stderr,
"No more channel combinations to try, audio open failed\n");
2415 if (spec.format != AUDIO_S16SYS) {
2416 fprintf(stderr,
"SDL advised audio format %d is not supported!\n", spec.format);
2419 if (spec.channels != wanted_spec.channels) {
2421 if (!wanted_channel_layout) {
2422 fprintf(stderr,
"SDL advised channel count %d is not supported!\n", spec.channels);
2428 audio_hw_params->
freq = spec.freq;
2430 audio_hw_params->
channels = spec.channels;
2440 const char *forced_codec_name =
NULL;
2444 int64_t channel_layout;
2447 if (stream_index < 0 || stream_index >= ic->
nb_streams)
2458 if (forced_codec_name)
2461 if (forced_codec_name) fprintf(stderr,
"No codec could be found with name '%s'\n", forced_codec_name);
2462 else fprintf(stderr,
"No codec could be found with id %d\n", avctx->
codec_id);
2502 is->audio_filter_src.channels = avctx->
channels;
2504 is->audio_filter_src.fmt = avctx->
sample_fmt;
2505 if ((ret = configure_audio_filters(is, afilters, 0)) < 0)
2507 link = is->out_audio_filter->inputs[0];
2568 if (stream_index < 0 || stream_index >= ic->
nb_streams)
2662 if(s->
pb && ( !strncmp(s->
filename,
"rtp:", 4)
2663 || !strncmp(s->
filename,
"udp:", 4)
2679 int pkt_in_play_range = 0;
2682 int orig_nb_streams;
2683 SDL_mutex *wait_mutex = SDL_CreateMutex();
2685 memset(st_index, -1,
sizeof(st_index));
2714 fprintf(stderr,
"%s: could not find codec parameters\n", is->
filename);
2718 for (i = 0; i < orig_nb_streams; i++)
2743 fprintf(stderr,
"%s: could not seek to position %0.3f\n",
2760 st_index[AVMEDIA_TYPE_VIDEO],
2766 (st_index[AVMEDIA_TYPE_AUDIO] >= 0 ?
2767 st_index[AVMEDIA_TYPE_AUDIO] :
2768 st_index[AVMEDIA_TYPE_VIDEO]),
2777 if (st_index[AVMEDIA_TYPE_AUDIO] >= 0) {
2782 if (st_index[AVMEDIA_TYPE_VIDEO] >= 0) {
2786 is->
show_mode = ret >= 0 ? SHOW_MODE_VIDEO : SHOW_MODE_RDFT;
2788 if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) {
2793 fprintf(stderr,
"%s: could not open codecs\n", is->
filename);
2798 if (infinite_buffer < 0 && is->realtime)
2811 #if CONFIG_RTSP_DEMUXER || CONFIG_MMSH_PROTOCOL
2822 int64_t seek_target = is->
seek_pos;
2823 int64_t seek_min = is->
seek_rel > 0 ? seek_target - is->
seek_rel + 2: INT64_MIN;
2824 int64_t seek_max = is->
seek_rel < 0 ? seek_target - is->
seek_rel - 2: INT64_MAX;
2830 fprintf(stderr,
"%s: error while seeking\n", is->
ic->
filename);
2874 SDL_LockMutex(wait_mutex);
2876 SDL_UnlockMutex(wait_mutex);
2913 SDL_LockMutex(wait_mutex);
2915 SDL_UnlockMutex(wait_mutex);
2957 event.user.data1 = is;
2958 SDL_PushEvent(&event);
2960 SDL_DestroyMutex(wait_mutex);
3008 int start_index, stream_index;
3022 stream_index = start_index;
3032 if (start_index == -1)
3036 if (stream_index == start_index)
3038 st = ic->
streams[stream_index];
3041 switch (codec_type) {
3063 #if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14)
3075 int bgcolor = SDL_MapRGB(
screen->format, 0x00, 0x00, 0x00);
3078 next = (next + 1) % SHOW_MODE_NB;
3079 }
while (next != is->
show_mode && (next == SHOW_MODE_VIDEO && !is->
video_st || next != SHOW_MODE_VIDEO && !is->
audio_st));
3090 double remaining_time = 0.0;
3092 while (!SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_ALLEVENTS)) {
3097 if (remaining_time > 0.0)
3098 av_usleep((int64_t)(remaining_time * 1000000.0));
3110 double incr, pos, frac;
3115 switch (event.type) {
3121 switch (event.key.keysym.sym) {
3194 case SDL_VIDEOEXPOSE:
3197 case SDL_MOUSEBUTTONDOWN:
3202 case SDL_MOUSEMOTION:
3208 if (event.type == SDL_MOUSEBUTTONDOWN) {
3211 if (event.motion.state != SDL_PRESSED)
3221 int tns, thh, tmm, tss;
3224 tmm = (tns % 3600) / 60;
3226 frac = x / cur_stream->
width;
3229 mm = (ns % 3600) / 60;
3231 fprintf(stderr,
"Seek to %2.0f%% (%2d:%02d:%02d) of total duration (%2d:%02d:%02d) \n", frac*100,
3232 hh, mm, ss, thh, tmm, tss);
3239 case SDL_VIDEORESIZE:
3240 screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
3241 SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL);
3280 if (!file_iformat) {
3281 fprintf(stderr,
"Unknown input format: %s\n", arg);
3295 if (!strcmp(arg,
"audio"))
3297 else if (!strcmp(arg,
"video"))
3299 else if (!strcmp(arg,
"ext"))
3302 fprintf(stderr,
"Unknown value for %s: %s\n", opt, arg);
3322 show_mode = !strcmp(arg,
"video") ? SHOW_MODE_VIDEO :
3323 !strcmp(arg,
"waves") ? SHOW_MODE_WAVES :
3324 !strcmp(arg,
"rdft" ) ? SHOW_MODE_RDFT :
3332 fprintf(stderr,
"Argument '%s' provided as input filename, but '%s' was already specified.\n",
3336 if (!strcmp(filename,
"-"))
3343 const char *spec = strchr(opt,
':');
3345 fprintf(stderr,
"No media specifier was specified in '%s' in option '%s'\n",
3355 fprintf(stderr,
"Invalid media specifier '%s' in option '%s'\n", spec, opt);
3365 {
"x",
HAS_ARG, { .func_arg =
opt_width },
"force displayed width",
"width" },
3366 {
"y",
HAS_ARG, { .func_arg =
opt_height },
"force displayed height",
"height" },
3375 {
"ss",
HAS_ARG, { .func_arg =
opt_seek },
"seek to a given position in seconds",
"pos" },
3376 {
"t",
HAS_ARG, { .func_arg =
opt_duration },
"play \"duration\" seconds of audio/video",
"duration" },
3389 {
"sync",
HAS_ARG |
OPT_EXPERT, { .func_arg =
opt_sync },
"set audio-video sync. type (type=audio/video/ext)",
"type" },
3398 {
"vf",
OPT_STRING |
HAS_ARG, { &vfilters },
"set video filters",
"filter_graph" },
3399 {
"af",
OPT_STRING |
HAS_ARG, { &afilters },
"set audio filters",
"filter_graph" },
3402 {
"showmode",
HAS_ARG, { .func_arg =
opt_show_mode},
"select show mode (0 = video, 1 = waves, 2 = RDFT)",
"mode" },
3404 {
"i",
OPT_BOOL, { &dummy},
"read specified file",
"input_file"},
3405 {
"codec",
HAS_ARG, { .func_arg =
opt_codec},
"force decoder",
"decoder_name" },
3428 #if !CONFIG_AVFILTER
3433 printf(
"\nWhile playing:\n"
3435 "f toggle full screen\n"
3437 "a cycle audio channel\n"
3438 "v cycle video channel\n"
3439 "t cycle subtitle channel\n"
3440 "w show audio waves\n"
3441 "s activate frame-step mode\n"
3442 "left/right seek backward/forward 10 seconds\n"
3443 "down/up seek backward/forward 1 minute\n"
3444 "page down/page up seek backward/forward 10 minutes\n"
3445 "mouse click seek to percentage in file corresponding to fraction of width\n"
3453 *mtx = SDL_CreateMutex();
3458 return !!SDL_LockMutex(*mtx);
3460 return !!SDL_UnlockMutex(*mtx);
3462 SDL_DestroyMutex(*mtx);
3473 char dummy_videodriver[] =
"SDL_VIDEODRIVER=dummy";
3500 fprintf(stderr,
"An input file must be specified\n");
3501 fprintf(stderr,
"Use -h to get full help or, even better, run 'man %s'\n",
program_name);
3508 flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
3510 flags &= ~SDL_INIT_AUDIO;
3512 SDL_putenv(dummy_videodriver);
3513 #if !defined(__MINGW32__) && !defined(__APPLE__)
3514 flags |= SDL_INIT_EVENTTHREAD;
3516 if (SDL_Init (flags)) {
3517 fprintf(stderr,
"Could not initialize SDL - %s\n", SDL_GetError());
3518 fprintf(stderr,
"(Did you set the DISPLAY variable?)\n");
3523 const SDL_VideoInfo *
vi = SDL_GetVideoInfo();
3528 SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);
3529 SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
3530 SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
3533 fprintf(stderr,
"Could not initialize lock manager!\n");
3542 fprintf(stderr,
"Failed to initialize VideoState!\n");