forked from openlp/openlp
Fix dvd clip selection. Pretty much coppied from lp:~mikey74/openlp/dvdplayerfix/
Fixes: https://launchpad.net/bugs/1514545
This commit is contained in:
parent
29f7d8967f
commit
572e1efb9c
@ -507,9 +507,9 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
controller.media_info.media_type = MediaType.CD
|
controller.media_info.media_type = MediaType.CD
|
||||||
else:
|
else:
|
||||||
controller.media_info.media_type = MediaType.DVD
|
controller.media_info.media_type = MediaType.DVD
|
||||||
controller.media_info.start_time = start // 1000
|
controller.media_info.start_time = start
|
||||||
controller.media_info.end_time = end // 1000
|
controller.media_info.end_time = end
|
||||||
controller.media_info.length = (end - start) // 1000
|
controller.media_info.length = (end - start)
|
||||||
controller.media_info.title_track = title
|
controller.media_info.title_track = title
|
||||||
controller.media_info.audio_track = audio_track
|
controller.media_info.audio_track = audio_track
|
||||||
controller.media_info.subtitle_track = subtitle_track
|
controller.media_info.subtitle_track = subtitle_track
|
||||||
|
@ -280,7 +280,8 @@ class VlcPlayer(MediaPlayer):
|
|||||||
start_time = controller.media_info.start_time
|
start_time = controller.media_info.start_time
|
||||||
log.debug('mediatype: ' + str(controller.media_info.media_type))
|
log.debug('mediatype: ' + str(controller.media_info.media_type))
|
||||||
# Set tracks for the optical device
|
# 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')
|
log.debug('vlc play, playing started')
|
||||||
if controller.media_info.title_track > 0:
|
if controller.media_info.title_track > 0:
|
||||||
log.debug('vlc play, title_track set: ' + str(controller.media_info.title_track))
|
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 \
|
if display.controller.media_info.media_type == MediaType.CD \
|
||||||
or display.controller.media_info.media_type == MediaType.DVD:
|
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():
|
if display.vlc_media_player.is_seekable():
|
||||||
display.vlc_media_player.set_time(seek_value)
|
display.vlc_media_player.set_time(seek_value)
|
||||||
|
|
||||||
@ -386,15 +387,15 @@ class VlcPlayer(MediaPlayer):
|
|||||||
self.stop(display)
|
self.stop(display)
|
||||||
controller = display.controller
|
controller = display.controller
|
||||||
if controller.media_info.end_time > 0:
|
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.stop(display)
|
||||||
self.set_visible(display, False)
|
self.set_visible(display, False)
|
||||||
if not controller.seek_slider.isSliderDown():
|
if not controller.seek_slider.isSliderDown():
|
||||||
controller.seek_slider.blockSignals(True)
|
controller.seek_slider.blockSignals(True)
|
||||||
if display.controller.media_info.media_type == MediaType.CD \
|
if display.controller.media_info.media_type == MediaType.CD \
|
||||||
or display.controller.media_info.media_type == MediaType.DVD:
|
or display.controller.media_info.media_type == MediaType.DVD:
|
||||||
controller.seek_slider.setSliderPosition(display.vlc_media_player.get_time() -
|
controller.seek_slider.setSliderPosition(
|
||||||
int(display.controller.media_info.start_time * 1000))
|
display.vlc_media_player.get_time() - int(display.controller.media_info.start_time))
|
||||||
else:
|
else:
|
||||||
controller.seek_slider.setSliderPosition(display.vlc_media_player.get_time())
|
controller.seek_slider.setSliderPosition(display.vlc_media_player.get_time())
|
||||||
controller.seek_slider.blockSignals(False)
|
controller.seek_slider.blockSignals(False)
|
||||||
|
@ -110,7 +110,7 @@ class MediaClipSelectorForm(QtWidgets.QDialog, Ui_MediaClipSelector, RegistryPro
|
|||||||
self.subtitle_tracks_combobox.clear()
|
self.subtitle_tracks_combobox.clear()
|
||||||
self.audio_tracks_combobox.clear()
|
self.audio_tracks_combobox.clear()
|
||||||
self.titles_combo_box.clear()
|
self.titles_combo_box.clear()
|
||||||
time = QtCore.QTime()
|
time = QtCore.QTime(0, 0, 0)
|
||||||
self.start_position_edit.setTime(time)
|
self.start_position_edit.setTime(time)
|
||||||
self.end_timeedit.setTime(time)
|
self.end_timeedit.setTime(time)
|
||||||
self.position_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.
|
:param clicked: Given from signal, not used.
|
||||||
"""
|
"""
|
||||||
vlc_ms_pos = self.vlc_media_player.get_time()
|
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)
|
new_pos_time = time.addMSecs(vlc_ms_pos)
|
||||||
self.start_position_edit.setTime(new_pos_time)
|
self.start_position_edit.setTime(new_pos_time)
|
||||||
# If start time is after end time, update end 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.
|
:param clicked: Given from signal, not used.
|
||||||
"""
|
"""
|
||||||
vlc_ms_pos = self.vlc_media_player.get_time()
|
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)
|
new_pos_time = time.addMSecs(vlc_ms_pos)
|
||||||
self.end_timeedit.setTime(new_pos_time)
|
self.end_timeedit.setTime(new_pos_time)
|
||||||
# If start time is after end time, update start 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)
|
self.position_slider.setMaximum(self.playback_length)
|
||||||
# setup start and end time
|
# setup start and end time
|
||||||
rounded_vlc_ms_length = int(round(self.playback_length / 100.0) * 100.0)
|
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)
|
playback_length_time = time.addMSecs(rounded_vlc_ms_length)
|
||||||
self.start_position_edit.setMaximumTime(playback_length_time)
|
self.start_position_edit.setMaximumTime(playback_length_time)
|
||||||
self.end_timeedit.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:
|
if self.vlc_media_player:
|
||||||
vlc_ms_pos = self.vlc_media_player.get_time()
|
vlc_ms_pos = self.vlc_media_player.get_time()
|
||||||
rounded_vlc_ms_pos = int(round(vlc_ms_pos / 100.0) * 100.0)
|
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)
|
new_pos_time = time.addMSecs(rounded_vlc_ms_pos)
|
||||||
self.position_timeedit.setTime(new_pos_time)
|
self.position_timeedit.setTime(new_pos_time)
|
||||||
self.position_slider.setSliderPosition(vlc_ms_pos)
|
self.position_slider.setSliderPosition(vlc_ms_pos)
|
||||||
|
@ -269,10 +269,9 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
|||||||
service_item.add_from_command(filename, name, CLAPPERBOARD)
|
service_item.add_from_command(filename, name, CLAPPERBOARD)
|
||||||
service_item.title = clip_name
|
service_item.title = clip_name
|
||||||
# Set the length
|
# 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)
|
||||||
service_item.set_media_length((end - start) / 1000)
|
service_item.start_time = start
|
||||||
service_item.start_time = start / 1000
|
service_item.end_time = end
|
||||||
service_item.end_time = end / 1000
|
|
||||||
service_item.add_capability(ItemCapabilities.IsOptical)
|
service_item.add_capability(ItemCapabilities.IsOptical)
|
||||||
else:
|
else:
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
|
Loading…
Reference in New Issue
Block a user