[FFmpeg-devel] ffplay: properly detect all window size changes

Submitted by Marton Balint on Aug. 13, 2019, 9:20 p.m.

Details

Message ID 20190813212008.28495-1-cus@passwd.hu
State Accepted
Commit a1c70148471c528104d64dffbc7af70e5d1ce33e
Headers show

Commit Message

Marton Balint Aug. 13, 2019, 9:20 p.m.
SDL_WINDOWEVENT_SIZE_CHANGED should be used instead of SDL_WINDOWEVENT_RESIZED
because SDL_WINDOWEVENT_RESIZED is only emitted if the resize happened due to
an external event.

Fixes ticket #8072.

Additional references:
https://bugzilla.libsdl.org/show_bug.cgi?id=4760
https://wiki.libsdl.org/SDL_WindowEventID

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 fftools/ffplay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Aug. 14, 2019, 3:33 p.m.
LGTM

On Tue, Aug 13, 2019 at 11:20 PM Marton Balint <cus@passwd.hu> wrote:

> SDL_WINDOWEVENT_SIZE_CHANGED should be used instead of
> SDL_WINDOWEVENT_RESIZED
> because SDL_WINDOWEVENT_RESIZED is only emitted if the resize happened due
> to
> an external event.
>
> Fixes ticket #8072.
>
> Additional references:
> https://bugzilla.libsdl.org/show_bug.cgi?id=4760
> https://wiki.libsdl.org/SDL_WindowEventID
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  fftools/ffplay.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index 8fb8faeb06..fee0619f7c 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -3436,7 +3436,7 @@ static void event_loop(VideoState *cur_stream)
>              break;
>          case SDL_WINDOWEVENT:
>              switch (event.window.event) {
> -                case SDL_WINDOWEVENT_RESIZED:
> +                case SDL_WINDOWEVENT_SIZE_CHANGED:
>                      screen_width  = cur_stream->width  =
> event.window.data1;
>                      screen_height = cur_stream->height =
> event.window.data2;
>                      if (cur_stream->vis_texture) {
> --
> 2.16.4
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Reino Wijnsma Aug. 14, 2019, 7:35 p.m.
On 2019-08-13T23:20:08+0200, Marton Balint <cus@passwd.hu> wrote:
> SDL_WINDOWEVENT_SIZE_CHANGED should be used instead of SDL_WINDOWEVENT_RESIZED
> because SDL_WINDOWEVENT_RESIZED is only emitted if the resize happened due to
> an external event.
>
> Fixes ticket #8072.
>
> Additional references:
> https://bugzilla.libsdl.org/show_bug.cgi?id=4760
> https://wiki.libsdl.org/SDL_WindowEventID
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  fftools/ffplay.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index 8fb8faeb06..fee0619f7c 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -3436,7 +3436,7 @@ static void event_loop(VideoState *cur_stream)
>              break;
>          case SDL_WINDOWEVENT:
>              switch (event.window.event) {
> -                case SDL_WINDOWEVENT_RESIZED:
> +                case SDL_WINDOWEVENT_SIZE_CHANGED:
>                      screen_width  = cur_stream->width  = event.window.data1;
>                      screen_height = cur_stream->height = event.window.data2;
>                      if (cur_stream->vis_texture) {

Applied patch and compiled ffplay locally. I can confirm this patch fixes ticket #8072.

-- Reino
Marton Balint Aug. 14, 2019, 8:23 p.m.
On Wed, 14 Aug 2019, Reino Wijnsma wrote:

> On 2019-08-13T23:20:08+0200, Marton Balint <cus@passwd.hu> wrote:
>> SDL_WINDOWEVENT_SIZE_CHANGED should be used instead of SDL_WINDOWEVENT_RESIZED
>> because SDL_WINDOWEVENT_RESIZED is only emitted if the resize happened due to
>> an external event.
>>
>> Fixes ticket #8072.
>>
>> Additional references:
>> https://bugzilla.libsdl.org/show_bug.cgi?id=4760
>> https://wiki.libsdl.org/SDL_WindowEventID
>>
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  fftools/ffplay.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
>> index 8fb8faeb06..fee0619f7c 100644
>> --- a/fftools/ffplay.c
>> +++ b/fftools/ffplay.c
>> @@ -3436,7 +3436,7 @@ static void event_loop(VideoState *cur_stream)
>>              break;
>>          case SDL_WINDOWEVENT:
>>              switch (event.window.event) {
>> -                case SDL_WINDOWEVENT_RESIZED:
>> +                case SDL_WINDOWEVENT_SIZE_CHANGED:
>>                      screen_width  = cur_stream->width  = event.window.data1;
>>                      screen_height = cur_stream->height = event.window.data2;
>>                      if (cur_stream->vis_texture) {
>
> Applied patch and compiled ffplay locally. I can confirm this patch fixes ticket #8072.

Thanks for testing, pushed to git master and 4.2 release branch.

Regards,
Marton

Patch hide | download patch | download mbox

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 8fb8faeb06..fee0619f7c 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3436,7 +3436,7 @@  static void event_loop(VideoState *cur_stream)
             break;
         case SDL_WINDOWEVENT:
             switch (event.window.event) {
-                case SDL_WINDOWEVENT_RESIZED:
+                case SDL_WINDOWEVENT_SIZE_CHANGED:
                     screen_width  = cur_stream->width  = event.window.data1;
                     screen_height = cur_stream->height = event.window.data2;
                     if (cur_stream->vis_texture) {