/* for subtitles */
#include <lib/gui/esubtitle.h>
+#ifndef GST_SEEK_FLAG_SKIP
+#warning Compiling for legacy gstreamer, things will break
+#define GST_SEEK_FLAG_SKIP 0
+#define GST_TAG_HOMEPAGE ""
+#endif
+
// eServiceFactoryMP3
eServiceFactoryMP3::eServiceFactoryMP3()
RESULT eServiceMP3::start()
{
- assert(m_state == stIdle);
+ ASSERT(m_state == stIdle);
m_state = stRunning;
if (m_gst_playbin)
RESULT eServiceMP3::stop()
{
- assert(m_state != stIdle);
+ ASSERT(m_state != stIdle);
if (m_state == stStopped)
return -1;
eDebug("eServiceMP3::stop %s", m_filename.c_str());
// iPausableService
RESULT eServiceMP3::pause()
{
- if (!m_gst_playbin)
+ if (!m_gst_playbin || m_state != stRunning)
return -1;
GstStateChangeReturn res = gst_element_set_state(m_gst_playbin, GST_STATE_PAUSED);
if (res == GST_STATE_CHANGE_ASYNC)
RESULT eServiceMP3::unpause()
{
- if (!m_gst_playbin)
+ m_subtitle_pages.clear();
+ if (!m_gst_playbin || m_state != stRunning)
return -1;
GstStateChangeReturn res;
RESULT eServiceMP3::seekTo(pts_t to)
{
+ m_subtitle_pages.clear();
+
if (!m_gst_playbin)
return -1;
int eServiceMP3::getInfo(int w)
{
- gchar *tag = 0;
+ const gchar *tag = 0;
switch (w)
{
{
if ( !m_stream_tags )
return "";
- gchar *tag = 0;
+ const gchar *tag = 0;
switch (w)
{
case sTagTitle:
PyObject *eServiceMP3::getInfoObject(int w)
{
- gchar *tag = 0;
+ const gchar *tag = 0;
bool isBuffer = false;
switch (w)
{
GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin),"subtitle_sink");
GstClock *clock;
clock = gst_element_get_clock (appsink);
- do
+ while ( !m_subtitle_pages.empty() )
{
page = m_subtitle_pages.front();
m_subtitle_widget->setPage(page);
m_subtitle_pages.pop_front();
}
- } while ( !m_subtitle_pages.empty() );
+ } ;
gst_object_unref (clock);
}
g_object_get (G_OBJECT (m_gst_playbin), "current-text", &text_pid, NULL);
eDebug ("eServiceMP3::switched to subtitle stream %i", text_pid);
+ m_subtitle_pages.clear();
return 0;
RESULT eServiceMP3::disableSubtitles(eWidget *parent)
{
eDebug("eServiceMP3::disableSubtitles");
+ m_subtitle_pages.clear();
delete m_subtitle_widget;
m_subtitle_widget = 0;
return 0;