mlt icon indicating copy to clipboard operation
mlt copied to clipboard

melt playing window stopped refresh after resized

Open chengyingyuan opened this issue 2 years ago • 2 comments

I built mlt-7.4.0 using mingw64 toolchain. When playing mp4 videos using command line tool melt, consumer_sdl2 is used, and the producer is avformat I guess. If I resized playing window, frame resized as well, but stopped refreshing afterwards, and audio played as normal as before.

I digged into source file consumer_sdl2.c, finding self->window_width is updated after resizing event, everything seems OK. I tried adding following line after window resized:

SDL_RenderSetViewport(self->sdl_renderer, NULL);

Nothing good happened.

It's frustrated me serveral days. Any advice to solve it?

chengyingyuan avatar Mar 25 '22 10:03 chengyingyuan

After serveral days of hard work, I got an acceptable solution, although not elegant.

I changed consumer_sdl2.c to create an opengl context in function setup_sdl_video(), rendering frame from video_thread(), which is called from main thread of melt.c instead of a standalone thread. If I create opengl context in one thread and render in another one, nothing will be rendered.

To get the function address of video_thread() from melt.c, I set it as a property when consumer starts.

My patch is messy. Hope you great guys make a more reasonable solution.

changes.zip

chengyingyuan avatar Mar 31 '22 03:03 chengyingyuan

我碰到了一样的问题,修改consumer_sdl2.c,将setup_sdl_video放到video_thread线程初始化就正常了

xfc1939 avatar Jul 15 '22 12:07 xfc1939