Fix dvd clip selection. Pretty much coppied from lp:~mikey74/openlp/dvdplayerfix/

Fixes: https://launchpad.net/bugs/1514545
This commit is contained in:
Phill Ridout 2017-11-22 21:56:56 +00:00
parent 29f7d8967f
commit 572e1efb9c
4 changed files with 17 additions and 17 deletions

View File

@ -507,9 +507,9 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
controller.media_info.media_type = MediaType.CD
else:
controller.media_info.media_type = MediaType.DVD
controller.media_info.start_time = start // 1000
controller.media_info.end_time = end // 1000
controller.media_info.length = (end - start) // 1000
controller.media_info.start_time = start
controller.media_info.end_time = end
controller.media_info.length = (end - start)
controller.media_info.title_track = title
controller.media_info.audio_track = audio_track
controller.media_info.subtitle_track = subtitle_track

View File

@ -280,7 +280,8 @@ class VlcPlayer(MediaPlayer):
start_time = controller.media_info.start_time
log.debug('mediatype: ' + str(controller.media_info.media_type))
# Set tracks for the optical device
if controller.media_info.media_type == MediaType.DVD:
if controller.media_info.media_type == MediaType.DVD and \
self.get_live_state() != MediaState.Paused and self.get_preview_state() != MediaState.Paused:
log.debug('vlc play, playing started')
if controller.media_info.title_track > 0:
log.debug('vlc play, title_track set: ' + str(controller.media_info.title_track))
@ -350,7 +351,7 @@ class VlcPlayer(MediaPlayer):
"""
if display.controller.media_info.media_type == MediaType.CD \
or display.controller.media_info.media_type == MediaType.DVD:
seek_value += int(display.controller.media_info.start_time * 1000)
seek_value += int(display.controller.media_info.start_time)
if display.vlc_media_player.is_seekable():
display.vlc_media_player.set_time(seek_value)
@ -386,15 +387,15 @@ class VlcPlayer(MediaPlayer):
self.stop(display)
controller = display.controller
if controller.media_info.end_time > 0:
if display.vlc_media_player.get_time() > controller.media_info.end_time * 1000:
if display.vlc_media_player.get_time() > controller.media_info.end_time:
self.stop(display)
self.set_visible(display, False)
if not controller.seek_slider.isSliderDown():
controller.seek_slider.blockSignals(True)
if display.controller.media_info.media_type == MediaType.CD \
or display.controller.media_info.media_type == MediaType.DVD:
controller.seek_slider.setSliderPosition(display.vlc_media_player.get_time() -
int(display.controller.media_info.start_time * 1000))
controller.seek_slider.setSliderPosition(
display.vlc_media_player.get_time() - int(display.controller.media_info.start_time))
else:
controller.seek_slider.setSliderPosition(display.vlc_media_player.get_time())
controller.seek_slider.blockSignals(False)

View File

@ -110,7 +110,7 @@ class MediaClipSelectorForm(QtWidgets.QDialog, Ui_MediaClipSelector, RegistryPro
self.subtitle_tracks_combobox.clear()
self.audio_tracks_combobox.clear()
self.titles_combo_box.clear()
time = QtCore.QTime()
time = QtCore.QTime(0, 0, 0)
self.start_position_edit.setTime(time)
self.end_timeedit.setTime(time)
self.position_timeedit.setTime(time)
@ -295,7 +295,7 @@ class MediaClipSelectorForm(QtWidgets.QDialog, Ui_MediaClipSelector, RegistryPro
:param clicked: Given from signal, not used.
"""
vlc_ms_pos = self.vlc_media_player.get_time()
time = QtCore.QTime()
time = QtCore.QTime(0, 0, 0)
new_pos_time = time.addMSecs(vlc_ms_pos)
self.start_position_edit.setTime(new_pos_time)
# If start time is after end time, update end time.
@ -311,7 +311,7 @@ class MediaClipSelectorForm(QtWidgets.QDialog, Ui_MediaClipSelector, RegistryPro
:param clicked: Given from signal, not used.
"""
vlc_ms_pos = self.vlc_media_player.get_time()
time = QtCore.QTime()
time = QtCore.QTime(0, 0, 0)
new_pos_time = time.addMSecs(vlc_ms_pos)
self.end_timeedit.setTime(new_pos_time)
# If start time is after end time, update start time.
@ -448,7 +448,7 @@ class MediaClipSelectorForm(QtWidgets.QDialog, Ui_MediaClipSelector, RegistryPro
self.position_slider.setMaximum(self.playback_length)
# setup start and end time
rounded_vlc_ms_length = int(round(self.playback_length / 100.0) * 100.0)
time = QtCore.QTime()
time = QtCore.QTime(0, 0, 0)
playback_length_time = time.addMSecs(rounded_vlc_ms_length)
self.start_position_edit.setMaximumTime(playback_length_time)
self.end_timeedit.setMaximumTime(playback_length_time)
@ -506,7 +506,7 @@ class MediaClipSelectorForm(QtWidgets.QDialog, Ui_MediaClipSelector, RegistryPro
if self.vlc_media_player:
vlc_ms_pos = self.vlc_media_player.get_time()
rounded_vlc_ms_pos = int(round(vlc_ms_pos / 100.0) * 100.0)
time = QtCore.QTime()
time = QtCore.QTime(0, 0, 0)
new_pos_time = time.addMSecs(rounded_vlc_ms_pos)
self.position_timeedit.setTime(new_pos_time)
self.position_slider.setSliderPosition(vlc_ms_pos)

View File

@ -269,10 +269,9 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
service_item.add_from_command(filename, name, CLAPPERBOARD)
service_item.title = clip_name
# Set the length
#self.media_controller.media_setup_optical(name, title, audio_track, subtitle_track, start, end, None, None)
service_item.set_media_length((end - start) / 1000)
service_item.start_time = start / 1000
service_item.end_time = end / 1000
service_item.set_media_length(end - start)
service_item.start_time = start
service_item.end_time = end
service_item.add_capability(ItemCapabilities.IsOptical)
else:
if not os.path.exists(filename):