bino-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bino-list] SubTitles?


From: Joe
Subject: Re: [Bino-list] SubTitles?
Date: Mon, 21 Mar 2011 17:42:53 +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/21/2011 4:37 PM, Martin Lambers napsal(a):
On 21/03/11 12:45, Joe wrote:
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.
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?
I get an OpenGL error (0x0501: Invalid value), so the problem is
probably not in subtitle processing, but in rendering. It might also be
a problem in the existing rendering code that was not triggered before,
or a problem with my OpenGL driver. I currently cannot debug this due to
lack of time.

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 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?
Exactly there ;)  I did not see that this pointer is just a flag, I
thought it held the complete subtitle data.

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.
- The subtitle reading/decoding is separated into threads just like
video and audio reading/decoding.
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?
That's not necessary; my patch was just a rough sketch. The font
rendering should stay in video_output, it should not go into a separate
thread.

I don't get this. Font rendering (creating ARGB image from textual data) is the only time consuming operation that can be done during subtitle decoding. Otherwise subtitle decoding thread will only memcpy text from packet to subtitle_box. If separate subtitles decoding thread should be created, I don't get why font should be rendered elsewhere. I suggest in decoding thread to create subtitle_box, render text using QT into buffer inside subtitle_box and in video_output only blend the buffer with left/right image.
- 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?

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.
Once you have the subtitle rendered (with Qt) into a buffer, you can
create a texture from this buffer. Both the buffer and the texture
should have an alpha channel. Then, the subtitle texture should be
rendered into the _color_srgb_tex textures with blending enabled (in the
function display_current_frame).
I will try to do that, but I'm not sure I have enough OpenGL skills to alpha blend two textures.

Bye,
Joe.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]