From ca44a114298a8b35224c5c248b28701d87043448 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 3 Jun 2014 10:02:10 +0200 Subject: [PATCH] validate: Run gst-indent on all code so whitespace. much indent. spacing ! --- validate/gst/validate/gst-validate-bin-monitor.c | 23 ++-- validate/gst/validate/gst-validate-media-info.c | 63 +++++----- .../gst/validate/gst-validate-override-registry.c | 8 +- validate/gst/validate/gst-validate-pad-monitor.c | 23 ++-- validate/gst/validate/gst-validate-report.c | 38 +++--- validate/gst/validate/gst-validate-reporter.c | 5 +- validate/gst/validate/gst-validate-utils.c | 7 +- validate/gst/validate/media-descriptor.c | 27 +++-- validate/tools/gst-validate-media-check.c | 8 +- validate/tools/gst-validate-transcoding.c | 134 +++++++++++---------- validate/tools/gst-validate.c | 45 +++---- 11 files changed, 201 insertions(+), 180 deletions(-) diff --git a/validate/gst/validate/gst-validate-bin-monitor.c b/validate/gst/validate/gst-validate-bin-monitor.c index a09bb8b..2b2c401 100644 --- a/validate/gst/validate/gst-validate-bin-monitor.c +++ b/validate/gst/validate/gst-validate-bin-monitor.c @@ -74,9 +74,9 @@ gst_validate_bin_monitor_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_STATELESS: - monitor->stateless = g_value_get_boolean(value); + monitor->stateless = g_value_get_boolean (value); if (monitor->scenario != NULL) - g_object_set(monitor->scenario, "stateless", monitor->stateless, NULL); + g_object_set (monitor->scenario, "stateless", monitor->stateless, NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -139,9 +139,9 @@ gst_validate_bin_monitor_class_init (GstValidateBinMonitorClass * klass) gobject_class->dispose = gst_validate_bin_monitor_dispose; g_object_class_install_property (gobject_class, PROP_STATELESS, - g_param_spec_boolean ("stateless", "Stateless", "True to execute actions as soon as possible, regardless " - "of the initial state of the pipeline", - FALSE, G_PARAM_READWRITE)); + g_param_spec_boolean ("stateless", "Stateless", + "True to execute actions as soon as possible, regardless " + "of the initial state of the pipeline", FALSE, G_PARAM_READWRITE)); validatemonitor_class->setup = gst_validate_bin_monitor_setup; } @@ -152,11 +152,12 @@ gst_validate_bin_monitor_init (GstValidateBinMonitor * bin_monitor) } static gboolean -print_position (GstValidateMonitor *monitor) +print_position (GstValidateMonitor * monitor) { GstQuery *query; gint64 position, duration; - GstElement *pipeline = GST_ELEMENT (GST_VALIDATE_MONITOR_GET_OBJECT (monitor)); + GstElement *pipeline = + GST_ELEMENT (GST_VALIDATE_MONITOR_GET_OBJECT (monitor)); gdouble rate = 1.0; GstFormat format = GST_FORMAT_TIME; @@ -180,7 +181,8 @@ print_position (GstValidateMonitor *monitor) } static void -_bus_handler (GstBus * bus, GstMessage * message, GstValidateBinMonitor *monitor) +_bus_handler (GstBus * bus, GstMessage * message, + GstValidateBinMonitor * monitor) { GError *err; gchar *debug; @@ -256,10 +258,11 @@ gst_validate_bin_monitor_new (GstBin * bin, GstValidateRunner * runner, GstBus *bus; monitor->print_pos_srcid = - g_timeout_add (PRINT_POSITION_TIMEOUT, (GSourceFunc) print_position, monitor); + g_timeout_add (PRINT_POSITION_TIMEOUT, (GSourceFunc) print_position, + monitor); bus = gst_element_get_bus (GST_ELEMENT (bin)); - gst_bus_enable_sync_message_emission(bus); + gst_bus_enable_sync_message_emission (bus); g_signal_connect (bus, "sync-message", (GCallback) _bus_handler, monitor); gst_object_unref (bus); diff --git a/validate/gst/validate/gst-validate-media-info.c b/validate/gst/validate/gst-validate-media-info.c index d1e6e5c..b226eed 100644 --- a/validate/gst/validate/gst-validate-media-info.c +++ b/validate/gst/validate/gst-validate-media-info.c @@ -186,7 +186,8 @@ gst_validate_media_info_load (const gchar * path, GError ** err) if (err && *err) goto end; - mi->duration = g_key_file_get_uint64 (kf, "media-info", "file-duration", NULL); + mi->duration = + g_key_file_get_uint64 (kf, "media-info", "file-duration", NULL); mi->seekable = g_key_file_get_boolean (kf, "media-info", "seekable", NULL); mi->is_image = g_key_file_get_boolean (kf, "media-info", "is-image", NULL); @@ -1042,25 +1043,25 @@ end: } static gboolean -check_is_image (GstDiscovererInfo *info) +check_is_image (GstDiscovererInfo * info) { - gboolean ret = FALSE; - GList *video_streams = gst_discoverer_info_get_video_streams (info); + gboolean ret = FALSE; + GList *video_streams = gst_discoverer_info_get_video_streams (info); - if (g_list_length (video_streams) == 1) { - if (gst_discoverer_video_info_is_image (video_streams->data)) { - GList *audio_streams = gst_discoverer_info_get_audio_streams (info); + if (g_list_length (video_streams) == 1) { + if (gst_discoverer_video_info_is_image (video_streams->data)) { + GList *audio_streams = gst_discoverer_info_get_audio_streams (info); - if (audio_streams == NULL) - ret = TRUE; - else - gst_discoverer_stream_info_list_free (audio_streams); - } + if (audio_streams == NULL) + ret = TRUE; + else + gst_discoverer_stream_info_list_free (audio_streams); } + } - gst_discoverer_stream_info_list_free (video_streams); + gst_discoverer_stream_info_list_free (video_streams); - return ret; + return ret; } gboolean @@ -1093,11 +1094,11 @@ gst_validate_media_info_inspect_uri (GstValidateMediaInfo * mi, ret = check_file_duration (mi, info) & ret; if (mi->is_image) - goto done; + goto done; check_seekable (mi, info); if (discover_only) - goto done; + goto done; ret = check_playback (mi, &mi->playback_error) & ret; ret = check_reverse_playback (mi, &mi->reverse_playback_error) & ret; @@ -1131,21 +1132,21 @@ gst_validate_media_info_compare (GstValidateMediaInfo * expected, } if (extracted->discover_only == FALSE) { - if (expected->playback_error == NULL && extracted->playback_error) { - g_print ("Playback is now failing with: %s\n", extracted->playback_error); - ret = FALSE; - } - if (expected->reverse_playback_error == NULL - && extracted->reverse_playback_error) { - g_print ("Reverse playback is now failing with: %s\n", - extracted->reverse_playback_error); - ret = FALSE; - } - if (expected->track_switch_error == NULL && extracted->track_switch_error) { - g_print ("Track switching is now failing with: %s\n", - extracted->track_switch_error); - ret = FALSE; - } + if (expected->playback_error == NULL && extracted->playback_error) { + g_print ("Playback is now failing with: %s\n", extracted->playback_error); + ret = FALSE; + } + if (expected->reverse_playback_error == NULL + && extracted->reverse_playback_error) { + g_print ("Reverse playback is now failing with: %s\n", + extracted->reverse_playback_error); + ret = FALSE; + } + if (expected->track_switch_error == NULL && extracted->track_switch_error) { + g_print ("Track switching is now failing with: %s\n", + extracted->track_switch_error); + ret = FALSE; + } } if (extracted->stream_info == NULL || expected->stream_info == NULL) { diff --git a/validate/gst/validate/gst-validate-override-registry.c b/validate/gst/validate/gst-validate-override-registry.c index bb30620..4552a74 100644 --- a/validate/gst/validate/gst-validate-override-registry.c +++ b/validate/gst/validate/gst-validate-override-registry.c @@ -51,7 +51,7 @@ static GstValidateOverrideRegistry *_registry_default; #define GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK(r) g_mutex_unlock (&r->mutex) #define GST_VALIDATE_OVERRIDE_INIT_SYMBOL "gst_validate_create_overrides" -typedef int (*GstValidateCreateOverride)(void); +typedef int (*GstValidateCreateOverride) (void); static GstValidateOverrideRegistry * gst_validate_override_registry_new (void) @@ -222,7 +222,8 @@ gst_validate_override_registry_preload (void) module = g_module_open (*modname, G_MODULE_BIND_LAZY); if (module == NULL) { loaderr = g_module_error (); - GST_ERROR ("Failed to load %s %s", *modname, loaderr ? loaderr : "no idea why"); + GST_ERROR ("Failed to load %s %s", *modname, + loaderr ? loaderr : "no idea why"); continue; } if (g_module_symbol (module, GST_VALIDATE_OVERRIDE_INIT_SYMBOL, @@ -237,7 +238,8 @@ gst_validate_override_registry_preload (void) GST_INFO ("Loaded no overrides from %s", *modname); } } else { - GST_WARNING (GST_VALIDATE_OVERRIDE_INIT_SYMBOL " not found in %s", *modname); + GST_WARNING (GST_VALIDATE_OVERRIDE_INIT_SYMBOL " not found in %s", + *modname); } g_module_close (module); } diff --git a/validate/gst/validate/gst-validate-pad-monitor.c b/validate/gst/validate/gst-validate-pad-monitor.c index f09c577..7e97667 100644 --- a/validate/gst/validate/gst-validate-pad-monitor.c +++ b/validate/gst/validate/gst-validate-pad-monitor.c @@ -154,7 +154,7 @@ _structure_is_raw_audio (GstStructure * structure) } static gchar * -_get_event_string (GstEvent *event) +_get_event_string (GstEvent * event) { const GstStructure *st; @@ -841,7 +841,7 @@ gst_validate_pad_monitor_check_eos (GstValidatePadMonitor * { if (G_UNLIKELY (pad_monitor->is_eos)) { GST_VALIDATE_REPORT (pad_monitor, BUFFER_AFTER_EOS, - "Received buffer %" GST_PTR_FORMAT " after EOS", buffer); + "Received buffer %" GST_PTR_FORMAT " after EOS", buffer); } } @@ -1192,7 +1192,8 @@ gst_validate_pad_monitor_flush (GstValidatePadMonitor * pad_monitor) pad_monitor->is_eos = FALSE; pad_monitor->last_flow_return = GST_FLOW_OK; gst_caps_replace (&pad_monitor->last_caps, NULL); - pad_monitor->caps_is_audio = pad_monitor->caps_is_video = pad_monitor->caps_is_raw = FALSE; + pad_monitor->caps_is_audio = pad_monitor->caps_is_video = + pad_monitor->caps_is_raw = FALSE; g_list_free_full (pad_monitor->expired_events, (GDestroyNotify) gst_event_unref); @@ -1679,13 +1680,15 @@ gst_validate_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * buffer, if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)) && GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)) && ((!gst_segment_clip (&monitor->segment, monitor->segment.format, - GST_BUFFER_TIMESTAMP (buffer), GST_BUFFER_TIMESTAMP (buffer) + - GST_BUFFER_DURATION (buffer), NULL, NULL)) || - /* In the case of raw data, buffers should be strictly contained inside the - * segment */ - (monitor->caps_is_raw && - GST_BUFFER_PTS (buffer) + GST_BUFFER_DURATION (buffer) < monitor->segment.start)) - ) { + GST_BUFFER_TIMESTAMP (buffer), + GST_BUFFER_TIMESTAMP (buffer) + + GST_BUFFER_DURATION (buffer), NULL, NULL)) || + /* In the case of raw data, buffers should be strictly contained inside the + * segment */ + (monitor->caps_is_raw && + GST_BUFFER_PTS (buffer) + GST_BUFFER_DURATION (buffer) < + monitor->segment.start)) + ) { /* TODO is this a timestamp issue? */ GST_VALIDATE_REPORT (monitor, BUFFER_IS_OUT_OF_SEGMENT, "buffer is out of segment and shouldn't be pushed. Timestamp: %" diff --git a/validate/gst/validate/gst-validate-report.c b/validate/gst/validate/gst-validate-report.c index 61e7aa0..c9b6aec 100644 --- a/validate/gst/validate/gst-validate-report.c +++ b/validate/gst/validate/gst-validate-report.c @@ -260,11 +260,11 @@ gst_validate_report_init (void) file_env = g_getenv ("GST_VALIDATE_FILE"); if (file_env != NULL && *file_env != '\0') { - log_file = g_fopen (file_env, "w"); - if (log_file == NULL) { - g_printerr ("Could not open log file '%s' for writing: %s\n", file_env, - g_strerror (errno)); - log_file = stderr; + log_file = g_fopen (file_env, "w"); + if (log_file == NULL) { + g_printerr ("Could not open log file '%s' for writing: %s\n", file_env, + g_strerror (errno)); + log_file = stderr; } } else { log_file = stdout; @@ -390,24 +390,24 @@ gst_validate_printf (gpointer source, const gchar * format, ...) } void -gst_validate_printf_valist (gpointer source, - const gchar * format, va_list args) +gst_validate_printf_valist (gpointer source, const gchar * format, va_list args) { GString *string = g_string_new (NULL); if (source) { if (*(GType *) source == GST_TYPE_VALIDATE_ACTION) { - GstValidateAction *action = (GstValidateAction*) source; + GstValidateAction *action = (GstValidateAction *) source; - g_string_printf (string, "\n(Executing action: %s, number: %u at position: %" - GST_TIME_FORMAT " repeat: %i) | ", g_strcmp0 (action->name, "") == 0 ? - "Unnamed" : action->name, - action->action_number, GST_TIME_ARGS (action->playback_time), - action->repeat); + g_string_printf (string, + "\n(Executing action: %s, number: %u at position: %" GST_TIME_FORMAT + " repeat: %i) | ", g_strcmp0 (action->name, + "") == 0 ? "Unnamed" : action->name, action->action_number, + GST_TIME_ARGS (action->playback_time), action->repeat); } else if (GST_IS_OBJECT (source)) { g_string_printf (string, "\n%s --> ", GST_OBJECT_NAME (source)); } else if (G_IS_OBJECT (source)) { - g_string_printf (string, "\n<%s@%p> --> ", G_OBJECT_TYPE_NAME (source), source); + g_string_printf (string, "\n<%s@%p> --> ", G_OBJECT_TYPE_NAME (source), + source); } } @@ -422,14 +422,16 @@ gst_validate_printf_valist (gpointer source, void gst_validate_report_printf (GstValidateReport * report) { - gst_validate_printf (NULL, "%10s : %s\n", gst_validate_report_level_get_name (report->level), + gst_validate_printf (NULL, "%10s : %s\n", + gst_validate_report_level_get_name (report->level), report->issue->summary); - gst_validate_printf (NULL, "%*s Detected on <%s> at %" GST_TIME_FORMAT "\n", 12, "", - gst_validate_reporter_get_name (report->reporter), + gst_validate_printf (NULL, "%*s Detected on <%s> at %" GST_TIME_FORMAT "\n", + 12, "", gst_validate_reporter_get_name (report->reporter), GST_TIME_ARGS (report->timestamp)); if (report->message) gst_validate_printf (NULL, "%*s Details : %s\n", 12, "", report->message); if (report->issue->description) - gst_validate_printf (NULL, "%*s Description : %s\n", 12, "", report->issue->description); + gst_validate_printf (NULL, "%*s Description : %s\n", 12, "", + report->issue->description); gst_validate_printf (NULL, "\n"); } diff --git a/validate/gst/validate/gst-validate-reporter.c b/validate/gst/validate/gst-validate-reporter.c index af3bb17..a8f67b3 100644 --- a/validate/gst/validate/gst-validate-reporter.c +++ b/validate/gst/validate/gst-validate-reporter.c @@ -38,7 +38,7 @@ typedef struct _GstValidateReporterPrivate guint log_handler_id; } GstValidateReporterPrivate; -static GstValidateReporterPrivate * g_log_handler = NULL; +static GstValidateReporterPrivate *g_log_handler = NULL; G_DEFINE_INTERFACE (GstValidateReporter, gst_validate_reporter, G_TYPE_OBJECT); @@ -226,7 +226,8 @@ gst_validate_reporter_set_runner (GstValidateReporter * reporter, void gst_validate_reporter_set_handle_g_logs (GstValidateReporter * reporter) { - g_log_set_default_handler ((GLogFunc) gst_validate_reporter_g_log_func, reporter); + g_log_set_default_handler ((GLogFunc) gst_validate_reporter_g_log_func, + reporter); g_log_handler = gst_validate_reporter_get_priv (reporter); } diff --git a/validate/gst/validate/gst-validate-utils.c b/validate/gst/validate/gst-validate-utils.c index 08c5a40..b2527a7 100644 --- a/validate/gst/validate/gst-validate-utils.c +++ b/validate/gst/validate/gst-validate-utils.c @@ -446,8 +446,8 @@ _read_power (MathParser * parser) } gdouble -gst_validate_utils_parse_expression (const gchar * expr, ParseVariableFunc variable_func, - gpointer user_data, gchar ** error) +gst_validate_utils_parse_expression (const gchar * expr, + ParseVariableFunc variable_func, gpointer user_data, gchar ** error) { gdouble val; MathParser parser; @@ -489,7 +489,8 @@ gst_validate_utils_flags_from_str (GType type, const gchar * str_flags) } gboolean -gst_validate_utils_enum_from_str (GType type, const gchar * str_enum, guint * enum_value) +gst_validate_utils_enum_from_str (GType type, const gchar * str_enum, + guint * enum_value) { guint i; GEnumClass *class = g_type_class_ref (type); diff --git a/validate/gst/validate/media-descriptor.c b/validate/gst/validate/media-descriptor.c index 9ced8eb..8f01283 100644 --- a/validate/gst/validate/media-descriptor.c +++ b/validate/gst/validate/media-descriptor.c @@ -139,8 +139,8 @@ gst_media_descriptor_finalize (GstMediaDescriptor * self) if (self->filenode) free_filenode (self->filenode); - G_OBJECT_CLASS (gst_media_descriptor_parent_class)-> - finalize (G_OBJECT (self)); + G_OBJECT_CLASS (gst_media_descriptor_parent_class)->finalize (G_OBJECT + (self)); } static void @@ -203,7 +203,8 @@ gst_media_descriptor_class_init (GstMediaDescriptorClass * self_class) } static gint -compare_tags (GstMediaDescriptor *ref, StreamNode *rstream, StreamNode *cstream) +compare_tags (GstMediaDescriptor * ref, StreamNode * rstream, + StreamNode * cstream) { gboolean found; TagNode *rtag, *ctag; @@ -233,7 +234,7 @@ compare_tags (GstMediaDescriptor *ref, StreamNode *rstream, StreamNode *cstream) GST_VALIDATE_REPORT (ref, FILE_PROFILE_INCORRECT, "Reference descriptor for stream %s has tags %s" " but no equivalent taglist was found on the compared stream", - rstream->id, rtaglist); + rstream->id, rtaglist); g_free (rtaglist); return 0; @@ -245,17 +246,17 @@ compare_tags (GstMediaDescriptor *ref, StreamNode *rstream, StreamNode *cstream) /* Return -1 if not found 1 if OK 0 if an error occured */ static gint -comparse_stream (GstMediaDescriptor *ref, StreamNode *rstream, StreamNode *cstream) +comparse_stream (GstMediaDescriptor * ref, StreamNode * rstream, + StreamNode * cstream) { if (g_strcmp0 (rstream->id, cstream->id) == 0) { if (!gst_caps_is_equal (rstream->caps, cstream->caps)) { gchar *rcaps = gst_caps_to_string (rstream->caps), - *ccaps = gst_caps_to_string (cstream->caps); + *ccaps = gst_caps_to_string (cstream->caps); GST_VALIDATE_REPORT (ref, FILE_PROFILE_INCORRECT, "Reference descriptor for stream %s has caps: %s" " but compared stream %s has caps: %s", - rstream->id, rcaps, - cstream->id, ccaps); + rstream->id, rcaps, cstream->id, ccaps); g_free (rcaps); g_free (ccaps); return 0; @@ -276,8 +277,8 @@ gst_media_descriptors_compare (GstMediaDescriptor * ref, if (rfilenode->duration != cfilenode->duration) { GST_VALIDATE_REPORT (ref, FILE_DURATION_INCORRECT, - "Duration %" GST_TIME_FORMAT " is different from the reference %" GST_TIME_FORMAT, - GST_TIME_ARGS (cfilenode->duration), + "Duration %" GST_TIME_FORMAT " is different from the reference %" + GST_TIME_FORMAT, GST_TIME_ARGS (cfilenode->duration), GST_TIME_ARGS (rfilenode->duration)); } @@ -300,7 +301,7 @@ gst_media_descriptors_compare (GstMediaDescriptor * ref, for (rstream_list = rfilenode->streams; rstream_list; rstream_list = rstream_list->next) { GList *cstream_list; - gint sfound = -1; + gint sfound = -1; for (cstream_list = cfilenode->streams; cstream_list; cstream_list = cstream_list->next) { @@ -309,14 +310,14 @@ gst_media_descriptors_compare (GstMediaDescriptor * ref, if (sfound == 0) { return FALSE; } else if (sfound == 1) { - break; + break; } } if (sfound == FALSE) { GST_VALIDATE_REPORT (ref, FILE_PROFILE_INCORRECT, "Could not find stream %s in the compared descriptor", - ((StreamNode*) rstream_list->data)->id); + ((StreamNode *) rstream_list->data)->id); return FALSE; } diff --git a/validate/tools/gst-validate-media-check.c b/validate/tools/gst-validate-media-check.c index 113cd56..258268c 100644 --- a/validate/tools/gst-validate-media-check.c +++ b/validate/tools/gst-validate-media-check.c @@ -48,7 +48,7 @@ main (int argc, gchar ** argv) gchar *output = NULL; GstMediaDescriptorWriter *writer; GstValidateRunner *runner; - GstMediaDescriptorParser * reference = NULL; + GstMediaDescriptorParser *reference = NULL; GOptionEntry options[] = { {"output-file", 'o', 0, G_OPTION_ARG_FILENAME, @@ -93,7 +93,8 @@ main (int argc, gchar ** argv) g_option_context_free (ctx); runner = gst_validate_runner_new (); - writer = gst_media_descriptor_writer_new_discover (runner, argv[1], full, NULL); + writer = + gst_media_descriptor_writer_new_discover (runner, argv[1], full, NULL); if (writer == NULL) { g_print ("Could not discover file: %s", argv[1]); return 1; @@ -103,8 +104,7 @@ main (int argc, gchar ** argv) gst_media_descriptor_writer_write (writer, output_file); if (expected_file) { - reference = gst_media_descriptor_parser_new (runner, - expected_file, NULL); + reference = gst_media_descriptor_parser_new (runner, expected_file, NULL); if (reference == NULL) { g_print ("Could not parse file: %s", expected_file); diff --git a/validate/tools/gst-validate-transcoding.c b/validate/tools/gst-validate-transcoding.c index a9d0bc6..c663c14 100644 --- a/validate/tools/gst-validate-transcoding.c +++ b/validate/tools/gst-validate-transcoding.c @@ -55,7 +55,7 @@ typedef struct { volatile gint refcount; - GstSegment segment; /* The currently configured segment */ + GstSegment segment; /* The currently configured segment */ /* FIXME Do we need a weak ref here? */ GstValidateScenario *scenario; @@ -95,7 +95,7 @@ intr_handler (gpointer user_data) #endif /* G_OS_UNIX */ static void -key_unit_data_unref (KeyUnitProbeInfo *info) +key_unit_data_unref (KeyUnitProbeInfo * info) { if (G_UNLIKELY (g_atomic_int_dec_and_test (&info->refcount))) { g_slice_free (KeyUnitProbeInfo, info); @@ -103,7 +103,7 @@ key_unit_data_unref (KeyUnitProbeInfo *info) } static KeyUnitProbeInfo * -key_unit_data_ref (KeyUnitProbeInfo *info) +key_unit_data_ref (KeyUnitProbeInfo * info) { g_atomic_int_inc (&info->refcount); @@ -111,7 +111,7 @@ key_unit_data_ref (KeyUnitProbeInfo *info) } static KeyUnitProbeInfo * -key_unit_data_new (GstValidateScenario *scenario, GstClockTime running_time) +key_unit_data_new (GstValidateScenario * scenario, GstClockTime running_time) { KeyUnitProbeInfo *info = g_slice_new0 (KeyUnitProbeInfo); info->refcount = 1; @@ -123,7 +123,8 @@ key_unit_data_new (GstValidateScenario *scenario, GstClockTime running_time) } static GstPadProbeReturn -_check_is_key_unit_cb (GstPad * pad, GstPadProbeInfo * info, KeyUnitProbeInfo *kuinfo) +_check_is_key_unit_cb (GstPad * pad, GstPadProbeInfo * info, + KeyUnitProbeInfo * kuinfo) { if (GST_IS_EVENT (GST_PAD_PROBE_INFO_DATA (info))) { if (gst_video_event_is_force_key_unit (GST_PAD_PROBE_INFO_DATA (info))) @@ -135,38 +136,40 @@ _check_is_key_unit_cb (GstPad * pad, GstPadProbeInfo * info, KeyUnitProbeInfo *k gst_event_parse_segment (info->data, &segment); kuinfo->segment = *segment; } - } else if (GST_IS_BUFFER (GST_PAD_PROBE_INFO_DATA (info)) && kuinfo->seen_event) { - - if (GST_CLOCK_TIME_IS_VALID (kuinfo->running_time)) { - GstClockTime running_time = gst_segment_to_running_time (&kuinfo->segment, - GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (info->data)); - - if (running_time < kuinfo->running_time) - return GST_PAD_PROBE_OK; - } - - if (GST_BUFFER_FLAG_IS_SET (GST_PAD_PROBE_INFO_BUFFER (info), GST_BUFFER_FLAG_DELTA_UNIT)) { - if (kuinfo->count_bufs >= NOT_KF_AFTER_FORCE_KF_EVT_TOLERANCE) { - GST_VALIDATE_REPORT (kuinfo->scenario, - SCENARIO_ACTION_EXECUTION_ERROR, - "Did not receive a key frame after requested one, " - " at running_time %" GST_TIME_FORMAT " (with a %i " - "frame tolerance)", GST_TIME_ARGS (kuinfo->running_time), - NOT_KF_AFTER_FORCE_KF_EVT_TOLERANCE); - - return GST_PAD_PROBE_REMOVE; - } - - kuinfo->count_bufs++; - } else { - GST_DEBUG_OBJECT (kuinfo->scenario, - "Properly got keyframe after \"force-keyframe\" event " - "with running_time %" GST_TIME_FORMAT " (latency %d frame(s))", - GST_TIME_ARGS (kuinfo->running_time), kuinfo->count_bufs); - - return GST_PAD_PROBE_REMOVE; - } - } + } else if (GST_IS_BUFFER (GST_PAD_PROBE_INFO_DATA (info)) + && kuinfo->seen_event) { + + if (GST_CLOCK_TIME_IS_VALID (kuinfo->running_time)) { + GstClockTime running_time = gst_segment_to_running_time (&kuinfo->segment, + GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (info->data)); + + if (running_time < kuinfo->running_time) + return GST_PAD_PROBE_OK; + } + + if (GST_BUFFER_FLAG_IS_SET (GST_PAD_PROBE_INFO_BUFFER (info), + GST_BUFFER_FLAG_DELTA_UNIT)) { + if (kuinfo->count_bufs >= NOT_KF_AFTER_FORCE_KF_EVT_TOLERANCE) { + GST_VALIDATE_REPORT (kuinfo->scenario, + SCENARIO_ACTION_EXECUTION_ERROR, + "Did not receive a key frame after requested one, " + " at running_time %" GST_TIME_FORMAT " (with a %i " + "frame tolerance)", GST_TIME_ARGS (kuinfo->running_time), + NOT_KF_AFTER_FORCE_KF_EVT_TOLERANCE); + + return GST_PAD_PROBE_REMOVE; + } + + kuinfo->count_bufs++; + } else { + GST_DEBUG_OBJECT (kuinfo->scenario, + "Properly got keyframe after \"force-keyframe\" event " + "with running_time %" GST_TIME_FORMAT " (latency %d frame(s))", + GST_TIME_ARGS (kuinfo->running_time), kuinfo->count_bufs); + + return GST_PAD_PROBE_REMOVE; + } + } return GST_PAD_PROBE_OK; } @@ -176,11 +179,11 @@ _find_video_encoder (GValue * velement, gpointer udata) { GstElement *element = g_value_get_object (velement); - const gchar *klass = gst_element_class_get_metadata (GST_ELEMENT_GET_CLASS (element), + const gchar *klass = + gst_element_class_get_metadata (GST_ELEMENT_GET_CLASS (element), GST_ELEMENT_METADATA_KLASS); - if (g_strstr_len (klass, -1, "Video") && - g_strstr_len (klass, -1, "Encoder")) { + if (g_strstr_len (klass, -1, "Video") && g_strstr_len (klass, -1, "Encoder")) { return 0; } @@ -210,7 +213,7 @@ _execute_request_key_unit (GstValidateScenario * scenario, iter = gst_bin_iterate_recurse (GST_BIN (encodebin)); if (!gst_iterator_find_custom (iter, - (GCompareFunc) _find_video_encoder, &result,NULL)) { + (GCompareFunc) _find_video_encoder, &result, NULL)) { g_error ("Could not find any video encode"); goto fail; @@ -254,8 +257,7 @@ _execute_request_key_unit (GstValidateScenario * scenario, gst_pad_add_probe (encoder_srcpad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, (GstPadProbeCallback) _check_is_key_unit_cb, - key_unit_data_ref (info), - (GDestroyNotify) key_unit_data_unref); + key_unit_data_ref (info), (GDestroyNotify) key_unit_data_unref); } else if (g_strcmp0 (direction, "downstream") == 0) { GstClockTime timestamp = GST_CLOCK_TIME_NONE, stream_time = GST_CLOCK_TIME_NONE; @@ -274,14 +276,14 @@ _execute_request_key_unit (GstValidateScenario * scenario, gst_validate_action_get_clocktime (scenario, action, "stream-time", &stream_time); - event = gst_video_event_new_downstream_force_key_unit (timestamp, stream_time, + event = + gst_video_event_new_downstream_force_key_unit (timestamp, stream_time, running_time, all_headers, count); gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, (GstPadProbeCallback) _check_is_key_unit_cb, - key_unit_data_ref (info), - (GDestroyNotify) key_unit_data_unref); + key_unit_data_ref (info), (GDestroyNotify) key_unit_data_unref); } else { g_error ("request keyunit direction %s invalide (should be in" " [downstrean, upstream]", direction); @@ -289,15 +291,15 @@ _execute_request_key_unit (GstValidateScenario * scenario, goto fail; } - gst_validate_printf (action, "Sendings a \"force key unit\" event %s\n", direction); + gst_validate_printf (action, "Sendings a \"force key unit\" event %s\n", + direction); segment_query = gst_query_new_segment (GST_FORMAT_TIME); gst_pad_query (encoder_srcpad, segment_query); gst_query_parse_segment (segment_query, &(info->segment.rate), - &(info->segment.format), - (gint64*) &(info->segment.start), - (gint64*) &(info->segment.stop)); + &(info->segment.format), + (gint64 *) & (info->segment.start), (gint64 *) & (info->segment.stop)); gst_pad_add_probe (encoder_srcpad, GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, @@ -306,8 +308,8 @@ _execute_request_key_unit (GstValidateScenario * scenario, if (!gst_pad_send_event (pad, event)) { - GST_VALIDATE_REPORT (scenario, SCENARIO_ACTION_EXECUTION_ERROR, - "Could not send \"force key unit\" event %s", direction); + GST_VALIDATE_REPORT (scenario, SCENARIO_ACTION_EXECUTION_ERROR, + "Could not send \"force key unit\" event %s", direction); goto fail; } @@ -493,10 +495,10 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data) if (GST_IS_VALIDATE_SCENARIO (GST_MESSAGE_SRC (message)) && state == GST_STATE_NULL) { - GST_VALIDATE_REPORT (GST_MESSAGE_SRC (message), - SCENARIO_ACTION_EXECUTION_ISSUE, - "Force stopping a transcoding pipeline is not recommanded" - " you should make sure to finalize it using a EOS event"); + GST_VALIDATE_REPORT (GST_MESSAGE_SRC (message), + SCENARIO_ACTION_EXECUTION_ISSUE, + "Force stopping a transcoding pipeline is not recommanded" + " you should make sure to finalize it using a EOS event"); gst_validate_printf (pipeline, "State change request NULL, " "quiting mainloop\n"); @@ -701,10 +703,12 @@ _register_actions (void) { const gchar *resize_video_mandatory_fields[] = { "restriction-caps", NULL }; const gchar *force_key_unit_mandatory_fields[] = { "direction", - "running-time", "all-headers", "count", NULL }; + "running-time", "all-headers", "count", NULL + }; gst_validate_add_action_type ("set-restriction", _execute_set_restriction, - resize_video_mandatory_fields, "Change the restriction caps on the fly", FALSE); + resize_video_mandatory_fields, "Change the restriction caps on the fly", + FALSE); gst_validate_add_action_type ("video-request-key-unit", _execute_request_key_unit, force_key_unit_mandatory_fields, "Request a video key unit", FALSE); @@ -745,9 +749,9 @@ main (int argc, gchar ** argv) "Let you set a scenario, it will override the GST_VALIDATE_SCENARIO " "environment variable", NULL}, {"set-configs", '\0', 0, G_OPTION_ARG_STRING, &configs, - "Let you set a config scenario, the scenario needs to be set as 'config" - "' you can specify a list of scenario separated by ':'" - " it will override the GST_VALIDATE_SCENARIO environment variable,", + "Let you set a config scenario, the scenario needs to be set as 'config" + "' you can specify a list of scenario separated by ':'" + " it will override the GST_VALIDATE_SCENARIO environment variable,", NULL}, {"eos-on-shutdown", 'e', 0, G_OPTION_ARG_NONE, &eos_on_shutdown, "If an EOS event should be sent to the pipeline if an interrupt is " @@ -757,12 +761,12 @@ main (int argc, gchar ** argv) {"list-scenarios", 'l', 0, G_OPTION_ARG_NONE, &list_scenarios, "List the avalaible scenarios that can be run", NULL}, {"scenarios-defs-output-file", '\0', 0, G_OPTION_ARG_FILENAME, - &output_file, "The output file to store scenarios details. " - "Implies --list-scenario", + &output_file, "The output file to store scenarios details. " + "Implies --list-scenario", NULL}, {"force-reencoding", 'r', 0, G_OPTION_ARG_NONE, &force_reencoding, "Whether to try to force reencoding, meaning trying to only remux " - "if possible(default: TRUE)", NULL}, + "if possible(default: TRUE)", NULL}, {NULL} }; @@ -812,7 +816,7 @@ main (int argc, gchar ** argv) if (list_scenarios || output_file) { if (gst_validate_list_scenarios (argv + 1, argc - 1, output_file)) - return 1; + return 1; return 0; } diff --git a/validate/tools/gst-validate.c b/validate/tools/gst-validate.c index 13e9e33..ac17488 100644 --- a/validate/tools/gst-validate.c +++ b/validate/tools/gst-validate.c @@ -128,9 +128,9 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data) gst_message_parse_request_state (message, &state); if (GST_IS_VALIDATE_SCENARIO (GST_MESSAGE_SRC (message)) - && state == GST_STATE_NULL) { - gst_validate_printf (GST_MESSAGE_SRC (message), "State change request NULL, " - "quiting mainloop\n"); + && state == GST_STATE_NULL) { + gst_validate_printf (GST_MESSAGE_SRC (message), + "State change request NULL, " "quiting mainloop\n"); g_main_loop_quit (mainloop); } break; @@ -143,7 +143,7 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data) } static gboolean -_is_playbin_pipeline (int argc, gchar **argv) +_is_playbin_pipeline (int argc, gchar ** argv) { gint i; @@ -157,10 +157,11 @@ _is_playbin_pipeline (int argc, gchar **argv) } static gboolean -_execute_set_subtitles (GstValidateScenario * scenario, GstValidateAction * action) +_execute_set_subtitles (GstValidateScenario * scenario, + GstValidateAction * action) { gchar *uri, *fname; - GFile * tmpfile, *folder; + GFile *tmpfile, *folder; const gchar *subtitle_file, *subtitle_dir; subtitle_file = gst_structure_get_string (action->structure, "subtitle-file"); @@ -176,8 +177,7 @@ _execute_set_subtitles (GstValidateScenario * scenario, GstValidateAction * acti fname = g_strdup_printf ("%s%s%s%s", subtitle_dir ? subtitle_dir : "", subtitle_dir ? G_DIR_SEPARATOR_S : "", - g_file_get_basename (tmpfile), - subtitle_file); + g_file_get_basename (tmpfile), subtitle_file); gst_object_unref (tmpfile); tmpfile = g_file_get_child (folder, fname); @@ -206,12 +206,14 @@ _execute_switch_track (GstValidateScenario * scenario, if (!(type = gst_structure_get_string (action->structure, "type"))) type = "audio"; - tflag = gst_validate_utils_flags_from_str (g_type_from_name ("GstPlayFlags"), type); + tflag = + gst_validate_utils_flags_from_str (g_type_from_name ("GstPlayFlags"), + type); current_txt = g_strdup_printf ("current-%s", type); tmp = g_strdup_printf ("n-%s", type); g_object_get (scenario->pipeline, "flags", &flags, tmp, &n, - current_txt, ¤t, NULL); + current_txt, ¤t, NULL); g_free (tmp); @@ -219,7 +221,8 @@ _execute_switch_track (GstValidateScenario * scenario, disabling = TRUE; flags &= ~tflag; index = -1; - } else if (!(str_index = gst_structure_get_string (action->structure, "index"))) { + } else if (!(str_index = + gst_structure_get_string (action->structure, "index"))) { if (!gst_structure_get_int (action->structure, "index", &index)) { GST_WARNING ("No index given, defaulting to +1"); index = 1; @@ -230,7 +233,7 @@ _execute_switch_track (GstValidateScenario * scenario, index = g_ascii_strtoll (str_index, NULL, 10); } - if (relative) { /* We are changing track relatively to current track */ + if (relative) { /* We are changing track relatively to current track */ index = current + index; if (current >= n) index = -2; @@ -238,7 +241,8 @@ _execute_switch_track (GstValidateScenario * scenario, if (!disabling) { tmp = g_strdup_printf ("get-%s-pad", type); - g_signal_emit_by_name (G_OBJECT (scenario->pipeline), tmp, current, &oldpad); + g_signal_emit_by_name (G_OBJECT (scenario->pipeline), tmp, current, + &oldpad); g_signal_emit_by_name (G_OBJECT (scenario->pipeline), tmp, index, &newpad); gst_validate_printf (action, "Switching to track number: %i," @@ -277,13 +281,13 @@ main (int argc, gchar ** argv) {"list-scenarios", 'l', 0, G_OPTION_ARG_NONE, &list_scenarios, "List the avalaible scenarios that can be run", NULL}, {"scenarios-defs-output-file", '\0', 0, G_OPTION_ARG_FILENAME, - &output_file, "The output file to store scenarios details. " - "Implies --list-scenario", + &output_file, "The output file to store scenarios details. " + "Implies --list-scenario", NULL}, {"set-configs", '\0', 0, G_OPTION_ARG_STRING, &configs, - "Let you set a config scenario, the scenario needs to be set as 'config" - "' you can specify a list of scenario separated by ':'" - " it will override the GST_VALIDATE_SCENARIO environment variable,", + "Let you set a config scenario, the scenario needs to be set as 'config" + "' you can specify a list of scenario separated by ':'" + " it will override the GST_VALIDATE_SCENARIO environment variable,", NULL}, {NULL} }; @@ -330,7 +334,7 @@ main (int argc, gchar ** argv) if (list_scenarios || output_file) { if (gst_validate_list_scenarios (argv + 1, argc - 1, output_file)) - return 1; + return 1; return 0; } @@ -358,7 +362,6 @@ main (int argc, gchar ** argv) gst_bin_add (GST_BIN (new_pipeline), pipeline); pipeline = new_pipeline; } - #ifdef G_OS_UNIX signal_watch_id = g_unix_signal_add (SIGINT, (GSourceFunc) intr_handler, pipeline); @@ -379,7 +382,7 @@ main (int argc, gchar ** argv) FALSE); /* Overriding default implementation */ - gst_validate_add_action_type ("switch-track", _execute_switch_track, NULL, + gst_validate_add_action_type ("switch-track", _execute_switch_track, NULL, "The 'switch-track' command can be used to switch tracks.\n" "The 'type' argument selects which track type to change (can be 'audio', 'video'," " or 'text'). The 'index' argument selects which track of this type" -- 2.7.4