mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Fix cmd line resolution regarding #3633 - thx MounaLafi :)
This commit is contained in:
parent
fffd99d51c
commit
8eb271a14f
@ -1327,7 +1327,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
if ((ext.Equals(".ts", StringComparison.OrdinalIgnoreCase) || ext.Equals(".m2ts", StringComparison.OrdinalIgnoreCase)) &&
|
||||
(FileUtil.IsTransportStream(fileName) || FileUtil.IsM2TransportStream(fileName)))
|
||||
{
|
||||
success = TsToBluRaySup.ConvertFromTsToBluRaySup(fileName, outputFolder, overwrite, count, _stdOutWriter, progressCallback);
|
||||
success = TsToBluRaySup.ConvertFromTsToBluRaySup(fileName, outputFolder, overwrite, count, _stdOutWriter, progressCallback, resolution);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1557,7 +1557,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
if ((ext.Equals(".ts", StringComparison.OrdinalIgnoreCase) || ext.Equals(".m2ts", StringComparison.OrdinalIgnoreCase)) &&
|
||||
(FileUtil.IsTransportStream(fileName) || FileUtil.IsM2TransportStream(fileName)))
|
||||
{
|
||||
success = TsToBdnXml.ConvertFromTsToBdnXml(fileName, outputFolder, overwrite, _stdOutWriter, progressCallback);
|
||||
success = TsToBdnXml.ConvertFromTsToBdnXml(fileName, outputFolder, overwrite, _stdOutWriter, progressCallback, resolution);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Nikse.SubtitleEdit.Core;
|
||||
@ -12,7 +11,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
{
|
||||
public static class TsToBdnXml
|
||||
{
|
||||
public static bool ConvertFromTsToBdnXml(string fileName, string outputFolder, bool overwrite, StreamWriter stdOutWriter, CommandLineConverter.BatchConvertProgress progressCallback)
|
||||
public static bool ConvertFromTsToBdnXml(string fileName, string outputFolder, bool overwrite, StreamWriter stdOutWriter, CommandLineConverter.BatchConvertProgress progressCallback, Point? resolution)
|
||||
{
|
||||
var programMapTableParser = new ProgramMapTableParser();
|
||||
programMapTableParser.Parse(fileName); // get languages from PMT if possible
|
||||
@ -28,7 +27,8 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
|
||||
var overrideScreenSize = Configuration.Settings.Tools.BatchConvertTsOverrideScreenSize &&
|
||||
Configuration.Settings.Tools.BatchConvertTsScreenWidth > 0 &&
|
||||
Configuration.Settings.Tools.BatchConvertTsScreenHeight > 0;
|
||||
Configuration.Settings.Tools.BatchConvertTsScreenHeight > 0 ||
|
||||
resolution.HasValue;
|
||||
|
||||
using (var form = new ExportPngXml())
|
||||
{
|
||||
@ -57,7 +57,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
subtitle.Paragraphs.Add(new Paragraph(string.Empty, p.StartMilliseconds, p.EndMilliseconds));
|
||||
}
|
||||
|
||||
var res = TsToBluRaySup.GetSubtitleScreenSize(sub, overrideScreenSize);
|
||||
var res = TsToBluRaySup.GetSubtitleScreenSize(sub, overrideScreenSize, resolution);
|
||||
var videoInfo = new VideoInfo { Success = true, Width = res.X, Height = res.Y };
|
||||
form.Initialize(subtitle, new SubRip(), BatchConvert.BdnXmlSubtitle, fileName, videoInfo, fileName);
|
||||
var sb = new StringBuilder();
|
||||
|
@ -12,7 +12,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
{
|
||||
public static class TsToBluRaySup
|
||||
{
|
||||
public static bool ConvertFromTsToBluRaySup(string fileName, string outputFolder, bool overwrite, int count, StreamWriter stdOutWriter, CommandLineConverter.BatchConvertProgress progressCallback)
|
||||
public static bool ConvertFromTsToBluRaySup(string fileName, string outputFolder, bool overwrite, int count, StreamWriter stdOutWriter, CommandLineConverter.BatchConvertProgress progressCallback, Point? resolution)
|
||||
{
|
||||
var programMapTableParser = new ProgramMapTableParser();
|
||||
programMapTableParser.Parse(fileName); // get languages from PMT if possible
|
||||
@ -28,7 +28,8 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
|
||||
var overrideScreenSize = Configuration.Settings.Tools.BatchConvertTsOverrideScreenSize &&
|
||||
Configuration.Settings.Tools.BatchConvertTsScreenWidth > 0 &&
|
||||
Configuration.Settings.Tools.BatchConvertTsScreenHeight > 0;
|
||||
Configuration.Settings.Tools.BatchConvertTsScreenHeight > 0 ||
|
||||
resolution.HasValue;
|
||||
|
||||
using (var form = new ExportPngXml())
|
||||
{
|
||||
@ -46,7 +47,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
stdOutWriter?.Write($"{count}: {Path.GetFileName(fileName)} -> PID {pid} to {outputFileName}...");
|
||||
var sub = tsParser.GetDvbSubtitles(pid);
|
||||
progressCallback?.Invoke($"Save PID {pid}");
|
||||
var subtitleScreenSize = GetSubtitleScreenSize(sub, overrideScreenSize);
|
||||
var subtitleScreenSize = GetSubtitleScreenSize(sub, overrideScreenSize, resolution);
|
||||
using (var binarySubtitleFile = new FileStream(outputFileName, FileMode.Create))
|
||||
{
|
||||
for (int index = 0; index < sub.Count; index++)
|
||||
@ -156,8 +157,13 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
|
||||
.Replace("{three-letter-country-code-uppercase}", threeLetter);
|
||||
}
|
||||
|
||||
public static Point GetSubtitleScreenSize(List<TransportStreamSubtitle> sub, bool overrideScreenSize)
|
||||
public static Point GetSubtitleScreenSize(List<TransportStreamSubtitle> sub, bool overrideScreenSize, Point? resolution)
|
||||
{
|
||||
if (resolution.HasValue)
|
||||
{
|
||||
return new Point(resolution.Value.X, resolution.Value.Y);
|
||||
}
|
||||
|
||||
if (overrideScreenSize)
|
||||
{
|
||||
return new Point(Configuration.Settings.Tools.BatchConvertTsScreenWidth, Configuration.Settings.Tools.BatchConvertTsScreenHeight);
|
||||
|
Loading…
Reference in New Issue
Block a user