Bug 213710 - [PATCH] Add external subtitles auto-detection feature in phonon-xine backend (.srt,.sub, .txt, and so on)
Summary: [PATCH] Add external subtitles auto-detection feature in phonon-xine backend ...
Status: RESOLVED DUPLICATE of bug 300967
Alias: None
Product: Phonon
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Martin Sandsmark
URL:
Keywords:
: 179853 238697 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-11-08 17:51 UTC by Romain Perier
Modified: 2012-06-03 11:36 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
phonon-subtitles-phonon-xine.patch (6.53 KB, patch)
2009-11-08 17:52 UTC, Romain Perier
Details
phonon-4.4-subtitles-files-phonon-xine.patch (10.55 KB, patch)
2009-11-14 23:01 UTC, Romain Perier
Details
phonon-4.4-subtitles-files-phonon-xine.patch (13.64 KB, patch)
2009-11-18 11:29 UTC, Romain Perier
Details
phonon-4.4-subtitles-files-phonon-xine.patch (14.89 KB, patch)
2009-11-18 23:01 UTC, Romain Perier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Perier 2009-11-08 17:51:29 UTC
Version:            (using Devel)
Compiler:          GNU C compiler, gcc-4.4.2 
OS:                Linux
Installed from:    Compiled sources

Hey,

As discussed with Martin (sandsmark) on IRC, this is a patch to read external file subtitles using phonon-xine backend (like .srt, .txt, .sub, .asc files)

Actually I added a method MediaController::setAutoDetectSubtitles(bool) in order to be able to set or unset the auto-dectection (enabled as default but may be I'm wrong, because some developers don't want necessarily this feature as default.. which implies to have to touch to existing code..)

The auto-detection itself is present in XineStream::xineOpen(), and works for local files only.

two other things : 
- That would be very interesting to be able to choice a subtitle manually (without auto-detection, however this feature is good anyway for some mediaplayers)
- xine seems to use ISO fonts to display subtitles (a bit annoying, imho)

I hope this patch will help you, feel free to commented out it in case of remarks, problems... ;)

Regards,
Romain.
Comment 1 Romain Perier 2009-11-08 17:52:39 UTC
Created attachment 38188 [details]
phonon-subtitles-phonon-xine.patch
Comment 2 Romain Perier 2009-11-14 23:01:49 UTC
Created attachment 38332 [details]
phonon-4.4-subtitles-files-phonon-xine.patch
Comment 3 Romain Perier 2009-11-14 23:03:47 UTC
You'll find in attachment, a new patch :

- I cleaned up a lot my code for the autodetection phase
- Now we're able to load a subtitle file manually (MediaController::setFileSubtitle() )

My code is probably not perfect, please get back me in case of problems, comments, and so on . In the worst case I can of course fix it ;)
Regards,
Romain.
Comment 4 Romain Perier 2009-11-15 12:48:24 UTC
Probably move the auto-detection part somewhere else, would be better imho.
I meant instead of keeping this part in XineStream::xineOpen() (which is able to be executed for each call of xineOpen() ) it would be better to move this part in XineStream::event() when a MrlChangedEvent() is received...

==> In this way we try to find a subtitle recursively only when the MRL changes, and not for each xineOpen()... however may be I'm wrong.
Comment 5 Martin Sandsmark 2009-11-16 16:40:57 UTC
Nice!

Just the technical details, we use 4 spaces indentation in Phonon (not tabs). But don't worry, I can fix it when applying the patch. But please remember it for the next patch. :-)
Comment 6 Romain Perier 2009-11-18 11:29:29 UTC
Created attachment 38417 [details]
phonon-4.4-subtitles-files-phonon-xine.patch
Comment 7 Romain Perier 2009-11-18 11:33:53 UTC
- I fixed "indentation" to use 4 spaces instead.
- I moved auto-detection code in a private method (more correct imho)
- m_mrl_sub is concat to m_mrl only when MrlChangedEvent is received
- setFileSubtitles() has a higher priority than autoDetectSubtitles:
  --> setFileSubtitles() is able to overwrite an autodetected subtitle (because it called explicitly)
  --> auto-detection has a lower priority because it can be enabled accidentaly (assuming that setAutoDetectSubtitles(false) is not called...)
- Now m_mrl_sub is cleared when the UnloadCommand is received (it was a bug)

- mhhh... that all :)
Comment 8 Romain Perier 2009-11-18 23:01:19 UTC
Created attachment 38433 [details]
phonon-4.4-subtitles-files-phonon-xine.patch
Comment 9 Romain Perier 2009-11-18 23:03:01 UTC
New method : MediaController::setSubtitleEncoding(const QString &encoding)

--> In order to be able to change the subtitle encoding dynamically ;)
(API commented out)
Comment 10 Martin Sandsmark 2009-12-07 03:02:58 UTC
*** Bug 179853 has been marked as a duplicate of this bug. ***
Comment 11 Martín Cigorraga 2010-04-27 02:57:50 UTC
Dear Romain Perier, thank you for such a nice work and really needed contribution.
Dear Martini Sandsmark, thank you very much for being actively involved in this development.


I'm an end user -I mean I do not code- and this is my humble contribution:

Multimedia support in KDE SC 4 (4.4.2) on x86_64 plain SUCKS.

I love KDE SC 4, it's an incredible DE/WM but I cannot believe KDE Org don't pay attention to multimedia needs like Flash support -you can watch any video online but without sound, grrr-, subtitles for foreign movies AND a correct backend interface for apps that do not run on Phonon-Xine by default as Songbird.

And what about an all-round '4x4' multimedia player? I need several players for each type of multimedia file to play it well... WTF!, S U C K S!!!
SMPlayer (works really good with near all, but not all), KMPlayer (not so good as Totem but not so bad too), Dragon Player (for DVD playback, with a HORRIBLE font for subtitles), Kaffeine (which is nearly unusable) an this new project called KDE Media Player which promises a lot...

A LOT of different applications FOR A SINGLE TASK: play a media file :P

Back when I used Ubuntu on this 64 bits system (I now run ArchLinux + KDE SC) I never, NEVER had ANY SINGLE ISSUE playing ANY TYPE of multimedia file, provided codecs where installed. Not to say Flash allways worked like charm!!
And guess what? Sure I can use the multimedia application I want for a specific task, but Totem is an incredible useful and versatile multimedia player that do it job really good.

Sorry if I sound upsetted, I'm not, but I think someone should tell you what you're missing from sight. I'm not criticizing you rather thanking you all your hard work and love and time and energy you put to code this awesome KDE - I'm one of those guys who used to say never will use KDE xD
I'm just pointing some things I need get some attention... God! if only I know how to code I would be eager to give you a hand here.

Please accept this as a little, very little contribution from an END USER point of view. I'm not an expert in usability and such but it's evident a change's needed here.

Thank you for creating KDE SC and making it free, best!
Comment 12 Sam 2010-05-27 12:18:51 UTC
Re: Martín Cigorraga

Your multimedia support issues, especially flash, are likely your distribution. It's more apt to compare Ubuntu to Kubuntu.

Also, what do you mean about supporting non-kde software like songbird? I didn't get what you wanted KDE to do. As far as I know, I've never had an issue when I tried songbird in Kubuntu.

P.S.

There is an application that does it all, http://bangarangkde.wordpress.com/
Comment 13 Martin Sandsmark 2010-06-29 22:35:16 UTC
*** Bug 238697 has been marked as a duplicate of this bug. ***
Comment 14 Harald Sitter 2012-06-01 06:59:44 UTC

*** This bug has been marked as a duplicate of bug 300967 ***
Comment 15 Adrián Chaves (Gallaecio) 2012-06-03 05:55:34 UTC
How can bug 213710 be a duplicate of 300967? Shouldn’t it be the other way around?
Comment 16 Harald Sitter 2012-06-03 11:36:49 UTC
coz this here bug is about xine which is unmaintained, unsupported, uncaredfor, unwanted...