[gstreamer-bugs] [Bug 576534] ts-offset property of appsink is ineffective

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Tue Mar 24 11:17:39 PDT 2009


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=576534

  GStreamer | gst-plugins-base | Ver: git




------- Comment #3 from Fraxinas  2009-03-24 18:18 UTC -------
with this code in our app i can work around the issue by calculating the needed
offset and then delaying it with a proprietary timer call:

void eServiceMP3::gstCBsubtitleAvail(GstElement *appsink, gpointer user_data)
{
        eServiceMP3 *_this = (eServiceMP3*)user_data;
        GstBuffer *buffer;
        g_signal_emit_by_name (appsink, "pull-buffer", &buffer);
        if (buffer)
        {
                GstFormat fmt = GST_FORMAT_TIME;
                gint64 buf_pos = GST_BUFFER_TIMESTAMP(buffer);
                gint64 duration_ns = GST_BUFFER_DURATION(buffer);
                size_t len = GST_BUFFER_SIZE(buffer);
                unsigned char line[len+1];
                memcpy(line, GST_BUFFER_DATA(buffer), len);
                line[len] = 0;
                eDebug("got new subtitle @ buf_pos = %lld ns (in pts=%lld):
'%s' ", buf_pos, buf_pos/11111, line);
                if ( _this->m_subtitle_widget )
                {
                        ePangoSubtitlePage page;
                        gRGB rgbcol(0xD0,0xD0,0xD0);
                       
page.m_elements.push_back(ePangoSubtitlePageElement(rgbcol, (const
char*)line));
                        page.show_pts = buf_pos / 11111L;
                        page.m_timeout = duration_ns / 1000000;
                        _this->m_subtitle_pages.push_back(page);
                        _this->pushSubtitles();
                }
        }
}

void eServiceMP3::pushSubtitles()
{
        ePangoSubtitlePage page;
        GstClockTime base_time;
        pts_t running_pts;
        GstElement *appsink =
gst_bin_get_by_name(GST_BIN(m_gst_playbin),"subtitle_sink");
        GstClock *clock;
        clock = gst_element_get_clock (appsink);
        do
        {
                page = m_subtitle_pages.front();

                base_time = gst_element_get_base_time (appsink);
                running_pts = ( gst_clock_get_time (clock) - base_time ) /
11111L;
                gint64 diff_ms = ( page.show_pts - running_pts ) / 90;
//              eDebug("eServiceMP3::pushSubtitles show_pts = %lld  running_pts
= %lld  diff = %lld", page.show_pts, running_pts, diff_ms);
                if ( diff_ms > 20 )
                {
//                      eDebug("m_subtitle_sync_timer->start(%lld,1)",
diff_ms);
                        m_subtitle_sync_timer->start(diff_ms, 1);
                        break;
                }
                else
                {
                        m_subtitle_widget->setPage(page);
                        m_subtitle_pages.pop_front();
                }
        } while ( !m_subtitle_pages.empty() );

        gst_object_unref (clock);
}


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=576534.




More information about the Gstreamer-bugs mailing list