GstElement *source = 0;
GstElement *decoder = 0, *conv = 0, *flt = 0, *parser = 0, *sink = 0; /* for audio */
GstElement *audio = 0, *switch_audio = 0, *queue_audio = 0, *video = 0, *queue_video = 0, *videodemux = 0, *audiodemux = 0, *id3demux;
-
+ m_aspect = m_width = m_height = m_framerate = m_progressive = -1;
+
m_state = stIdle;
eDebug("SERVICEMP3 construct!");
return -1;
if (m_state != stRunning)
return -1;
-
+
GstFormat fmt = GST_FORMAT_TIME;
gint64 len;
if (!gst_element_query_position(m_gst_pipeline, &fmt, &len))
return -1;
-
+
/* len is in nanoseconds. we have 90 000 pts per second. */
pts = len / 11111;
return 0;
switch (w)
{
+ case sVideoHeight: return m_height;
+ case sVideoWidth: return m_width;
+ case sFrameRate: return m_framerate;
+ case sProgressive: return m_progressive;
+ case sAspect: return m_aspect;
case sTitle:
case sArtist:
case sAlbum:
}
else if (const GstStructure *msgstruct = gst_message_get_structure(msg))
{
- const gchar *eventname;
- if ( eventname = gst_structure_get_name(msgstruct) )
+ const gchar *eventname = gst_structure_get_name(msgstruct);
+ if ( eventname )
{
- if (!strcmp(eventname, "eventSizeChanged"))
+ if (!strcmp(eventname, "eventSizeChanged") || !strcmp(eventname, "eventSizeAvail"))
{
- gint aspect_ratio, width, height = 0;
- gst_structure_get_int (msgstruct, "aspect_ratio", &aspect_ratio);
- gst_structure_get_int (msgstruct, "width", &width);
- gst_structure_get_int (msgstruct, "height", &height);
- eDebug("****** decoder threw eventSizeChanged! aspect_ratio=%i, width=%i, height=%i", aspect_ratio, width, height);
+ gst_structure_get_int (msgstruct, "aspect_ratio", &m_aspect);
+ gst_structure_get_int (msgstruct, "width", &m_width);
+ gst_structure_get_int (msgstruct, "height", &m_height);
+ if (strstr(eventname, "Changed"))
+ m_event((iPlayableService*)this, evVideoSizeChanged);
}
- if (!strcmp(eventname, "eventFrameRateChanged"))
+ else if (!strcmp(eventname, "eventFrameRateChanged") || !strcmp(eventname, "eventFrameRateAvail"))
{
- gint frame_rate = 0;
- gst_structure_get_int (msgstruct, "frame_rate", &frame_rate);
- eDebug("****** decoder threw eventFrameRateChanged! frame_rate=%i", frame_rate);
+ gst_structure_get_int (msgstruct, "frame_rate", &m_framerate);
+ if (strstr(eventname, "Changed"))
+ m_event((iPlayableService*)this, evVideoFramerateChanged);
}
- if (!strcmp(eventname, "eventProgressiveChanged"))
+ else if (!strcmp(eventname, "eventProgressiveChanged") || !strcmp(eventname, "eventProgressiveAvail"))
{
- gint progressive = 0;
- gst_structure_get_int (msgstruct, "progressive", &progressive);
- eDebug("****** decoder threw eventProgressiveChanged! progressive=%i", progressive);
+ gst_structure_get_int (msgstruct, "progressive", &m_progressive);
+ if (strstr(eventname, "Changed"))
+ m_event((iPlayableService*)this, evVideoProgressiveChanged);
}
}
}
void eServiceMP3::gstCBsubtitleAvail(GstElement *element, GstBuffer *buffer, GstPad *pad, gpointer user_data)
{
gint64 duration_ns = GST_BUFFER_DURATION(buffer);
- const unsigned char *text = (unsigned char *)GST_BUFFER_DATA(buffer);
- eDebug("gstCBsubtitleAvail: %s",text);
+ size_t len = GST_BUFFER_SIZE(buffer);
+ unsigned char tmp[len+1];
+ memcpy(tmp, GST_BUFFER_DATA(buffer), len);
+ tmp[len] = 0;
+ eDebug("gstCBsubtitleAvail: %s", tmp);
eServiceMP3 *_this = (eServiceMP3*)user_data;
if ( _this->m_subtitle_widget )
{
ePangoSubtitlePage page;
gRGB rgbcol(0xD0,0xD0,0xD0);
- page.m_elements.push_back(ePangoSubtitlePageElement(rgbcol, (const char*)text));
+ page.m_elements.push_back(ePangoSubtitlePageElement(rgbcol, (const char*)tmp));
page.m_timeout = duration_ns / 1000000;
(_this->m_subtitle_widget)->setPage(page);
}