diff options
author | John Stebbins <[email protected]> | 2019-08-02 11:41:13 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-08-11 15:36:40 -0700 |
commit | d62dfce98fda79ef6cd10d4089141c81fe994223 (patch) | |
tree | c07e3b2ce16a162bc9d6f2067659eedf94c3df7a /gtk | |
parent | 692ac873ccf2ea3a5091566ed9e2d027d4825eda (diff) |
add subtitle track name read/write
Works similar to audio track names.
If source has a subtitle track name, hb_subtitle_t.name is set.
To set output subtitle track name, set hb_subtitle_config_t.name.
Source track names are available in title returned by hb_title_to_dict
and hb_title_to_json in SubtitleList[].Name
In job dict it is also SubtitleList[].Name
hb_preset_job_init and hb_preset_job_init_json initialize output tracks
with the source track name.
Also adds subtitle name support to LinGui
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/ghb3.ui | 470 | ||||
-rw-r--r-- | gtk/src/ghb4.ui | 376 | ||||
-rw-r--r-- | gtk/src/subtitlehandler.c | 59 |
3 files changed, 507 insertions, 398 deletions
diff --git a/gtk/src/ghb3.ui b/gtk/src/ghb3.ui index eccd56efc..1a7eea08a 100644 --- a/gtk/src/ghb3.ui +++ b/gtk/src/ghb3.ui @@ -8732,6 +8732,7 @@ Setting this to 0 means there is no maximum height.</property> </action-widgets> <child internal-child="vbox"> <object class="GtkBox" id="dialog-subtitle-vbox"> + <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="spacing">6</property> @@ -8797,263 +8798,297 @@ Setting this to 0 means there is no maximum height.</property> </child> </object> <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="subtitle_track_grid"> + <property name="row-spacing">2</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="column_spacing">5</property> + <property name="halign">center</property> + <child> + <object class="GtkLabel" id="subtitle_track_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Source Track</property> + </object> + <packing> + <property name="top_attach">0</property> + <property name="left_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="SubtitleTrack"> + <property name="valign">GTK_ALIGN_CENTER</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip_text" translatable="yes">List of subtitle tracks available from your source.</property> + <signal name="changed" handler="subtitle_track_changed_cb" swapped="no"/> + </object> + <packing> + <property name="top_attach">1</property> + <property name="left_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="subtitle_name_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Track Name:</property> + <property name="use_markup">True</property> + <property name="halign">center</property> + </object> + <packing> + <property name="top_attach">0</property> + <property name="left_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="SubtitleTrackName"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip_text" translatable="yes">Set the subtitle track name. + +Players may use this in the subtitle selection list.</property> + <property name="max_length">80</property> + <property name="width-chars">40</property> + <property name="activates_default">True</property> + <property name="truncate_multiline">True</property> + <signal name="changed" handler="subtitle_name_changed_cb" swapped="no"/> + </object> + <packing> + <property name="top_attach">1</property> + <property name="left_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> <property name="position">1</property> </packing> </child> <child> - <object class="GtkBox" id="subtitle_settings_box"> - <property name="orientation">horizontal</property> + <object class="GtkGrid" id="subtitle_import_grid"> <property name="visible">True</property> + <property name="row-spacing">2</property> <property name="can_focus">False</property> - <property name="spacing">6</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="column_spacing">4</property> <child> - <object class="GtkGrid" id="subtitle_import_grid"> + <object class="GtkLabel" id="import_lang_label"> <property name="visible">True</property> - <property name="row-spacing">2</property> <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="column_spacing">4</property> - <child> - <object class="GtkLabel" id="import_lang_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Language</property> - </object> - <packing> - <property name="top_attach">0</property> - <property name="left_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="srt_code_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Character Code</property> - </object> - <packing> - <property name="top_attach">0</property> - <property name="left_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="import_file_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">File:</property> - <property name="halign">end</property> - </object> - <packing> - <property name="top_attach">2</property> - <property name="left_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="import_offset_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Offset (ms)</property> - </object> - <packing> - <property name="top_attach">0</property> - <property name="left_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="ImportLanguage"> - <property name="valign">GTK_ALIGN_CENTER</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip_text" translatable="yes">Set the language of this subtitle. + <property name="label" translatable="yes">Language</property> + </object> + <packing> + <property name="top_attach">0</property> + <property name="left_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="srt_code_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Character Code</property> + </object> + <packing> + <property name="top_attach">0</property> + <property name="left_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="import_file_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">File:</property> + <property name="halign">end</property> + </object> + <packing> + <property name="top_attach">2</property> + <property name="left_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="import_offset_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="label" translatable="yes">Offset (ms)</property> + </object> + <packing> + <property name="top_attach">0</property> + <property name="left_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="ImportLanguage"> + <property name="valign">GTK_ALIGN_CENTER</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip_text" translatable="yes">Set the language of this subtitle. This value will be used by players in subtitle menus.</property> - <signal name="changed" handler="import_lang_changed_cb" swapped="no"/> - </object> - <packing> - <property name="top_attach">1</property> - <property name="left_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="SrtCodeset"> - <property name="valign">GTK_ALIGN_FILL</property> - <property name="width_request">150</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip_text" translatable="yes">Set the character code used by the SRT file you are importing. + <signal name="changed" handler="import_lang_changed_cb" swapped="no"/> + </object> + <packing> + <property name="top_attach">1</property> + <property name="left_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="SrtCodeset"> + <property name="valign">GTK_ALIGN_FILL</property> + <property name="width_request">150</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip_text" translatable="yes">Set the character code used by the SRT file you are importing. SRTs come in all flavours of character sets. We translate the character set to UTF-8. The source's character code is needed in order to perform this translation.</property> - <signal name="changed" handler="srt_codeset_changed_cb" swapped="no"/> - <property name="has_entry">True</property> - <child internal-child="entry"> - <object class="GtkEntry" id="combobox-entry1"> - <property name="can_focus">True</property> - </object> - </child> - </object> - <packing> - <property name="top_attach">1</property> - <property name="left_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkFileChooserButton" id="ImportFile"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Select the SRT file to import.</property> - <property name="local_only">False</property> - <property name="hexpand">True</property> - <property name="title" translatable="yes">Import File</property> - <signal name="selection-changed" handler="import_file_changed_cb" swapped="no"/> - </object> - <packing> - <property name="top_attach">2</property> - <property name="left_attach">1</property> - <property name="width">2</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="ImportOffset"> - <property name="valign">GTK_ALIGN_FILL</property> - <property name="vexpand">False</property> - <property name="width-chars">8</property> - <property name="visible">True</property> + <signal name="changed" handler="srt_codeset_changed_cb" swapped="no"/> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry" id="combobox-entry1"> <property name="can_focus">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip_text" translatable="yes">Adjust the offset in milliseconds between video and SRT timestamps</property> - <property name="adjustment">adjustment31</property> - <signal name="value-changed" handler="import_offset_changed_cb" swapped="no"/> </object> - <packing> - <property name="top_attach">1</property> - <property name="left_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> </object> <packing> - <property name="position">0</property> + <property name="top_attach">1</property> + <property name="left_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> </packing> </child> <child> - <object class="GtkBox" id="subtitle_track_box"> - <property name="orientation">vertical</property> + <object class="GtkFileChooserButton" id="ImportFile"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkLabel" id="subtitle_track_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label" translatable="yes">Track</property> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="SubtitleTrack"> - <property name="valign">GTK_ALIGN_CENTER</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip_text" translatable="yes">List of subtitle tracks available from your source.</property> - <signal name="changed" handler="subtitle_track_changed_cb" swapped="no"/> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Select the SRT file to import.</property> + <property name="local_only">False</property> + <property name="hexpand">True</property> + <property name="title" translatable="yes">Import File</property> + <signal name="selection-changed" handler="import_file_changed_cb" swapped="no"/> </object> <packing> - <property name="position">1</property> + <property name="top_attach">2</property> + <property name="left_attach">1</property> + <property name="width">2</property> + <property name="height">1</property> </packing> </child> <child> - <object class="GtkBox" id="subtitle_options_box"> - <property name="orientation">vertical</property> + <object class="GtkSpinButton" id="ImportOffset"> + <property name="valign">GTK_ALIGN_FILL</property> + <property name="vexpand">False</property> + <property name="width-chars">8</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="SubtitleForced"> - <property name="label" translatable="yes">Forced Subtitles Only</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip_text" translatable="yes">Use only subtitles that have been flagged + <property name="can_focus">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip_text" translatable="yes">Adjust the offset in milliseconds between video and SRT timestamps</property> + <property name="adjustment">adjustment31</property> + <signal name="value-changed" handler="import_offset_changed_cb" swapped="no"/> + </object> + <packing> + <property name="top_attach">1</property> + <property name="left_attach">4</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkBox" id="subtitle_options_box"> + <property name="orientation">vertical</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_top">12</property> + <child> + <object class="GtkCheckButton" id="SubtitleForced"> + <property name="label" translatable="yes">Forced Subtitles Only</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip_text" translatable="yes">Use only subtitles that have been flagged as forced in the source subtitle track "Forced" subtitles are usually used to show subtitles during scenes where someone is speaking a foreign language.</property> - <property name="halign">start</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="subtitle_forced_toggled_cb" swapped="no"/> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="SubtitleBurned"> - <property name="label" translatable="yes">Burn into video</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip_text" translatable="yes">Render the subtitle over the video. + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="subtitle_forced_toggled_cb" swapped="no"/> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="SubtitleBurned"> + <property name="label" translatable="yes">Burn into video</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip_text" translatable="yes">Render the subtitle over the video. The subtitle will be part of the video and can not be disabled.</property> - <property name="halign">start</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="subtitle_burned_toggled_cb" swapped="no"/> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="SubtitleDefaultTrack"> - <property name="label" translatable="yes">Set Default Track</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="tooltip_text" translatable="yes">Set the default output subtitle track. + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="subtitle_burned_toggled_cb" swapped="no"/> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="SubtitleDefaultTrack"> + <property name="label" translatable="yes">Set Default Track</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="tooltip_text" translatable="yes">Set the default output subtitle track. Most players will automatically display this subtitle track whenever the video is played. This is useful for creating a "forced" track in your output.</property> - <property name="halign">start</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="subtitle_default_toggled_cb" swapped="no"/> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="subtitle_default_toggled_cb" swapped="no"/> </object> <packing> <property name="position">2</property> @@ -9061,7 +9096,7 @@ in your output.</property> </child> </object> <packing> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> </object> @@ -9170,7 +9205,8 @@ in your output.</property> <property name="tooltip_text" translatable="yes">Set the audio track name. Players may use this in the audio selection list.</property> - <property name="max_length">40</property> + <property name="max_length">80</property> + <property name="width-chars">40</property> <property name="hexpand">True</property> <property name="activates_default">True</property> <property name="truncate_multiline">True</property> diff --git a/gtk/src/ghb4.ui b/gtk/src/ghb4.ui index a43645944..ca4d3d36a 100644 --- a/gtk/src/ghb4.ui +++ b/gtk/src/ghb4.ui @@ -7335,210 +7335,244 @@ Setting this to 0 means there is no maximum height.</property> </object> </child> <child> - <object class="GtkBox" id="subtitle_settings_box"> - <property name="orientation">horizontal</property> + <object class="GtkGrid" id="subtitle_track_grid"> + <property name="row-spacing">2</property> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">6</property> + <property name="column-spacing">5</property> + <property name="halign">center</property> <child> - <object class="GtkGrid" id="subtitle_import_grid"> + <object class="GtkLabel" id="subtitle_track_label"> <property name="visible">True</property> - <property name="row-spacing">2</property> <property name="can_focus">False</property> - <property name="column-spacing">4</property> - <child> - <object class="GtkLabel" id="import_lang_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Language</property> - <layout> - <property name="top-attach">0</property> - <property name="left-attach">1</property> - </layout> - </object> - </child> - <child> - <object class="GtkLabel" id="srt_code_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Character Code</property> - <layout> - <property name="top-attach">0</property> - <property name="left-attach">2</property> - </layout> - </object> - </child> - <child> - <object class="GtkLabel" id="import_file_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">File:</property> - <property name="halign">end</property> - <layout> - <property name="top-attach">2</property> - <property name="left-attach">0</property> - </layout> - </object> - </child> - <child> - <object class="GtkLabel" id="import_offset_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Offset (ms)</property> - <layout> - <property name="top-attach">0</property> - <property name="left-attach">4</property> - </layout> - </object> - </child> - <child> - <object class="GtkComboBox" id="ImportLanguage"> - <property name="valign">GTK_ALIGN_CENTER</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">Set the language of this subtitle. + <property name="label" translatable="yes">Source Track</property> + <layout> + <property name="top_attach">0</property> + <property name="left_attach">0</property> + </layout> + </object> + </child> + <child> + <object class="GtkComboBox" id="SubtitleTrack"> + <property name="valign">GTK_ALIGN_CENTER</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">List of subtitle tracks available from your source.</property> + <signal name="changed" handler="subtitle_track_changed_cb" swapped="no"/> + <layout> + <property name="top_attach">1</property> + <property name="left_attach">0</property> + </layout> + </object> + </child> + <child> + <object class="GtkLabel" id="subtitle_name_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Track Name:</property> + <property name="use_markup">True</property> + <property name="halign">center</property> + <layout> + <property name="top_attach">0</property> + <property name="left_attach">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkEntry" id="SubtitleTrackName"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Set the subtitle track name. + +Players may use this in the subtitle selection list.</property> + <property name="max_length">80</property> + <property name="width-chars">40</property> + <property name="activates_default">True</property> + <property name="truncate_multiline">True</property> + <signal name="changed" handler="subtitle_name_changed_cb" swapped="no"/> + <layout> + <property name="top_attach">1</property> + <property name="left_attach">1</property> + </layout> + </object> + </child> + </object> + </child> + <child> + <object class="GtkGrid" id="subtitle_import_grid"> + <property name="visible">True</property> + <property name="row-spacing">2</property> + <property name="can_focus">False</property> + <property name="column-spacing">4</property> + <child> + <object class="GtkLabel" id="import_lang_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Language</property> + <layout> + <property name="top-attach">0</property> + <property name="left-attach">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkLabel" id="srt_code_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Character Code</property> + <layout> + <property name="top-attach">0</property> + <property name="left-attach">2</property> + </layout> + </object> + </child> + <child> + <object class="GtkLabel" id="import_file_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">File:</property> + <property name="halign">end</property> + <layout> + <property name="top-attach">2</property> + <property name="left-attach">0</property> + </layout> + </object> + </child> + <child> + <object class="GtkLabel" id="import_offset_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Offset (ms)</property> + <layout> + <property name="top-attach">0</property> + <property name="left-attach">4</property> + </layout> + </object> + </child> + <child> + <object class="GtkComboBox" id="ImportLanguage"> + <property name="valign">GTK_ALIGN_CENTER</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Set the language of this subtitle. This value will be used by players in subtitle menus.</property> - <signal name="changed" handler="import_lang_changed_cb" swapped="no"/> - <layout> - <property name="top-attach">1</property> - <property name="left-attach">1</property> - </layout> - </object> - </child> - <child> - <object class="GtkComboBox" id="SrtCodeset"> - <property name="valign">GTK_ALIGN_FILL</property> - <property name="width_request">150</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">Set the character code used by the SRT file you are importing. + <signal name="changed" handler="import_lang_changed_cb" swapped="no"/> + <layout> + <property name="top-attach">1</property> + <property name="left-attach">1</property> + </layout> + </object> + </child> + <child> + <object class="GtkComboBox" id="SrtCodeset"> + <property name="valign">GTK_ALIGN_FILL</property> + <property name="width_request">150</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Set the character code used by the SRT file you are importing. SRTs come in all flavours of character sets. We translate the character set to UTF-8. The source's character code is needed in order to perform this translation.</property> - <signal name="changed" handler="srt_codeset_changed_cb" swapped="no"/> - <property name="has_entry">True</property> - <layout> - <property name="top-attach">1</property> - <property name="left-attach">2</property> - </layout> - <child internal-child="entry"> - <object class="GtkEntry" id="combobox-entry1"> - <property name="can_focus">True</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkFileChooserButton" id="ImportFile"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Select the SRT file to import.</property> - <property name="local_only">False</property> - <property name="hexpand">True</property> - <property name="title" translatable="yes">Import File</property> - <signal name="selection-changed" handler="import_file_changed_cb" swapped="no"/> - <layout> - <property name="top-attach">2</property> - <property name="left-attach">1</property> - <property name="column-span">2</property> - </layout> - </object> - </child> - <child> - <object class="GtkSpinButton" id="ImportOffset"> - <property name="valign">GTK_ALIGN_FILL</property> - <property name="vexpand">False</property> - <property name="width-chars">8</property> - <property name="visible">True</property> + <signal name="changed" handler="srt_codeset_changed_cb" swapped="no"/> + <property name="has_entry">True</property> + <layout> + <property name="top-attach">1</property> + <property name="left-attach">2</property> + </layout> + <child internal-child="entry"> + <object class="GtkEntry" id="combobox-entry1"> <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Adjust the offset in milliseconds between video and SRT timestamps</property> - <property name="adjustment">adjustment31</property> - <signal name="value-changed" handler="import_offset_changed_cb" swapped="no"/> - <layout> - <property name="top-attach">1</property> - <property name="left-attach">4</property> - </layout> </object> </child> </object> </child> <child> - <object class="GtkBox" id="subtitle_track_box"> - <property name="orientation">vertical</property> + <object class="GtkFileChooserButton" id="ImportFile"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkLabel" id="subtitle_track_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Track</property> - </object> - </child> - <child> - <object class="GtkComboBox" id="SubtitleTrack"> - <property name="valign">GTK_ALIGN_CENTER</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">List of subtitle tracks available from your source.</property> - <signal name="changed" handler="subtitle_track_changed_cb" swapped="no"/> - </object> - </child> + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Select the SRT file to import.</property> + <property name="local_only">False</property> + <property name="hexpand">True</property> + <property name="title" translatable="yes">Import File</property> + <signal name="selection-changed" handler="import_file_changed_cb" swapped="no"/> + <layout> + <property name="top-attach">2</property> + <property name="left-attach">1</property> + <property name="column-span">2</property> + </layout> </object> </child> <child> - <object class="GtkBox" id="subtitle_options_box"> - <property name="orientation">vertical</property> + <object class="GtkSpinButton" id="ImportOffset"> + <property name="valign">GTK_ALIGN_FILL</property> + <property name="vexpand">False</property> + <property name="width-chars">8</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="SubtitleForced"> - <property name="label" translatable="yes">Forced Subtitles Only</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Use only subtitles that have been flagged + <property name="can_focus">True</property> + <property name="tooltip_text" translatable="yes">Adjust the offset in milliseconds between video and SRT timestamps</property> + <property name="adjustment">adjustment31</property> + <signal name="value-changed" handler="import_offset_changed_cb" swapped="no"/> + <layout> + <property name="top-attach">1</property> + <property name="left-attach">4</property> + </layout> + </object> + </child> + </object> + </child> + <child> + <object class="GtkBox" id="subtitle_options_box"> + <property name="orientation">vertical</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_top">12</property> + <child> + <object class="GtkCheckButton" id="SubtitleForced"> + <property name="label" translatable="yes">Forced Subtitles Only</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Use only subtitles that have been flagged as forced in the source subtitle track "Forced" subtitles are usually used to show subtitles during scenes where someone is speaking a foreign language.</property> - <property name="halign">start</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="subtitle_forced_toggled_cb" swapped="no"/> - </object> - </child> - <child> - <object class="GtkCheckButton" id="SubtitleBurned"> - <property name="label" translatable="yes">Burn into video</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Render the subtitle over the video. + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="subtitle_forced_toggled_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkCheckButton" id="SubtitleBurned"> + <property name="label" translatable="yes">Burn into video</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Render the subtitle over the video. The subtitle will be part of the video and can not be disabled.</property> - <property name="halign">start</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="subtitle_burned_toggled_cb" swapped="no"/> - </object> - </child> - <child> - <object class="GtkCheckButton" id="SubtitleDefaultTrack"> - <property name="label" translatable="yes">Set Default Track</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">Set the default output subtitle track. + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="subtitle_burned_toggled_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkCheckButton" id="SubtitleDefaultTrack"> + <property name="label" translatable="yes">Set Default Track</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes">Set the default output subtitle track. Most players will automatically display this subtitle track whenever the video is played. This is useful for creating a "forced" track in your output.</property> - <property name="halign">start</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="subtitle_default_toggled_cb" swapped="no"/> - </object> - </child> + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="subtitle_default_toggled_cb" swapped="no"/> </object> </child> </object> diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c index fcf530cc7..684603895 100644 --- a/gtk/src/subtitlehandler.c +++ b/gtk/src/subtitlehandler.c @@ -27,6 +27,7 @@ #include "hb.h" #include "settings.h" #include "jobdict.h" +#include "titledict.h" #include "hb-backend.h" #include "values.h" #include "callbacks.h" @@ -428,7 +429,6 @@ subtitle_get_track_description(GhbValue *settings, GhbValue *subsettings) static GhbValue* subtitle_add_track( signal_user_data_t *ud, GhbValue *settings, - const hb_title_t *title, int track, int mux, gboolean default_track, @@ -437,10 +437,14 @@ static GhbValue* subtitle_add_track( gboolean burn, gboolean *burned) { + const char * name = NULL; if (track >= 0 && !import) { - hb_subtitle_t *subtitle = hb_list_item(title->list_subtitle, track); - source = subtitle->source; + GhbValue * strack; + + strack = ghb_get_title_subtitle_track(settings, track); + source = ghb_dict_get_int(strack, "Source"); + name = ghb_dict_get_string(strack, "Name"); } burn |= !hb_subtitle_can_pass(source, mux); @@ -474,6 +478,10 @@ static GhbValue* subtitle_add_track( g_free(filename); } + if (name != NULL && name[0] != 0) + { + ghb_dict_set_string(subsettings, "Name", name); + } ghb_dict_set_int(subsettings, "Track", track); ghb_dict_set_int(subsettings, "Offset", 0); ghb_dict_set_bool(subsettings, "Forced", track == -1); @@ -640,14 +648,26 @@ subtitle_update_dialog_widgets(signal_user_data_t *ud, GhbValue *subsettings) import = ghb_dict_get(subsettings, "Import"); source = get_sub_source(ud->settings, subsettings); - val = ghb_dict_get(subsettings, "Track"); + val = ghb_dict_get_value(subsettings, "Name"); + if (val != NULL) + { + ghb_ui_update(ud, "SubtitleTrackName", val); + } + else + { + ghb_ui_update(ud, "SubtitleTrackName", ghb_string_value("")); + } + + val = ghb_dict_get(subsettings, "Track"); if (val != NULL) { ghb_ui_update(ud, "SubtitleTrack", val); // Hide regular subtitle widgets - widget = GHB_WIDGET(ud->builder, "subtitle_track_box"); + widget = GHB_WIDGET(ud->builder, "subtitle_track_label"); + gtk_widget_set_visible(widget, import == NULL); + widget = GHB_WIDGET(ud->builder, "SubtitleTrack"); gtk_widget_set_visible(widget, import == NULL); // Show import subitle widgets @@ -665,7 +685,9 @@ subtitle_update_dialog_widgets(signal_user_data_t *ud, GhbValue *subsettings) else { // Hide widgets not needed for "Foreign audio search" - widget = GHB_WIDGET(ud->builder, "subtitle_track_box"); + widget = GHB_WIDGET(ud->builder, "subtitle_track_label"); + gtk_widget_set_visible(widget, FALSE); + widget = GHB_WIDGET(ud->builder, "SubtitleTrack"); gtk_widget_set_visible(widget, FALSE); widget = GHB_WIDGET(ud->builder, "subtitle_import_grid"); @@ -742,7 +764,9 @@ subtitle_update_dialog_widgets(signal_user_data_t *ud, GhbValue *subsettings) gtk_widget_set_visible(widget, FALSE); // Show regular subtitle widgets - widget = GHB_WIDGET(ud->builder, "subtitle_track_box"); + widget = GHB_WIDGET(ud->builder, "subtitle_track_label"); + gtk_widget_set_visible(widget, TRUE); + widget = GHB_WIDGET(ud->builder, "SubtitleTrack"); gtk_widget_set_visible(widget, TRUE); } } @@ -784,6 +808,21 @@ subtitle_track_changed_cb(GtkWidget *widget, signal_user_data_t *ud) } G_MODULE_EXPORT void +subtitle_name_changed_cb(GtkWidget *widget, signal_user_data_t *ud) +{ + ghb_widget_to_setting(ud->settings, widget); + const char *s = ghb_dict_get_string(ud->settings, "SubtitleTrackName"); + if (s != NULL && s[0] != 0) + { + subtitle_update_setting(ghb_widget_value(widget), "Name", ud); + } + else + { + subtitle_update_setting(NULL, "Name", ud); + } +} + +G_MODULE_EXPORT void subtitle_forced_toggled_cb(GtkWidget *widget, signal_user_data_t *ud) { ghb_widget_to_setting(ud->settings, widget); @@ -1129,13 +1168,13 @@ subtitle_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) for (subsettings = NULL, track = 0; subsettings == NULL && track < count; track++) { - subsettings = subtitle_add_track(ud, ud->settings, title, track, + subsettings = subtitle_add_track(ud, ud->settings, track, mux->format, FALSE, FALSE, VOBSUB, FALSE, &one_burned); } if (subsettings == NULL) { - subsettings = subtitle_add_track(ud, ud->settings, title, 0, + subsettings = subtitle_add_track(ud, ud->settings, 0, mux->format, FALSE, TRUE, IMPORTSRT, FALSE, &one_burned); } @@ -1247,7 +1286,7 @@ subtitle_add_all_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) int count = hb_list_count(title->list_subtitle); for (track = 0; track < count; track++) { - subtitle_add_track(ud, ud->settings, title, track, mux->format, + subtitle_add_track(ud, ud->settings, track, mux->format, FALSE, FALSE, VOBSUB, FALSE, &one_burned); } subtitle_refresh_list_ui(ud); |