RESULT eMP3ServiceOfflineOperations::deleteFromDisk(int simulate)
{
- if (simulate)
- return 0;
- else
+ if (!simulate)
{
std::list<std::string> res;
if (getListOfFilenames(res))
else
::unlink(i->c_str());
}
-
- return 0;
}
+ return 0;
}
RESULT eMP3ServiceOfflineOperations::getListOfFilenames(std::list<std::string> &res)
m_prev_decoder_time = -1;
m_decoder_time_valid_state = 0;
m_errorInfo.missing_codec = "";
- //vuplus
- m_is_hls_stream = 0;
+
audioSink = videoSink = NULL;
CONNECT(m_subtitle_sync_timer->timeout, eServiceMP3::pushSubtitles);
CONNECT(m_pump.recv_msg, eServiceMP3::gstPoll);
if ( m_sourceinfo.is_streaming )
{
uri = g_strdup_printf ("%s", filename);
- m_streamingsrc_timeout = eTimer::create(eApp);;
- CONNECT(m_streamingsrc_timeout->timeout, eServiceMP3::sourceTimeout);
-
+ if (strstr(filename, "rtmp://") || strstr(filename, "rtsp://")) {
+ m_streamingsrc_timeout = eTimer::create(eApp);
+ }
+ if (m_streamingsrc_timeout) {
+ CONNECT(m_streamingsrc_timeout->timeout, eServiceMP3::sourceTimeout);
+ }
std::string config_str;
if( ePythonConfigQuery::getConfigValue("config.mediaplayer.useAlternateUserAgent", config_str) == 0 )
{
{
ASSERT(m_state != stIdle);
- if (m_state == stStopped)
+ if (!m_gst_playbin || m_state == stStopped)
return -1;
//GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(m_gst_playbin),GST_DEBUG_GRAPH_SHOW_ALL,"e2-playbin");
RESULT eServiceMP3::getLength(pts_t &pts)
{
- if (!m_gst_playbin)
- return -1;
-
- if (m_state != stRunning)
+ if (!m_gst_playbin || m_state != stRunning)
return -1;
GstFormat fmt = GST_FORMAT_TIME;
gint64 pos;
pts = 0;
- if (!m_gst_playbin)
- return -1;
- if (m_state != stRunning)
+ if (!m_gst_playbin || m_state != stRunning)
return -1;
if (audioSink || videoSink)
{
if (!msg)
return;
- gchar *sourceName;
- GstObject *source;
+ gchar *sourceName = NULL;
+ GstObject *source = NULL;
+ GstElement *subsink = NULL;
source = GST_MESSAGE_SRC(msg);
if (!GST_IS_OBJECT(source))
return;
{
if(GST_MESSAGE_SRC(msg) != GST_OBJECT(m_gst_playbin))
{
- //vuplus
- if(!strncmp(sourceName, "hls", 3))
- {
- //eDebug("HLS Protocol detected : source [%s]", sourceName);
- m_is_hls_stream = 1;
- }
break;
}
GValue result = { 0, };
#endif
GstIterator *children;
- GstElement *subsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin), "subtitle_sink");
- if (subsink)
- {
+ subsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin), "subtitle_sink");
+ if (subsink)
+ {
#ifdef GSTREAMER_SUBTITLE_SYNC_MODE_BUG
g_object_set (G_OBJECT (subsink), "sync", FALSE, NULL);
#endif
setAC3Delay(ac3_delay);
setPCMDelay(pcm_delay);
+
} break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
{
m_event((iPlayableService*)this, evUser+10);
}
}
- else //if( err->domain == 1232 )
+ else if ( err->domain == GST_RESOURCE_ERROR )
{
- if ( err->code == 5 )
- m_event((iPlayableService*)this, evUser+20);
+ if ( err->code == GST_RESOURCE_ERROR_OPEN_READ || err->code == GST_RESOURCE_ERROR_READ )
+ {
+ sourceTimeout();
+ }
}
g_error_free(err);
break;
m_subtitleStreams.push_back(subs);
g_free (g_lang);
}
- m_event((iPlayableService*)this, evUpdatedEventInfo);
+ m_event((iPlayableService*)this, evUpdatedInfo);
if ( m_errorInfo.missing_codec != "" )
{
const gchar *name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory));
if (!strcmp(name, "souphttpsrc"))
{
- m_streamingsrc_timeout->start(HTTP_TIMEOUT*1000, true);
+ if (m_streamingsrc_timeout) {
+ m_streamingsrc_timeout->start(HTTP_TIMEOUT*1000, true);
+ }
g_object_set (G_OBJECT (owner), "timeout", HTTP_TIMEOUT, NULL);
eDebug("eServiceMP3::GST_STREAM_STATUS_TYPE_CREATE -> setting timeout on %s to %is", name, HTTP_TIMEOUT);
}
- //vuplus
- else if (m_is_hls_stream && !strncmp(name, "queue", 5))
- {
- m_streamingsrc_timeout->stop();
- m_is_hls_stream = 0;
- //eDebug("Stoped response timeout!! : HLS");
- }
}
if ( GST_IS_PAD(source) )
gst_object_unref(owner);
if (source)
{
#if GST_VERSION_MAJOR >= 1
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "timeout") != 0)
+ {
+ GstElementFactory *factory = gst_element_get_factory(source);
+ if (factory)
+ {
+ const gchar *sourcename = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory));
+ if (!strcmp(sourcename, "souphttpsrc"))
+ {
+ g_object_set(G_OBJECT(source), "timeout", HTTP_TIMEOUT, NULL);
+ }
+ }
+ }
if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "ssl-strict") != 0)
{
g_object_set(G_OBJECT(source), "ssl-strict", FALSE, NULL);
{
if ( subType < stVOB )
{
+ int delay = ePythonConfigQuery::getConfigIntValue("config.subtitles.pango_subtitles_delay");
+ int subtitle_fps = ePythonConfigQuery::getConfigIntValue("config.subtitles.pango_subtitles_fps");
+
+ double convert_fps = 1.0;
+ if (subtitle_fps > 1 && m_framerate > 0)
+ convert_fps = subtitle_fps / (double)m_framerate;
+
unsigned char line[len+1];
SubtitlePage page;
#if GST_VERSION_MAJOR < 1
gRGB rgbcol(0xD0,0xD0,0xD0);
page.type = SubtitlePage::Pango;
page.pango_page.m_elements.push_back(ePangoSubtitlePageElement(rgbcol, (const char*)line));
- page.pango_page.m_show_pts = buf_pos / 11111LL;
+ page.pango_page.m_show_pts = buf_pos / 11111LL + convert_fps + delay;
page.pango_page.m_timeout = duration_ns / 1000000;
m_subtitle_pages.push_back(page);
m_subtitle_sync_timer->start(1, true);
PyObject *eServiceMP3::getCachedSubtitle()
{
// eDebug("eServiceMP3::getCachedSubtitle");
+ bool autoturnon = ePythonConfigQuery::getConfigBoolValue("config.subtitles.pango_autoturnon", true);
+ if (!autoturnon)
+ Py_RETURN_NONE;
+
+ if (!m_subtitleStreams.empty())
+ {
+ int index = 0;
+ if (m_currentSubtitleStream >= 0 && m_currentSubtitleStream < (int)m_subtitleStreams.size())
+ {
+ index = m_currentSubtitleStream;
+ }
+ ePyObject tuple = PyTuple_New(5);
+ PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(2));
+ PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(index));
+ PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(int(m_subtitleStreams[index].type)));
+ PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong(0));
+ PyTuple_SET_ITEM(tuple, 4, PyString_FromString(m_subtitleStreams[index].language_code.c_str()));
+ return tuple;
+ }
+
Py_RETURN_NONE;
}