Does anyone know how to support subtitles by Phonon?
Romain Perier
romain.perier at gmail.com
Fri Jul 29 13:26:45 BST 2011
Le 25/07/2011 05:47, Trever Fischer a écrit :
> On Wednesday, July 06, 2011 03:32:53 AM W W wrote:
>> Hi Guys
>>
>> Does anyone know how to support subtitles (such as srt, sub, ass/ssa,
>> smi...) by Phonon which backend is phonon-backend-gstreamer?
>> I check the Phonon source code,I find the MediaController class.It provide
>> some functions for subtitles.
> Its coming soon. Checkout the plumbing-subs branch of pgst from git.
>> But I try these code following which don't work.
>>
>> //Create the new subtitle and add it to the list of available
>> subtitles
>>
>> if(mediaController == NULL)
>>
>> {
>>
>> mediaController = new Phonon::MediaController(media);
>>
>> }
>>
>> QString fileName = "/home/simon/Desktop/video/test.sub";
>>
>> QHash<QByteArray, QVariant> properties;
>>
>> properties.insert("type", "file");
>>
>> properties.insert("name", fileName);
>>
>> Phonon::SubtitleDescription newSubtitle(0, properties);
>>
>> mediaController->setCurrentSubtitle(newSubtitle);
>>
>> And I download the source code of phonon-backend-gstreamer.
>>
>> I find there are some function about subtitle in MediaObject.cpp.
>>
>> void MediaObject::addSubtitle(GstPad *pad)
>>
>> {
>>
>> GstState currentState = GST_STATE(m_pipeline);
>>
>> if (addToPipeline(m_videoGraph)) {
>>
>> GstPad *subtitlepad = gst_element_get_pad(m_videoGraph,
>> "subtitle_sink");
>>
>> if (!GST_PAD_IS_LINKED(subtitlepad)&& (gst_pad_link(pad,
>> subtitlepad) == GST_PAD_LINK_OK)) {
>>
>> gst_element_set_state(m_videoGraph, currentState ==
>> GST_STATE_PLAYING ? GST_STATE_PLAYING : GST_STATE_PAUSED);
>>
>> m_backend->logMessage("Subtitle track connected",
>> Backend::Info, this);
>>
>> } else {
>>
>> m_backend->logMessage("Could not connect subtitle track");
>>
>> }
>>
>> gst_object_unref(subtitlepad);
>>
>> } else {
>>
>> m_backend->logMessage("The video stream could not be plugged.",
>> Backend::Info, this);
>>
>> }
>>
>> }
>>
>> But there is no prase subtitle function.
>>
>> So Could anyone give me some suggestion about how to support subtitles by
>> Phonon or gstreamer?
>>
>> Or Is there any media player which write by Phonon and whose backend is
>> phonon-backend-gstreamer can support subtitle ?
>>
>> I can download the source code to check how it works
> _______________________________________________
> kde-multimedia mailing list
> kde-multimedia at kde.org
> https://mail.kde.org/mailman/listinfo/kde-multimedia
Hi,
The plumbing-subs branch has been merged with the plumbing branch of
pgst. You can use it now!
~/KDE $ git clone git://anongit.kde.org/phonon-gstreamer.git -b plumbing
Actually no videoplayer has the feature for external subtitles. However,
an external subtitle can be auto detected and selected by pgst !
For that, just rename your subtitle file like your video (except the
extension) and move it into the same directory.
If the font is ugly, or you don't like it, you can change it, export the
variable PHONON_SUBTITLE_FONT in a terminal, using a pango font description.
An example :
~/movies $ ls
video.avi video.srt
~/movies $ export PHONON_SUBTITLE_FONT="Sans Bold 16"
~/movies $ dragon video.avi
enjoy ! ;)
Regards,
Romain
More information about the kde-multimedia
mailing list