[FFmpeg-devel] [PATCH] ffplay: allow fallback to software renderer

Josh de Kock josh at itanimul.li
Thu Nov 17 23:26:40 EET 2016


On 17/11/2016 21:18, Marton Balint wrote:
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  ffplay.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/ffplay.c b/ffplay.c
> index 12502f2..63c0e19 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -1282,6 +1282,10 @@ static int video_open(VideoState *is, Frame *vp)
>          if (window) {
>              SDL_RendererInfo info;
>              renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
> +            if (!renderer) {
> +                av_log(NULL, AV_LOG_WARNING, "Failed to initialize a hardware accelerated renderer.\n");
> +                renderer = SDL_CreateRenderer(window, -1, 0);
Shouldn't this be SDL_RENDERER_PRESENTVSYNC instead of 0?
> +            }
>              if (renderer) {
>                  if (!SDL_GetRendererInfo(renderer, &info))
>                      av_log(NULL, AV_LOG_VERBOSE, "Initialized %s renderer.\n", info.name);
>

If the hwaccel renderer fails, it may be useful to give the user the 
SDL_Error as well.

F.ex:
av_log(NULL, AV_LOG_WARNING, "Failed to intialize a hardware accelerated 
renderer: %s\n", SDL_GetError());

-- 
Josh

Sorry about the example wrapping, not sure how to turn off text wrapping 
on this client.


More information about the ffmpeg-devel mailing list