diff --git a/validate/gst/validate/media-descriptor-parser.c b/validate/gst/validate/media-descriptor-parser.c index aacbfc439e..09bb25551a 100644 --- a/validate/gst/validate/media-descriptor-parser.c +++ b/validate/gst/validate/media-descriptor-parser.c @@ -21,6 +21,7 @@ */ #include "media-descriptor-parser.h" +#include G_DEFINE_TYPE (GstMediaDescriptorParser, gst_media_descriptor_parser, GST_TYPE_MEDIA_DESCRIPTOR); @@ -134,15 +135,18 @@ deserialize_framenode (const gchar ** names, const gchar ** values) framenode->pts = g_ascii_strtoull (values[i], NULL, 0); else if (g_strcmp0 (names[i], "dts") == 0) framenode->dts = g_ascii_strtoull (values[i], NULL, 0); + else if (g_strcmp0 (names[i], "checksum") == 0) + framenode->checksum = g_strdup (values[i]); else if (g_strcmp0 (names[i], "is-keyframe") == 0) { - if (g_ascii_strcasecmp (values[i], "true")) + if (!g_ascii_strcasecmp (values[i], "true")) framenode->is_keyframe = TRUE; else framenode->is_keyframe = FALSE; } } - framenode->buf = gst_buffer_new (); + framenode->buf = gst_buffer_new_wrapped (framenode->checksum, + strlen (framenode->checksum) + 1); GST_BUFFER_OFFSET (framenode->buf) = framenode->offset; GST_BUFFER_OFFSET_END (framenode->buf) = framenode->offset_end; @@ -150,8 +154,11 @@ deserialize_framenode (const gchar ** names, const gchar ** values) GST_BUFFER_PTS (framenode->buf) = framenode->pts; GST_BUFFER_DTS (framenode->buf) = framenode->dts; - if (framenode->is_keyframe == FALSE) + if (framenode->is_keyframe) { + GST_BUFFER_FLAG_UNSET (framenode->buf, GST_BUFFER_FLAG_DELTA_UNIT); + } else { GST_BUFFER_FLAG_SET (framenode->buf, GST_BUFFER_FLAG_DELTA_UNIT); + } return framenode; } @@ -167,7 +174,7 @@ frame_node_compare (FrameNode * fnode, GstBuffer * buf, GstBuffer * expected) GST_BUFFER_PTS (expected) = fnode->pts; GST_BUFFER_DTS (expected) = fnode->dts; if (fnode->is_keyframe) - GST_BUFFER_FLAG_SET (expected, GST_BUFFER_FLAG_DELTA_UNIT); + GST_BUFFER_FLAG_UNSET (expected, GST_BUFFER_FLAG_DELTA_UNIT); } if ((fnode->offset == GST_BUFFER_OFFSET (buf) && diff --git a/validate/gst/validate/media-descriptor-writer.c b/validate/gst/validate/media-descriptor-writer.c index b123aecca4..bd5adc1b3b 100644 --- a/validate/gst/validate/media-descriptor-writer.c +++ b/validate/gst/validate/media-descriptor-writer.c @@ -729,9 +729,16 @@ gst_media_descriptor_writer_add_frame (GstMediaDescriptorWriter StreamNode *streamnode = (StreamNode *) tmp->data; if (streamnode->pad == pad) { + GstMapInfo map; + gchar *checksum; guint id = g_list_length (streamnode->frames); FrameNode *fnode = g_slice_new0 (FrameNode); + g_assert (gst_buffer_map (buf, &map, GST_MAP_READ)); + checksum = g_compute_checksum_for_data (G_CHECKSUM_MD5, + (const guchar *) map.data, map.size); + gst_buffer_unmap (buf, &map); + fnode->id = id; fnode->offset = GST_BUFFER_OFFSET (buf); fnode->offset_end = GST_BUFFER_OFFSET_END (buf); @@ -745,14 +752,16 @@ gst_media_descriptor_writer_add_frame (GstMediaDescriptorWriter g_markup_printf_escaped (" ", fnode->duration, id, - fnode->is_keyframe ? "true" : "false", - fnode->offset, fnode->offset_end, fnode->pts, fnode->dts); + "\" dts=\"%" G_GUINT64_FORMAT "\" checksum=\"%s\"/>", + fnode->duration, id, fnode->is_keyframe ? "true" : "false", + fnode->offset, fnode->offset_end, fnode->pts, fnode->dts, checksum); fnode->str_close = NULL; streamnode->frames = g_list_append (streamnode->frames, fnode); GST_MEDIA_DESCRIPTOR_UNLOCK (writer); + + g_free (checksum); return TRUE; } } diff --git a/validate/gst/validate/media-descriptor.h b/validate/gst/validate/media-descriptor.h index 66856733ad..ce181e40d0 100644 --- a/validate/gst/validate/media-descriptor.h +++ b/validate/gst/validate/media-descriptor.h @@ -108,6 +108,7 @@ typedef struct GstBuffer *buf; + gchar *checksum; gchar *str_open; gchar *str_close; } FrameNode;