Support for mxml4, backported from upstream commits
c1d42ee2dc9b6aba67348b4f386ecd91fb667e35 and
f4bb43ada1b6d6268b3205c7d00362816de9ca5e.

--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,15 @@
+MXML_VERSION := \
+  $(shell \
+  if `pkg-config --exists mxml4` ; then echo '4'; \
+  else echo ''; \
+  fi \
+  )
+MXML_CFLAGS := $(shell pkg-config --cflags mxml$(MXML_VERSION))
+MXML_LIBS := $(shell pkg-config --libs mxml$(MXML_VERSION))
 DEBUGopts = -g -O0 -fno-inline-functions -DDEBUG
 NDEBUGopts = $(EXTRA_CFLAGS) -O2 -DNDEBUG
-CFLAGS = -Wall -g -Wpedantic -c $(DEBUG) -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=25
-LFLAGS = -Wall -g -Wpedantic -lmxml -lfuse $(DEBUG) $(EXTRA_LFLAGS)
+CFLAGS = -Wall -g -Wpedantic -c $(DEBUG) -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=25 $(MXML_CFLAGS)
+LFLAGS = -Wall -g -Wpedantic -lfuse $(DEBUG) $(EXTRA_LFLAGS) $(MXML_LIBS)
 CC = gcc
 DEBUG=$(NDEBUGopts)
 
--- a/fuse-ts-kdenlive.c
+++ b/fuse-ts-kdenlive.c
@@ -10,6 +10,7 @@
 #include "fuse-ts.h"
 #include "fuse-ts-tools.h"
 #include "fuse-ts-debug.h"
+#include "fuse-ts-xml.h"
 #include "fuse-ts-kdenlive.h"
 
 char *kdenlive_path = "/project.kdenlive";
@@ -159,14 +160,14 @@ int find_cutmarks_in_kdenlive_project_file (int *inframe, int *outframe, int *bl
 */
 	mxml_node_t *xmldoc;
 	char* temp = filebuffer__read_all_to_cstring(kl_writebuffer);
-	xmldoc = mxmlLoadString (NULL, temp, MXML_TEXT_CALLBACK);
+	xmldoc = XMLLOAD(temp);
 	free(temp);
 	if (NULL == xmldoc) {
 		debug_printf ("find_cutmarks: no valid XML!\n");
 		return 1;
 	}
 	mxml_node_t *node, *subnode;
-	node = mxmlFindElement (xmldoc, xmldoc, "playlist", "id", "playlist0", MXML_DESCEND);
+	node = mxmlFindElement (xmldoc, xmldoc, "playlist", "id", "playlist0", MXML_DESCEND_ALL);
 	if (NULL == node) {
 		debug_printf ("find_cutmarks: node with id 'playlist1' not found!\n");
 		mxmlRelease (xmldoc);
@@ -174,7 +175,7 @@ int find_cutmarks_in_kdenlive_project_file (int *inframe, int *outframe, int *bl
 	}
 
 	int blank = 0;
-	subnode = mxmlFindElement (node, node, "blank", NULL, NULL, MXML_DESCEND);
+	subnode = mxmlFindElement (node, node, "blank", NULL, NULL, MXML_DESCEND_ALL);
 	if (NULL == subnode) {
 		debug_printf ("find_cutmarks: node 'blank' not found - assuming 0!\n");
 	} else {
@@ -192,7 +193,7 @@ int find_cutmarks_in_kdenlive_project_file (int *inframe, int *outframe, int *bl
 		}
 	}
 
-	node = mxmlFindElement (node, node, "entry", "producer", "1", MXML_DESCEND);
+	node = mxmlFindElement (node, node, "entry", "producer", "1", MXML_DESCEND_ALL);
 	if (NULL == node) {
 		debug_printf ("find_cutmarks: node 'entry' in playlist not found!\n");
 		mxmlRelease (xmldoc);
--- a/fuse-ts-shotcut.c
+++ b/fuse-ts-shotcut.c
@@ -10,6 +10,7 @@
 #include "fuse-ts.h"
 #include "fuse-ts-tools.h"
 #include "fuse-ts-debug.h"
+#include "fuse-ts-xml.h"
 #include "fuse-ts-shotcut.h"
 
 const char *shotcut_path = "/project_shotcut.mlt";
@@ -129,7 +130,7 @@ int find_cutmarks_in_shotcut_project_file (int *inframe, int *outframe, int *bla
 
 	mxml_node_t *xmldoc;
 	char* temp = filebuffer__read_all_to_cstring(sc_writebuffer);
-	xmldoc = mxmlLoadString (NULL, temp, MXML_TEXT_CALLBACK);
+	xmldoc = XMLLOAD(temp);
 	free(temp);
 	if (NULL == xmldoc) {
 		debug_printf ("find_cutmarks: no valid XML!\n");
@@ -137,9 +138,9 @@ int find_cutmarks_in_shotcut_project_file (int *inframe, int *outframe, int *bla
 	}
 
 	mxml_node_t *node;
-	node = mxmlFindElement (xmldoc, xmldoc, "producer", "id", "producer0", MXML_DESCEND);
+	node = mxmlFindElement (xmldoc, xmldoc, "producer", "id", "producer0", MXML_DESCEND_ALL);
 	if (NULL == node) {
-		node = mxmlFindElement (xmldoc, xmldoc, "chain", "id", "chain0", MXML_DESCEND);
+		node = mxmlFindElement (xmldoc, xmldoc, "chain", "id", "chain0", MXML_DESCEND_ALL);
 		if (NULL == node) {
 			debug_printf ("find_cutmarks: node with id 'producer0' or 'chain0' not found!\n");
 			mxmlRelease (xmldoc);
--- /dev/null
+++ b/fuse-ts-xml.h
@@ -0,0 +1,8 @@
+
+#if MXML_MAJOR_VERSION < 4
+#define MXML_DESCEND_ALL MXML_DESCEND
+#define XMLLOAD(x) mxmlLoadString (NULL, x, NULL);
+#else
+#define XMLLOAD(x) mxmlLoadString (NULL, NULL, x);
+#endif
+
