diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-03-02 23:21:42 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-03-02 23:21:42 +0100 |
| commit | 5f589c6d951a5fc549dc652a7839c257d9bc6782 (patch) | |
| tree | 5c19cc79c8c0c37f0c10e8ac240fbb2325d513ca /src | |
| parent | 8ed27c4278bc147b99602f59ede8639bbc8d00e6 (diff) | |
wip: srt export.3142-export-srt
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/subtitle_film_encoder.cc | 13 | ||||
| -rw-r--r-- | src/lib/subtitle_format.h | 3 | ||||
| -rw-r--r-- | src/wx/export_subtitles_dialog.cc | 27 |
3 files changed, 39 insertions, 4 deletions
diff --git a/src/lib/subtitle_film_encoder.cc b/src/lib/subtitle_film_encoder.cc index feca363eb..e759264f8 100644 --- a/src/lib/subtitle_film_encoder.cc +++ b/src/lib/subtitle_film_encoder.cc @@ -70,7 +70,18 @@ SubtitleFilmEncoder::SubtitleFilmEncoder( _player.set_ignore_audio(); _player.Text.connect(boost::bind(&SubtitleFilmEncoder::text, this, _1, _2, _3, _4)); - string const extension = format == SubtitleFormat::XML ? ".xml" : ".mxf"; + string extension; + switch (format) { + case SubtitleFormat::XML: + extension = ".xml"; + break; + case SubtitleFormat::MXF: + extension = ".mxf"; + break; + case SubtitleFormat::SRT: + extension = ".srt"; + break; + } int const files = split_reels ? film->reels().size() : 1; for (int i = 0; i < files; ++i) { diff --git a/src/lib/subtitle_format.h b/src/lib/subtitle_format.h index dbcbf6d17..5832e0cd2 100644 --- a/src/lib/subtitle_format.h +++ b/src/lib/subtitle_format.h @@ -25,7 +25,8 @@ enum class SubtitleFormat { XML, - MXF + MXF, + SRT }; diff --git a/src/wx/export_subtitles_dialog.cc b/src/wx/export_subtitles_dialog.cc index 5ce97c93c..e08369b12 100644 --- a/src/wx/export_subtitles_dialog.cc +++ b/src/wx/export_subtitles_dialog.cc @@ -46,6 +46,7 @@ ExportSubtitlesDialog::ExportSubtitlesDialog(wxWindow* parent, int reels, bool i _format = new Choice(this); _format->add_entry(_("XML (Interop)")); _format->add_entry(_("MXF (SMPTE)")); + _format->add_entry(_("SubRip (SRT)")); _format->set(interop ? 0 : 1); sizer->Add(_format, wxGBPosition(r, 1)); ++r; @@ -101,7 +102,17 @@ ExportSubtitlesDialog::format_changed() void ExportSubtitlesDialog::setup_wildcard() { - _file->set_wildcard(format() == SubtitleFormat::XML ? _("Subtitle files (.xml)|*.xml") : _("Subtitle files (.mxf)|*.mxf")); + switch (format()) { + case SubtitleFormat::XML: + _film->set_wildcard(_("Subtitle files (.xml)|*.xml")); + break; + case SubtitleFormat::MXF: + _film->set_wildcard(_("Subtitle files (.mxf)|*.mxf")); + break; + case SubtitleFormat::SRT: + _film->set_wildcard(_("Subtitle files (.srt)|*.srt")); + break; + } } @@ -113,6 +124,8 @@ ExportSubtitlesDialog::format() const return SubtitleFormat::XML; case 1: return SubtitleFormat::MXF; + case 2: + return SubtitleFormat::SRT; } DCPOMATIC_ASSERT(false); @@ -145,7 +158,17 @@ ExportSubtitlesDialog::path() const if (_file->IsEnabled()) { if (auto path = _file->path()) { wxFileName fn(std_to_wx(path->string())); - fn.SetExt(char_to_wx(format() == SubtitleFormat::XML ? "xml" : "mxf")); + switch (format()) { + case SubtitleFormat::XML: + fn.SetExt(char_to_wx("xml")); + break; + case SubtitleFormat::MXF: + fn.SetExt(char_to_wx("mxf")); + break; + case SubtitleFormat::SRT: + fn.SetExt(char_to_wx("srt")); + break; + } return wx_to_std(fn.GetFullPath()); } } |
