Does anyone know how to support subtitles by Phonon?

Trever Fischer tdfischer at fedoraproject.org
Mon Jul 25 04:47:54 BST 2011


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



More information about the kde-multimedia mailing list