Does anyone know how to support subtitles by Phonon?

W W linuxmeego at gmail.com
Wed Jul 6 08:32:53 BST 2011


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.
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-multimedia/attachments/20110706/225c1385/attachment.htm>
-------------- next part --------------
_______________________________________________
kde-multimedia mailing list
kde-multimedia at kde.org
https://mail.kde.org/mailman/listinfo/kde-multimedia


More information about the kde-multimedia mailing list