projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tidy up image/text subtitle distinction with FFmpeg sources.
[dcpomatic.git]
/
src
/
wx
/
subtitle_panel.cc
diff --git
a/src/wx/subtitle_panel.cc
b/src/wx/subtitle_panel.cc
index 3a0063c952315cf8a4287e1d39c638e9f5cbe12a..52b23f5a20069eab46138bbd436be696f45ef319 100644
(file)
--- a/
src/wx/subtitle_panel.cc
+++ b/
src/wx/subtitle_panel.cc
@@
-1,19
+1,20
@@
/*
Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
/*
Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
This program
is distributed in the hope that it will be useful,
+
DCP-o-matic
is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
*/
*/
@@
-234,35
+235,40
@@
SubtitlePanel::setup_sensitivity ()
int any_subs = 0;
int ffmpeg_subs = 0;
int text_subs = 0;
int any_subs = 0;
int ffmpeg_subs = 0;
int text_subs = 0;
- int dcp_subs = 0;
int image_subs = 0;
ContentList sel = _parent->selected_subtitle ();
BOOST_FOREACH (shared_ptr<Content> i, sel) {
int image_subs = 0;
ContentList sel = _parent->selected_subtitle ();
BOOST_FOREACH (shared_ptr<Content> i, sel) {
+ /* These are the content types that could include subtitles */
shared_ptr<const FFmpegContent> fc = boost::dynamic_pointer_cast<const FFmpegContent> (i);
shared_ptr<const TextSubtitleContent> sc = boost::dynamic_pointer_cast<const TextSubtitleContent> (i);
shared_ptr<const DCPSubtitleContent> dsc = boost::dynamic_pointer_cast<const DCPSubtitleContent> (i);
if (fc) {
if (fc->subtitle) {
shared_ptr<const FFmpegContent> fc = boost::dynamic_pointer_cast<const FFmpegContent> (i);
shared_ptr<const TextSubtitleContent> sc = boost::dynamic_pointer_cast<const TextSubtitleContent> (i);
shared_ptr<const DCPSubtitleContent> dsc = boost::dynamic_pointer_cast<const DCPSubtitleContent> (i);
if (fc) {
if (fc->subtitle) {
+ /* This content has some subtitles; check the selected stream to decide what type */
+ if (fc->subtitle_stream()->has_text()) {
+ ++text_subs;
+ } else if (fc->subtitle_stream()->has_image()) {
+ ++image_subs;
+ }
++ffmpeg_subs;
++any_subs;
}
++ffmpeg_subs;
++any_subs;
}
- } else if (sc) {
+ } else if (sc || dsc) {
+ /* XXX: in the future there could be bitmap subs from DCPs */
++text_subs;
++any_subs;
++text_subs;
++any_subs;
- } else if (dsc) {
- ++dcp_subs;
- ++any_subs;
- } else {
- ++any_subs;
}
}
+ }
-
if (i->subtitle->has_image_subtitles ()
) {
- ++image_subs;
+
if (image_subs
) {
+ BOOST_FOREACH (shared_ptr<Content> i, sel) {
/* We must burn image subtitles at the moment */
i->subtitle->set_burn (true);
}
}
/* We must burn image subtitles at the moment */
i->subtitle->set_burn (true);
}
}
+ /* Decide whether we can reference these subs */
+
shared_ptr<DCPContent> dcp;
if (sel.size() == 1) {
dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
shared_ptr<DCPContent> dcp;
if (sel.size() == 1) {
dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
@@
-274,6
+280,7
@@
SubtitlePanel::setup_sensitivity ()
bool const reference = _reference->GetValue ();
bool const reference = _reference->GetValue ();
+ /* Set up sensitivity */
_use->Enable (!reference && any_subs > 0);
bool const use = _use->GetValue ();
_burn->Enable (!reference && any_subs > 0 && use && image_subs == 0);
_use->Enable (!reference && any_subs > 0);
bool const use = _use->GetValue ();
_burn->Enable (!reference && any_subs > 0 && use && image_subs == 0);
@@
-283,9
+290,9
@@
SubtitlePanel::setup_sensitivity ()
_y_scale->Enable (!reference && any_subs > 0 && use);
_language->Enable (!reference && any_subs > 0 && use);
_stream->Enable (!reference && ffmpeg_subs == 1);
_y_scale->Enable (!reference && any_subs > 0 && use);
_language->Enable (!reference && any_subs > 0 && use);
_stream->Enable (!reference && ffmpeg_subs == 1);
- _subtitle_view_button->Enable (!reference &&
(text_subs == 1 || dcp_subs == 1)
);
- _fonts_dialog_button->Enable (!reference &&
(text_subs == 1 || dcp_subs == 1)
);
- _appearance_dialog_button->Enable (!reference
&& (ffmpeg_subs == 1 || text_subs == 1)
);
+ _subtitle_view_button->Enable (!reference &&
text_subs == 1
);
+ _fonts_dialog_button->Enable (!reference &&
text_subs == 1
);
+ _appearance_dialog_button->Enable (!reference);
}
void
}
void
@@
-377,7
+384,7
@@
SubtitlePanel::subtitle_view_clicked ()
ContentList c = _parent->selected_subtitle ();
DCPOMATIC_ASSERT (c.size() == 1);
ContentList c = _parent->selected_subtitle ();
DCPOMATIC_ASSERT (c.size() == 1);
- shared_ptr<
Subtitle
Decoder> decoder;
+ shared_ptr<Decoder> decoder;
shared_ptr<TextSubtitleContent> sr = dynamic_pointer_cast<TextSubtitleContent> (c.front ());
if (sr) {
shared_ptr<TextSubtitleContent> sr = dynamic_pointer_cast<TextSubtitleContent> (c.front ());
if (sr) {