SubtitleEdit/libse/SubtitleFormats/Cmaft.cs
2017-07-24 11:17:41 +02:00

45 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using Nikse.SubtitleEdit.Core.ContainerFormats.Mp4;
namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{
/// <summary>
/// CMFT - "Common Media application Format Text"
/// </summary>
public class Cmaft : SubtitleFormat
{
public override string Extension => ".cmft";
public const string NameOfFormat = "CMAF Text";
public override string Name => NameOfFormat;
public override bool IsTimeBased => true;
public override bool IsMine(List<string> lines, string fileName)
{
if (!string.IsNullOrEmpty(fileName) && fileName.EndsWith(".cmft", StringComparison.OrdinalIgnoreCase))
{
var parser = new CmafParser(fileName);
return parser.Subtitle.Paragraphs.Count > 0;
}
return false;
}
public override string ToText(Subtitle subtitle, string title)
{
return "Not implemented!";
}
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
{
var parser = new CmafParser(fileName);
subtitle.Paragraphs.Clear();
subtitle.Paragraphs.AddRange(parser.Subtitle.Paragraphs);
}
}
}