mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-04 14:38:48 +00:00
validate:pipelinemonitor: Print position only when in state >= PAUSED
Reviewers: Mathieu_Du Reviewed By: Mathieu_Du Differential Revision: http://phabricator.freedesktop.org/D86
This commit is contained in:
parent
31d11ff8c3
commit
848d660603
1 changed files with 22 additions and 25 deletions
|
@ -46,30 +46,10 @@ enum
|
||||||
G_DEFINE_TYPE (GstValidatePipelineMonitor, gst_validate_pipeline_monitor,
|
G_DEFINE_TYPE (GstValidatePipelineMonitor, gst_validate_pipeline_monitor,
|
||||||
GST_TYPE_VALIDATE_BIN_MONITOR);
|
GST_TYPE_VALIDATE_BIN_MONITOR);
|
||||||
|
|
||||||
static void
|
|
||||||
gst_validate_pipeline_monitor_dispose (GObject * object)
|
|
||||||
{
|
|
||||||
GstValidatePipelineMonitor *monitor =
|
|
||||||
GST_VALIDATE_PIPELINE_MONITOR_CAST (object);
|
|
||||||
|
|
||||||
if (monitor->print_pos_srcid) {
|
|
||||||
if (g_source_remove (monitor->print_pos_srcid))
|
|
||||||
monitor->print_pos_srcid = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_validate_pipeline_monitor_class_init (GstValidatePipelineMonitorClass *
|
gst_validate_pipeline_monitor_class_init (GstValidatePipelineMonitorClass *
|
||||||
klass)
|
klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
|
||||||
|
|
||||||
gobject_class = G_OBJECT_CLASS (klass);
|
|
||||||
|
|
||||||
gobject_class->dispose = gst_validate_pipeline_monitor_dispose;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -143,6 +123,28 @@ _bus_handler (GstBus * bus, GstMessage * message,
|
||||||
g_error_free (err);
|
g_error_free (err);
|
||||||
g_free (debug);
|
g_free (debug);
|
||||||
break;
|
break;
|
||||||
|
case GST_MESSAGE_STATE_CHANGED:
|
||||||
|
{
|
||||||
|
if (GST_MESSAGE_SRC (message) == GST_VALIDATE_MONITOR (monitor)->target) {
|
||||||
|
GstState oldstate, newstate, pending;
|
||||||
|
|
||||||
|
gst_message_parse_state_changed (message, &oldstate, &newstate,
|
||||||
|
&pending);
|
||||||
|
|
||||||
|
if (oldstate == GST_STATE_READY && newstate == GST_STATE_PAUSED) {
|
||||||
|
monitor->print_pos_srcid =
|
||||||
|
g_timeout_add (PRINT_POSITION_TIMEOUT,
|
||||||
|
(GSourceFunc) print_position, monitor);
|
||||||
|
} else if (oldstate == GST_STATE_PAUSED && newstate == GST_STATE_READY) {
|
||||||
|
if (monitor->print_pos_srcid
|
||||||
|
&& g_source_remove (monitor->print_pos_srcid))
|
||||||
|
monitor->print_pos_srcid = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case GST_MESSAGE_BUFFERING:
|
case GST_MESSAGE_BUFFERING:
|
||||||
{
|
{
|
||||||
GstBufferingMode mode;
|
GstBufferingMode mode;
|
||||||
|
@ -225,11 +227,6 @@ gst_validate_pipeline_monitor_new (GstPipeline * pipeline,
|
||||||
gst_validate_pipeline_monitor_create_scenarios (GST_VALIDATE_BIN_MONITOR
|
gst_validate_pipeline_monitor_create_scenarios (GST_VALIDATE_BIN_MONITOR
|
||||||
(monitor));
|
(monitor));
|
||||||
|
|
||||||
|
|
||||||
monitor->print_pos_srcid =
|
|
||||||
g_timeout_add (PRINT_POSITION_TIMEOUT, (GSourceFunc) print_position,
|
|
||||||
monitor);
|
|
||||||
|
|
||||||
bus = gst_element_get_bus (GST_ELEMENT (pipeline));
|
bus = gst_element_get_bus (GST_ELEMENT (pipeline));
|
||||||
gst_bus_enable_sync_message_emission (bus);
|
gst_bus_enable_sync_message_emission (bus);
|
||||||
g_signal_connect (bus, "sync-message", (GCallback) _bus_handler, monitor);
|
g_signal_connect (bus, "sync-message", (GCallback) _bus_handler, monitor);
|
||||||
|
|
Loading…
Reference in a new issue