identity: Print buffer flags in the verbose output

This commit is contained in:
Sebastian Dröge 2011-12-06 14:55:11 +01:00
parent 675e54f1f4
commit b7b84671ba

View file

@ -32,6 +32,7 @@
#endif
#include <stdlib.h>
#include <string.h>
#include "../../gst/gst-i18n-lib.h"
#include "gstidentity.h"
@ -581,19 +582,40 @@ gst_identity_update_last_message_for_buffer (GstIdentity * identity,
const gchar * action, GstBuffer * buf)
{
gchar ts_str[64], dur_str[64];
gchar flag_str[100];
GST_OBJECT_LOCK (identity);
{
const char *flag_list[12] = {
"ro", "media4", "", "",
"preroll", "discont", "incaps", "gap",
"delta_unit", "media1", "media2", "media3"
};
int i;
char *end = flag_str;
end[0] = '\0';
for (i = 0; i < 12; i++) {
if (GST_MINI_OBJECT_CAST (buf)->flags & (1 << i)) {
strcpy (end, flag_list[i]);
end += strlen (end);
end[0] = ' ';
end[1] = '\0';
end++;
}
}
}
g_free (identity->last_message);
identity->last_message = g_strdup_printf ("%s ******* (%s:%s)i "
identity->last_message = g_strdup_printf ("%s ******* (%s:%s) "
"(%u bytes, timestamp: %s, duration: %s, offset: %" G_GINT64_FORMAT ", "
"offset_end: % " G_GINT64_FORMAT ", flags: %d) %p", action,
"offset_end: % " G_GINT64_FORMAT ", flags: %d %s) %p", action,
GST_DEBUG_PAD_NAME (GST_BASE_TRANSFORM_CAST (identity)->sinkpad),
GST_BUFFER_SIZE (buf),
print_pretty_time (ts_str, sizeof (ts_str), GST_BUFFER_TIMESTAMP (buf)),
print_pretty_time (dur_str, sizeof (dur_str), GST_BUFFER_DURATION (buf)),
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
GST_BUFFER_FLAGS (buf), buf);
GST_BUFFER_FLAGS (buf), flag_str, buf);
GST_OBJECT_UNLOCK (identity);