RESULT audioDelay(ePtr<iAudioDelay> &ptr) { ptr = 0; return -1; }
RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr) { ptr = 0; return -1; }
RESULT stream(ePtr<iStreamableService> &ptr) { ptr = 0; return -1; }
+ RESULT streamed(ePtr<iStreamedService> &ptr) { ptr = 0; return -1; }
RESULT cueSheet(ePtr<iCueSheet> &ptr);
// iPlayableService
};
SWIG_TEMPLATE_TYPEDEF(ePtr<iStreamableService>, iStreamableServicePtr);
+SWIG_IGNORE(iStreamedService);
+class iStreamedService: public iObject
+{
+#ifdef SWIG
+ iStreamedService();
+ ~iStreamedService();
+#endif
+public:
+ virtual PyObject *getBufferCharge()=0;
+ virtual int setBufferSize(int size)=0;
+};
+SWIG_TEMPLATE_TYPEDEF(ePtr<iStreamedService>, iStreamedServicePtr);
+
class iServiceKeys_ENUMS
{
#ifdef SWIG
evVideoFramerateChanged,
evVideoProgressiveChanged,
+ evBuffering,
+
evStopped,
evUser = 0x100
virtual SWIG_VOID(RESULT) audioDelay(ePtr<iAudioDelay> &SWIG_OUTPUT)=0;
virtual SWIG_VOID(RESULT) rdsDecoder(ePtr<iRdsDecoder> &SWIG_OUTPUT)=0;
virtual SWIG_VOID(RESULT) stream(ePtr<iStreamableService> &SWIG_OUTPUT)=0;
+ virtual SWIG_VOID(RESULT) streamed(ePtr<iStreamedService> &SWIG_OUTPUT)=0;
virtual SWIG_VOID(RESULT) keys(ePtr<iServiceKeys> &SWIG_OUTPUT)=0;
};
SWIG_TEMPLATE_TYPEDEF(ePtr<iPlayableService>, iPlayableServicePtr);
RESULT audioDelay(ePtr<iAudioDelay> &ptr);
RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr);
RESULT keys(ePtr<iServiceKeys> &ptr) { ptr = 0; return -1; }
+ RESULT streamed(ePtr<iStreamedService> &ptr) { ptr = 0; return -1; }
// iPauseableService
RESULT pause();
RESULT unpause();
RESULT setSlowMotion(int ratio);
RESULT setFastForward(int ratio);
-
+
// iSeekableService
RESULT getLength(pts_t &len);
RESULT seekTo(pts_t to);
// iStreamableService
RESULT stream(ePtr<iStreamableService> &ptr);
PyObject *getStreamingData();
+
private:
friend class eServiceFactoryDVB;
eServiceReference m_reference;
RESULT frontendInfo(ePtr<iFrontendInformation> &ptr);
RESULT subServices(ePtr<iSubserviceList> &ptr);
- /* streamable service */
+ // iStreamableService
PyObject *getStreamingData();
// iSubserviceList
m_currentSubtitleStream = 0;
m_subtitle_widget = 0;
m_currentTrickRatio = 0;
+ m_buffer_size = 1*1024*1024;
CONNECT(m_seekTimeout->timeout, eServiceMP3::seekTimeoutCB);
CONNECT(m_subtitle_sync_timer->timeout, eServiceMP3::pushSubtitles);
CONNECT(m_pump.recv_msg, eServiceMP3::gstPoll);
}
gst_element_set_state (m_gst_playbin, GST_STATE_PLAYING);
+ setBufferSize(m_buffer_size);
}
eServiceMP3::~eServiceMP3()
g_free(eventname);
}
}
+ break;
+ }
+ case GST_MESSAGE_BUFFERING:
+ {
+ GstBufferingMode mode;
+ gst_message_parse_buffering(msg, &(m_bufferInfo.bufferPercent));
+ gst_message_parse_buffering_stats(msg, &mode, &(m_bufferInfo.avgInRate), &(m_bufferInfo.avgOutRate), &(m_bufferInfo.bufferingLeft));
+ m_event((iPlayableService*)this, evBuffering);
}
default:
break;
PyObject *eServiceMP3::getCachedSubtitle()
{
+// eDebug("eServiceMP3::getCachedSubtitle");
Py_RETURN_NONE;
}
return l;
}
+RESULT eServiceMP3::streamed(ePtr<iStreamedService> &ptr)
+{
+ ptr = this;
+ return 0;
+}
+
+PyObject *eServiceMP3::getBufferCharge()
+{
+ ePyObject tuple = PyTuple_New(5);
+ PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(m_bufferInfo.bufferPercent));
+ PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(m_bufferInfo.avgInRate));
+ PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(m_bufferInfo.avgOutRate));
+ PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong(m_bufferInfo.bufferingLeft));
+ PyTuple_SET_ITEM(tuple, 4, PyInt_FromLong(m_buffer_size));
+ return tuple;
+}
+
+int eServiceMP3::setBufferSize(int size)
+{
+ m_buffer_size = size;
+ g_object_set (G_OBJECT (m_gst_playbin), "buffer-size", m_buffer_size, NULL);
+ return 0;
+}
+
+
#else
#warning gstreamer not available, not building media player
#endif
typedef enum { ctNone, ctMPEGTS, ctMPEGPS, ctMKV, ctAVI, ctMP4, ctVCD, ctCDA } containertype_t;
class eServiceMP3: public iPlayableService, public iPauseableService,
- public iServiceInformation, public iSeekableService, public iAudioTrackSelection, public iAudioChannelSelection, public iSubtitleOutput, public Object
+ public iServiceInformation, public iSeekableService, public iAudioTrackSelection, public iAudioChannelSelection, public iSubtitleOutput, public iStreamedService, public Object
{
DECLARE_REF(eServiceMP3);
public:
RESULT cueSheet(ePtr<iCueSheet> &ptr) { ptr = 0; return -1; }
RESULT audioDelay(ePtr<iAudioDelay> &ptr) { ptr = 0; return -1; }
RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr) { ptr = 0; return -1; }
- RESULT stream(ePtr<iStreamableService> &ptr) { ptr = 0; return -1; }
RESULT keys(ePtr<iServiceKeys> &ptr) { ptr = 0; return -1; }
+ RESULT stream(ePtr<iStreamableService> &ptr) { ptr = 0; return -1; }
// iPausableService
RESULT pause();
PyObject *getSubtitleList();
PyObject *getCachedSubtitle();
+ // iStreamedService
+ RESULT streamed(ePtr<iStreamedService> &ptr);
+ PyObject *getBufferCharge();
+ int setBufferSize(int size);
+
struct audioStream
{
GstPad* pad;
{
}
};
+ struct bufferInfo
+ {
+ int bufferPercent;
+ int avgInRate;
+ int avgOutRate;
+ long long bufferingLeft;
+ bufferInfo()
+ :bufferPercent(0), avgInRate(0), avgOutRate(0), bufferingLeft(-1)
+ {
+ }
+ };
private:
int m_currentAudioStream;
int m_currentSubtitleStream;
friend class eServiceFactoryMP3;
std::string m_filename;
std::string m_title;
+ int m_buffer_size;
+ bufferInfo m_bufferInfo;
eServiceMP3(const char *filename, const char *title);
Signal2<void,iPlayableService*,int> m_event;
enum