summaryrefslogtreecommitdiffstats
path: root/gst/mxf/mxfparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/mxf/mxfparse.c')
-rw-r--r--gst/mxf/mxfparse.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c
index 22efb333..32f5e336 100644
--- a/gst/mxf/mxfparse.c
+++ b/gst/mxf/mxfparse.c
@@ -271,6 +271,37 @@ mxf_umid_to_string (const MXFUMID * key, gchar str[96])
return str;
}
+MXFUMID *
+mxf_umid_from_string (const gchar * str, MXFUMID * umid)
+{
+ gint len;
+ guint i, j;
+
+ g_return_val_if_fail (str != NULL, NULL);
+ len = strlen (str);
+
+ memset (umid, 0, 32);
+
+ if (len != 95) {
+ GST_ERROR ("Invalid UMID string length %d", len);
+ return NULL;
+ }
+
+ for (i = 0, j = 0; i < 32; i++) {
+ if (!g_ascii_isxdigit (str[j]) ||
+ !g_ascii_isxdigit (str[j + 1]) ||
+ (str[j + 2] != '.' && str[j + 2] != '\0')) {
+ GST_ERROR ("Invalid UMID string '%s'", str);
+ return NULL;
+ }
+
+ umid->u[i] =
+ (g_ascii_xdigit_value (str[j]) << 4) | (g_ascii_xdigit_value (str[j +
+ 1]));
+ j += 3;
+ }
+ return umid;
+}
static guint
gst_mxf_ul_hash (const MXFUL * key)