X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=fftools%2Fffplay.c;h=55cea32caebe3d156cf8139f891f31e25e931630;hb=bcc0ae5d5a3841a743f3990e5cfc2e56cad185ff;hp=f2028d4b13df957056c612933d33ebf41387ed1d;hpb=bcab11a1a23d8b156198db352bbdb932740a966c;p=ffmpeg diff --git a/fftools/ffplay.c b/fftools/ffplay.c index f2028d4b13d..55cea32caeb 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -834,10 +834,11 @@ static int realloc_texture(SDL_Texture **texture, Uint32 new_format, int new_wid { Uint32 format; int access, w, h; - if (SDL_QueryTexture(*texture, &format, &access, &w, &h) < 0 || new_width != w || new_height != h || new_format != format) { + if (!*texture || SDL_QueryTexture(*texture, &format, &access, &w, &h) < 0 || new_width != w || new_height != h || new_format != format) { void *pixels; int pitch; - SDL_DestroyTexture(*texture); + if (*texture) + SDL_DestroyTexture(*texture); if (!(*texture = SDL_CreateTexture(renderer, new_format, SDL_TEXTUREACCESS_STREAMING, new_width, new_height))) return -1; if (SDL_SetTextureBlendMode(*texture, blendmode) < 0) @@ -2577,7 +2578,7 @@ static int stream_component_open(VideoState *is, int stream_index) if (forced_codec_name) av_log(NULL, AV_LOG_WARNING, "No codec could be found with name '%s'\n", forced_codec_name); else av_log(NULL, AV_LOG_WARNING, - "No codec could be found with id %d\n", avctx->codec_id); + "No decoder could be found for codec %s\n", avcodec_get_name(avctx->codec_id)); ret = AVERROR(EINVAL); goto fail; } @@ -3250,15 +3251,14 @@ static void event_loop(VideoState *cur_stream) refresh_loop_wait_event(cur_stream, &event); switch (event.type) { case SDL_KEYDOWN: - if (exit_on_keydown) { + if (exit_on_keydown || event.key.keysym.sym == SDLK_ESCAPE || event.key.keysym.sym == SDLK_q) { do_exit(cur_stream); break; } + // If we don't yet have a window, skip all key events, because read_thread might still be initializing... + if (!cur_stream->width) + continue; switch (event.key.keysym.sym) { - case SDLK_ESCAPE: - case SDLK_q: - do_exit(cur_stream); - break; case SDLK_f: toggle_full_screen(cur_stream); cur_stream->force_refresh = 1; @@ -3655,10 +3655,6 @@ int main(int argc, char **argv) #if CONFIG_AVDEVICE avdevice_register_all(); #endif -#if CONFIG_AVFILTER - avfilter_register_all(); -#endif - av_register_all(); avformat_network_init(); init_opts();