validate: Run gst-indent on all code

so whitespace. much indent. spacing !
This commit is contained in:
Edward Hervey 2014-06-03 10:02:10 +02:00
parent 90f5dae534
commit ca44a11429
11 changed files with 195 additions and 174 deletions

View file

@ -74,9 +74,9 @@ gst_validate_bin_monitor_set_property (GObject * object, guint prop_id,
switch (prop_id) { switch (prop_id) {
case PROP_STATELESS: case PROP_STATELESS:
monitor->stateless = g_value_get_boolean(value); monitor->stateless = g_value_get_boolean (value);
if (monitor->scenario != NULL) if (monitor->scenario != NULL)
g_object_set(monitor->scenario, "stateless", monitor->stateless, NULL); g_object_set (monitor->scenario, "stateless", monitor->stateless, NULL);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 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; gobject_class->dispose = gst_validate_bin_monitor_dispose;
g_object_class_install_property (gobject_class, PROP_STATELESS, g_object_class_install_property (gobject_class, PROP_STATELESS,
g_param_spec_boolean ("stateless", "Stateless", "True to execute actions as soon as possible, regardless " g_param_spec_boolean ("stateless", "Stateless",
"of the initial state of the pipeline", "True to execute actions as soon as possible, regardless "
FALSE, G_PARAM_READWRITE)); "of the initial state of the pipeline", FALSE, G_PARAM_READWRITE));
validatemonitor_class->setup = gst_validate_bin_monitor_setup; validatemonitor_class->setup = gst_validate_bin_monitor_setup;
} }
@ -152,11 +152,12 @@ gst_validate_bin_monitor_init (GstValidateBinMonitor * bin_monitor)
} }
static gboolean static gboolean
print_position (GstValidateMonitor *monitor) print_position (GstValidateMonitor * monitor)
{ {
GstQuery *query; GstQuery *query;
gint64 position, duration; 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; gdouble rate = 1.0;
GstFormat format = GST_FORMAT_TIME; GstFormat format = GST_FORMAT_TIME;
@ -180,7 +181,8 @@ print_position (GstValidateMonitor *monitor)
} }
static void static void
_bus_handler (GstBus * bus, GstMessage * message, GstValidateBinMonitor *monitor) _bus_handler (GstBus * bus, GstMessage * message,
GstValidateBinMonitor * monitor)
{ {
GError *err; GError *err;
gchar *debug; gchar *debug;
@ -256,10 +258,11 @@ gst_validate_bin_monitor_new (GstBin * bin, GstValidateRunner * runner,
GstBus *bus; GstBus *bus;
monitor->print_pos_srcid = 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)); 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); g_signal_connect (bus, "sync-message", (GCallback) _bus_handler, monitor);
gst_object_unref (bus); gst_object_unref (bus);

View file

@ -186,7 +186,8 @@ gst_validate_media_info_load (const gchar * path, GError ** err)
if (err && *err) if (err && *err)
goto end; 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->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); mi->is_image = g_key_file_get_boolean (kf, "media-info", "is-image", NULL);
@ -1042,7 +1043,7 @@ end:
} }
static gboolean static gboolean
check_is_image (GstDiscovererInfo *info) check_is_image (GstDiscovererInfo * info)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
GList *video_streams = gst_discoverer_info_get_video_streams (info); GList *video_streams = gst_discoverer_info_get_video_streams (info);

View file

@ -51,7 +51,7 @@ static GstValidateOverrideRegistry *_registry_default;
#define GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK(r) g_mutex_unlock (&r->mutex) #define GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK(r) g_mutex_unlock (&r->mutex)
#define GST_VALIDATE_OVERRIDE_INIT_SYMBOL "gst_validate_create_overrides" #define GST_VALIDATE_OVERRIDE_INIT_SYMBOL "gst_validate_create_overrides"
typedef int (*GstValidateCreateOverride)(void); typedef int (*GstValidateCreateOverride) (void);
static GstValidateOverrideRegistry * static GstValidateOverrideRegistry *
gst_validate_override_registry_new (void) 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); module = g_module_open (*modname, G_MODULE_BIND_LAZY);
if (module == NULL) { if (module == NULL) {
loaderr = g_module_error (); 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; continue;
} }
if (g_module_symbol (module, GST_VALIDATE_OVERRIDE_INIT_SYMBOL, 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); GST_INFO ("Loaded no overrides from %s", *modname);
} }
} else { } 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); g_module_close (module);
} }

View file

@ -154,7 +154,7 @@ _structure_is_raw_audio (GstStructure * structure)
} }
static gchar * static gchar *
_get_event_string (GstEvent *event) _get_event_string (GstEvent * event)
{ {
const GstStructure *st; const GstStructure *st;
@ -1192,7 +1192,8 @@ gst_validate_pad_monitor_flush (GstValidatePadMonitor * pad_monitor)
pad_monitor->is_eos = FALSE; pad_monitor->is_eos = FALSE;
pad_monitor->last_flow_return = GST_FLOW_OK; pad_monitor->last_flow_return = GST_FLOW_OK;
gst_caps_replace (&pad_monitor->last_caps, NULL); 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, g_list_free_full (pad_monitor->expired_events,
(GDestroyNotify) gst_event_unref); (GDestroyNotify) gst_event_unref);
@ -1679,12 +1680,14 @@ gst_validate_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * buffer,
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)) && if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)) &&
GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)) && GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)) &&
((!gst_segment_clip (&monitor->segment, monitor->segment.format, ((!gst_segment_clip (&monitor->segment, monitor->segment.format,
GST_BUFFER_TIMESTAMP (buffer), GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_TIMESTAMP (buffer),
GST_BUFFER_TIMESTAMP (buffer) +
GST_BUFFER_DURATION (buffer), NULL, NULL)) || GST_BUFFER_DURATION (buffer), NULL, NULL)) ||
/* In the case of raw data, buffers should be strictly contained inside the /* In the case of raw data, buffers should be strictly contained inside the
* segment */ * segment */
(monitor->caps_is_raw && (monitor->caps_is_raw &&
GST_BUFFER_PTS (buffer) + GST_BUFFER_DURATION (buffer) < monitor->segment.start)) GST_BUFFER_PTS (buffer) + GST_BUFFER_DURATION (buffer) <
monitor->segment.start))
) { ) {
/* TODO is this a timestamp issue? */ /* TODO is this a timestamp issue? */
GST_VALIDATE_REPORT (monitor, BUFFER_IS_OUT_OF_SEGMENT, GST_VALIDATE_REPORT (monitor, BUFFER_IS_OUT_OF_SEGMENT,

View file

@ -390,24 +390,24 @@ gst_validate_printf (gpointer source, const gchar * format, ...)
} }
void void
gst_validate_printf_valist (gpointer source, gst_validate_printf_valist (gpointer source, const gchar * format, va_list args)
const gchar * format, va_list args)
{ {
GString *string = g_string_new (NULL); GString *string = g_string_new (NULL);
if (source) { if (source) {
if (*(GType *) source == GST_TYPE_VALIDATE_ACTION) { 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: %" g_string_printf (string,
GST_TIME_FORMAT " repeat: %i) | ", g_strcmp0 (action->name, "") == 0 ? "\n(Executing action: %s, number: %u at position: %" GST_TIME_FORMAT
"Unnamed" : action->name, " repeat: %i) | ", g_strcmp0 (action->name,
action->action_number, GST_TIME_ARGS (action->playback_time), "") == 0 ? "Unnamed" : action->name, action->action_number,
action->repeat); GST_TIME_ARGS (action->playback_time), action->repeat);
} else if (GST_IS_OBJECT (source)) { } else if (GST_IS_OBJECT (source)) {
g_string_printf (string, "\n%s --> ", GST_OBJECT_NAME (source)); g_string_printf (string, "\n%s --> ", GST_OBJECT_NAME (source));
} else if (G_IS_OBJECT (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 void
gst_validate_report_printf (GstValidateReport * report) 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); report->issue->summary);
gst_validate_printf (NULL, "%*s Detected on <%s> at %" GST_TIME_FORMAT "\n", 12, "", gst_validate_printf (NULL, "%*s Detected on <%s> at %" GST_TIME_FORMAT "\n",
gst_validate_reporter_get_name (report->reporter), 12, "", gst_validate_reporter_get_name (report->reporter),
GST_TIME_ARGS (report->timestamp)); GST_TIME_ARGS (report->timestamp));
if (report->message) if (report->message)
gst_validate_printf (NULL, "%*s Details : %s\n", 12, "", report->message); gst_validate_printf (NULL, "%*s Details : %s\n", 12, "", report->message);
if (report->issue->description) 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"); gst_validate_printf (NULL, "\n");
} }

View file

@ -38,7 +38,7 @@ typedef struct _GstValidateReporterPrivate
guint log_handler_id; guint log_handler_id;
} GstValidateReporterPrivate; } GstValidateReporterPrivate;
static GstValidateReporterPrivate * g_log_handler = NULL; static GstValidateReporterPrivate *g_log_handler = NULL;
G_DEFINE_INTERFACE (GstValidateReporter, gst_validate_reporter, G_TYPE_OBJECT); G_DEFINE_INTERFACE (GstValidateReporter, gst_validate_reporter, G_TYPE_OBJECT);
@ -226,7 +226,8 @@ gst_validate_reporter_set_runner (GstValidateReporter * reporter,
void void
gst_validate_reporter_set_handle_g_logs (GstValidateReporter * reporter) 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); g_log_handler = gst_validate_reporter_get_priv (reporter);
} }

View file

@ -446,8 +446,8 @@ _read_power (MathParser * parser)
} }
gdouble gdouble
gst_validate_utils_parse_expression (const gchar * expr, ParseVariableFunc variable_func, gst_validate_utils_parse_expression (const gchar * expr,
gpointer user_data, gchar ** error) ParseVariableFunc variable_func, gpointer user_data, gchar ** error)
{ {
gdouble val; gdouble val;
MathParser parser; MathParser parser;
@ -489,7 +489,8 @@ gst_validate_utils_flags_from_str (GType type, const gchar * str_flags)
} }
gboolean 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; guint i;
GEnumClass *class = g_type_class_ref (type); GEnumClass *class = g_type_class_ref (type);

View file

@ -139,8 +139,8 @@ gst_media_descriptor_finalize (GstMediaDescriptor * self)
if (self->filenode) if (self->filenode)
free_filenode (self->filenode); free_filenode (self->filenode);
G_OBJECT_CLASS (gst_media_descriptor_parent_class)-> G_OBJECT_CLASS (gst_media_descriptor_parent_class)->finalize (G_OBJECT
finalize (G_OBJECT (self)); (self));
} }
static void static void
@ -203,7 +203,8 @@ gst_media_descriptor_class_init (GstMediaDescriptorClass * self_class)
} }
static gint static gint
compare_tags (GstMediaDescriptor *ref, StreamNode *rstream, StreamNode *cstream) compare_tags (GstMediaDescriptor * ref, StreamNode * rstream,
StreamNode * cstream)
{ {
gboolean found; gboolean found;
TagNode *rtag, *ctag; TagNode *rtag, *ctag;
@ -245,7 +246,8 @@ compare_tags (GstMediaDescriptor *ref, StreamNode *rstream, StreamNode *cstream)
/* Return -1 if not found 1 if OK 0 if an error occured */ /* Return -1 if not found 1 if OK 0 if an error occured */
static gint 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 (g_strcmp0 (rstream->id, cstream->id) == 0) {
if (!gst_caps_is_equal (rstream->caps, cstream->caps)) { if (!gst_caps_is_equal (rstream->caps, cstream->caps)) {
@ -254,8 +256,7 @@ comparse_stream (GstMediaDescriptor *ref, StreamNode *rstream, StreamNode *cstre
GST_VALIDATE_REPORT (ref, FILE_PROFILE_INCORRECT, GST_VALIDATE_REPORT (ref, FILE_PROFILE_INCORRECT,
"Reference descriptor for stream %s has caps: %s" "Reference descriptor for stream %s has caps: %s"
" but compared stream %s has caps: %s", " but compared stream %s has caps: %s",
rstream->id, rcaps, rstream->id, rcaps, cstream->id, ccaps);
cstream->id, ccaps);
g_free (rcaps); g_free (rcaps);
g_free (ccaps); g_free (ccaps);
return 0; return 0;
@ -276,8 +277,8 @@ gst_media_descriptors_compare (GstMediaDescriptor * ref,
if (rfilenode->duration != cfilenode->duration) { if (rfilenode->duration != cfilenode->duration) {
GST_VALIDATE_REPORT (ref, FILE_DURATION_INCORRECT, GST_VALIDATE_REPORT (ref, FILE_DURATION_INCORRECT,
"Duration %" GST_TIME_FORMAT " is different from the reference %" GST_TIME_FORMAT, "Duration %" GST_TIME_FORMAT " is different from the reference %"
GST_TIME_ARGS (cfilenode->duration), GST_TIME_FORMAT, GST_TIME_ARGS (cfilenode->duration),
GST_TIME_ARGS (rfilenode->duration)); GST_TIME_ARGS (rfilenode->duration));
} }
@ -316,7 +317,7 @@ gst_media_descriptors_compare (GstMediaDescriptor * ref,
if (sfound == FALSE) { if (sfound == FALSE) {
GST_VALIDATE_REPORT (ref, FILE_PROFILE_INCORRECT, GST_VALIDATE_REPORT (ref, FILE_PROFILE_INCORRECT,
"Could not find stream %s in the compared descriptor", "Could not find stream %s in the compared descriptor",
((StreamNode*) rstream_list->data)->id); ((StreamNode *) rstream_list->data)->id);
return FALSE; return FALSE;
} }

View file

@ -48,7 +48,7 @@ main (int argc, gchar ** argv)
gchar *output = NULL; gchar *output = NULL;
GstMediaDescriptorWriter *writer; GstMediaDescriptorWriter *writer;
GstValidateRunner *runner; GstValidateRunner *runner;
GstMediaDescriptorParser * reference = NULL; GstMediaDescriptorParser *reference = NULL;
GOptionEntry options[] = { GOptionEntry options[] = {
{"output-file", 'o', 0, G_OPTION_ARG_FILENAME, {"output-file", 'o', 0, G_OPTION_ARG_FILENAME,
@ -93,7 +93,8 @@ main (int argc, gchar ** argv)
g_option_context_free (ctx); g_option_context_free (ctx);
runner = gst_validate_runner_new (); 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) { if (writer == NULL) {
g_print ("Could not discover file: %s", argv[1]); g_print ("Could not discover file: %s", argv[1]);
return 1; return 1;
@ -103,8 +104,7 @@ main (int argc, gchar ** argv)
gst_media_descriptor_writer_write (writer, output_file); gst_media_descriptor_writer_write (writer, output_file);
if (expected_file) { if (expected_file) {
reference = gst_media_descriptor_parser_new (runner, reference = gst_media_descriptor_parser_new (runner, expected_file, NULL);
expected_file, NULL);
if (reference == NULL) { if (reference == NULL) {
g_print ("Could not parse file: %s", expected_file); g_print ("Could not parse file: %s", expected_file);

View file

@ -95,7 +95,7 @@ intr_handler (gpointer user_data)
#endif /* G_OS_UNIX */ #endif /* G_OS_UNIX */
static void 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))) { if (G_UNLIKELY (g_atomic_int_dec_and_test (&info->refcount))) {
g_slice_free (KeyUnitProbeInfo, info); g_slice_free (KeyUnitProbeInfo, info);
@ -103,7 +103,7 @@ key_unit_data_unref (KeyUnitProbeInfo *info)
} }
static KeyUnitProbeInfo * static KeyUnitProbeInfo *
key_unit_data_ref (KeyUnitProbeInfo *info) key_unit_data_ref (KeyUnitProbeInfo * info)
{ {
g_atomic_int_inc (&info->refcount); g_atomic_int_inc (&info->refcount);
@ -111,7 +111,7 @@ key_unit_data_ref (KeyUnitProbeInfo *info)
} }
static KeyUnitProbeInfo * 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); KeyUnitProbeInfo *info = g_slice_new0 (KeyUnitProbeInfo);
info->refcount = 1; info->refcount = 1;
@ -123,7 +123,8 @@ key_unit_data_new (GstValidateScenario *scenario, GstClockTime running_time)
} }
static GstPadProbeReturn 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_IS_EVENT (GST_PAD_PROBE_INFO_DATA (info))) {
if (gst_video_event_is_force_key_unit (GST_PAD_PROBE_INFO_DATA (info))) if (gst_video_event_is_force_key_unit (GST_PAD_PROBE_INFO_DATA (info)))
@ -135,7 +136,8 @@ _check_is_key_unit_cb (GstPad * pad, GstPadProbeInfo * info, KeyUnitProbeInfo *k
gst_event_parse_segment (info->data, &segment); gst_event_parse_segment (info->data, &segment);
kuinfo->segment = *segment; kuinfo->segment = *segment;
} }
} else if (GST_IS_BUFFER (GST_PAD_PROBE_INFO_DATA (info)) && kuinfo->seen_event) { } else if (GST_IS_BUFFER (GST_PAD_PROBE_INFO_DATA (info))
&& kuinfo->seen_event) {
if (GST_CLOCK_TIME_IS_VALID (kuinfo->running_time)) { if (GST_CLOCK_TIME_IS_VALID (kuinfo->running_time)) {
GstClockTime running_time = gst_segment_to_running_time (&kuinfo->segment, GstClockTime running_time = gst_segment_to_running_time (&kuinfo->segment,
@ -145,7 +147,8 @@ _check_is_key_unit_cb (GstPad * pad, GstPadProbeInfo * info, KeyUnitProbeInfo *k
return GST_PAD_PROBE_OK; return GST_PAD_PROBE_OK;
} }
if (GST_BUFFER_FLAG_IS_SET (GST_PAD_PROBE_INFO_BUFFER (info), GST_BUFFER_FLAG_DELTA_UNIT)) { 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) { if (kuinfo->count_bufs >= NOT_KF_AFTER_FORCE_KF_EVT_TOLERANCE) {
GST_VALIDATE_REPORT (kuinfo->scenario, GST_VALIDATE_REPORT (kuinfo->scenario,
SCENARIO_ACTION_EXECUTION_ERROR, SCENARIO_ACTION_EXECUTION_ERROR,
@ -176,11 +179,11 @@ _find_video_encoder (GValue * velement, gpointer udata)
{ {
GstElement *element = g_value_get_object (velement); 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); GST_ELEMENT_METADATA_KLASS);
if (g_strstr_len (klass, -1, "Video") && if (g_strstr_len (klass, -1, "Video") && g_strstr_len (klass, -1, "Encoder")) {
g_strstr_len (klass, -1, "Encoder")) {
return 0; return 0;
} }
@ -210,7 +213,7 @@ _execute_request_key_unit (GstValidateScenario * scenario,
iter = gst_bin_iterate_recurse (GST_BIN (encodebin)); iter = gst_bin_iterate_recurse (GST_BIN (encodebin));
if (!gst_iterator_find_custom (iter, 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"); g_error ("Could not find any video encode");
goto fail; goto fail;
@ -254,8 +257,7 @@ _execute_request_key_unit (GstValidateScenario * scenario,
gst_pad_add_probe (encoder_srcpad, gst_pad_add_probe (encoder_srcpad,
GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM,
(GstPadProbeCallback) _check_is_key_unit_cb, (GstPadProbeCallback) _check_is_key_unit_cb,
key_unit_data_ref (info), key_unit_data_ref (info), (GDestroyNotify) key_unit_data_unref);
(GDestroyNotify) key_unit_data_unref);
} else if (g_strcmp0 (direction, "downstream") == 0) { } else if (g_strcmp0 (direction, "downstream") == 0) {
GstClockTime timestamp = GST_CLOCK_TIME_NONE, GstClockTime timestamp = GST_CLOCK_TIME_NONE,
stream_time = 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, gst_validate_action_get_clocktime (scenario, action,
"stream-time", &stream_time); "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); running_time, all_headers, count);
gst_pad_add_probe (pad, gst_pad_add_probe (pad,
GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
(GstPadProbeCallback) _check_is_key_unit_cb, (GstPadProbeCallback) _check_is_key_unit_cb,
key_unit_data_ref (info), key_unit_data_ref (info), (GDestroyNotify) key_unit_data_unref);
(GDestroyNotify) key_unit_data_unref);
} else { } else {
g_error ("request keyunit direction %s invalide (should be in" g_error ("request keyunit direction %s invalide (should be in"
" [downstrean, upstream]", direction); " [downstrean, upstream]", direction);
@ -289,15 +291,15 @@ _execute_request_key_unit (GstValidateScenario * scenario,
goto fail; 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); segment_query = gst_query_new_segment (GST_FORMAT_TIME);
gst_pad_query (encoder_srcpad, segment_query); gst_pad_query (encoder_srcpad, segment_query);
gst_query_parse_segment (segment_query, &(info->segment.rate), gst_query_parse_segment (segment_query, &(info->segment.rate),
&(info->segment.format), &(info->segment.format),
(gint64*) &(info->segment.start), (gint64 *) & (info->segment.start), (gint64 *) & (info->segment.stop));
(gint64*) &(info->segment.stop));
gst_pad_add_probe (encoder_srcpad, gst_pad_add_probe (encoder_srcpad,
GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
@ -701,10 +703,12 @@ _register_actions (void)
{ {
const gchar *resize_video_mandatory_fields[] = { "restriction-caps", NULL }; const gchar *resize_video_mandatory_fields[] = { "restriction-caps", NULL };
const gchar *force_key_unit_mandatory_fields[] = { "direction", 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, 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", gst_validate_add_action_type ("video-request-key-unit",
_execute_request_key_unit, force_key_unit_mandatory_fields, _execute_request_key_unit, force_key_unit_mandatory_fields,
"Request a video key unit", FALSE); "Request a video key unit", FALSE);

View file

@ -129,8 +129,8 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
if (GST_IS_VALIDATE_SCENARIO (GST_MESSAGE_SRC (message)) if (GST_IS_VALIDATE_SCENARIO (GST_MESSAGE_SRC (message))
&& state == GST_STATE_NULL) { && state == GST_STATE_NULL) {
gst_validate_printf (GST_MESSAGE_SRC (message), "State change request NULL, " gst_validate_printf (GST_MESSAGE_SRC (message),
"quiting mainloop\n"); "State change request NULL, " "quiting mainloop\n");
g_main_loop_quit (mainloop); g_main_loop_quit (mainloop);
} }
break; break;
@ -143,7 +143,7 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
} }
static gboolean static gboolean
_is_playbin_pipeline (int argc, gchar **argv) _is_playbin_pipeline (int argc, gchar ** argv)
{ {
gint i; gint i;
@ -157,10 +157,11 @@ _is_playbin_pipeline (int argc, gchar **argv)
} }
static gboolean static gboolean
_execute_set_subtitles (GstValidateScenario * scenario, GstValidateAction * action) _execute_set_subtitles (GstValidateScenario * scenario,
GstValidateAction * action)
{ {
gchar *uri, *fname; gchar *uri, *fname;
GFile * tmpfile, *folder; GFile *tmpfile, *folder;
const gchar *subtitle_file, *subtitle_dir; const gchar *subtitle_file, *subtitle_dir;
subtitle_file = gst_structure_get_string (action->structure, "subtitle-file"); 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", fname = g_strdup_printf ("%s%s%s%s",
subtitle_dir ? subtitle_dir : "", subtitle_dir ? subtitle_dir : "",
subtitle_dir ? G_DIR_SEPARATOR_S : "", subtitle_dir ? G_DIR_SEPARATOR_S : "",
g_file_get_basename (tmpfile), g_file_get_basename (tmpfile), subtitle_file);
subtitle_file);
gst_object_unref (tmpfile); gst_object_unref (tmpfile);
tmpfile = g_file_get_child (folder, fname); tmpfile = g_file_get_child (folder, fname);
@ -206,7 +206,9 @@ _execute_switch_track (GstValidateScenario * scenario,
if (!(type = gst_structure_get_string (action->structure, "type"))) if (!(type = gst_structure_get_string (action->structure, "type")))
type = "audio"; 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); current_txt = g_strdup_printf ("current-%s", type);
tmp = g_strdup_printf ("n-%s", type); tmp = g_strdup_printf ("n-%s", type);
@ -219,7 +221,8 @@ _execute_switch_track (GstValidateScenario * scenario,
disabling = TRUE; disabling = TRUE;
flags &= ~tflag; flags &= ~tflag;
index = -1; 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)) { if (!gst_structure_get_int (action->structure, "index", &index)) {
GST_WARNING ("No index given, defaulting to +1"); GST_WARNING ("No index given, defaulting to +1");
index = 1; index = 1;
@ -238,7 +241,8 @@ _execute_switch_track (GstValidateScenario * scenario,
if (!disabling) { if (!disabling) {
tmp = g_strdup_printf ("get-%s-pad", type); 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); g_signal_emit_by_name (G_OBJECT (scenario->pipeline), tmp, index, &newpad);
gst_validate_printf (action, "Switching to track number: %i," gst_validate_printf (action, "Switching to track number: %i,"
@ -358,7 +362,6 @@ main (int argc, gchar ** argv)
gst_bin_add (GST_BIN (new_pipeline), pipeline); gst_bin_add (GST_BIN (new_pipeline), pipeline);
pipeline = new_pipeline; pipeline = new_pipeline;
} }
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
signal_watch_id = signal_watch_id =
g_unix_signal_add (SIGINT, (GSourceFunc) intr_handler, pipeline); g_unix_signal_add (SIGINT, (GSourceFunc) intr_handler, pipeline);