X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/bbb82688540582d2049b584e5263cbc0423fb551..b0332cff6d1120f3b84696ce6b33a185bcda88e9:/lib/service/servicemp3.cpp diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index c95609a3..c0ae42fd 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -641,7 +641,31 @@ RESULT eServiceMP3::setTrickmode(int trick) RESULT eServiceMP3::isCurrentlySeekable() { - return 1; + int ret = 3; // seeking and fast/slow winding possible + GstElement *sink; + + if (!m_gst_playbin) + return 0; + if (m_state != stRunning) + return 0; + + g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL); + + // disable fast winding yet when a dvbvideosink or dvbaudiosink is used + // for this we must do some changes on different places.. (gstreamer.. our sinks.. enigma2) + if (sink) { + ret &= ~2; // only seeking possible + gst_object_unref(sink); + } + else { + g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL); + if (sink) { + ret &= ~2; // only seeking possible + gst_object_unref(sink); + } + } + + return ret; } RESULT eServiceMP3::info(ePtr&i) @@ -1604,23 +1628,33 @@ int eServiceMP3::getPCMDelay() void eServiceMP3::setAC3Delay(int delay) { + ac3_delay = delay; if (!m_gst_playbin || m_state != stRunning) return; else { GstElement *sink; - std::string config_delay; int config_delay_int = delay; - if(ePythonConfigQuery::getConfigValue("config.av.generalAC3delay", config_delay) == 0) - config_delay_int += atoi(config_delay.c_str()); + g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL); + + if (sink) + { + std::string config_delay; + if(ePythonConfigQuery::getConfigValue("config.av.generalAC3delay", config_delay) == 0) + config_delay_int += atoi(config_delay.c_str()); + gst_object_unref(sink); + } + else + { + eDebug("dont apply ac3 delay when no video is running!"); + config_delay_int = 0; + } g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL); - if (!sink) - return; - else { + if (sink) + { gchar *name = gst_element_get_name(sink); - if (strstr(name, "dvbaudiosink")) eTSMPEGDecoder::setHwAC3Delay(config_delay_int); g_free(name); @@ -1631,26 +1665,37 @@ void eServiceMP3::setAC3Delay(int delay) void eServiceMP3::setPCMDelay(int delay) { + pcm_delay = delay; if (!m_gst_playbin || m_state != stRunning) return; else { GstElement *sink; - std::string config_delay; int config_delay_int = delay; - if(ePythonConfigQuery::getConfigValue("config.av.generalPCMdelay", config_delay) == 0) - config_delay_int += atoi(config_delay.c_str()); + g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL); + + if (sink) + { + std::string config_delay; + if(ePythonConfigQuery::getConfigValue("config.av.generalPCMdelay", config_delay) == 0) + config_delay_int += atoi(config_delay.c_str()); + gst_object_unref(sink); + } + else + { + eDebug("dont apply pcm delay when no video is running!"); + config_delay_int = 0; + } g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL); - if (!sink) - return; - else { + if (sink) + { gchar *name = gst_element_get_name(sink); - if (strstr(name, "dvbaudiosink")) eTSMPEGDecoder::setHwPCMDelay(config_delay_int); - else { + else + { // this is realy untested..and not used yet gint64 offset = config_delay_int; offset *= 1000000; // milli to nano