mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 03:45:39 +00:00
validate:flow: Add a way to dump buffer content as hex
Useful in unit tests with very small buffers Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/205>
This commit is contained in:
parent
3b69b73299
commit
83ebecef5c
3 changed files with 14 additions and 1 deletions
|
@ -247,6 +247,17 @@ validate_flow_format_buffer (GstBuffer * buffer, gint checksum_type,
|
|||
&& g_strv_contains (CONSTIFY (logged_fields), "checksum"))) {
|
||||
if (!gst_buffer_map (buffer, &map, GST_MAP_READ)) {
|
||||
GST_ERROR ("Buffer could not be mapped.");
|
||||
} else if (checksum_type == CHECKSUM_TYPE_CONTENT_HEX) {
|
||||
gint i;
|
||||
GString *content = g_string_new ("content=");
|
||||
|
||||
for (i = 0; i < map.size; i++) {
|
||||
if (i)
|
||||
g_string_append_c (content, ' ');
|
||||
g_string_append_printf (content, "0x%02x", map.data[i]);
|
||||
}
|
||||
|
||||
buffer_parts[buffer_parts_index++] = g_string_free (content, FALSE);
|
||||
} else {
|
||||
sum =
|
||||
g_compute_checksum_for_data (checksum_type ==
|
||||
|
|
|
@ -25,8 +25,9 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#define CHECKSUM_TYPE_NONE -2
|
||||
#define CHECKSUM_TYPE_AS_ID -1
|
||||
#define CHECKSUM_TYPE_NONE -2
|
||||
#define CHECKSUM_TYPE_CONTENT_HEX -3
|
||||
|
||||
void format_time(gchar* dest_str, guint64 time);
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ validate_flow_checksum_type_get_type (void)
|
|||
static const GEnumValue values[] = {
|
||||
{CHECKSUM_TYPE_NONE, "NONE", "none"},
|
||||
{CHECKSUM_TYPE_AS_ID, "AS-ID", "as-id"},
|
||||
{CHECKSUM_TYPE_CONTENT_HEX, "raw-hex", "raw-hex"},
|
||||
{G_CHECKSUM_MD5, "MD5", "md5"},
|
||||
{G_CHECKSUM_SHA1, "SHA-1", "sha1"},
|
||||
{G_CHECKSUM_SHA256, "SHA-256", "sha256"},
|
||||
|
|
Loading…
Reference in a new issue