+void eServiceMP3::gstCBsubtitleCAPS(GObject *obj, GParamSpec *pspec, gpointer user_data)
+{
+ eDebug("gstCBsubtitleCAPS:: signal::caps callback obj=%p", obj);
+
+ eServiceMP3 *_this = (eServiceMP3*)user_data;
+ eDebug("gstCBsubtitleCAPS:: m_currentSubtitleStream=%i, m_subtitleStreams.size()=%i", _this->m_currentSubtitleStream, _this->m_subtitleStreams.size());
+
+ if ( _this->m_currentSubtitleStream >= _this->m_subtitleStreams.size() )
+ {
+ eDebug("return");
+ return;
+ }
+
+ subtitleStream subs = _this->m_subtitleStreams[_this->m_currentSubtitleStream];
+
+ if ( subs.type == stUnknown )
+ {
+ GstTagList *tags;
+ eDebug("gstCBsubtitleCAPS::m_subtitleStreams[%i].type == stUnknown...", _this->m_currentSubtitleStream);
+
+ gchar *g_lang;
+ g_signal_emit_by_name (_this->m_gst_playbin, "get-text-tags", _this->m_currentSubtitleStream, &tags);
+
+ g_lang = g_strdup_printf ("und");
+ if ( tags && gst_is_tag_list(tags) )
+ gst_tag_list_get_string(tags, GST_TAG_LANGUAGE_CODE, &g_lang);
+ subs.language_code = std::string(g_lang);
+
+ subs.type = getSubtitleType(GST_PAD(obj));
+
+ _this->m_subtitleStreams[_this->m_currentSubtitleStream] = subs;
+
+ g_free (g_lang);
+ }
+
+ if ( subs.type == stVOB )
+ {
+ GstPad *ghostpad = gst_element_get_static_pad(_this->m_gst_subtitlebin, "sink");
+ GstElement *dvdsubdec = gst_bin_get_by_name(GST_BIN(_this->m_gst_subtitlebin), "vobsubtitle_decoder");
+ GstPad *subdecsinkpad = gst_element_get_static_pad (dvdsubdec, "sink");
+ eDebug("gstCBsubtitleCAPS:: dvdsubdec=%p, subdecsinkpad=%p, ghostpad=%p,", dvdsubdec, subdecsinkpad, ghostpad);
+ gst_ghost_pad_set_target((GstGhostPad*)ghostpad, subdecsinkpad);
+ }
+ else
+ {
+ GstPad *ghostpad = gst_element_get_static_pad(_this->m_gst_subtitlebin, "sink");
+ GstElement *appsink = gst_bin_get_by_name(GST_BIN(_this->m_gst_subtitlebin), "subtitle_sink");
+ GstPad *appsinkpad = gst_element_get_static_pad (appsink, "sink");
+ eDebug("gstCBsubtitleCAPS:: appsink=%p, appsinkpad=%p, ghostpad=%p,", appsink, appsinkpad, ghostpad);
+ gst_ghost_pad_set_target((GstGhostPad*)ghostpad, appsinkpad);
+ }
+}
+