4 #include <gst/pbutils/descriptions.h>
7 print (GstDebugColorFlags c, gboolean err, gboolean nline, const gchar * format,
10 GString *str = g_string_new (NULL);
11 GstDebugColorMode color_mode;
13 const gchar *clear = NULL;
15 color_mode = gst_debug_get_color_mode ();
17 if (color_mode == GST_DEBUG_COLOR_MODE_UNIX) {
19 if (color_mode != GST_DEBUG_COLOR_MODE_OFF) {
22 color = gst_debug_construct_term_color (c);
26 g_string_append (str, color);
30 g_string_append_vprintf (str, format, var_args);
33 g_string_append_c (str, '\n');
36 g_string_append (str, clear);
39 g_printerr ("%s", str->str);
41 g_print ("%s", str->str);
43 g_string_free (str, TRUE);
47 ok (const gchar * format, ...)
51 va_start (var_args, format);
52 print (GST_DEBUG_FG_GREEN, FALSE, TRUE, format, var_args);
57 warn (const gchar * format, ...)
61 va_start (var_args, format);
62 print (GST_DEBUG_FG_YELLOW, TRUE, TRUE, format, var_args);
67 error (const gchar * format, ...)
71 va_start (var_args, format);
72 print (GST_DEBUG_FG_RED, TRUE, TRUE, format, var_args);
77 ensure_uri (const gchar * location)
79 if (gst_uri_is_valid (location))
80 return g_strdup (location);
82 return gst_filename_to_uri (location, NULL);
86 get_file_extension (gchar * uri)
103 return &uri[find + 1];
107 get_usable_profiles (GstEncodingTarget * target)
109 GList *tmpprof, *usable_profiles = NULL;
111 for (tmpprof = (GList *) gst_encoding_target_get_profiles (target);
112 tmpprof; tmpprof = tmpprof->next) {
113 GstEncodingProfile *profile = tmpprof->data;
114 GstElement *tmpencodebin = gst_element_factory_make ("encodebin", NULL);
116 gst_encoding_profile_set_presence (profile, 1);
117 if (GST_IS_ENCODING_CONTAINER_PROFILE (profile)) {
119 for (tmpsubprof = (GList *)
120 gst_encoding_container_profile_get_profiles
121 (GST_ENCODING_CONTAINER_PROFILE (profile)); tmpsubprof;
122 tmpsubprof = tmpsubprof->next)
123 gst_encoding_profile_set_presence (tmpsubprof->data, 1);
126 g_object_set (tmpencodebin, "profile", gst_object_ref (profile), NULL);
127 GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (tmpencodebin),
128 GST_DEBUG_GRAPH_SHOW_ALL, gst_encoding_profile_get_name (profile));
130 /* The profile could be expended */
131 if (GST_BIN (tmpencodebin)->children)
132 usable_profiles = g_list_prepend (usable_profiles, profile);
134 gst_object_unref (tmpencodebin);
137 return usable_profiles;
141 create_encoding_profile (const gchar * pname)
143 GstEncodingProfile *profile;
144 GValue value = G_VALUE_INIT;
146 g_value_init (&value, GST_TYPE_ENCODING_PROFILE);
148 if (!gst_value_deserialize (&value, pname)) {
149 g_value_reset (&value);
154 profile = g_value_dup_object (&value);
155 g_value_reset (&value);
161 get_profile_type (GstEncodingProfile * profile)
163 if (GST_IS_ENCODING_CONTAINER_PROFILE (profile))
165 else if (GST_IS_ENCODING_AUDIO_PROFILE (profile))
167 else if (GST_IS_ENCODING_VIDEO_PROFILE (profile))
174 print_profile (GstEncodingProfile * profile, const gchar * prefix)
176 const gchar *name = gst_encoding_profile_get_name (profile);
177 const gchar *desc = gst_encoding_profile_get_description (profile);
178 GstCaps *format = gst_encoding_profile_get_format (profile);
181 if (gst_caps_is_fixed (format))
182 capsdesc = gst_pb_utils_get_codec_description (format);
184 capsdesc = gst_caps_to_string (format);
186 g_print ("%s%s: %s%s%s%s%s%s\n", prefix, get_profile_type (profile),
187 name ? name : capsdesc, desc ? ": " : "", desc ? desc : "",
188 name ? " (" : "", name ? capsdesc : "", name ? ")" : "");
194 describe_encoding_profile (GstEncodingProfile * profile)
196 g_return_if_fail (GST_IS_ENCODING_PROFILE (profile));
198 print_profile (profile, " ");
199 if (GST_IS_ENCODING_CONTAINER_PROFILE (profile)) {
203 gst_encoding_container_profile_get_profiles
204 (GST_ENCODING_CONTAINER_PROFILE (profile)); tmp; tmp = tmp->next)
205 print_profile (tmp->data, " - ");