add subtitle list
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 5 Jun 2006 21:21:31 +0000 (21:21 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 5 Jun 2006 21:21:31 +0000 (21:21 +0000)
lib/service/servicedvb.cpp
lib/service/servicedvb.h

index de4f84ee691b3adf90eef027504182a148b956f7..826c29aafec2a9a138f1dff71aa36a126aae84a6 100644 (file)
@@ -1843,7 +1843,7 @@ void eDVBServicePlay::cutlistToCuesheet()
        m_cue->commitSpans();
 }
 
-RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, int index)
+RESULT eDVBServicePlay::enableSubtitles(eWidget *parent, PyObject *entry)
 {
        if (m_subtitle_widget)
                disableSubtitles(parent);
@@ -1861,9 +1861,27 @@ RESULT eDVBServicePlay::disableSubtitles(eWidget *parent)
        return 0;
 }
 
-RESULT eDVBServicePlay::getSubtitleList(PyList *list)
+PyObject *eDVBServicePlay::getSubtitleList()
 {
-       return -1;
+       if (!m_teletext_parser)
+       {
+               Py_INCREF(Py_None);
+               return Py_None;
+       }
+       
+       PyObject *l = PyList_New(0);
+       
+       for (std::set<int>::iterator i(m_teletext_parser->m_found_subtitle_pages.begin()); i != m_teletext_parser->m_found_subtitle_pages.end(); ++i)
+       {
+               PyObject *tuple = PyTuple_New(2);
+               char desc[20];
+               sprintf(desc, "Page %x", *i);
+               PyTuple_SetItem(tuple, 0, PyString_FromString(desc));
+               PyTuple_SetItem(tuple, 1, PyInt_FromLong(*i));
+               PyList_Append(l, tuple);
+       }
+       
+       return l;
 }
 
 void eDVBServicePlay::newSubtitlePage(const eDVBTeletextSubtitlePage &page)
index 85653caa8eff798b6c22e849592c74aec48545dd..00aba963efab12da12fca1e643788f2f003db6d8 100644 (file)
@@ -142,9 +142,9 @@ public:
        void setCutListEnable(int enable);
        
                // iSubtitleOutput
-       RESULT enableSubtitles(eWidget *parent, int index);
+       RESULT enableSubtitles(eWidget *parent, PyObject *entry);
        RESULT disableSubtitles(eWidget *parent);
-       SWIG_VOID(RESULT) getSubtitleList(PyList *list);
+       PyObject *getSubtitleList();
 
 private:
        friend class eServiceFactoryDVB;