Ejemplo n.º 1
0
MacWidget::~MacWidget()
{
    // No longer listen to synchronous messages.
    Gst::ScopedObject<GstBus> bus(gst_pipeline_get_bus(GST_PIPELINE(mPipeline)));
    gst_bus_disable_sync_message_emission(bus.get());
    g_signal_handlers_disconnect_by_func(bus.get(), (void*)G_CALLBACK(&MacWidget::OnSyncMessage), gpointer(this));
}
void VideoPlayerBackend::clear()
{
    if (m_sink)
        g_object_unref(m_sink);

    if (m_pipeline)
    {
        qDebug("gstreamer: Destroying pipeline");

        /* Disable the message handlers to avoid anything calling back into this instance */
        GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(m_pipeline));
        Q_ASSERT(bus);
        gst_bus_disable_sync_message_emission(bus);

        gst_object_unref(bus);

        gst_element_set_state(m_pipeline, GST_STATE_NULL);

        /* Ensure the transition to NULL completes */
        gst_element_get_state(m_pipeline, 0, 0, GST_CLOCK_TIME_NONE);
        gst_object_unref(GST_OBJECT(m_pipeline));
    }

    m_pipeline = m_videoLink = m_sink = 0;

    setVideoBuffer(0);

    m_state = Stopped;
    m_errorMessage.clear();
}
Ejemplo n.º 3
0
void GstVideoPlayerBackend::clear()
{
    if (m_sink)
        g_object_unref(m_sink);

    /* stream doesn't support audio. Audio elemets have been unlinked from bus, but they stil are in PAUSED state.
     * Set their state to null to avoid warning on disposing
     */
    if (!m_hasAudio && m_audioDecoder)
    {
        gst_element_set_state(m_audioDecoder, GST_STATE_NULL);
        gst_element_set_state(m_audioQueue, GST_STATE_NULL);
        gst_element_set_state(m_audioLink, GST_STATE_NULL);
        gst_element_set_state(m_audioResample, GST_STATE_NULL);
        gst_element_set_state(m_volumeController, GST_STATE_NULL);
        gst_element_set_state(m_audioSink, GST_STATE_NULL);
    }

    if (m_pipeline)
    {
        qDebug("gstreamer: Destroying pipeline");

        /* Disable the message handlers to avoid anything calling back into this instance */
        GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(m_pipeline));
        Q_ASSERT(bus);
        gst_bus_disable_sync_message_emission(bus);

        gst_object_unref(bus);

        gst_element_set_state(m_pipeline, GST_STATE_NULL);

        /* Ensure the transition to NULL completes */
        gst_element_get_state(m_pipeline, 0, 0, GST_CLOCK_TIME_NONE);
        gst_object_unref(GST_OBJECT(m_pipeline));
    }

    m_pipeline = m_videoLink = m_sink = m_audioLink = 0;
    m_audioDecoder = m_audioQueue = m_audioResample = m_volumeController = m_audioSink = 0;

    m_hasAudio = false;

    setVideoBuffer(0);

    m_state = Stopped;
    m_errorMessage.clear();
}
MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase()
{
    if (m_repaintHandler) {
        g_signal_handler_disconnect(m_videoSink.get(), m_repaintHandler);
        m_repaintHandler = 0;
    }

    g_mutex_clear(&m_sampleMutex);

    m_player = 0;

    if (m_volumeSignalHandler) {
        g_signal_handler_disconnect(m_volumeElement.get(), m_volumeSignalHandler);
        m_volumeSignalHandler = 0;
    }

    if (m_muteSignalHandler) {
        g_signal_handler_disconnect(m_volumeElement.get(), m_muteSignalHandler);
        m_muteSignalHandler = 0;
    }

#if USE(GSTREAMER_GL)
    g_cond_clear(&m_drawCondition);
    g_mutex_clear(&m_drawMutex);
#endif

    if (m_pipeline) {
        GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));
        ASSERT(bus);
        g_signal_handlers_disconnect_by_func(bus.get(), reinterpret_cast<gpointer>(mediaPlayerPrivateNeedContextMessageCallback), this);
        gst_bus_disable_sync_message_emission(bus.get());
        m_pipeline.clear();
    }

#if USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS)
    if (client())
        client()->platformLayerWillBeDestroyed();
#endif
}
Ejemplo n.º 5
0
void Bus::disableSyncMessageEmission()
{
    gst_bus_disable_sync_message_emission(object<GstBus>());
}