diff --git a/libse/LibSE.csproj b/libse/LibSE.csproj
index 276581471..42190c502 100644
--- a/libse/LibSE.csproj
+++ b/libse/LibSE.csproj
@@ -373,6 +373,7 @@
+
diff --git a/libse/SubtitleFormats/MediaTransData.cs b/libse/SubtitleFormats/MediaTransData.cs
new file mode 100644
index 000000000..330f4bf19
--- /dev/null
+++ b/libse/SubtitleFormats/MediaTransData.cs
@@ -0,0 +1,241 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace Nikse.SubtitleEdit.Core.SubtitleFormats
+{
+ internal class MediaTransData : SubtitleFormat
+ {
+ public override string Extension
+ {
+ get { return ".imtpro"; }
+ }
+
+ public override string Name
+ {
+ get { return "MediaTransData"; }
+ }
+
+ public override bool IsTimeBased
+ {
+ get { return true; }
+ }
+
+ public override bool IsMine(List lines, string fileName)
+ {
+ var subtitle = new Subtitle();
+ LoadSubtitle(subtitle, lines, fileName);
+ return subtitle.Paragraphs.Count > _errorCount;
+ }
+
+ public override string ToText(Subtitle subtitle, string title)
+ {
+ const string xmpTemplate = @"
+
+
+
+
+ 2
+ For editing SDTV video
+ Standard PAL video (4:3interlaced)
+
+
+ SDTV
+ 25.00 fps
+ True
+ 720
+ 400
+ 720/400
+ D1/DV PAL (1.067)
+
+ |
+
+
+
+ Default
+ Default
+ 24Bit PNG
+ 0001
+ False
+
+
+ 1
+ False
+ Default
+ FOX-HD-Malaysia
+ Default
+ False
+
+
+
+ 2500
+ FALSE
+ 00:00:00:00
+ 1
+ 09:59:35:00
+ 1
+
+
+
+ C:\Project\uknown.mpg
+ 29.97DF
+
+
+ 1
+
+
+ Track 1
+ True
+ False
+
+
+ 7
+
+ No
+ 40
+ False
+
+ False
+
+
+ In
+ 64
+ False
+
+ False
+
+
+ Out
+ 66
+ False
+
+ False
+
+
+ Style
+ 15
+ False
+
+ False
+
+
+ StyleEx
+ 96
+ False
+
+ False
+
+
+ Comment
+ 77
+ False
+
+ False
+
+
+ Language 01
+ 349
+ False
+
+ False
+
+
+
+ 4096
+
+
+ [COUNT]
+
+
+
+ 0
+
+
+
+
+";
+
+ const string paragraphTemplate = @"
+ 10:21:15:06
+ 10:21:16:18
+
+
+
+
+
+ Text
+ Line1|Line2
+
+ ";
+ var xml = new XmlDocument();
+ var firstTimeCode = new TimeCode(0);
+ var lastTimeCode = new TimeCode(0);
+ if (subtitle.Paragraphs.Count > 0)
+ {
+ firstTimeCode = subtitle.Paragraphs[0].StartTime;
+ lastTimeCode = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].StartTime;
+ }
+ xml.LoadXml(xmpTemplate.Replace('\'', '"').Replace("[COUNT]", subtitle.Paragraphs.Count.ToString()));
+
+ var paragraphInsertNode = xml.DocumentElement.SelectSingleNode("Tracks/Track1/Data");
+ int count = 1;
+ foreach (Paragraph p in subtitle.Paragraphs)
+ {
+ string nodeName = "Data" + count;
+ XmlNode paragraph = xml.CreateElement(nodeName);
+ paragraph.InnerXml = paragraphTemplate;
+ paragraph.SelectSingleNode("In").InnerText = p.StartTime.ToHHMMSSFF();
+ paragraph.SelectSingleNode("Out").InnerText = p.EndTime.ToHHMMSSFF();
+ paragraph.SelectSingleNode("Fields/Field1/Data").InnerText = string.Join("|", p.Text.SplitToLines());
+ paragraphInsertNode.AppendChild(paragraph);
+ count++;
+ }
+ return ToUtf8XmlString(xml).Replace(" xmlns=\"\"", string.Empty);
+ }
+
+ public override void LoadSubtitle(Subtitle subtitle, List lines, string fileName)
+ {
+ _errorCount = 0;
+ var sb = new StringBuilder();
+ lines.ForEach(line => sb.AppendLine(line));
+ var xmlAsText = sb.ToString().Trim();
+ if (!xmlAsText.Contains("Text") || !xmlAsText.Contains(""))
+ {
+ return;
+ }
+
+ try
+ {
+ var xml = new XmlDocument { XmlResolver = null };
+ xml.LoadXml(xmlAsText);
+ foreach (XmlNode node in xml.DocumentElement.SelectNodes("//Fields/Field1"))
+ {
+ try
+ {
+ var nodeType = node.SelectSingleNode("Type");
+ if (nodeType != null && nodeType.InnerText == "Text")
+ {
+ var timeCodeIn = DecodeTimeCodeFrames(node.ParentNode.ParentNode.SelectSingleNode("In").InnerText, SplitCharColon);
+ var timeCodeOut = DecodeTimeCodeFrames(node.ParentNode.ParentNode.SelectSingleNode("Out").InnerText, SplitCharColon);
+ var text = node.SelectSingleNode("Data").InnerText.Replace("|", Environment.NewLine);
+ var p = new Paragraph(timeCodeIn, timeCodeOut, text);
+ subtitle.Paragraphs.Add(p);
+ }
+ }
+ catch (Exception ex)
+ {
+ System.Diagnostics.Debug.WriteLine(ex.Message);
+ _errorCount++;
+ }
+ }
+ subtitle.Renumber();
+ }
+ catch (Exception)
+ {
+ _errorCount++;
+ }
+ }
+
+ }
+}
diff --git a/libse/SubtitleFormats/SubtitleFormat.cs b/libse/SubtitleFormats/SubtitleFormat.cs
index 147c49347..a3ddad13e 100644
--- a/libse/SubtitleFormats/SubtitleFormat.cs
+++ b/libse/SubtitleFormats/SubtitleFormat.cs
@@ -86,6 +86,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
new JsonType6(),
new JsonType7(),
new Lrc(),
+ new MediaTransData(),
new MicroDvd(),
new MidwayInscriberCGX(),
new MPlayer2(),