Re: [FFmpeg-devel] [PATCH] fftools/ffplay: do not write out of rdft visualization texture
On Mon, 8 Mar 2021, Michael Niedermayer wrote: On Mon, Mar 08, 2021 at 09:56:38PM +0100, Marton Balint wrote: On Sun, 7 Mar 2021, Michael Niedermayer wrote: On Wed, Mar 03, 2021 at 11:27:22PM +0100, Marton Balint wrote: If the window is resized it was possible that xpos pointed outside the visualization texture. By rearranging the overflow check we make sure this (and a crash) does not happen. We also don't have to use xleft for start position, as that is 0 anyways, and if we ever want to take into account xleft then the texture should be positioned accordingly when rendering. reading this, i wonder if a assertion with xleft == 0 would make sense I don't really see the point. It was just an idea that came to my mind without any deep thoughts I'd rather add the xleft/ytop to the render if you prefer, but overall I don't think it matters. please do what you prefer! Ok, thanks, pushed as is then. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/ffplay: do not write out of rdft visualization texture
On Mon, Mar 08, 2021 at 09:56:38PM +0100, Marton Balint wrote: > > > On Sun, 7 Mar 2021, Michael Niedermayer wrote: > > > On Wed, Mar 03, 2021 at 11:27:22PM +0100, Marton Balint wrote: > > > If the window is resized it was possible that xpos pointed outside the > > > visualization texture. By rearranging the overflow check we make sure > > > this (and > > > a crash) does not happen. > > > > > > > > We also don't have to use xleft for start position, as that is 0 anyways, > > > and > > > if we ever want to take into account xleft then the texture should be > > > positioned accordingly when rendering. > > > > reading this, i wonder if a assertion with xleft == 0 would make sense > > I don't really see the point. It was just an idea that came to my mind without any deep thoughts > I'd rather add the xleft/ytop to the render if > you prefer, but overall I don't think it matters. please do what you prefer! thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Does the universe only have a finite lifespan? No, its going to go on forever, its just that you wont like living in it. -- Hiranya Peiri signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/ffplay: do not write out of rdft visualization texture
On Sun, 7 Mar 2021, Michael Niedermayer wrote: On Wed, Mar 03, 2021 at 11:27:22PM +0100, Marton Balint wrote: If the window is resized it was possible that xpos pointed outside the visualization texture. By rearranging the overflow check we make sure this (and a crash) does not happen. We also don't have to use xleft for start position, as that is 0 anyways, and if we ever want to take into account xleft then the texture should be positioned accordingly when rendering. reading this, i wonder if a assertion with xleft == 0 would make sense I don't really see the point. I'd rather add the xleft/ytop to the render if you prefer, but overall I don't think it matters. --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1193,7 +1193,8 @@ static void video_audio_display(VideoState *s) } SDL_UnlockTexture(s->vis_texture); } -SDL_RenderCopy(renderer, s->vis_texture, NULL, NULL); +rect = (SDL_Rect){s->xleft, s->ytop, s->width, s->height}; +SDL_RenderCopy(renderer, s->vis_texture, NULL, ); } if (!s->paused) s->xpos++; Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] fftools/ffplay: do not write out of rdft visualization texture
On Wed, Mar 03, 2021 at 11:27:22PM +0100, Marton Balint wrote: > If the window is resized it was possible that xpos pointed outside the > visualization texture. By rearranging the overflow check we make sure this > (and > a crash) does not happen. > > We also don't have to use xleft for start position, as that is 0 anyways, and > if we ever want to take into account xleft then the texture should be > positioned accordingly when rendering. reading this, i wonder if a assertion with xleft == 0 would make sense thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] fftools/ffplay: do not write out of rdft visualization texture
If the window is resized it was possible that xpos pointed outside the visualization texture. By rearranging the overflow check we make sure this (and a crash) does not happen. We also don't have to use xleft for start position, as that is 0 anyways, and if we ever want to take into account xleft then the texture should be positioned accordingly when rendering. Signed-off-by: Marton Balint --- fftools/ffplay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index b9a30cdb11..0cdadab293 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1148,6 +1148,8 @@ static void video_audio_display(VideoState *s) if (realloc_texture(>vis_texture, SDL_PIXELFORMAT_ARGB, s->width, s->height, SDL_BLENDMODE_NONE, 1) < 0) return; +if (s->xpos >= s->width) +s->xpos = 0; nb_display_channels= FFMIN(nb_display_channels, 2); if (rdft_bits != s->rdft_bits) { av_rdft_end(s->rdft); @@ -1197,8 +1199,6 @@ static void video_audio_display(VideoState *s) } if (!s->paused) s->xpos++; -if (s->xpos >= s->width) -s->xpos= s->xleft; } } -- 2.26.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".