mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
validate: Namespace all our structures and objects
Making GI a bit happier. Those are not stable API anyway... Differential Revision: https://phabricator.freedesktop.org/D704
This commit is contained in:
parent
62e5e5f2e3
commit
3657e7867f
18 changed files with 591 additions and 405 deletions
|
@ -66,7 +66,7 @@ _validate_bin_element_added (GstBin * bin, GstElement * pad,
|
|||
|
||||
static void
|
||||
gst_validate_bin_set_media_descriptor (GstValidateMonitor * monitor,
|
||||
GstMediaDescriptor * media_descriptor)
|
||||
GstValidateMediaDescriptor * media_descriptor)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ _validate_element_pad_added (GstElement * element, GstPad * pad,
|
|||
|
||||
static void
|
||||
gst_validate_element_set_media_descriptor (GstValidateMonitor * monitor,
|
||||
GstMediaDescriptor * media_descriptor)
|
||||
GstValidateMediaDescriptor * media_descriptor)
|
||||
{
|
||||
gboolean done;
|
||||
GstPad *pad;
|
||||
|
|
|
@ -372,7 +372,7 @@ gst_validate_monitor_get_property (GObject * object, guint prop_id,
|
|||
|
||||
void
|
||||
gst_validate_monitor_set_media_descriptor (GstValidateMonitor * monitor,
|
||||
GstMediaDescriptor * media_descriptor)
|
||||
GstValidateMediaDescriptor * media_descriptor)
|
||||
{
|
||||
GstValidateMonitorClass *klass = GST_VALIDATE_MONITOR_GET_CLASS (monitor);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ struct _GstValidateMonitor {
|
|||
|
||||
GMutex overrides_mutex;
|
||||
GQueue overrides;
|
||||
GstMediaDescriptor *media_descriptor;
|
||||
GstValidateMediaDescriptor *media_descriptor;
|
||||
|
||||
GstValidateReportingDetails level;
|
||||
|
||||
|
@ -111,7 +111,7 @@ struct _GstValidateMonitorClass {
|
|||
gboolean (* setup) (GstValidateMonitor * monitor);
|
||||
GstElement *(* get_element) (GstValidateMonitor * monitor);
|
||||
void (*set_media_descriptor) (GstValidateMonitor * monitor,
|
||||
GstMediaDescriptor * media_descriptor);
|
||||
GstValidateMediaDescriptor * media_descriptor);
|
||||
};
|
||||
|
||||
/* normal GObject stuff */
|
||||
|
@ -123,7 +123,7 @@ void gst_validate_monitor_attach_override (GstValidateMonitor * moni
|
|||
GstElement * gst_validate_monitor_get_element (GstValidateMonitor * monitor);
|
||||
const gchar * gst_validate_monitor_get_element_name (GstValidateMonitor * monitor);
|
||||
void gst_validate_monitor_set_media_descriptor (GstValidateMonitor * monitor,
|
||||
GstMediaDescriptor *media_descriptor);
|
||||
GstValidateMediaDescriptor *media_descriptor);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_VALIDATE_MONITOR_H__ */
|
||||
|
|
|
@ -1616,13 +1616,15 @@ _should_check_buffers (GstValidatePadMonitor * pad_monitor,
|
|||
GST_DEBUG_OBJECT (pad, "No media_descriptor set => no buffer checking");
|
||||
|
||||
pad_monitor->check_buffers = FALSE;
|
||||
} else if (!gst_media_descriptor_detects_frames (monitor->media_descriptor)) {
|
||||
GST_DEBUG_OBJECT (pad, "No frame detection media descriptor "
|
||||
"=> not buffer checking");
|
||||
} else
|
||||
if (!gst_validate_media_descriptor_detects_frames
|
||||
(monitor->media_descriptor)) {
|
||||
GST_DEBUG_OBJECT (pad,
|
||||
"No frame detection media descriptor " "=> not buffer checking");
|
||||
pad_monitor->check_buffers = FALSE;
|
||||
} else if (pad_monitor->all_bufs == NULL &&
|
||||
!gst_media_descriptor_get_buffers (monitor->media_descriptor, pad, NULL,
|
||||
&pad_monitor->all_bufs)) {
|
||||
!gst_validate_media_descriptor_get_buffers (monitor->media_descriptor,
|
||||
pad, NULL, &pad_monitor->all_bufs)) {
|
||||
|
||||
GST_INFO_OBJECT (monitor,
|
||||
"The MediaInfo is marked as detecting frame, but getting frames"
|
||||
|
|
|
@ -113,7 +113,7 @@ struct _GstValidatePadMonitor {
|
|||
GstClockTime timestamp_range_start;
|
||||
GstClockTime timestamp_range_end;
|
||||
|
||||
/* GstMediaCheck related fields */
|
||||
/* GstValidateMediaCheck related fields */
|
||||
GList *all_bufs;
|
||||
/* The GstBuffer that should arrive next in a GList */
|
||||
GList *current_buf;
|
||||
|
|
|
@ -366,7 +366,8 @@ _set_variable_func (const gchar * name, double *value, gpointer user_data)
|
|||
"Could not query duration. Trying to get duration from media-info");
|
||||
if (monitor && monitor->media_descriptor)
|
||||
duration =
|
||||
gst_media_descriptor_get_duration (monitor->media_descriptor);
|
||||
gst_validate_media_descriptor_get_duration
|
||||
(monitor->media_descriptor);
|
||||
else {
|
||||
GST_ERROR_OBJECT (scenario, "Media-info not set");
|
||||
return FALSE;
|
||||
|
@ -2784,7 +2785,7 @@ _parse_scenario (GFile * f, GKeyFile * kf)
|
|||
GstStructure *desc = NULL;
|
||||
|
||||
gchar **name = g_strsplit (fname, GST_VALIDATE_SCENARIO_SUFFIX, 0);
|
||||
GList *tmp, *structures = structs_parse_from_gfile (f);
|
||||
GList *tmp, *structures = gst_validate_structs_parse_from_gfile (f);
|
||||
|
||||
for (tmp = structures; tmp; tmp = tmp->next) {
|
||||
GstValidateActionType *type =
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct
|
|||
jmp_buf err_jmp_buf;
|
||||
const gchar *error;
|
||||
void *user_data;
|
||||
ParseVariableFunc variable_func;
|
||||
GstValidateGstValidateParseVariableFunc variable_func;
|
||||
} MathParser;
|
||||
|
||||
static gdouble _read_power (MathParser * parser);
|
||||
|
@ -298,7 +298,7 @@ _read_boolean_or (MathParser * parser)
|
|||
|
||||
static gboolean
|
||||
_init (MathParser * parser, const gchar * str,
|
||||
ParseVariableFunc variable_func, void *user_data)
|
||||
GstValidateGstValidateParseVariableFunc variable_func, void *user_data)
|
||||
{
|
||||
parser->str = str;
|
||||
parser->len = strlen (str) + 1;
|
||||
|
@ -448,7 +448,8 @@ _read_power (MathParser * parser)
|
|||
|
||||
gdouble
|
||||
gst_validate_utils_parse_expression (const gchar * expr,
|
||||
ParseVariableFunc variable_func, gpointer user_data, gchar ** error)
|
||||
GstValidateGstValidateParseVariableFunc variable_func, gpointer user_data,
|
||||
gchar ** error)
|
||||
{
|
||||
gdouble val;
|
||||
MathParser parser;
|
||||
|
@ -629,7 +630,7 @@ gst_validate_utils_structs_parse_from_filename (const gchar * scenario_file)
|
|||
}
|
||||
|
||||
GList *
|
||||
structs_parse_from_gfile (GFile * scenario_file)
|
||||
gst_validate_structs_parse_from_gfile (GFile * scenario_file)
|
||||
{
|
||||
gchar **lines;
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
#include<gio/gio.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
typedef int (*ParseVariableFunc) (const gchar *name,
|
||||
typedef int (*GstValidateGstValidateParseVariableFunc) (const gchar *name,
|
||||
double *value, gpointer user_data);
|
||||
|
||||
gdouble gst_validate_utils_parse_expression (const gchar *expr,
|
||||
ParseVariableFunc variable_func,
|
||||
GstValidateGstValidateParseVariableFunc variable_func,
|
||||
gpointer user_data,
|
||||
gchar **error);
|
||||
guint gst_validate_utils_flags_from_str (GType type, const gchar * str_flags);
|
||||
|
@ -42,7 +42,7 @@ gboolean gst_validate_utils_enum_from_str (GType type,
|
|||
guint * enum_value);
|
||||
|
||||
GList * gst_validate_utils_structs_parse_from_filename (const gchar * scenario_file);
|
||||
GList * structs_parse_from_gfile (GFile * scenario_file);
|
||||
GList * gst_validate_structs_parse_from_gfile (GFile * scenario_file);
|
||||
|
||||
gboolean gst_validate_element_has_klass (GstElement * element, const gchar * klass);
|
||||
gboolean gst_validate_utils_get_clocktime (GstStructure *structure, const gchar * name,
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include "media-descriptor-parser.h"
|
||||
#include <string.h>
|
||||
|
||||
G_DEFINE_TYPE (GstMediaDescriptorParser, gst_media_descriptor_parser,
|
||||
GST_TYPE_MEDIA_DESCRIPTOR);
|
||||
G_DEFINE_TYPE (GstValidateMediaDescriptorParser,
|
||||
gst_validate_media_descriptor_parser, GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ enum
|
|||
N_PROPERTIES
|
||||
};
|
||||
|
||||
struct _GstMediaDescriptorParserPrivate
|
||||
struct _GstValidateMediaDescriptorParserPrivate
|
||||
{
|
||||
gchar *xmlpath;
|
||||
|
||||
|
@ -43,7 +43,8 @@ struct _GstMediaDescriptorParserPrivate
|
|||
|
||||
/* Private methods and callbacks */
|
||||
static gint
|
||||
compare_frames (FrameNode * frm, FrameNode * frm1)
|
||||
compare_frames (GstValidateMediaGstValidateMediaGstValidateMediaFrameNode * frm,
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaFrameNode * frm1)
|
||||
{
|
||||
if (frm->id < frm1->id)
|
||||
return -1;
|
||||
|
@ -55,8 +56,9 @@ compare_frames (FrameNode * frm, FrameNode * frm1)
|
|||
}
|
||||
|
||||
static void
|
||||
deserialize_filenode (FileNode * filenode,
|
||||
const gchar ** names, const gchar ** values)
|
||||
deserialize_filenode
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode *
|
||||
filenode, const gchar ** names, const gchar ** values)
|
||||
{
|
||||
gint i;
|
||||
for (i = 0; names[i] != NULL; i++) {
|
||||
|
@ -73,11 +75,14 @@ deserialize_filenode (FileNode * filenode,
|
|||
}
|
||||
}
|
||||
|
||||
static StreamNode *
|
||||
static GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode *
|
||||
deserialize_streamnode (const gchar ** names, const gchar ** values)
|
||||
{
|
||||
gint i;
|
||||
StreamNode *streamnode = g_slice_new0 (StreamNode);
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode =
|
||||
g_slice_new0
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode);
|
||||
|
||||
for (i = 0; names[i] != NULL; i++) {
|
||||
if (g_strcmp0 (names[i], "id") == 0)
|
||||
|
@ -92,19 +97,23 @@ deserialize_streamnode (const gchar ** names, const gchar ** values)
|
|||
return streamnode;
|
||||
}
|
||||
|
||||
static TagsNode *
|
||||
static GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode *
|
||||
deserialize_tagsnode (const gchar ** names, const gchar ** values)
|
||||
{
|
||||
TagsNode *tagsnode = g_slice_new0 (TagsNode);
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode
|
||||
* tagsnode =
|
||||
g_slice_new0
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode);
|
||||
|
||||
return tagsnode;
|
||||
}
|
||||
|
||||
static TagNode *
|
||||
static GstValidateMediaGstValidateMediaGstValidateMediaTagNode *
|
||||
deserialize_tagnode (const gchar ** names, const gchar ** values)
|
||||
{
|
||||
gint i;
|
||||
TagNode *tagnode = g_slice_new0 (TagNode);
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaTagNode *tagnode =
|
||||
g_slice_new0 (GstValidateMediaGstValidateMediaGstValidateMediaTagNode);
|
||||
|
||||
for (i = 0; names[i] != NULL; i++) {
|
||||
if (g_strcmp0 (names[i], "content") == 0)
|
||||
|
@ -114,12 +123,13 @@ deserialize_tagnode (const gchar ** names, const gchar ** values)
|
|||
return tagnode;
|
||||
}
|
||||
|
||||
static FrameNode *
|
||||
static GstValidateMediaGstValidateMediaGstValidateMediaFrameNode *
|
||||
deserialize_framenode (const gchar ** names, const gchar ** values)
|
||||
{
|
||||
gint i;
|
||||
|
||||
FrameNode *framenode = g_slice_new0 (FrameNode);
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaFrameNode *framenode =
|
||||
g_slice_new0 (GstValidateMediaGstValidateMediaGstValidateMediaFrameNode);
|
||||
|
||||
for (i = 0; names[i] != NULL; i++) {
|
||||
if (g_strcmp0 (names[i], "id") == 0)
|
||||
|
@ -169,8 +179,8 @@ static void
|
|||
on_end_element_cb (GMarkupParseContext * context,
|
||||
const gchar * element_name, gpointer user_data, GError ** error)
|
||||
{
|
||||
GstMediaDescriptorParserPrivate *priv =
|
||||
GST_MEDIA_DESCRIPTOR_PARSER (user_data)->priv;
|
||||
GstValidateMediaDescriptorParserPrivate *priv =
|
||||
GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER (user_data)->priv;
|
||||
|
||||
if (g_strcmp0 (element_name, "stream") == 0) {
|
||||
priv->in_stream = FALSE;
|
||||
|
@ -182,20 +192,22 @@ on_start_element_cb (GMarkupParseContext * context,
|
|||
const gchar * element_name, const gchar ** attribute_names,
|
||||
const gchar ** attribute_values, gpointer user_data, GError ** error)
|
||||
{
|
||||
FileNode *filenode = GST_MEDIA_DESCRIPTOR (user_data)->filenode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode
|
||||
* filenode = GST_VALIDATE_MEDIA_DESCRIPTOR (user_data)->filenode;
|
||||
|
||||
GstMediaDescriptorParserPrivate *priv =
|
||||
GST_MEDIA_DESCRIPTOR_PARSER (user_data)->priv;
|
||||
GstValidateMediaDescriptorParserPrivate *priv =
|
||||
GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER (user_data)->priv;
|
||||
|
||||
if (g_strcmp0 (element_name, "file") == 0) {
|
||||
deserialize_filenode (filenode, attribute_names, attribute_values);
|
||||
} else if (g_strcmp0 (element_name, "stream") == 0) {
|
||||
StreamNode *node =
|
||||
deserialize_streamnode (attribute_names, attribute_values);
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* node = deserialize_streamnode (attribute_names, attribute_values);
|
||||
priv->in_stream = TRUE;
|
||||
filenode->streams = g_list_prepend (filenode->streams, node);
|
||||
} else if (g_strcmp0 (element_name, "frame") == 0) {
|
||||
StreamNode *streamnode = filenode->streams->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode = filenode->streams->data;
|
||||
|
||||
streamnode->cframe = streamnode->frames =
|
||||
g_list_insert_sorted (streamnode->frames,
|
||||
|
@ -203,17 +215,26 @@ on_start_element_cb (GMarkupParseContext * context,
|
|||
(GCompareFunc) compare_frames);
|
||||
} else if (g_strcmp0 (element_name, "tags") == 0) {
|
||||
if (priv->in_stream) {
|
||||
StreamNode *snode = (StreamNode *) filenode->streams->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* snode =
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*)
|
||||
filenode->streams->data;
|
||||
|
||||
snode->tags = deserialize_tagsnode (attribute_names, attribute_values);
|
||||
} else {
|
||||
filenode->tags = deserialize_tagsnode (attribute_names, attribute_values);
|
||||
}
|
||||
} else if (g_strcmp0 (element_name, "tag") == 0) {
|
||||
TagsNode *tagsnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode
|
||||
* tagsnode;
|
||||
|
||||
if (priv->in_stream) {
|
||||
StreamNode *snode = (StreamNode *) filenode->streams->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* snode =
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*)
|
||||
filenode->streams->data;
|
||||
tagsnode = snode->tags;
|
||||
} else {
|
||||
tagsnode = filenode->tags;
|
||||
|
@ -239,11 +260,11 @@ static const GMarkupParser content_parser = {
|
|||
};
|
||||
|
||||
static gboolean
|
||||
_set_content (GstMediaDescriptorParser * parser,
|
||||
_set_content (GstValidateMediaDescriptorParser * parser,
|
||||
const gchar * content, gsize size, GError ** error)
|
||||
{
|
||||
GError *err = NULL;
|
||||
GstMediaDescriptorParserPrivate *priv = parser->priv;
|
||||
GstValidateMediaDescriptorParserPrivate *priv = parser->priv;
|
||||
|
||||
priv->parsecontext = g_markup_parse_context_new (&content_parser,
|
||||
G_MARKUP_TREAT_CDATA_AS_TEXT, parser, NULL);
|
||||
|
@ -260,13 +281,13 @@ failed:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
set_xml_path (GstMediaDescriptorParser * parser, const gchar * path,
|
||||
set_xml_path (GstValidateMediaDescriptorParser * parser, const gchar * path,
|
||||
GError ** error)
|
||||
{
|
||||
gsize xmlsize;
|
||||
gchar *content;
|
||||
GError *err = NULL;
|
||||
GstMediaDescriptorParserPrivate *priv = parser->priv;
|
||||
GstValidateMediaDescriptorParserPrivate *priv = parser->priv;
|
||||
gboolean result;
|
||||
|
||||
if (!g_file_get_contents (path, &content, &xmlsize, &err))
|
||||
|
@ -285,16 +306,16 @@ failed:
|
|||
|
||||
/* GObject standard vmethods */
|
||||
static void
|
||||
dispose (GstMediaDescriptorParser * parser)
|
||||
dispose (GstValidateMediaDescriptorParser * parser)
|
||||
{
|
||||
G_OBJECT_CLASS (gst_media_descriptor_parser_parent_class)->dispose (G_OBJECT
|
||||
(parser));
|
||||
G_OBJECT_CLASS (gst_validate_media_descriptor_parser_parent_class)->dispose
|
||||
(G_OBJECT (parser));
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GstMediaDescriptorParser * parser)
|
||||
finalize (GstValidateMediaDescriptorParser * parser)
|
||||
{
|
||||
GstMediaDescriptorParserPrivate *priv;
|
||||
GstValidateMediaDescriptorParserPrivate *priv;
|
||||
|
||||
priv = parser->priv;
|
||||
|
||||
|
@ -304,8 +325,8 @@ finalize (GstMediaDescriptorParser * parser)
|
|||
if (priv->parsecontext != NULL)
|
||||
g_markup_parse_context_free (priv->parsecontext);
|
||||
|
||||
G_OBJECT_CLASS (gst_media_descriptor_parser_parent_class)->finalize (G_OBJECT
|
||||
(parser));
|
||||
G_OBJECT_CLASS (gst_validate_media_descriptor_parser_parent_class)->finalize
|
||||
(G_OBJECT (parser));
|
||||
}
|
||||
|
||||
|
||||
|
@ -331,24 +352,26 @@ set_property (GObject * gobject, guint prop_id, const GValue * value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_media_descriptor_parser_init (GstMediaDescriptorParser * parser)
|
||||
gst_validate_media_descriptor_parser_init (GstValidateMediaDescriptorParser *
|
||||
parser)
|
||||
{
|
||||
GstMediaDescriptorParserPrivate *priv;
|
||||
GstValidateMediaDescriptorParserPrivate *priv;
|
||||
|
||||
parser->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (parser,
|
||||
GST_TYPE_MEDIA_DESCRIPTOR_PARSER, GstMediaDescriptorParserPrivate);
|
||||
GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER,
|
||||
GstValidateMediaDescriptorParserPrivate);
|
||||
|
||||
priv->xmlpath = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_media_descriptor_parser_class_init (GstMediaDescriptorParserClass *
|
||||
self_class)
|
||||
gst_validate_media_descriptor_parser_class_init
|
||||
(GstValidateMediaDescriptorParserClass * self_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (self_class);
|
||||
|
||||
g_type_class_add_private (self_class,
|
||||
sizeof (GstMediaDescriptorParserPrivate));
|
||||
sizeof (GstValidateMediaDescriptorParserPrivate));
|
||||
object_class->dispose = (void (*)(GObject * object)) dispose;
|
||||
object_class->finalize = (void (*)(GObject * object)) finalize;
|
||||
object_class->get_property = get_property;
|
||||
|
@ -356,14 +379,15 @@ gst_media_descriptor_parser_class_init (GstMediaDescriptorParserClass *
|
|||
}
|
||||
|
||||
/* Public methods */
|
||||
GstMediaDescriptorParser *
|
||||
gst_media_descriptor_parser_new (GstValidateRunner * runner,
|
||||
GstValidateMediaDescriptorParser *
|
||||
gst_validate_media_descriptor_parser_new (GstValidateRunner * runner,
|
||||
const gchar * xmlpath, GError ** error)
|
||||
{
|
||||
GstMediaDescriptorParser *parser;
|
||||
GstValidateMediaDescriptorParser *parser;
|
||||
|
||||
parser = g_object_new (GST_TYPE_MEDIA_DESCRIPTOR_PARSER, "validate-runner",
|
||||
runner, NULL);
|
||||
parser =
|
||||
g_object_new (GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER,
|
||||
"validate-runner", runner, NULL);
|
||||
|
||||
if (set_xml_path (parser, xmlpath, error) == FALSE) {
|
||||
g_object_unref (parser);
|
||||
|
@ -375,14 +399,15 @@ gst_media_descriptor_parser_new (GstValidateRunner * runner,
|
|||
return parser;
|
||||
}
|
||||
|
||||
GstMediaDescriptorParser *
|
||||
gst_media_descriptor_parser_new_from_xml (GstValidateRunner * runner,
|
||||
GstValidateMediaDescriptorParser *
|
||||
gst_validate_media_descriptor_parser_new_from_xml (GstValidateRunner * runner,
|
||||
const gchar * xml, GError ** error)
|
||||
{
|
||||
GstMediaDescriptorParser *parser;
|
||||
GstValidateMediaDescriptorParser *parser;
|
||||
|
||||
parser = g_object_new (GST_TYPE_MEDIA_DESCRIPTOR_PARSER, "validate-runner",
|
||||
runner, NULL);
|
||||
parser =
|
||||
g_object_new (GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER,
|
||||
"validate-runner", runner, NULL);
|
||||
if (_set_content (parser, xml, strlen (xml) * sizeof (gchar), error) == FALSE) {
|
||||
g_object_unref (parser);
|
||||
|
||||
|
@ -393,29 +418,34 @@ gst_media_descriptor_parser_new_from_xml (GstValidateRunner * runner,
|
|||
return parser;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gst_media_descriptor_parser_get_xml_path (GstMediaDescriptorParser * parser)
|
||||
gchar *gst_validate_media_descriptor_parser_get_xml_path
|
||||
(GstValidateMediaDescriptorParser * parser)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_PARSER (parser), NULL);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_PARSER (parser), NULL);
|
||||
|
||||
return g_strdup (parser->priv->xmlpath);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_parser_add_stream (GstMediaDescriptorParser * parser,
|
||||
GstPad * pad)
|
||||
{
|
||||
gst_validate_media_descriptor_parser_add_stream
|
||||
(GstValidateMediaDescriptorParser * parser, GstPad * pad) {
|
||||
GList *tmp;
|
||||
gboolean ret = FALSE;
|
||||
GstCaps *caps;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_PARSER (parser), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) parser)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_PARSER (parser),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) parser)->filenode,
|
||||
FALSE);
|
||||
|
||||
caps = gst_pad_query_caps (pad, NULL);
|
||||
for (tmp = ((GstMediaDescriptor *) parser)->filenode->streams; tmp;
|
||||
for (tmp = ((GstValidateMediaDescriptor *) parser)->filenode->streams; tmp;
|
||||
tmp = tmp->next) {
|
||||
StreamNode *streamnode = (StreamNode *) tmp->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode =
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*)
|
||||
tmp->data;
|
||||
|
||||
if (streamnode->pad == NULL && gst_caps_is_equal (streamnode->caps, caps)) {
|
||||
ret = TRUE;
|
||||
|
@ -433,16 +463,22 @@ done:
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_parser_all_stream_found (GstMediaDescriptorParser * parser)
|
||||
{
|
||||
gst_validate_media_descriptor_parser_all_stream_found
|
||||
(GstValidateMediaDescriptorParser * parser) {
|
||||
GList *tmp;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_PARSER (parser), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) parser)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_PARSER (parser),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) parser)->filenode,
|
||||
FALSE);
|
||||
|
||||
for (tmp = ((GstMediaDescriptor *) parser)->filenode->streams; tmp;
|
||||
for (tmp = ((GstValidateMediaDescriptor *) parser)->filenode->streams; tmp;
|
||||
tmp = tmp->next) {
|
||||
StreamNode *streamnode = (StreamNode *) tmp->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode =
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*)
|
||||
tmp->data;
|
||||
|
||||
if (streamnode->pad == NULL)
|
||||
return FALSE;
|
||||
|
@ -453,20 +489,24 @@ gst_media_descriptor_parser_all_stream_found (GstMediaDescriptorParser * parser)
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_parser_add_taglist (GstMediaDescriptorParser * parser,
|
||||
GstTagList * taglist)
|
||||
{
|
||||
gst_validate_media_descriptor_parser_add_taglist
|
||||
(GstValidateMediaDescriptorParser * parser, GstTagList * taglist) {
|
||||
GList *tmptag;
|
||||
TagsNode *tagsnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode
|
||||
* tagsnode;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_PARSER (parser), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) parser)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_PARSER (parser),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) parser)->filenode,
|
||||
FALSE);
|
||||
g_return_val_if_fail (GST_IS_STRUCTURE (taglist), FALSE);
|
||||
|
||||
tagsnode = ((GstMediaDescriptor *) parser)->filenode->tags;
|
||||
tagsnode = ((GstValidateMediaDescriptor *) parser)->filenode->tags;
|
||||
|
||||
for (tmptag = tagsnode->tags; tmptag; tmptag = tmptag->next) {
|
||||
if (tag_node_compare ((TagNode *) tmptag->data, taglist)) {
|
||||
if (gst_validate_gst_validate_gst_validate_gst_validate_tag_node_compare (
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaTagNode *)
|
||||
tmptag->data, taglist)) {
|
||||
GST_DEBUG ("Adding tag %" GST_PTR_FORMAT, taglist);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -476,23 +516,31 @@ gst_media_descriptor_parser_add_taglist (GstMediaDescriptorParser * parser,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_parser_all_tags_found (GstMediaDescriptorParser * parser)
|
||||
{
|
||||
gst_validate_media_descriptor_parser_all_tags_found
|
||||
(GstValidateMediaDescriptorParser * parser) {
|
||||
GList *tmptag;
|
||||
TagsNode *tagsnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode
|
||||
* tagsnode;
|
||||
gboolean ret = TRUE;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_PARSER (parser), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) parser)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_PARSER (parser),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) parser)->filenode,
|
||||
FALSE);
|
||||
|
||||
tagsnode = ((GstMediaDescriptor *) parser)->filenode->tags;
|
||||
tagsnode = ((GstValidateMediaDescriptor *) parser)->filenode->tags;
|
||||
for (tmptag = tagsnode->tags; tmptag; tmptag = tmptag->next) {
|
||||
gchar *tag = NULL;
|
||||
|
||||
tag = gst_tag_list_to_string (((TagNode *) tmptag->data)->taglist);
|
||||
if (((TagNode *) tmptag->data)->found == FALSE) {
|
||||
tag =
|
||||
gst_tag_list_to_string ((
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaTagNode *)
|
||||
tmptag->data)->taglist);
|
||||
if (((GstValidateMediaGstValidateMediaGstValidateMediaTagNode *)
|
||||
tmptag->data)->found == FALSE) {
|
||||
|
||||
if (((TagNode *) tmptag->data)->taglist != NULL) {
|
||||
if (((GstValidateMediaGstValidateMediaGstValidateMediaTagNode *)
|
||||
tmptag->data)->taglist != NULL) {
|
||||
GST_DEBUG ("Tag not found %s", tag);
|
||||
} else {
|
||||
GST_DEBUG ("Tag not not properly deserialized");
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef GST_MEDIA_DESCRIPTOR_PARSER_h
|
||||
#define GST_MEDIA_DESCRIPTOR_PARSER_h
|
||||
#ifndef GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_h
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_h
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
@ -29,46 +29,46 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType gst_media_descriptor_parser_get_type (void);
|
||||
GType gst_validate_media_descriptor_parser_get_type (void);
|
||||
|
||||
#define GST_TYPE_MEDIA_DESCRIPTOR_PARSER (gst_media_descriptor_parser_get_type ())
|
||||
#define GST_MEDIA_DESCRIPTOR_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MEDIA_DESCRIPTOR_PARSER, GstMediaDescriptorParser))
|
||||
#define GST_MEDIA_DESCRIPTOR_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MEDIA_DESCRIPTOR_PARSER, GstMediaDescriptorParserClass))
|
||||
#define GST_IS_MEDIA_DESCRIPTOR_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MEDIA_DESCRIPTOR_PARSER))
|
||||
#define GST_IS_MEDIA_DESCRIPTOR_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MEDIA_DESCRIPTOR_PARSER))
|
||||
#define GST_MEDIA_DESCRIPTOR_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MEDIA_DESCRIPTOR_PARSER, GstMediaDescriptorParserClass))
|
||||
#define GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER (gst_validate_media_descriptor_parser_get_type ())
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER, GstValidateMediaDescriptorParser))
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER, GstValidateMediaDescriptorParserClass))
|
||||
#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER))
|
||||
#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER))
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER, GstValidateMediaDescriptorParserClass))
|
||||
|
||||
typedef struct _GstMediaDescriptorParserPrivate GstMediaDescriptorParserPrivate;
|
||||
typedef struct _GstValidateMediaDescriptorParserPrivate GstValidateMediaDescriptorParserPrivate;
|
||||
|
||||
|
||||
typedef struct {
|
||||
GstMediaDescriptor parent;
|
||||
GstValidateMediaDescriptor parent;
|
||||
|
||||
GstMediaDescriptorParserPrivate *priv;
|
||||
GstValidateMediaDescriptorParserPrivate *priv;
|
||||
|
||||
} GstMediaDescriptorParser;
|
||||
} GstValidateMediaDescriptorParser;
|
||||
|
||||
typedef struct {
|
||||
|
||||
GstMediaDescriptorClass parent;
|
||||
GstValidateMediaDescriptorClass parent;
|
||||
|
||||
} GstMediaDescriptorParserClass;
|
||||
} GstValidateMediaDescriptorParserClass;
|
||||
|
||||
GstMediaDescriptorParser * gst_media_descriptor_parser_new (GstValidateRunner *runner,
|
||||
GstValidateMediaDescriptorParser * gst_validate_media_descriptor_parser_new (GstValidateRunner *runner,
|
||||
const gchar * xmlpath,
|
||||
GError **error);
|
||||
GstMediaDescriptorParser *
|
||||
gst_media_descriptor_parser_new_from_xml (GstValidateRunner * runner,
|
||||
GstValidateMediaDescriptorParser *
|
||||
gst_validate_media_descriptor_parser_new_from_xml (GstValidateRunner * runner,
|
||||
const gchar * xml,
|
||||
GError ** error);
|
||||
gchar * gst_media_descriptor_parser_get_xml_path (GstMediaDescriptorParser *parser);
|
||||
gboolean gst_media_descriptor_parser_add_stream (GstMediaDescriptorParser *parser,
|
||||
gchar * gst_validate_media_descriptor_parser_get_xml_path (GstValidateMediaDescriptorParser *parser);
|
||||
gboolean gst_validate_media_descriptor_parser_add_stream (GstValidateMediaDescriptorParser *parser,
|
||||
GstPad *pad);
|
||||
gboolean gst_media_descriptor_parser_add_taglist (GstMediaDescriptorParser *parser,
|
||||
gboolean gst_validate_media_descriptor_parser_add_taglist (GstValidateMediaDescriptorParser *parser,
|
||||
GstTagList *taglist);
|
||||
gboolean gst_media_descriptor_parser_all_stream_found (GstMediaDescriptorParser *parser);
|
||||
gboolean gst_media_descriptor_parser_all_tags_found (GstMediaDescriptorParser *parser);
|
||||
gboolean gst_validate_media_descriptor_parser_all_stream_found (GstValidateMediaDescriptorParser *parser);
|
||||
gboolean gst_validate_media_descriptor_parser_all_tags_found (GstValidateMediaDescriptorParser *parser);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_MEDIA_DESCRIPTOR_PARSER_h */
|
||||
#endif /* GST_VALIDATE_MEDIA_DESCRIPTOR_PARSER_h */
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include "media-descriptor-writer.h"
|
||||
#include <string.h>
|
||||
|
||||
G_DEFINE_TYPE (GstMediaDescriptorWriter,
|
||||
gst_media_descriptor_writer, GST_TYPE_MEDIA_DESCRIPTOR);
|
||||
G_DEFINE_TYPE (GstValidateMediaDescriptorWriter,
|
||||
gst_validate_media_descriptor_writer, GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR);
|
||||
|
||||
#define STR_APPEND(arg, nb_white) \
|
||||
g_string_append_printf (res, "%*s%s%s", (nb_white), " ", (arg), "\n"); \
|
||||
|
@ -43,7 +43,7 @@ enum
|
|||
N_PROPERTIES
|
||||
};
|
||||
|
||||
struct _GstMediaDescriptorWriterPrivate
|
||||
struct _GstValidateMediaDescriptorWriterPrivate
|
||||
{
|
||||
GstElement *pipeline;
|
||||
GstCaps *raw_caps;
|
||||
|
@ -53,7 +53,7 @@ struct _GstMediaDescriptorWriterPrivate
|
|||
};
|
||||
|
||||
static void
|
||||
finalize (GstMediaDescriptorWriter * writer)
|
||||
finalize (GstValidateMediaDescriptorWriter * writer)
|
||||
{
|
||||
if (writer->priv->raw_caps)
|
||||
gst_caps_unref (writer->priv->raw_caps);
|
||||
|
@ -61,8 +61,8 @@ finalize (GstMediaDescriptorWriter * writer)
|
|||
if (writer->priv->parsers)
|
||||
gst_plugin_feature_list_free (writer->priv->parsers);
|
||||
|
||||
G_OBJECT_CLASS (gst_media_descriptor_writer_parent_class)->finalize (G_OBJECT
|
||||
(writer));
|
||||
G_OBJECT_CLASS (gst_validate_media_descriptor_writer_parent_class)->finalize
|
||||
(G_OBJECT (writer));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -87,13 +87,15 @@ set_property (GObject * gobject, guint prop_id, const GValue * value,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_media_descriptor_writer_init (GstMediaDescriptorWriter * writer)
|
||||
gst_validate_media_descriptor_writer_init (GstValidateMediaDescriptorWriter *
|
||||
writer)
|
||||
{
|
||||
GstMediaDescriptorWriterPrivate *priv;
|
||||
GstValidateMediaDescriptorWriterPrivate *priv;
|
||||
|
||||
|
||||
writer->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (writer,
|
||||
GST_TYPE_MEDIA_DESCRIPTOR_WRITER, GstMediaDescriptorWriterPrivate);
|
||||
GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER,
|
||||
GstValidateMediaDescriptorWriterPrivate);
|
||||
|
||||
writer->priv->parsers =
|
||||
gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_PARSER,
|
||||
|
@ -101,13 +103,13 @@ gst_media_descriptor_writer_init (GstMediaDescriptorWriter * writer)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_media_descriptor_writer_class_init
|
||||
(GstMediaDescriptorWriterClass * self_class)
|
||||
gst_validate_media_descriptor_writer_class_init
|
||||
(GstValidateMediaDescriptorWriterClass * self_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (self_class);
|
||||
|
||||
g_type_class_add_private (self_class,
|
||||
sizeof (GstMediaDescriptorWriterPrivate));
|
||||
sizeof (GstValidateMediaDescriptorWriterPrivate));
|
||||
object_class->finalize = (void (*)(GObject * object)) finalize;
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
@ -115,13 +117,15 @@ static void
|
|||
|
||||
/* Private methods */
|
||||
static gchar *
|
||||
serialize_filenode (GstMediaDescriptorWriter * writer)
|
||||
serialize_filenode (GstValidateMediaDescriptorWriter * writer)
|
||||
{
|
||||
GString *res;
|
||||
gchar *tmpstr, *caps_str;
|
||||
GList *tmp, *tmp2;
|
||||
TagsNode *tagsnode;
|
||||
FileNode *filenode = ((GstMediaDescriptor *) writer)->filenode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode
|
||||
* tagsnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode
|
||||
* filenode = ((GstValidateMediaDescriptor *) writer)->filenode;
|
||||
|
||||
tmpstr = g_markup_printf_escaped ("<file duration=\"%" G_GUINT64_FORMAT
|
||||
"\" frame-detection=\"%i\" uri=\"%s\" seekable=\"%s\">\n",
|
||||
|
@ -139,19 +143,25 @@ serialize_filenode (GstMediaDescriptorWriter * writer)
|
|||
g_free (tmpstr);
|
||||
for (tmp = filenode->streams; tmp; tmp = tmp->next) {
|
||||
GList *tmp3;
|
||||
StreamNode *snode = ((StreamNode *) tmp->data);
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* snode =
|
||||
(
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*) tmp->data);
|
||||
|
||||
STR_APPEND2 (snode->str_open);
|
||||
|
||||
for (tmp2 = snode->frames; tmp2; tmp2 = tmp2->next) {
|
||||
STR_APPEND3 (((FrameNode *) tmp2->data)->str_open);
|
||||
STR_APPEND3 (((GstValidateMediaGstValidateMediaGstValidateMediaFrameNode
|
||||
*) tmp2->data)->str_open);
|
||||
}
|
||||
|
||||
tagsnode = snode->tags;
|
||||
if (tagsnode) {
|
||||
STR_APPEND3 (tagsnode->str_open);
|
||||
for (tmp3 = tagsnode->tags; tmp3; tmp3 = tmp3->next) {
|
||||
STR_APPEND4 (((TagNode *) tmp3->data)->str_open);
|
||||
STR_APPEND4 (((GstValidateMediaGstValidateMediaGstValidateMediaTagNode
|
||||
*) tmp3->data)->str_open);
|
||||
}
|
||||
STR_APPEND3 (tagsnode->str_close);
|
||||
}
|
||||
|
@ -164,7 +174,8 @@ serialize_filenode (GstMediaDescriptorWriter * writer)
|
|||
if (tagsnode) {
|
||||
STR_APPEND1 (tagsnode->str_open);
|
||||
for (tmp2 = tagsnode->tags; tmp2; tmp2 = tmp2->next) {
|
||||
STR_APPEND2 (((TagNode *) tmp2->data)->str_open);
|
||||
STR_APPEND2 (((GstValidateMediaGstValidateMediaGstValidateMediaTagNode *)
|
||||
tmp2->data)->str_open);
|
||||
}
|
||||
STR_APPEND1 (tagsnode->str_close);
|
||||
}
|
||||
|
@ -174,15 +185,19 @@ serialize_filenode (GstMediaDescriptorWriter * writer)
|
|||
return g_string_free (res, FALSE);
|
||||
}
|
||||
|
||||
/* Should be called with GST_MEDIA_DESCRIPTOR_LOCK */
|
||||
static StreamNode *
|
||||
gst_media_descriptor_find_stream_node_by_pad (GstMediaDescriptor * md,
|
||||
GstPad * pad)
|
||||
/* Should be called with GST_VALIDATE_MEDIA_DESCRIPTOR_LOCK */
|
||||
static
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* gst_validate_media_descriptor_find_stream_node_by_pad
|
||||
(GstValidateMediaDescriptor * md, GstPad * pad)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
for (tmp = md->filenode->streams; tmp; tmp = tmp->next) {
|
||||
StreamNode *streamnode = (StreamNode *) tmp->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode =
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*) tmp->data;
|
||||
|
||||
if (streamnode->pad == pad) {
|
||||
return streamnode;
|
||||
|
@ -193,18 +208,19 @@ gst_media_descriptor_find_stream_node_by_pad (GstMediaDescriptor * md,
|
|||
}
|
||||
|
||||
/* Public methods */
|
||||
GstMediaDescriptorWriter *
|
||||
gst_media_descriptor_writer_new (GstValidateRunner * runner,
|
||||
GstValidateMediaDescriptorWriter *
|
||||
gst_validate_media_descriptor_writer_new (GstValidateRunner * runner,
|
||||
const gchar * uri, GstClockTime duration, gboolean seekable)
|
||||
{
|
||||
GstMediaDescriptorWriter *writer;
|
||||
FileNode *fnode;
|
||||
GstValidateMediaDescriptorWriter *writer;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode
|
||||
* fnode;
|
||||
|
||||
writer =
|
||||
g_object_new (GST_TYPE_MEDIA_DESCRIPTOR_WRITER, "validate-runner", runner,
|
||||
NULL);
|
||||
g_object_new (GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER,
|
||||
"validate-runner", runner, NULL);
|
||||
|
||||
fnode = ((GstMediaDescriptor *) writer)->filenode;
|
||||
fnode = ((GstValidateMediaDescriptor *) writer)->filenode;
|
||||
fnode->uri = g_strdup (uri);
|
||||
fnode->duration = duration;
|
||||
fnode->seekable = seekable;
|
||||
|
@ -216,19 +232,24 @@ gst_media_descriptor_writer_new (GstValidateRunner * runner,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_media_descriptor_writer_add_stream (GstMediaDescriptorWriter * writer,
|
||||
GstDiscovererStreamInfo * info)
|
||||
gst_validate_media_descriptor_writer_add_stream
|
||||
(GstValidateMediaDescriptorWriter * writer, GstDiscovererStreamInfo * info)
|
||||
{
|
||||
const gchar *stype;
|
||||
gboolean ret = FALSE;
|
||||
GstCaps *caps;
|
||||
gchar *capsstr = NULL;
|
||||
StreamNode *snode = NULL;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* snode = NULL;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_WRITER (writer), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) writer)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER (writer),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) writer)->filenode,
|
||||
FALSE);
|
||||
|
||||
snode = g_slice_new0 (StreamNode);
|
||||
snode =
|
||||
g_slice_new0
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode);
|
||||
snode->frames = NULL;
|
||||
snode->cframe = NULL;
|
||||
|
||||
|
@ -237,7 +258,9 @@ gst_media_descriptor_writer_add_stream (GstMediaDescriptorWriter * writer,
|
|||
caps = gst_discoverer_stream_info_get_caps (info);
|
||||
capsstr = gst_caps_to_string (caps);
|
||||
|
||||
g_slice_free (StreamNode, snode);
|
||||
g_slice_free
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode,
|
||||
snode);
|
||||
GST_VALIDATE_REPORT (writer, FILE_NO_STREAM_ID,
|
||||
"Stream with caps: %s has no stream ID", capsstr);
|
||||
gst_caps_unref (caps);
|
||||
|
@ -268,12 +291,12 @@ gst_media_descriptor_writer_add_stream (GstMediaDescriptorWriter * writer,
|
|||
|
||||
snode->str_close = g_markup_printf_escaped ("</stream>");
|
||||
|
||||
((GstMediaDescriptor *) writer)->filenode->streams =
|
||||
g_list_prepend (((GstMediaDescriptor *) writer)->filenode->streams,
|
||||
snode);
|
||||
((GstValidateMediaDescriptor *) writer)->filenode->streams =
|
||||
g_list_prepend (((GstValidateMediaDescriptor *) writer)->
|
||||
filenode->streams, snode);
|
||||
|
||||
if (gst_discoverer_stream_info_get_tags (info)) {
|
||||
gst_media_descriptor_writer_add_tags (writer, snode->id,
|
||||
gst_validate_media_descriptor_writer_add_tags (writer, snode->id,
|
||||
gst_discoverer_stream_info_get_tags (info));
|
||||
}
|
||||
|
||||
|
@ -290,20 +313,22 @@ gst_media_descriptor_writer_add_stream (GstMediaDescriptorWriter * writer,
|
|||
|
||||
static GstPadProbeReturn
|
||||
_uridecodebin_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||
GstMediaDescriptorWriter * writer)
|
||||
GstValidateMediaDescriptorWriter * writer)
|
||||
{
|
||||
if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BUFFER) {
|
||||
gst_media_descriptor_writer_add_frame (writer, pad, info->data);
|
||||
gst_validate_media_descriptor_writer_add_frame (writer, pad, info->data);
|
||||
} else if (GST_PAD_PROBE_INFO_TYPE (info) &
|
||||
GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) {
|
||||
GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info);
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_SEGMENT:{
|
||||
const GstSegment *segment;
|
||||
StreamNode *streamnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode;
|
||||
|
||||
streamnode =
|
||||
gst_media_descriptor_find_stream_node_by_pad ((GstMediaDescriptor *)
|
||||
gst_validate_media_descriptor_find_stream_node_by_pad (
|
||||
(GstValidateMediaDescriptor *)
|
||||
writer, pad);
|
||||
if (streamnode) {
|
||||
gst_event_parse_segment (event, &segment);
|
||||
|
@ -323,17 +348,21 @@ _uridecodebin_probe (GstPad * pad, GstPadProbeInfo * info,
|
|||
|
||||
static gboolean
|
||||
_find_stream_id (GstPad * pad, GstEvent ** event,
|
||||
GstMediaDescriptorWriter * writer)
|
||||
GstValidateMediaDescriptorWriter * writer)
|
||||
{
|
||||
if (GST_EVENT_TYPE (*event) == GST_EVENT_STREAM_START) {
|
||||
GList *tmp;
|
||||
StreamNode *snode = NULL;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* snode = NULL;
|
||||
const gchar *stream_id;
|
||||
|
||||
gst_event_parse_stream_start (*event, &stream_id);
|
||||
for (tmp = ((GstMediaDescriptor *) writer)->filenode->streams; tmp;
|
||||
for (tmp = ((GstValidateMediaDescriptor *) writer)->filenode->streams; tmp;
|
||||
tmp = tmp->next) {
|
||||
if (g_strcmp0 (((StreamNode *) tmp->data)->id, stream_id) == 0) {
|
||||
if (g_strcmp0 ((
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*)
|
||||
tmp->data)->id, stream_id) == 0) {
|
||||
snode = tmp->data;
|
||||
|
||||
break;
|
||||
|
@ -357,7 +386,7 @@ _find_stream_id (GstPad * pad, GstEvent ** event,
|
|||
}
|
||||
|
||||
static inline GstElement *
|
||||
_get_parser (GstMediaDescriptorWriter * writer, GstPad * pad)
|
||||
_get_parser (GstValidateMediaDescriptorWriter * writer, GstPad * pad)
|
||||
{
|
||||
GList *parsers1, *parsers;
|
||||
GstElement *parser = NULL;
|
||||
|
@ -395,9 +424,10 @@ beach:
|
|||
|
||||
static void
|
||||
pad_added_cb (GstElement * decodebin, GstPad * pad,
|
||||
GstMediaDescriptorWriter * writer)
|
||||
GstValidateMediaDescriptorWriter * writer)
|
||||
{
|
||||
StreamNode *snode = NULL;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* snode = NULL;
|
||||
GstPad *sinkpad, *srcpad;
|
||||
|
||||
/* Try to plug a parser so we have as much info as possible
|
||||
|
@ -424,7 +454,9 @@ pad_added_cb (GstElement * decodebin, GstPad * pad,
|
|||
(GstPadStickyEventsForeachFunction) _find_stream_id, writer);
|
||||
|
||||
if (srcpad != pad) {
|
||||
snode = gst_media_descriptor_find_stream_node_by_pad ((GstMediaDescriptor *)
|
||||
snode =
|
||||
gst_validate_media_descriptor_find_stream_node_by_pad (
|
||||
(GstValidateMediaDescriptor *)
|
||||
writer, pad);
|
||||
if (snode) {
|
||||
gst_object_unref (pad);
|
||||
|
@ -439,7 +471,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad,
|
|||
|
||||
static gboolean
|
||||
bus_callback (GstBus * bus, GstMessage * message,
|
||||
GstMediaDescriptorWriter * writer)
|
||||
GstValidateMediaDescriptorWriter * writer)
|
||||
{
|
||||
GMainLoop *loop = writer->priv->loop;
|
||||
|
||||
|
@ -497,7 +529,7 @@ bus_callback (GstBus * bus, GstMessage * message,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_run_frame_analysis (GstMediaDescriptorWriter * writer,
|
||||
_run_frame_analysis (GstValidateMediaDescriptorWriter * writer,
|
||||
GstValidateRunner * runner, const gchar * uri)
|
||||
{
|
||||
GstBus *bus;
|
||||
|
@ -544,16 +576,16 @@ _run_frame_analysis (GstMediaDescriptorWriter * writer,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GstMediaDescriptorWriter *
|
||||
gst_media_descriptor_writer_new_discover (GstValidateRunner * runner,
|
||||
GstValidateMediaDescriptorWriter *
|
||||
gst_validate_media_descriptor_writer_new_discover (GstValidateRunner * runner,
|
||||
const gchar * uri, gboolean full, gboolean handle_g_logs, GError ** err)
|
||||
{
|
||||
GList *tmp, *streams = NULL;
|
||||
GstDiscovererInfo *info = NULL;
|
||||
GstDiscoverer *discoverer;
|
||||
GstDiscovererStreamInfo *streaminfo = NULL;
|
||||
GstMediaDescriptorWriter *writer = NULL;
|
||||
GstMediaDescriptor *media_descriptor;
|
||||
GstValidateMediaDescriptorWriter *writer = NULL;
|
||||
GstValidateMediaDescriptor *media_descriptor;
|
||||
const GstTagList *tags;
|
||||
GError *error = NULL;
|
||||
|
||||
|
@ -607,7 +639,7 @@ gst_media_descriptor_writer_new_discover (GstValidateRunner * runner,
|
|||
|
||||
if (streaminfo) {
|
||||
writer =
|
||||
gst_media_descriptor_writer_new (runner,
|
||||
gst_validate_media_descriptor_writer_new (runner,
|
||||
gst_discoverer_info_get_uri (info),
|
||||
gst_discoverer_info_get_duration (info),
|
||||
gst_discoverer_info_get_seekable (info));
|
||||
|
@ -617,19 +649,19 @@ gst_media_descriptor_writer_new_discover (GstValidateRunner * runner,
|
|||
|
||||
tags = gst_discoverer_info_get_tags (info);
|
||||
if (tags)
|
||||
gst_media_descriptor_writer_add_taglist (writer, tags);
|
||||
gst_validate_media_descriptor_writer_add_taglist (writer, tags);
|
||||
|
||||
if (GST_IS_DISCOVERER_CONTAINER_INFO (streaminfo)) {
|
||||
((GstMediaDescriptor *) writer)->filenode->caps =
|
||||
((GstValidateMediaDescriptor *) writer)->filenode->caps =
|
||||
gst_discoverer_stream_info_get_caps (GST_DISCOVERER_STREAM_INFO
|
||||
(streaminfo));
|
||||
|
||||
streams = gst_discoverer_info_get_stream_list (info);
|
||||
for (tmp = streams; tmp; tmp = tmp->next) {
|
||||
gst_media_descriptor_writer_add_stream (writer, tmp->data);
|
||||
gst_validate_media_descriptor_writer_add_stream (writer, tmp->data);
|
||||
}
|
||||
} else {
|
||||
gst_media_descriptor_writer_add_stream (writer, streaminfo);
|
||||
gst_validate_media_descriptor_writer_add_stream (writer, streaminfo);
|
||||
}
|
||||
} else {
|
||||
GST_VALIDATE_REPORT (writer, FILE_NO_STREAM_INFO,
|
||||
|
@ -637,7 +669,7 @@ gst_media_descriptor_writer_new_discover (GstValidateRunner * runner,
|
|||
goto out;
|
||||
}
|
||||
|
||||
media_descriptor = (GstMediaDescriptor *) writer;
|
||||
media_descriptor = (GstValidateMediaDescriptor *) writer;
|
||||
if (streams == NULL && media_descriptor->filenode->caps)
|
||||
writer->priv->raw_caps = gst_caps_copy (media_descriptor->filenode->caps);
|
||||
gst_discoverer_stream_info_list_free (streams);
|
||||
|
@ -656,22 +688,28 @@ out:
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_writer_add_tags (GstMediaDescriptorWriter
|
||||
gst_validate_media_descriptor_writer_add_tags (GstValidateMediaDescriptorWriter
|
||||
* writer, const gchar * stream_id, const GstTagList * taglist)
|
||||
{
|
||||
TagsNode *tagsnode;
|
||||
TagNode *tagnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode
|
||||
* tagsnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaTagNode *tagnode;
|
||||
GList *tmp, *tmptag;
|
||||
|
||||
gchar *str_str = NULL;
|
||||
StreamNode *snode = NULL;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* snode = NULL;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_WRITER (writer), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) writer)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER (writer),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) writer)->filenode,
|
||||
FALSE);
|
||||
|
||||
for (tmp = ((GstMediaDescriptor *) writer)->filenode->streams; tmp;
|
||||
for (tmp = ((GstValidateMediaDescriptor *) writer)->filenode->streams; tmp;
|
||||
tmp = tmp->next) {
|
||||
if (g_strcmp0 (((StreamNode *) tmp->data)->id, stream_id) == 0) {
|
||||
if (g_strcmp0 ((
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*) tmp->data)->id, stream_id) == 0) {
|
||||
snode = tmp->data;
|
||||
|
||||
break;
|
||||
|
@ -685,7 +723,9 @@ gst_media_descriptor_writer_add_tags (GstMediaDescriptorWriter
|
|||
}
|
||||
|
||||
if (snode->tags == NULL) {
|
||||
tagsnode = g_slice_new0 (TagsNode);
|
||||
tagsnode =
|
||||
g_slice_new0
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode);
|
||||
tagsnode->str_open = g_markup_printf_escaped ("<tags>");
|
||||
tagsnode->str_close = g_markup_printf_escaped ("</tags>");
|
||||
snode->tags = tagsnode;
|
||||
|
@ -693,7 +733,9 @@ gst_media_descriptor_writer_add_tags (GstMediaDescriptorWriter
|
|||
tagsnode = snode->tags;
|
||||
|
||||
for (tmptag = tagsnode->tags; tmptag; tmptag = tmptag->next) {
|
||||
if (tag_node_compare ((TagNode *) tmptag->data, taglist)) {
|
||||
if (gst_validate_gst_validate_gst_validate_gst_validate_tag_node_compare (
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaTagNode *)
|
||||
tmptag->data, taglist)) {
|
||||
GST_DEBUG ("Tag already in... not adding again %" GST_PTR_FORMAT,
|
||||
taglist);
|
||||
return TRUE;
|
||||
|
@ -701,7 +743,8 @@ gst_media_descriptor_writer_add_tags (GstMediaDescriptorWriter
|
|||
}
|
||||
}
|
||||
|
||||
tagnode = g_slice_new0 (TagNode);
|
||||
tagnode =
|
||||
g_slice_new0 (GstValidateMediaGstValidateMediaGstValidateMediaTagNode);
|
||||
tagnode->taglist = gst_tag_list_copy (taglist);
|
||||
str_str = gst_tag_list_to_string (tagnode->taglist);
|
||||
tagnode->str_open =
|
||||
|
@ -714,29 +757,37 @@ gst_media_descriptor_writer_add_tags (GstMediaDescriptorWriter
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_writer_add_pad (GstMediaDescriptorWriter *
|
||||
gst_validate_media_descriptor_writer_add_pad (GstValidateMediaDescriptorWriter *
|
||||
writer, GstPad * pad)
|
||||
{
|
||||
GList *tmp;
|
||||
gboolean ret = FALSE;
|
||||
GstCaps *caps;
|
||||
gchar *capsstr = NULL, *padname = NULL;
|
||||
StreamNode *snode = NULL;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* snode = NULL;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_WRITER (writer), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) writer)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER (writer),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) writer)->filenode,
|
||||
FALSE);
|
||||
|
||||
caps = gst_pad_get_current_caps (pad);
|
||||
for (tmp = ((GstMediaDescriptor *) writer)->filenode->streams; tmp;
|
||||
for (tmp = ((GstValidateMediaDescriptor *) writer)->filenode->streams; tmp;
|
||||
tmp = tmp->next) {
|
||||
StreamNode *streamnode = (StreamNode *) tmp->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode =
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*) tmp->data;
|
||||
|
||||
if (streamnode->pad == pad) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
snode = g_slice_new0 (StreamNode);
|
||||
snode =
|
||||
g_slice_new0
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode);
|
||||
snode->frames = NULL;
|
||||
snode->cframe = NULL;
|
||||
|
||||
|
@ -751,9 +802,9 @@ gst_media_descriptor_writer_add_pad (GstMediaDescriptorWriter *
|
|||
|
||||
snode->str_close = g_markup_printf_escaped ("</stream>");
|
||||
|
||||
((GstMediaDescriptor *) writer)->filenode->streams =
|
||||
g_list_prepend (((GstMediaDescriptor *) writer)->filenode->streams,
|
||||
snode);
|
||||
((GstValidateMediaDescriptor *) writer)->filenode->streams =
|
||||
g_list_prepend (((GstValidateMediaDescriptor *) writer)->
|
||||
filenode->streams, snode);
|
||||
|
||||
done:
|
||||
if (caps != NULL)
|
||||
|
@ -765,26 +816,32 @@ done:
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_writer_add_taglist (GstMediaDescriptorWriter * writer,
|
||||
const GstTagList * taglist)
|
||||
{
|
||||
gst_validate_media_descriptor_writer_add_taglist
|
||||
(GstValidateMediaDescriptorWriter * writer, const GstTagList * taglist) {
|
||||
gchar *str_str = NULL;
|
||||
TagsNode *tagsnode;
|
||||
TagNode *tagnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode
|
||||
* tagsnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaTagNode *tagnode;
|
||||
GList *tmptag;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_WRITER (writer), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) writer)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER (writer),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) writer)->filenode,
|
||||
FALSE);
|
||||
|
||||
if (((GstMediaDescriptor *) writer)->filenode->tags == NULL) {
|
||||
tagsnode = g_slice_new0 (TagsNode);
|
||||
if (((GstValidateMediaDescriptor *) writer)->filenode->tags == NULL) {
|
||||
tagsnode =
|
||||
g_slice_new0
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode);
|
||||
tagsnode->str_open = g_markup_printf_escaped ("<tags>");
|
||||
tagsnode->str_close = g_markup_printf_escaped ("</tags>");
|
||||
((GstMediaDescriptor *) writer)->filenode->tags = tagsnode;
|
||||
((GstValidateMediaDescriptor *) writer)->filenode->tags = tagsnode;
|
||||
} else {
|
||||
tagsnode = ((GstMediaDescriptor *) writer)->filenode->tags;
|
||||
tagsnode = ((GstValidateMediaDescriptor *) writer)->filenode->tags;
|
||||
for (tmptag = tagsnode->tags; tmptag; tmptag = tmptag->next) {
|
||||
if (tag_node_compare ((TagNode *) tmptag->data, taglist)) {
|
||||
if (gst_validate_gst_validate_gst_validate_gst_validate_tag_node_compare (
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaTagNode *)
|
||||
tmptag->data, taglist)) {
|
||||
GST_DEBUG ("Tag already in... not adding again %" GST_PTR_FORMAT,
|
||||
taglist);
|
||||
return TRUE;
|
||||
|
@ -792,7 +849,8 @@ gst_media_descriptor_writer_add_taglist (GstMediaDescriptorWriter * writer,
|
|||
}
|
||||
}
|
||||
|
||||
tagnode = g_slice_new0 (TagNode);
|
||||
tagnode =
|
||||
g_slice_new0 (GstValidateMediaGstValidateMediaGstValidateMediaTagNode);
|
||||
tagnode->taglist = gst_tag_list_copy (taglist);
|
||||
str_str = gst_tag_list_to_string (tagnode->taglist);
|
||||
tagnode->str_open =
|
||||
|
@ -805,30 +863,35 @@ gst_media_descriptor_writer_add_taglist (GstMediaDescriptorWriter * writer,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_writer_add_frame (GstMediaDescriptorWriter
|
||||
gst_validate_media_descriptor_writer_add_frame (GstValidateMediaDescriptorWriter
|
||||
* writer, GstPad * pad, GstBuffer * buf)
|
||||
{
|
||||
StreamNode *streamnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode;
|
||||
GstMapInfo map;
|
||||
gchar *checksum;
|
||||
guint id;
|
||||
FrameNode *fnode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaFrameNode *fnode;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_WRITER (writer), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) writer)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER (writer),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) writer)->filenode,
|
||||
FALSE);
|
||||
|
||||
((GstMediaDescriptor *) writer)->filenode->frame_detection = TRUE;
|
||||
GST_MEDIA_DESCRIPTOR_LOCK (writer);
|
||||
((GstValidateMediaDescriptor *) writer)->filenode->frame_detection = TRUE;
|
||||
GST_VALIDATE_MEDIA_DESCRIPTOR_LOCK (writer);
|
||||
streamnode =
|
||||
gst_media_descriptor_find_stream_node_by_pad ((GstMediaDescriptor *)
|
||||
gst_validate_media_descriptor_find_stream_node_by_pad (
|
||||
(GstValidateMediaDescriptor *)
|
||||
writer, pad);
|
||||
if (streamnode == NULL) {
|
||||
GST_MEDIA_DESCRIPTOR_UNLOCK (writer);
|
||||
GST_VALIDATE_MEDIA_DESCRIPTOR_UNLOCK (writer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
id = g_list_length (streamnode->frames);
|
||||
fnode = g_slice_new0 (FrameNode);
|
||||
fnode =
|
||||
g_slice_new0 (GstValidateMediaGstValidateMediaGstValidateMediaFrameNode);
|
||||
|
||||
g_assert (gst_buffer_map (buf, &map, GST_MAP_READ));
|
||||
checksum = g_compute_checksum_for_data (G_CHECKSUM_MD5,
|
||||
|
@ -862,20 +925,22 @@ gst_media_descriptor_writer_add_frame (GstMediaDescriptorWriter
|
|||
streamnode->frames = g_list_append (streamnode->frames, fnode);
|
||||
|
||||
g_free (checksum);
|
||||
GST_MEDIA_DESCRIPTOR_UNLOCK (writer);
|
||||
GST_VALIDATE_MEDIA_DESCRIPTOR_UNLOCK (writer);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_writer_write (GstMediaDescriptorWriter *
|
||||
gst_validate_media_descriptor_writer_write (GstValidateMediaDescriptorWriter *
|
||||
writer, const gchar * filename)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gchar *serialized;
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_WRITER (writer), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) writer)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER (writer),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) writer)->filenode,
|
||||
FALSE);
|
||||
|
||||
serialized = serialize_filenode (writer);
|
||||
|
||||
|
@ -890,10 +955,13 @@ gst_media_descriptor_writer_write (GstMediaDescriptorWriter *
|
|||
}
|
||||
|
||||
gchar *
|
||||
gst_media_descriptor_writer_serialize (GstMediaDescriptorWriter * writer)
|
||||
gst_validate_media_descriptor_writer_serialize (GstValidateMediaDescriptorWriter
|
||||
* writer)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR_WRITER (writer), FALSE);
|
||||
g_return_val_if_fail (((GstMediaDescriptor *) writer)->filenode, FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER (writer),
|
||||
FALSE);
|
||||
g_return_val_if_fail (((GstValidateMediaDescriptor *) writer)->filenode,
|
||||
FALSE);
|
||||
|
||||
return serialize_filenode (writer);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef GST_MEDIA_DESCRIPTOR_WRITER_h
|
||||
#define GST_MEDIA_DESCRIPTOR_WRITER_h
|
||||
#ifndef GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_h
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_h
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
@ -30,63 +30,63 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType gst_media_descriptor_writer_get_type (void);
|
||||
GType gst_validate_media_descriptor_writer_get_type (void);
|
||||
|
||||
#define GST_TYPE_MEDIA_DESCRIPTOR_WRITER (gst_media_descriptor_writer_get_type ())
|
||||
#define GST_MEDIA_DESCRIPTOR_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MEDIA_DESCRIPTOR_WRITER, GstMediaDescriptorWriter))
|
||||
#define GST_MEDIA_DESCRIPTOR_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MEDIA_DESCRIPTOR_WRITER, GstMediaDescriptorWriterClass))
|
||||
#define GST_IS_MEDIA_DESCRIPTOR_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MEDIA_DESCRIPTOR_WRITER))
|
||||
#define GST_IS_MEDIA_DESCRIPTOR_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MEDIA_DESCRIPTOR_WRITER))
|
||||
#define GST_MEDIA_DESCRIPTOR_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MEDIA_DESCRIPTOR_WRITER, GstMediaDescriptorWriterClass))
|
||||
#define GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER (gst_validate_media_descriptor_writer_get_type ())
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER, GstValidateMediaDescriptorWriter))
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER, GstValidateMediaDescriptorWriterClass))
|
||||
#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER))
|
||||
#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER))
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER, GstValidateMediaDescriptorWriterClass))
|
||||
|
||||
typedef struct _GstMediaDescriptorWriterPrivate GstMediaDescriptorWriterPrivate;
|
||||
typedef struct _GstValidateMediaDescriptorWriterPrivate GstValidateMediaDescriptorWriterPrivate;
|
||||
|
||||
|
||||
typedef struct {
|
||||
GstMediaDescriptor parent;
|
||||
GstValidateMediaDescriptor parent;
|
||||
|
||||
GstMediaDescriptorWriterPrivate *priv;
|
||||
GstValidateMediaDescriptorWriterPrivate *priv;
|
||||
|
||||
} GstMediaDescriptorWriter;
|
||||
} GstValidateMediaDescriptorWriter;
|
||||
|
||||
typedef struct {
|
||||
|
||||
GstMediaDescriptorClass parent;
|
||||
GstValidateMediaDescriptorClass parent;
|
||||
|
||||
} GstMediaDescriptorWriterClass;
|
||||
} GstValidateMediaDescriptorWriterClass;
|
||||
|
||||
GstMediaDescriptorWriter * gst_media_descriptor_writer_new_discover (GstValidateRunner *runner,
|
||||
GstValidateMediaDescriptorWriter * gst_validate_media_descriptor_writer_new_discover (GstValidateRunner *runner,
|
||||
const gchar *uri,
|
||||
gboolean full,
|
||||
gboolean handle_g_logs,
|
||||
GError **err);
|
||||
|
||||
GstMediaDescriptorWriter * gst_media_descriptor_writer_new (GstValidateRunner *runner,
|
||||
GstValidateMediaDescriptorWriter * gst_validate_media_descriptor_writer_new (GstValidateRunner *runner,
|
||||
const gchar *location,
|
||||
GstClockTime duration,
|
||||
gboolean seekable);
|
||||
|
||||
gchar * gst_media_descriptor_writer_get_xml_path (GstMediaDescriptorWriter *writer);
|
||||
gchar * gst_validate_media_descriptor_writer_get_xml_path (GstValidateMediaDescriptorWriter *writer);
|
||||
|
||||
gboolean gst_media_descriptor_writer_detects_frames (GstMediaDescriptorWriter *writer);
|
||||
GstClockTime gst_media_descriptor_writer_get_duration (GstMediaDescriptorWriter *writer);
|
||||
gboolean gst_media_descriptor_writer_get_seekable (GstMediaDescriptorWriter * writer);
|
||||
gboolean gst_validate_media_descriptor_writer_detects_frames (GstValidateMediaDescriptorWriter *writer);
|
||||
GstClockTime gst_validate_media_descriptor_writer_get_duration (GstValidateMediaDescriptorWriter *writer);
|
||||
gboolean gst_validate_media_descriptor_writer_get_seekable (GstValidateMediaDescriptorWriter * writer);
|
||||
|
||||
gboolean gst_media_descriptor_writer_add_pad (GstMediaDescriptorWriter *writer,
|
||||
gboolean gst_validate_media_descriptor_writer_add_pad (GstValidateMediaDescriptorWriter *writer,
|
||||
GstPad *pad);
|
||||
gboolean gst_media_descriptor_writer_add_taglist (GstMediaDescriptorWriter *writer,
|
||||
gboolean gst_validate_media_descriptor_writer_add_taglist (GstValidateMediaDescriptorWriter *writer,
|
||||
const GstTagList *taglist);
|
||||
gboolean gst_media_descriptor_writer_add_frame (GstMediaDescriptorWriter *writer,
|
||||
gboolean gst_validate_media_descriptor_writer_add_frame (GstValidateMediaDescriptorWriter *writer,
|
||||
GstPad *pad,
|
||||
GstBuffer *buf);
|
||||
gboolean gst_media_descriptor_writer_add_tags (GstMediaDescriptorWriter *writer,
|
||||
gboolean gst_validate_media_descriptor_writer_add_tags (GstValidateMediaDescriptorWriter *writer,
|
||||
const gchar *stream_id,
|
||||
const GstTagList *taglist);
|
||||
gboolean gst_media_descriptor_writer_write (GstMediaDescriptorWriter * writer,
|
||||
gboolean gst_validate_media_descriptor_writer_write (GstValidateMediaDescriptorWriter * writer,
|
||||
const gchar * filename);
|
||||
gchar * gst_media_descriptor_writer_serialize (GstMediaDescriptorWriter *writer);
|
||||
gchar * gst_validate_media_descriptor_writer_serialize (GstValidateMediaDescriptorWriter *writer);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_MEDIA_DESCRIPTOR_WRITER_h */
|
||||
#endif /* GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_h */
|
||||
|
|
|
@ -23,34 +23,41 @@
|
|||
#include <string.h>
|
||||
#include "media-descriptor.h"
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstMediaDescriptor, gst_media_descriptor,
|
||||
G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, NULL));
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstValidateMediaDescriptor,
|
||||
gst_validate_media_descriptor, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, NULL));
|
||||
|
||||
#define GST_MEDIA_DESCRIPTOR_GET_PRIVATE(o)\
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_MEDIA_DESCRIPTOR, GstMediaDescriptorPrivate))
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_GET_PRIVATE(o)\
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR, GstValidateMediaDescriptorPrivate))
|
||||
|
||||
static inline void
|
||||
free_tagnode (TagNode * tagnode)
|
||||
free_tagnode (GstValidateMediaGstValidateMediaGstValidateMediaTagNode * tagnode)
|
||||
{
|
||||
g_free (tagnode->str_open);
|
||||
g_free (tagnode->str_close);
|
||||
if (tagnode->taglist)
|
||||
gst_tag_list_unref (tagnode->taglist);
|
||||
|
||||
g_slice_free (TagNode, tagnode);
|
||||
g_slice_free (GstValidateMediaGstValidateMediaGstValidateMediaTagNode,
|
||||
tagnode);
|
||||
}
|
||||
|
||||
static inline void
|
||||
free_tagsnode (TagsNode * tagsnode)
|
||||
free_tagsnode
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode *
|
||||
tagsnode)
|
||||
{
|
||||
g_free (tagsnode->str_open);
|
||||
g_free (tagsnode->str_close);
|
||||
g_list_free_full (tagsnode->tags, (GDestroyNotify) free_tagnode);
|
||||
g_slice_free (TagsNode, tagsnode);
|
||||
g_slice_free
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode,
|
||||
tagsnode);
|
||||
}
|
||||
|
||||
static inline void
|
||||
free_framenode (FrameNode * framenode)
|
||||
free_framenode (GstValidateMediaGstValidateMediaGstValidateMediaFrameNode *
|
||||
framenode)
|
||||
{
|
||||
g_free (framenode->str_open);
|
||||
g_free (framenode->str_close);
|
||||
|
@ -58,11 +65,14 @@ free_framenode (FrameNode * framenode)
|
|||
if (framenode->buf)
|
||||
gst_buffer_unref (framenode->buf);
|
||||
|
||||
g_slice_free (FrameNode, framenode);
|
||||
g_slice_free (GstValidateMediaGstValidateMediaGstValidateMediaFrameNode,
|
||||
framenode);
|
||||
}
|
||||
|
||||
static inline void
|
||||
free_streamnode (StreamNode * streamnode)
|
||||
free_streamnode
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode)
|
||||
{
|
||||
if (streamnode->caps)
|
||||
gst_caps_unref (streamnode->caps);
|
||||
|
@ -83,11 +93,14 @@ free_streamnode (StreamNode * streamnode)
|
|||
|
||||
g_free (streamnode->str_open);
|
||||
g_free (streamnode->str_close);
|
||||
g_slice_free (StreamNode, streamnode);
|
||||
g_slice_free
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode,
|
||||
streamnode);
|
||||
}
|
||||
|
||||
void
|
||||
free_filenode (FileNode * filenode)
|
||||
void gst_validate_filenode_free
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode *
|
||||
filenode)
|
||||
{
|
||||
g_list_free_full (filenode->streams, (GDestroyNotify) free_streamnode);
|
||||
if (filenode->tags)
|
||||
|
@ -102,11 +115,15 @@ free_filenode (FileNode * filenode)
|
|||
g_free (filenode->str_open);
|
||||
g_free (filenode->str_close);
|
||||
|
||||
g_slice_free (FileNode, filenode);
|
||||
g_slice_free
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode,
|
||||
filenode);
|
||||
}
|
||||
|
||||
gboolean
|
||||
tag_node_compare (TagNode * tnode, const GstTagList * tlist)
|
||||
gst_validate_gst_validate_gst_validate_gst_validate_tag_node_compare
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaTagNode * tnode,
|
||||
const GstTagList * tlist)
|
||||
{
|
||||
if (gst_structure_is_equal (GST_STRUCTURE (tlist),
|
||||
GST_STRUCTURE (tnode->taglist)) == FALSE) {
|
||||
|
@ -118,7 +135,7 @@ tag_node_compare (TagNode * tnode, const GstTagList * tlist)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
struct _GstMediaDescriptorPrivate
|
||||
struct _GstValidateMediaDescriptorPrivate
|
||||
{
|
||||
gpointer dummy;
|
||||
};
|
||||
|
@ -132,25 +149,28 @@ enum
|
|||
|
||||
|
||||
static void
|
||||
gst_media_descriptor_dispose (GstMediaDescriptor * self)
|
||||
gst_validate_media_descriptor_dispose (GstValidateMediaDescriptor * self)
|
||||
{
|
||||
G_OBJECT_CLASS (gst_media_descriptor_parent_class)->dispose (G_OBJECT (self));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_media_descriptor_finalize (GstMediaDescriptor * self)
|
||||
{
|
||||
if (self->filenode)
|
||||
free_filenode (self->filenode);
|
||||
|
||||
G_OBJECT_CLASS (gst_media_descriptor_parent_class)->finalize (G_OBJECT
|
||||
G_OBJECT_CLASS (gst_validate_media_descriptor_parent_class)->dispose (G_OBJECT
|
||||
(self));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_media_descriptor_init (GstMediaDescriptor * self)
|
||||
gst_validate_media_descriptor_finalize (GstValidateMediaDescriptor * self)
|
||||
{
|
||||
self->filenode = g_slice_new0 (FileNode);
|
||||
if (self->filenode)
|
||||
gst_validate_filenode_free (self->filenode);
|
||||
|
||||
G_OBJECT_CLASS (gst_validate_media_descriptor_parent_class)->finalize
|
||||
(G_OBJECT (self));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_validate_media_descriptor_init (GstValidateMediaDescriptor * self)
|
||||
{
|
||||
self->filenode =
|
||||
g_slice_new0
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -186,15 +206,17 @@ _get_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_media_descriptor_class_init (GstMediaDescriptorClass * self_class)
|
||||
gst_validate_media_descriptor_class_init (GstValidateMediaDescriptorClass *
|
||||
self_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (self_class);
|
||||
|
||||
g_type_class_add_private (self_class, sizeof (GstMediaDescriptorPrivate));
|
||||
g_type_class_add_private (self_class,
|
||||
sizeof (GstValidateMediaDescriptorPrivate));
|
||||
object_class->dispose =
|
||||
(void (*)(GObject * object)) gst_media_descriptor_dispose;
|
||||
(void (*)(GObject * object)) gst_validate_media_descriptor_dispose;
|
||||
object_class->finalize =
|
||||
(void (*)(GObject * object)) gst_media_descriptor_finalize;
|
||||
(void (*)(GObject * object)) gst_validate_media_descriptor_finalize;
|
||||
|
||||
object_class->get_property = _get_property;
|
||||
object_class->set_property = _set_property;
|
||||
|
@ -207,13 +229,17 @@ gst_media_descriptor_class_init (GstMediaDescriptorClass * self_class)
|
|||
}
|
||||
|
||||
static gint
|
||||
compare_tags (GstMediaDescriptor * ref, StreamNode * rstream,
|
||||
StreamNode * cstream)
|
||||
compare_tags (GstValidateMediaDescriptor * ref,
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode *
|
||||
rstream,
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode *
|
||||
cstream)
|
||||
{
|
||||
gboolean found;
|
||||
TagNode *rtag, *ctag;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaTagNode *rtag, *ctag;
|
||||
GList *rtag_list, *ctag_list;
|
||||
TagsNode *rtags, *ctags;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode
|
||||
* rtags, *ctags;
|
||||
|
||||
rtags = rstream->tags;
|
||||
ctags = cstream->tags;
|
||||
|
@ -225,7 +251,9 @@ compare_tags (GstMediaDescriptor * ref, StreamNode * rstream,
|
|||
|
||||
for (taglist = ctags->tags; taglist; taglist = taglist->next) {
|
||||
gchar *stags =
|
||||
gst_tag_list_to_string (((TagNode *) taglist->data)->taglist);
|
||||
gst_tag_list_to_string ((
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaTagNode *)
|
||||
taglist->data)->taglist);
|
||||
|
||||
g_string_append_printf (all_tags, "%s\n", stags);
|
||||
g_free (stags);
|
||||
|
@ -244,7 +272,9 @@ compare_tags (GstMediaDescriptor * ref, StreamNode * rstream,
|
|||
|
||||
for (taglist = rtags->tags; taglist; taglist = taglist->next) {
|
||||
gchar *stags =
|
||||
gst_tag_list_to_string (((TagNode *) taglist->data)->taglist);
|
||||
gst_tag_list_to_string ((
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaTagNode *)
|
||||
taglist->data)->taglist);
|
||||
|
||||
g_string_append_printf (all_tags, "%s\n", stags);
|
||||
g_free (stags);
|
||||
|
@ -338,8 +368,10 @@ stream_id_is_equal (const gchar * uri, const gchar * rid, const gchar * cid)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
compare_frames (GstMediaDescriptor * ref, StreamNode * rstream,
|
||||
FrameNode * rframe, FrameNode * cframe)
|
||||
compare_frames (GstValidateMediaDescriptor * ref,
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode *
|
||||
rstream, GstValidateMediaGstValidateMediaGstValidateMediaFrameNode * rframe,
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaFrameNode * cframe)
|
||||
{
|
||||
if (rframe->id != cframe->id) {
|
||||
GST_VALIDATE_REPORT (ref, FILE_FRAMES_INCORRECT,
|
||||
|
@ -368,8 +400,11 @@ compare_frames (GstMediaDescriptor * ref, StreamNode * rstream,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
compare_frames_list (GstMediaDescriptor * ref, StreamNode * rstream,
|
||||
StreamNode * cstream)
|
||||
compare_frames_list (GstValidateMediaDescriptor * ref,
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode *
|
||||
rstream,
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode *
|
||||
cstream)
|
||||
{
|
||||
GList *rframes, *cframes;
|
||||
|
||||
|
@ -382,7 +417,7 @@ compare_frames_list (GstMediaDescriptor * ref, StreamNode * rstream,
|
|||
|
||||
for (rframes = rstream->frames, cframes = cstream->frames; rframes;
|
||||
rframes = g_list_next (rframes), cframes = g_list_next (cframes)) {
|
||||
FrameNode *rframe, *cframe;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaFrameNode *rframe, *cframe;
|
||||
|
||||
if (cframes == NULL) {
|
||||
/* The list was checked to be of the same size */
|
||||
|
@ -403,8 +438,11 @@ compare_frames_list (GstMediaDescriptor * ref, StreamNode * rstream,
|
|||
|
||||
/* Return -1 if not found 1 if OK 0 if an error occured */
|
||||
static gint
|
||||
compare_streams (GstMediaDescriptor * ref, StreamNode * rstream,
|
||||
StreamNode * cstream)
|
||||
compare_streams (GstValidateMediaDescriptor * ref,
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode *
|
||||
rstream,
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode *
|
||||
cstream)
|
||||
{
|
||||
if (stream_id_is_equal (ref->filenode->uri, rstream->id, cstream->id)) {
|
||||
if (!gst_caps_is_equal (rstream->caps, cstream->caps)) {
|
||||
|
@ -431,11 +469,12 @@ compare_streams (GstMediaDescriptor * ref, StreamNode * rstream,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptors_compare (GstMediaDescriptor * ref,
|
||||
GstMediaDescriptor * compared)
|
||||
gst_validate_media_descriptors_compare (GstValidateMediaDescriptor * ref,
|
||||
GstValidateMediaDescriptor * compared)
|
||||
{
|
||||
GList *rstream_list;
|
||||
FileNode *rfilenode = ref->filenode, *cfilenode = compared->filenode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode
|
||||
* rfilenode = ref->filenode, *cfilenode = compared->filenode;
|
||||
|
||||
if (rfilenode->duration != cfilenode->duration) {
|
||||
GST_VALIDATE_REPORT (ref, FILE_DURATION_INCORRECT,
|
||||
|
@ -479,7 +518,7 @@ gst_media_descriptors_compare (GstMediaDescriptor * ref,
|
|||
if (sfound == -1) {
|
||||
GST_VALIDATE_REPORT (ref, FILE_PROFILE_INCORRECT,
|
||||
"Could not find stream %s in the compared descriptor",
|
||||
((StreamNode *) rstream_list->data)->id);
|
||||
((GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode *) rstream_list->data)->id);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -489,28 +528,31 @@ gst_media_descriptors_compare (GstMediaDescriptor * ref,
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_detects_frames (GstMediaDescriptor * self)
|
||||
gst_validate_media_descriptor_detects_frames (GstValidateMediaDescriptor * self)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (self->filenode, FALSE);
|
||||
|
||||
return self->filenode->frame_detection;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_get_buffers (GstMediaDescriptor * self,
|
||||
gst_validate_media_descriptor_get_buffers (GstValidateMediaDescriptor * self,
|
||||
GstPad * pad, GCompareFunc compare_func, GList ** bufs)
|
||||
{
|
||||
GList *tmpstream, *tmpframe;
|
||||
gboolean check = (pad == NULL), ret = FALSE;
|
||||
GstCaps *pad_caps = gst_pad_get_current_caps (pad);
|
||||
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (self->filenode, FALSE);
|
||||
|
||||
for (tmpstream = self->filenode->streams;
|
||||
tmpstream; tmpstream = tmpstream->next) {
|
||||
StreamNode *streamnode = (StreamNode *) tmpstream->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode =
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*) tmpstream->data;
|
||||
|
||||
if (pad && streamnode->pad == pad)
|
||||
check = TRUE;
|
||||
|
@ -525,12 +567,15 @@ gst_media_descriptor_get_buffers (GstMediaDescriptor * self,
|
|||
if (compare_func)
|
||||
*bufs =
|
||||
g_list_insert_sorted (*bufs,
|
||||
gst_buffer_ref (((FrameNode *) tmpframe->data)->buf),
|
||||
compare_func);
|
||||
gst_buffer_ref ((
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaFrameNode
|
||||
*) tmpframe->data)->buf), compare_func);
|
||||
else
|
||||
*bufs =
|
||||
g_list_prepend (*bufs,
|
||||
gst_buffer_ref (((FrameNode *) tmpframe->data)->buf));
|
||||
gst_buffer_ref ((
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaFrameNode
|
||||
*) tmpframe->data)->buf));
|
||||
}
|
||||
|
||||
if (pad != NULL)
|
||||
|
@ -549,13 +594,16 @@ done:
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_has_frame_info (GstMediaDescriptor * self)
|
||||
gst_validate_media_descriptor_has_frame_info (GstValidateMediaDescriptor * self)
|
||||
{
|
||||
GList *tmpstream;
|
||||
|
||||
for (tmpstream = self->filenode->streams;
|
||||
tmpstream; tmpstream = tmpstream->next) {
|
||||
StreamNode *streamnode = (StreamNode *) tmpstream->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* streamnode =
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*) tmpstream->data;
|
||||
|
||||
if (g_list_length (streamnode->frames))
|
||||
return TRUE;
|
||||
|
@ -565,30 +613,33 @@ gst_media_descriptor_has_frame_info (GstMediaDescriptor * self)
|
|||
}
|
||||
|
||||
GstClockTime
|
||||
gst_media_descriptor_get_duration (GstMediaDescriptor * self)
|
||||
gst_validate_media_descriptor_get_duration (GstValidateMediaDescriptor * self)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (self->filenode, FALSE);
|
||||
|
||||
return self->filenode->duration;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_media_descriptor_get_seekable (GstMediaDescriptor * self)
|
||||
gst_validate_media_descriptor_get_seekable (GstValidateMediaDescriptor * self)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (GST_IS_VALIDATE_MEDIA_DESCRIPTOR (self), FALSE);
|
||||
g_return_val_if_fail (self->filenode, FALSE);
|
||||
|
||||
return self->filenode->seekable;
|
||||
}
|
||||
|
||||
GList *
|
||||
gst_media_descriptor_get_pads (GstMediaDescriptor * self)
|
||||
gst_validate_media_descriptor_get_pads (GstValidateMediaDescriptor * self)
|
||||
{
|
||||
GList *ret = NULL, *tmp;
|
||||
|
||||
for (tmp = self->filenode->streams; tmp; tmp = tmp->next) {
|
||||
StreamNode *snode = (StreamNode *) tmp->data;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
* snode =
|
||||
(GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode
|
||||
*) tmp->data;
|
||||
ret = g_list_append (ret, gst_pad_new (snode->padname, GST_PAD_UNKNOWN));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,34 +19,32 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_MEDIA_DESCRIPTOR_H__
|
||||
#define __GST_MEDIA_DESCRIPTOR_H__
|
||||
#ifndef __GST_VALIDATE_MEDIA_DESCRIPTOR_H__
|
||||
#define __GST_VALIDATE_MEDIA_DESCRIPTOR_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <gst/gst.h>
|
||||
#include "gst-validate-report.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct
|
||||
G_BEGIN_DECLS typedef struct
|
||||
{
|
||||
/* Children */
|
||||
/* TagNode */
|
||||
/* GstValidateMediaGstValidateMediaGstValidateMediaTagNode */
|
||||
GList *tags;
|
||||
|
||||
gchar *str_open;
|
||||
gchar *str_close;
|
||||
} TagsNode;
|
||||
} GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode;
|
||||
|
||||
/* Parsing structures */
|
||||
typedef struct
|
||||
{
|
||||
/* Children */
|
||||
/* StreamNode */
|
||||
/* GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode */
|
||||
GList *streams;
|
||||
/* TagsNode */
|
||||
TagsNode *tags;
|
||||
/* GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode */
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode *tags;
|
||||
|
||||
/* attributes */
|
||||
guint64 id;
|
||||
|
@ -59,7 +57,7 @@ typedef struct
|
|||
|
||||
gchar *str_open;
|
||||
gchar *str_close;
|
||||
} FileNode;
|
||||
} GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -71,16 +69,16 @@ typedef struct
|
|||
|
||||
gchar *str_open;
|
||||
gchar *str_close;
|
||||
} TagNode;
|
||||
} GstValidateMediaGstValidateMediaGstValidateMediaTagNode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Children */
|
||||
/* FrameNode */
|
||||
/* GstValidateMediaGstValidateMediaGstValidateMediaFrameNode */
|
||||
GList *frames;
|
||||
|
||||
/* TagsNode */
|
||||
TagsNode *tags;
|
||||
/* GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode */
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaTagsNode *tags;
|
||||
|
||||
/* Attributes */
|
||||
GstCaps *caps;
|
||||
|
@ -94,7 +92,7 @@ typedef struct
|
|||
|
||||
gchar *str_open;
|
||||
gchar *str_close;
|
||||
} StreamNode;
|
||||
} GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaStreamNode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -112,50 +110,61 @@ typedef struct
|
|||
gchar *checksum;
|
||||
gchar *str_open;
|
||||
gchar *str_close;
|
||||
} FrameNode;
|
||||
} GstValidateMediaGstValidateMediaGstValidateMediaFrameNode;
|
||||
|
||||
void free_filenode (FileNode * filenode);
|
||||
gboolean tag_node_compare (TagNode * tnode, const GstTagList * tlist);
|
||||
void gst_validate_filenode_free (GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode *
|
||||
filenode);
|
||||
gboolean gst_validate_gst_validate_gst_validate_gst_validate_tag_node_compare (GstValidateMediaGstValidateMediaGstValidateMediaTagNode *
|
||||
tnode, const GstTagList * tlist);
|
||||
|
||||
GType gst_media_descriptor_get_type (void);
|
||||
GType gst_validate_media_descriptor_get_type (void);
|
||||
|
||||
#define GST_TYPE_MEDIA_DESCRIPTOR (gst_media_descriptor_get_type ())
|
||||
#define GST_MEDIA_DESCRIPTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MEDIA_DESCRIPTOR, GstMediaDescriptor))
|
||||
#define GST_MEDIA_DESCRIPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MEDIA_DESCRIPTOR, GstMediaDescriptorClass))
|
||||
#define GST_IS_MEDIA_DESCRIPTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MEDIA_DESCRIPTOR))
|
||||
#define GST_IS_MEDIA_DESCRIPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MEDIA_DESCRIPTOR))
|
||||
#define GST_MEDIA_DESCRIPTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MEDIA_DESCRIPTOR, GstMediaDescriptorClass))
|
||||
#define GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR (gst_validate_media_descriptor_get_type ())
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR, GstValidateMediaDescriptor))
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR, GstValidateMediaDescriptorClass))
|
||||
#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR))
|
||||
#define GST_IS_VALIDATE_MEDIA_DESCRIPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR))
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR, GstValidateMediaDescriptorClass))
|
||||
|
||||
#define GST_MEDIA_DESCRIPTOR_GET_LOCK(obj) (&GST_MEDIA_DESCRIPTOR(obj)->lock)
|
||||
#define GST_MEDIA_DESCRIPTOR_LOCK(obj) g_mutex_lock(GST_MEDIA_DESCRIPTOR_GET_LOCK(obj))
|
||||
#define GST_MEDIA_DESCRIPTOR_UNLOCK(obj) g_mutex_unlock(GST_MEDIA_DESCRIPTOR_GET_LOCK(obj))
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_GET_LOCK(obj) (&GST_VALIDATE_MEDIA_DESCRIPTOR(obj)->lock)
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_LOCK(obj) g_mutex_lock(GST_VALIDATE_MEDIA_DESCRIPTOR_GET_LOCK(obj))
|
||||
#define GST_VALIDATE_MEDIA_DESCRIPTOR_UNLOCK(obj) g_mutex_unlock(GST_VALIDATE_MEDIA_DESCRIPTOR_GET_LOCK(obj))
|
||||
|
||||
typedef struct _GstMediaDescriptorPrivate GstMediaDescriptorPrivate;
|
||||
typedef struct _GstValidateMediaDescriptorPrivate
|
||||
GstValidateMediaDescriptorPrivate;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
FileNode *filenode;
|
||||
GstValidateMediaGstValidateMediaGstValidateMediaGstValidateMediaFileNode *filenode;
|
||||
|
||||
GMutex lock;
|
||||
GMutex lock;
|
||||
|
||||
GstMediaDescriptorPrivate *priv;
|
||||
} GstMediaDescriptor;
|
||||
GstValidateMediaDescriptorPrivate *priv;
|
||||
} GstValidateMediaDescriptor;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
GObjectClass parent;
|
||||
|
||||
} GstMediaDescriptorClass;
|
||||
} GstValidateMediaDescriptorClass;
|
||||
|
||||
gboolean gst_media_descriptors_compare (GstMediaDescriptor *ref,
|
||||
GstMediaDescriptor *compared);
|
||||
gboolean gst_media_descriptor_detects_frames (GstMediaDescriptor * self);
|
||||
gboolean gst_media_descriptor_get_buffers (GstMediaDescriptor * self,
|
||||
GstPad * pad, GCompareFunc compare_func, GList ** bufs);
|
||||
gboolean gst_media_descriptor_has_frame_info (GstMediaDescriptor * self);
|
||||
GstClockTime gst_media_descriptor_get_duration (GstMediaDescriptor * self);
|
||||
gboolean gst_media_descriptor_get_seekable (GstMediaDescriptor * self);
|
||||
GList * gst_media_descriptor_get_pads (GstMediaDescriptor * self);
|
||||
gboolean gst_validate_media_descriptors_compare (GstValidateMediaDescriptor *
|
||||
ref, GstValidateMediaDescriptor * compared);
|
||||
gboolean
|
||||
gst_validate_media_descriptor_detects_frames (GstValidateMediaDescriptor *
|
||||
self);
|
||||
gboolean gst_validate_media_descriptor_get_buffers (GstValidateMediaDescriptor *
|
||||
self, GstPad * pad, GCompareFunc compare_func, GList ** bufs);
|
||||
gboolean
|
||||
gst_validate_media_descriptor_has_frame_info (GstValidateMediaDescriptor *
|
||||
self);
|
||||
GstClockTime
|
||||
gst_validate_media_descriptor_get_duration (GstValidateMediaDescriptor * self);
|
||||
gboolean gst_validate_media_descriptor_get_seekable (GstValidateMediaDescriptor
|
||||
* self);
|
||||
GList *gst_validate_media_descriptor_get_pads (GstValidateMediaDescriptor *
|
||||
self);
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
|
@ -557,7 +557,7 @@ _check_media_info (GstSegment * segment, BufferDesc * bufs)
|
|||
GstValidateReport *report;
|
||||
GstValidateMonitor *monitor;
|
||||
GstValidateRunner *runner;
|
||||
GstMediaDescriptor *mdesc;
|
||||
GstValidateMediaDescriptor *mdesc;
|
||||
|
||||
GError *err = NULL;
|
||||
gint i, num_issues = 0;
|
||||
|
@ -565,8 +565,9 @@ _check_media_info (GstSegment * segment, BufferDesc * bufs)
|
|||
fail_unless (g_setenv ("GST_VALIDATE_REPORTING_DETAILS", "all", TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
|
||||
mdesc = (GstMediaDescriptor *)
|
||||
gst_media_descriptor_parser_new_from_xml (runner, media_info, &err);
|
||||
mdesc = (GstValidateMediaDescriptor *)
|
||||
gst_validate_media_descriptor_parser_new_from_xml (runner, media_info,
|
||||
&err);
|
||||
|
||||
decoder = fake_decoder_new ();
|
||||
monitor = _start_monitoring_element (decoder, runner);
|
||||
|
|
|
@ -47,9 +47,9 @@ main (int argc, gchar ** argv)
|
|||
gchar *output_file = NULL;
|
||||
gchar *expected_file = NULL;
|
||||
gchar *output = NULL;
|
||||
GstMediaDescriptorWriter *writer = NULL;
|
||||
GstValidateMediaDescriptorWriter *writer = NULL;
|
||||
GstValidateRunner *runner = NULL;
|
||||
GstMediaDescriptorParser *reference = NULL;
|
||||
GstValidateMediaDescriptorParser *reference = NULL;
|
||||
|
||||
GOptionEntry options[] = {
|
||||
{"output-file", 'o', 0, G_OPTION_ARG_FILENAME,
|
||||
|
@ -99,7 +99,8 @@ main (int argc, gchar ** argv)
|
|||
runner = gst_validate_runner_new ();
|
||||
|
||||
if (expected_file) {
|
||||
reference = gst_media_descriptor_parser_new (runner, expected_file, NULL);
|
||||
reference =
|
||||
gst_validate_media_descriptor_parser_new (runner, expected_file, NULL);
|
||||
|
||||
if (reference == NULL) {
|
||||
g_print ("Could not parse file: %s\n", expected_file);
|
||||
|
@ -107,14 +108,17 @@ main (int argc, gchar ** argv)
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (!full && gst_media_descriptor_has_frame_info ((GstMediaDescriptor *)
|
||||
if (!full
|
||||
&&
|
||||
gst_validate_media_descriptor_has_frame_info (
|
||||
(GstValidateMediaDescriptor *)
|
||||
reference))
|
||||
full = TRUE; /* Reference has frame info, activate to do comparison */
|
||||
}
|
||||
|
||||
writer =
|
||||
gst_media_descriptor_writer_new_discover (runner, argv[1], full, TRUE,
|
||||
NULL);
|
||||
gst_validate_media_descriptor_writer_new_discover (runner, argv[1], full,
|
||||
TRUE, NULL);
|
||||
if (writer == NULL) {
|
||||
g_print ("Could not discover file: %s\n", argv[1]);
|
||||
ret = 1;
|
||||
|
@ -122,27 +126,27 @@ main (int argc, gchar ** argv)
|
|||
}
|
||||
|
||||
if (output_file) {
|
||||
if (!gst_media_descriptor_writer_write (writer, output_file)) {
|
||||
if (!gst_validate_media_descriptor_writer_write (writer, output_file)) {
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (reference) {
|
||||
if (!gst_media_descriptors_compare (GST_MEDIA_DESCRIPTOR (reference),
|
||||
GST_MEDIA_DESCRIPTOR (writer))) {
|
||||
if (!gst_validate_media_descriptors_compare (GST_VALIDATE_MEDIA_DESCRIPTOR
|
||||
(reference), GST_VALIDATE_MEDIA_DESCRIPTOR (writer))) {
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
output = gst_media_descriptor_writer_serialize (writer);
|
||||
output = gst_validate_media_descriptor_writer_serialize (writer);
|
||||
g_print ("Media info:\n%s\n", output);
|
||||
g_free (output);
|
||||
}
|
||||
|
||||
ret = gst_validate_runner_exit (runner, TRUE);
|
||||
if (ret && expected_file) {
|
||||
output = gst_media_descriptor_writer_serialize (writer);
|
||||
output = gst_validate_media_descriptor_writer_serialize (writer);
|
||||
g_print ("Media info:\n%s\n", output);
|
||||
g_free (output);
|
||||
}
|
||||
|
|
|
@ -579,7 +579,8 @@ main (int argc, gchar ** argv)
|
|||
|
||||
if (media_info) {
|
||||
GError *err = NULL;
|
||||
GstMediaDescriptorParser *parser = gst_media_descriptor_parser_new (runner,
|
||||
GstValidateMediaDescriptorParser *parser =
|
||||
gst_validate_media_descriptor_parser_new (runner,
|
||||
media_info, &err);
|
||||
|
||||
if (parser == NULL) {
|
||||
|
@ -591,7 +592,7 @@ main (int argc, gchar ** argv)
|
|||
}
|
||||
|
||||
gst_validate_monitor_set_media_descriptor (monitor,
|
||||
GST_MEDIA_DESCRIPTOR (parser));
|
||||
GST_VALIDATE_MEDIA_DESCRIPTOR (parser));
|
||||
gst_object_unref (parser);
|
||||
g_free (media_info);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue