int ret = read(fd, tmp, 128*1024);
close(fd);
if ( ret == -1 ) // this is a "REAL" VCD
+ {
source = gst_element_factory_make ("vcdsrc", "vcd-source");
if (source)
+ {
g_object_set (G_OBJECT (source), "device", "/dev/cdroms/cdrom0", NULL);
+ eDebug("servicemp3: this is a 'REAL' video cd... we use vcdsrc !");
+ }
+ }
}
if ( !source && !sourceinfo.is_streaming )
{
if ( sourceinfo.containertype == ctVCD && gst_bin_get_by_name(GST_BIN(m_gst_pipeline),"file-source") )
{
- eDebug("this is a fake video cd... we use filesrc ! cdxaparse !");
+ eDebug("servicemp3: this is a fake video cd... we use filesrc ! cdxaparse !");
GstElement *cdxaparse = gst_element_factory_make("cdxaparse", "cdxaparse");
gst_bin_add(GST_BIN(m_gst_pipeline), cdxaparse);
gst_element_link(source, cdxaparse);
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;
gst_message_parse_error (msg, &err, &debug);
g_free (debug);
- eWarning("Gstreamer error: %s (%i)", err->message, err->code );
- if ( err->domain == GST_STREAM_ERROR && err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND )
+ eWarning("Gstreamer error: %s (%i) from %s", err->message, err->code, sourceName );
+ if ( err->domain == GST_STREAM_ERROR )
{
- if ( g_strrstr(sourceName, "videosink") )
+ if ( err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND && g_strrstr(sourceName, "videosink") )
m_event((iPlayableService*)this, evUser+11);
+ else if ( err->code == GST_STREAM_ERROR_FAILED && g_strrstr(sourceName, "file-source") )
+ {
+ eWarning("error in tag parsing, linking mp3parse directly to file-sink, bypassing id3demux...");
+ GstElement *source = gst_bin_get_by_name(GST_BIN(m_gst_pipeline),"file-source");
+ GstElement *parser = gst_bin_get_by_name(GST_BIN(m_gst_pipeline),"audiosink");
+ gst_element_set_state(m_gst_pipeline, GST_STATE_NULL);
+ gst_element_unlink(source, gst_bin_get_by_name(GST_BIN(m_gst_pipeline),"id3demux"));
+ gst_element_link(source, parser);
+ gst_element_set_state (m_gst_pipeline, GST_STATE_PLAYING);
+ }
}
g_error_free(err);
break;
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);
}