|
From: | Joe |
Subject: | Re: [Bino-list] SubTitles? |
Date: | Mon, 21 Mar 2011 12:45:46 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 |
Hi! Dne 3/20/2011 1:58 PM, Martin Lambers napsal(a):
Can you please debug it a bit? I added only one opengl call "glTexSubImage2D" to copy subtitle bitmap to left/right texture. Is the opengl call causing a problem or there is a bug in subtitle processing/rendering? For me the example videos I posted are working well. Have you tried them?On 17/03/11 01:16, Joe wrote:On Tuesday 15 March 2011 21:15:23 Martin Lambers wrote:Yes, we need a high level library that hides all those messy system dependent details, and ideally also takes care of any character encoding issues for us. I agree that we should avoid adding too many dependencies. Pango actually does not seem to be too much of a problem in this regard: it does depend on glib, but not on GTK, and on my system (Ubuntu 10.10) libqt4gui also depends on glib (to allow using the glib mainloop), so the number of additional dependencies would be limited to pango+cairo. Still, there might be better choices than pango. Maybe we should just use Qt, but I really would like to have subtitles working with Equalizer, too. From a quick look at the code, Equalizer itself seems to only support crappy old-style X11 fonts on Linux, and only in US-ASCII encoding.On second thought, there is probably no real advantage in using Pango over Qt. It looks like one would need to use QPainter on a QImage to draw the text, and then upload the QImage as a texture to the GPU. No additional libraries would be required. If we keep the subtitle rendering code a little bit separated from the rest, we can probably figure out a way to use this from within Equalizer later. MartinI got rid of FTGL and reimplemented font rendering in QT. Everything looks much cleaner now - system font selection dialog, all the fancy options and now there is subtitles text encoding selection. I'm drawing subtitles into argb buffer and I managed to print it directly into left/right textures, so finally I can implement depth of subtitles (paralax is correct name?). However I need help with alpha blending of two textures. I'm using glTexSubImage right now to copy the subtitle image directly into left/right texture, but that does not do alpha blending. I hope you will find the time to implement proper blending/overlaying of those textures. https://github.com/cuchac/bino has fresh sources and the code should be ready for testing.Many thanks for your work, it is highly appreciated! Your code does not yet work for me: I get OpenGL errors and video playback stops before the first subtitle is shown.
I hope I keep subtitles and video separated. I just added one pointer to video frame that says whether video frame has or has not a subtitle attached. Where do you see the mixture? I agree with breaking subtitle list into subtitle_box that will hold only one subtitle and will be buffered in the same way as video or audio frames/blobs.Nevertheless, I'm beginning to merge your work into Bino, since I'm sure the OpenGL problems can be fixed later. I would like to make a few conceptual changes if that's ok with you: - Keep subtitles and video frames separate in the media data. Just provide simple individual subtitle boxes from the media object, and do all buffering of subsequent subtitles (that may be stored in the same packet) in the media object. (This is similar to the way audio data is handled now.)
I will redo your patch on top of my branch and unify processing of audio, vide and subtitles. I will also move font rendering from video_output to subtitles decoding thread. Is it what you want?- The subtitle reading/decoding is separated into threads just like video and audio reading/decoding.
Is it possible to point me to same example how to alpha-blend two textures? I dont know how to replace glTexSubImage2D - see https://github.com/cuchac/bino/blob/master/src/video_output.cpp#L375. I have ARGB memory buffer with subtitles and I need to blend it with the video frame texture. glTexSubImage2D does just simple replacing, not blending.- I have changed the decoding of subtitles based on my (limited) understanding of the FFmpeg subtitle API. See the attached patch (against current Bino in git) as a proposal. This code compiles, but it is *untested* (i.e. broken). Its purpose is just to give an idea of the proposed subtitle input and management; everything else is not yet included. Do you agree to these changes? Do you have other suggestions?
Thanks, Joe.
[Prev in Thread] | Current Thread | [Next in Thread] |