Commit 5c6b9864 authored by Sergio Costas's avatar Sergio Costas

Added experimental support for 16:9 menues

parent e70bca51
......@@ -2,6 +2,7 @@
* version 4.11.0 (2018-05-01)
* Added support for XFBurn
* Added experimental support for 16:9 menues
* version 4.10.0 (2018-04-29)
* Now, when using a custom audio in the menu, it will last the whole audio duration, not 30 seconds
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAdjustment" id="margin_bottom">
......@@ -39,6 +39,9 @@
<property name="modal">True</property>
<property name="window_position">center</property>
<property name="deletable">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
......@@ -257,7 +260,7 @@
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
......@@ -321,7 +324,7 @@
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
......@@ -424,6 +427,71 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkRadioButton" id="menu_aspect_4_3">
<property name="label" translatable="yes">4:3 (classic)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="menu_aspect_16_9">
<property name="label" translatable="yes">16:9 (widescreen)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">menu_aspect_4_3</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Menu aspect&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
......@@ -579,7 +647,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
<child>
......@@ -623,7 +691,7 @@
<property name="preview_text"/>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
......@@ -752,7 +820,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
<child>
......@@ -857,7 +925,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
<property name="position">6</property>
</packing>
</child>
<child>
......@@ -948,7 +1016,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">7</property>
</packing>
</child>
</object>
......@@ -990,7 +1058,7 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
......
......@@ -494,7 +494,7 @@ class avconv(devedeng.avbase.avbase):
self.command_var.append(output_file)
def create_menu_mpeg(self, n_page, background_music, sound_length, pal, video_rate, audio_rate, output_path, use_mp2):
def create_menu_mpeg(self, n_page, background_music, sound_length, pal, video_rate, audio_rate, output_path, use_mp2, widescreen):
self.n_page = n_page
self.final_length = float(sound_length)
......@@ -539,7 +539,10 @@ class avconv(devedeng.avbase.avbase):
self.command_var.append("-b:a")
self.command_var.append(str(audio_rate) + "k")
self.command_var.append("-aspect")
self.command_var.append("4:3")
if widescreen:
self.command_var.append("16:9")
else:
self.command_var.append("4:3")
self.command_var.append("-t")
self.command_var.append(str(1 + sound_length))
......
......@@ -34,8 +34,7 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
devedeng.interface_manager.interface_manager.__init__(self)
self.config = devedeng.configuration_data.configuration.get_config()
self.default_background = os.path.join(
self.config.pic_path, "backgrounds", "default_bg.png")
self.default_background = os.path.join(self.config.pic_path, "backgrounds", "default_bg.png")
self.default_sound = os.path.join(self.config.pic_path, "silence.ogg")
self.add_colorbutton("title_color", (0, 0, 0, 1), self.update_preview)
......@@ -52,10 +51,9 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
self.add_text("playall_text", _("Play all"), self.update_preview)
self.add_group("position_horizontal", [
"left", "center", "right"], "center", self.update_preview)
self.add_group("at_startup", [
"menu_show_at_startup", "play_first_title_at_startup"], "menu_show_at_startup")
self.add_group("position_horizontal", ["left", "center", "right"], "center", self.update_preview)
self.add_group("at_startup", ["menu_show_at_startup", "play_first_title_at_startup"], "menu_show_at_startup")
self.add_group("menu_aspect_ratio", ["menu_aspect_4_3", "menu_aspect_16_9"], "menu_aspect_4_3", self.on_menu_aspect_changed)
self.add_toggle("play_all_c", False, self.update_preview)
self.add_integer_adjustment("sound_length", 30)
......@@ -72,10 +70,8 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
self.add_fontbutton("title_font", "Sans 28", self.update_preview)
self.add_fontbutton("entry_font", "Sans 28", self.update_preview)
self.add_filebutton("background_picture",
self.default_background, self.update_preview)
self.add_filebutton("background_music",
self.default_sound, self.update_music)
self.add_filebutton("background_picture", self.default_background, self.update_preview)
self.add_filebutton("background_music", self.default_sound, self.update_music)
self.cached_menu_font = None
self.cached_menu_size = 0
......@@ -346,13 +342,20 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
coordinates = []
if self.sf is None:
self.sf = cairo.ImageSurface(cairo.FORMAT_ARGB32, 720, int(self.y))
if self.to_png:
self.sf = cairo.ImageSurface(cairo.FORMAT_ARGB32, 720, int(self.y))
else:
self.sf = cairo.ImageSurface(cairo.FORMAT_ARGB32, 720, 540)
self.cr = cairo.Context(self.sf)
if not self.to_png:
if self.menu_aspect_ratio == "menu_aspect_16_9":
self.cr.scale(1.0,405.0 / self.y)
else:
self.cr.scale(1.0,540.0 / self.y)
if self.cached_menu_font != self.entry_font:
# memorize the font sizes
(fontname, fontstyle, fontslant,
fontsize) = self.get_font_params(self.entry_font)
(fontname, fontstyle, fontslant, fontsize) = self.get_font_params(self.entry_font)
self.cr.select_font_face(fontname, fontslant, fontstyle)
self.cr.set_font_size(fontsize)
extents = self.cr.font_extents()
......@@ -360,35 +363,27 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
self.cached_menu_font = self.entry_font
if paint_background:
extra_pixbuf = GdkPixbuf.Pixbuf.new_from_file(
self.background_picture)
extra_pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.background_picture)
extra_x = float(extra_pixbuf.get_width())
extra_y = float(extra_pixbuf.get_height())
self.cr.save()
self.cr.scale(720.0 / extra_x, self.y / extra_y)
surface = Gdk.cairo_surface_create_from_pixbuf(
extra_pixbuf, 1, None)
surface = Gdk.cairo_surface_create_from_pixbuf(extra_pixbuf, 1, None)
self.cr.set_source_surface(surface, 0, 0)
self.cr.paint()
self.cr.restore()
hmargin = self.title_horizontal * 720.0 / 100.0
self.write_text(self.title_text, "title", 0 + hmargin, 720 +
hmargin, self.title_vertical * self.y / 100.0, "center")
# else:
# self.cr.set_source_rgb(1.0,1.0,1.0)
# self.cr.paint()
self.write_text(self.title_text, "title", 0 + hmargin, 720 + hmargin, self.title_vertical * self.y / 100.0, "center")
top_margin_p = self.y * self.margin_top / 100.0
bottom_margin_p = self.y * self.margin_bottom / 100.0
left_margin_p = 720.0 * self.margin_left / 100.0
right_margin_p = 720.0 * self.margin_right / 100.0
entry_height = self.cached_menu_size + \
self.entry_vertical_margin * 2.0 + self.entry_separation
entries_per_page = int(
(self.y - top_margin_p - bottom_margin_p) / entry_height)
entry_height = self.cached_menu_size + self.entry_vertical_margin * 2.0 + self.entry_separation
entries_per_page = int((self.y - top_margin_p - bottom_margin_p) / entry_height)
if (self.play_all_c):
entries_per_page -= 1
n_entries = len(self.title_list)
......@@ -518,13 +513,16 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
self.current_shown_page = 0
self.update_preview()
def on_menu_aspect_changed(self, b=None):
self.update_preview()
def on_drawingarea_preview_draw(self, widget, cr):
""" Callback to repaint the menu preview window when it
sends the EXPOSE event """
if (self.sf is None):
self.paint_menu(True, self.wshow_as_selected.get_active(
), False, self.current_shown_page)
self.to_png = False
self.paint_menu(True, self.wshow_as_selected.get_active(), False, self.current_shown_page)
if (self.current_shown_page >= self.pages):
self.current_shown_page = self.pages
......@@ -544,12 +542,9 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
# transparent="000000"')
xml_file.write(
'<subpictures>\n\t<stream>\n\t\t<spu force="yes" start="00:00:00.00"')
xml_file.write(' image="' + os.path.join(path, "menu_" +
str(n_page) + '_unselected_bg.png"'))
xml_file.write(' highlight="' + os.path.join(path,
"menu_" + str(n_page) + '_selected_bg.png"'))
xml_file.write(' select="' + os.path.join(path,
"menu_" + str(n_page) + '_active_bg.png"'))
xml_file.write(' image="' + os.path.join(path, "menu_" + str(n_page) + '_unselected_bg.png"'))
xml_file.write(' highlight="' + os.path.join(path, "menu_" + str(n_page) + '_selected_bg.png"'))
xml_file.write(' select="' + os.path.join(path, "menu_" + str(n_page) + '_active_bg.png"'))
xml_file.write(' >\n')
n_elements = 0
has_next = False
......@@ -637,26 +632,21 @@ class dvd_menu(devedeng.interface_manager.interface_manager):
menu_converter = cv.get_menu_converter()
while n_page < self.pages:
self.sf = None
self.to_png = True
coordinates = self.paint_menu(True, False, False, n_page)
self.sf.write_to_png(os.path.join(
menu_folder, "menu_" + str(n_page) + "_bg.png"))
self.sf.write_to_png(os.path.join(menu_folder, "menu_" + str(n_page) + "_bg.png"))
self.sf = None
self.paint_menu(False, False, False, n_page)
self.sf.write_to_png(os.path.join(
menu_folder, "menu_" + str(n_page) + "_unselected_bg.png"))
self.sf.write_to_png(os.path.join(menu_folder, "menu_" + str(n_page) + "_unselected_bg.png"))
self.sf = None
self.paint_menu(False, True, False, n_page)
self.sf.write_to_png(os.path.join(
menu_folder, "menu_" + str(n_page) + "_selected_bg.png"))
self.sf.write_to_png(os.path.join(menu_folder, "menu_" + str(n_page) + "_selected_bg.png"))
self.sf = None
self.paint_menu(False, False, True, n_page)
self.sf.write_to_png(os.path.join(
menu_folder, "menu_" + str(n_page) + "_active_bg.png"))
entry_data = self.create_menu_stream(
menu_folder, n_page, coordinates)
self.sf.write_to_png(os.path.join(menu_folder, "menu_" + str(n_page) + "_active_bg.png"))
entry_data = self.create_menu_stream(menu_folder, n_page, coordinates)
converter = menu_converter()
final_path = converter.create_menu_mpeg(
n_page, self.background_music, self.sound_length, self.config.PAL, self.video_rate, self.audio_rate, menu_folder, self.audio_mp2)
final_path = converter.create_menu_mpeg(n_page, self.background_music, self.sound_length, self.config.PAL, self.video_rate, self.audio_rate, menu_folder, self.audio_mp2, self.menu_aspect_ratio == "menu_aspect_16_9")
entry_data["filename"] = final_path
menu_entries.append(entry_data)
# add this process without dependencies
......
......@@ -29,7 +29,7 @@ class dvdauthor_converter(devedeng.executor.executor):
devedeng.executor.executor.__init__(self)
self.config = devedeng.configuration_data.configuration.get_config()
def create_dvd_project(self, path, name, file_movies, menu_entries, start_with_menu, play_all_opt):
def create_dvd_project(self, path, name, file_movies, menu_entries, start_with_menu, play_all_opt, menuWide):
movie_path = os.path.join(path, "dvd_tree")
try:
......@@ -37,8 +37,7 @@ class dvdauthor_converter(devedeng.executor.executor):
except:
pass
xml_file = self.create_dvdauthor_xml(
path, file_movies, menu_entries, start_with_menu, play_all_opt)
xml_file = self.create_dvdauthor_xml(path, file_movies, menu_entries, start_with_menu, play_all_opt, menuWide)
self.command_var = []
self.command_var.append("dvdauthor")
......@@ -57,7 +56,7 @@ class dvdauthor_converter(devedeng.executor.executor):
self.progress_bar[1].set_text(data[0])
return
def create_dvdauthor_xml(self, movie_folder, file_movies, menu_entries, start_with_menu, play_all_opt):
def create_dvdauthor_xml(self, movie_folder, file_movies, menu_entries, start_with_menu, play_all_opt, menuWide):
xmlpath = os.path.join(movie_folder, "xml_data")
xml_file_path = os.path.join(xmlpath, "dvdauthor.xml")
......@@ -89,7 +88,11 @@ class dvdauthor_converter(devedeng.executor.executor):
xml_file.write("pal")
else:
xml_file.write("ntsc")
xml_file.write('" aspect="4:3"> </video>\n')
if menuWide:
xml_file.write('" aspect="16:9"> ')
else:
xml_file.write('" aspect="4:3"> ')
xml_file.write('</video>\n')
xml_file.write("\t\t</menus>\n")
xml_file.write('\t</vmgm>\n')
else:
......@@ -128,7 +131,11 @@ class dvdauthor_converter(devedeng.executor.executor):
xml_file.write("pal")
else:
xml_file.write("ntsc")
xml_file.write('" aspect="4:3"> </video>\n')
if menuWide:
xml_file.write('" aspect="16:9"> ')
else:
xml_file.write('" aspect="4:3"> ')
xml_file.write('</video>\n')
xml_file.write('\t\t\t<pgc>\n')
xml_file.write('\t\t\t\t<pre>\n')
......@@ -149,12 +156,16 @@ class dvdauthor_converter(devedeng.executor.executor):
# 100% compatibility
xml_file.write('\t\t\t\t<vob file="')
if self.config.PAL:
xml_file.write(self.expand_xml(
str(os.path.join(self.config.other_path, "base_pal.mpg"))))
if menuWide:
if self.config.PAL:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_pal_wide.mpg"))))
else:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_ntsc_wide.mpg"))))
else:
xml_file.write(self.expand_xml(
str(os.path.join(self.config.other_path, "base_ntsc.mpg"))))
if self.config.PAL:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_pal.mpg"))))
else:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_ntsc.mpg"))))
xml_file.write('"></vob>\n')
xml_file.write('\t\t\t</pgc>\n')
......@@ -173,7 +184,11 @@ class dvdauthor_converter(devedeng.executor.executor):
xml_file.write("pal")
else:
xml_file.write("ntsc")
xml_file.write('" aspect="4:3"> </video>\n')
if menuWide:
xml_file.write('" aspect="16:9"> ')
else:
xml_file.write('" aspect="4:3"> ')
xml_file.write('</video>\n')
first_entry = True
menu_number = 0
......@@ -275,12 +290,16 @@ class dvdauthor_converter(devedeng.executor.executor):
xml_file.write('\t\t\t\t</pre>\n')
xml_file.write('\t\t\t\t<vob file="')
if self.config.PAL:
xml_file.write(self.expand_xml(
str(os.path.join(self.config.other_path, "base_pal.mpg"))))
if menuWide:
if self.config.PAL:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_pal_wide.mpg"))))
else:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_ntsc_wide.mpg"))))
else:
xml_file.write(self.expand_xml(
str(os.path.join(self.config.other_path, "base_ntsc.mpg"))))
if self.config.PAL:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_pal.mpg"))))
else:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_ntsc.mpg"))))
xml_file.write('"></vob>\n')
xml_file.write('\t\t\t\t<post>\n')
......@@ -298,15 +317,23 @@ class dvdauthor_converter(devedeng.executor.executor):
xml_file.write("pal")
else:
xml_file.write("ntsc")
xml_file.write('" aspect="4:3"> </video>\n')
if menuWide:
xml_file.write('" aspect="16:9"> ')
else:
xml_file.write('" aspect="4:3"> ')
xml_file.write('</video>\n')
xml_file.write('\t\t\t<pgc>\n')
xml_file.write('\t\t\t\t<vob file="')
if self.config.PAL:
xml_file.write(self.expand_xml(
str(os.path.join(self.config.other_path, "base_pal.mpg"))))
if menuWide:
if self.config.PAL:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_pal_wide.mpg"))))
else:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_ntsc_wide.mpg"))))
else:
xml_file.write(self.expand_xml(
str(os.path.join(self.config.other_path, "base_ntsc.mpg"))))
if self.config.PAL:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_pal.mpg"))))
else:
xml_file.write(self.expand_xml(str(os.path.join(self.config.other_path, "base_ntsc.mpg"))))
xml_file.write('"></vob>\n')
xml_file.write('\t\t\t\t<post>\n')
xml_file.write('\t\t\t\t\tg0=1;\n')
......
......@@ -489,7 +489,7 @@ class ffmpeg(devedeng.executor.executor):
self.command_var.append(output_file)
def create_menu_mpeg(self, n_page, background_music, sound_length, pal, video_rate, audio_rate, output_path, use_mp2):
def create_menu_mpeg(self, n_page, background_music, sound_length, pal, video_rate, audio_rate, output_path, use_mp2, widescreen):
self.n_page = n_page
self.final_length = float(sound_length)
......@@ -534,7 +534,10 @@ class ffmpeg(devedeng.executor.executor):
self.command_var.append("-b:a")
self.command_var.append(str(audio_rate) + "k")
self.command_var.append("-aspect")
self.command_var.append("4:3")
if widescreen:
self.command_var.append("16:9")
else:
self.command_var.append("4:3")
self.command_var.append("-t")
self.command_var.append(str(1 + sound_length))
......
......@@ -38,8 +38,7 @@ class mux_dvd_menu(devedeng.executor.executor):
self.command_var = []
self.command_var.append("spumux")
self.command_var.append(os.path.join(
output_path, "menu_" + str(n_page) + ".xml"))
self.command_var.append(os.path.join(output_path, "menu_" + str(n_page) + ".xml"))
self.stdin_file = movie_path
self.stdout_file = final_path
......
......@@ -491,8 +491,7 @@ class devede_project:
file_movies = self.get_all_files()
t = len(file_movies)
if (max_files != -1) and (t > max_files):
devedeng.message.message_window(_("The limit for this format is %(l)d files, but your project has %(h)d.") % {
"l": max_files, "h": t}, _("Too many files in the project"))
devedeng.message.message_window(_("The limit for this format is %(l)d files, but your project has %(h)d.") % {"l": max_files, "h": t}, _("Too many files in the project"))
return
data = devedeng.create_disk_window.create_disk_window()
......@@ -532,8 +531,7 @@ class devede_project:
final_dependencies = []
if (self.disc_type == "dvd") and (self.wcreate_menu.get_active()):
processes, menu_entries = self.menu.create_dvd_menus(
file_movies, data.path)
processes, menu_entries = self.menu.create_dvd_menus(file_movies, data.path)
for p in processes:
run_window.add_process(p)
final_dependencies.append(p)
......@@ -565,8 +563,7 @@ class devede_project:
else:
start_with_menu = False
dvdauthor = devedeng.dvdauthor_converter.dvdauthor_converter()
dvdauthor.create_dvd_project(
data.path, data.name, file_movies, menu_entries, start_with_menu, self.menu.play_all_c)
dvdauthor.create_dvd_project(data.path, data.name, file_movies, menu_entries, start_with_menu, self.menu.play_all_c, self.menu.menu_aspect_ratio == "menu_aspect_16_9")
# dvdauthor must wait until all the files have been converted
for element in final_dependencies:
dvdauthor.add_dependency(element)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment