mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-13 10:55:34 +00:00
harness: use new take_all_data() function in _dump_to_file().
This commit is contained in:
parent
d8e7fc40b1
commit
e08834bff3
1 changed files with 9 additions and 17 deletions
|
@ -1829,25 +1829,17 @@ gst_harness_take_all_data_as_bytes (GstHarness * h)
|
||||||
void
|
void
|
||||||
gst_harness_dump_to_file (GstHarness * h, const gchar * filename)
|
gst_harness_dump_to_file (GstHarness * h, const gchar * filename)
|
||||||
{
|
{
|
||||||
GstHarnessPrivate *priv = h->priv;
|
GError *err = NULL;
|
||||||
FILE *fd;
|
gpointer data;
|
||||||
GstBuffer *buf;
|
gsize size;
|
||||||
fd = fopen (filename, "wb");
|
|
||||||
g_assert (fd);
|
|
||||||
|
|
||||||
while ((buf = g_async_queue_try_pop (priv->buffer_queue))) {
|
data = gst_harness_take_all_data (h, &size);
|
||||||
GstMapInfo info;
|
if (!g_file_set_contents (filename, data ? data : "", size, &err)) {
|
||||||
if (gst_buffer_map (buf, &info, GST_MAP_READ)) {
|
g_error ("GstHarness: Failed to write data to file: %s", err->message);
|
||||||
fwrite (info.data, 1, info.size, fd);
|
g_clear_error (&err);
|
||||||
gst_buffer_unmap (buf, &info);
|
|
||||||
} else {
|
|
||||||
GST_ERROR ("failed to map buffer %p", buf);
|
|
||||||
}
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
}
|
}
|
||||||
|
g_free (data);
|
||||||
fflush (fd);
|
g_free (data);
|
||||||
fclose (fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue