[FFmpeg-devel] [PATCH] ffplay: log possible error of SDL_EnableKeyRepeat

Ganesh Ajjanagadde gajjanag at mit.edu
Fri Oct 9 15:03:40 CEST 2015


On Fri, Oct 9, 2015 at 4:21 AM, wm4 <nfxjfg at googlemail.com> wrote:
> On Thu,  8 Oct 2015 18:46:44 -0400
> Ganesh Ajjanagadde <gajjanagadde at gmail.com> wrote:
>
>> Note that for the current SDL source code, 0 is always returned.
>> Nevertheless, this makes the code more robust.
>>
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> ---
>>  ffplay.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/ffplay.c b/ffplay.c
>> index 79f430d..c143e96 100644
>> --- a/ffplay.c
>> +++ b/ffplay.c
>> @@ -3814,7 +3814,8 @@ int main(int argc, char **argv)
>>      SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
>>      SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
>>
>> -    SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
>> +    if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) < 0)
>> +        av_log(NULL, AV_LOG_ERROR, "SDL_EnableKeyRepeat(): %s\n", SDL_GetError());
>>
>>      if (av_lockmgr_register(lockmgr)) {
>>          av_log(NULL, AV_LOG_FATAL, "Could not initialize lock manager!\n");
>
> How does this make the code more "robust"?

If in future some limitations are placed on the repeat delay/repeat
interval apart from nonnegativity, or if someone accidentally changes
the repeat delay to e.g something dynamic and forgot to check that it
is > 0, etc we would get a log message from ffplay allowing quick
fixing of the issue.

I don't know if "robust" is the right word for it, maybe "more complete"?

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list