forked from openlp/openlp
streaming works
This commit is contained in:
parent
e68af29694
commit
2b4842b20d
@ -230,7 +230,7 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
if controller.is_live:
|
if controller.is_live:
|
||||||
# if this is an optical device use special handling
|
# if this is an optical device use special handling
|
||||||
if service_item.is_capable(ItemCapabilities.CanStream):
|
if service_item.is_capable(ItemCapabilities.CanStream):
|
||||||
is_valid = self._check_file_type(controller, display)
|
is_valid = self._check_file_type(controller, display, True)
|
||||||
controller.media_info.media_type = MediaType.Stream
|
controller.media_info.media_type = MediaType.Stream
|
||||||
elif service_item.is_capable(ItemCapabilities.IsOptical):
|
elif service_item.is_capable(ItemCapabilities.IsOptical):
|
||||||
log.debug('video is optical and live')
|
log.debug('video is optical and live')
|
||||||
@ -253,8 +253,8 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
controller.media_info.end_time = service_item.end_time
|
controller.media_info.end_time = service_item.end_time
|
||||||
elif controller.preview_display:
|
elif controller.preview_display:
|
||||||
if service_item.is_capable(ItemCapabilities.CanStream):
|
if service_item.is_capable(ItemCapabilities.CanStream):
|
||||||
is_valid = self._check_file_type(controller, display)
|
|
||||||
controller.media_info.media_type = MediaType.Stream
|
controller.media_info.media_type = MediaType.Stream
|
||||||
|
is_valid = self._check_file_type(controller, display, True)
|
||||||
elif service_item.is_capable(ItemCapabilities.IsOptical):
|
elif service_item.is_capable(ItemCapabilities.IsOptical):
|
||||||
log.debug('video is optical and preview')
|
log.debug('video is optical and preview')
|
||||||
path = service_item.get_frame_path()
|
path = service_item.get_frame_path()
|
||||||
@ -352,19 +352,21 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
|||||||
controller.media_info.media_type = MediaType.DVD
|
controller.media_info.media_type = MediaType.DVD
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _check_file_type(self, controller, display):
|
def _check_file_type(self, controller, display, stream=False):
|
||||||
"""
|
"""
|
||||||
Select the correct media Player type from the prioritized Player list
|
Select the correct media Player type from the prioritized Player list
|
||||||
|
|
||||||
:param controller: First element is the controller which should be used
|
:param controller: First element is the controller which should be used
|
||||||
:param display: Which display to use
|
:param display: Which display to use
|
||||||
|
:param stream: Are we streaming or not
|
||||||
"""
|
"""
|
||||||
if controller.media_info.media_type == MediaType.Stream:
|
if stream:
|
||||||
self.resize(display, self.vlc_player)
|
self.resize(display, self.vlc_player)
|
||||||
|
display.media_info.media_type = MediaType.Stream
|
||||||
if self.vlc_player.load(display, None):
|
if self.vlc_player.load(display, None):
|
||||||
self.current_media_players[controller.controller_type] = self.vlc_player
|
self.current_media_players[controller.controller_type] = self.vlc_player
|
||||||
controller.media_info.media_type = MediaType.Video
|
|
||||||
return True
|
return True
|
||||||
|
return True
|
||||||
for file in controller.media_info.file_info:
|
for file in controller.media_info.file_info:
|
||||||
if file.is_file:
|
if file.is_file:
|
||||||
suffix = '*%s' % file.suffix.lower()
|
suffix = '*%s' % file.suffix.lower()
|
||||||
|
@ -32,10 +32,10 @@ from openlp.core.common.i18n import translate
|
|||||||
from openlp.core.common.settings import Settings
|
from openlp.core.common.settings import Settings
|
||||||
from openlp.core.lib.settingstab import SettingsTab
|
from openlp.core.lib.settingstab import SettingsTab
|
||||||
from openlp.core.ui.icons import UiIcons
|
from openlp.core.ui.icons import UiIcons
|
||||||
|
#vlc v4l2:///dev/video0:v4l2-standard= :input-slave=alsa://hw:0,0 :live-caching=300
|
||||||
LINUX_STREAM = 'v4l2://{video} :v4l2-standard= :input-slave={audio} :live-caching=300'
|
LINUX_STREAM = 'v4l2://{video}:v4l2-standard= :input-slave=alsa://{audio} :live-caching=300'
|
||||||
WIN_STREAM = 'dshow://:dshow-vdev={video} :dshow-adev={audio} :live-caching=300'
|
WIN_STREAM = 'dshow://:dshow-vdev={video} :dshow-adev={audio} :live-caching=300'
|
||||||
OSX_STREAM = 'avcapture://{video} :qtsound://{audio} :live-caching=300'
|
OSX_STREAM = 'avcapture://{video}:qtsound://{audio}:live-caching=300'
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -68,11 +68,15 @@ class MediaTab(SettingsTab):
|
|||||||
self.left_layout.addWidget(self.live_media_group_box)
|
self.left_layout.addWidget(self.live_media_group_box)
|
||||||
self.stream_media_group_box = QtWidgets.QGroupBox(self.left_column)
|
self.stream_media_group_box = QtWidgets.QGroupBox(self.left_column)
|
||||||
self.stream_media_group_box.setObjectName('stream_media_group_box')
|
self.stream_media_group_box.setObjectName('stream_media_group_box')
|
||||||
self.stream_media_layout = QtWidgets.QHBoxLayout(self.stream_media_group_box)
|
self.stream_media_layout = QtWidgets.QFormLayout(self.stream_media_group_box)
|
||||||
self.stream_media_layout.setObjectName('stream_media_layout')
|
self.stream_media_layout.setObjectName('stream_media_layout')
|
||||||
self.stream_media_layout.setContentsMargins(0, 0, 0, 0)
|
self.stream_media_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
self.stream_edit = QtWidgets.QLabel(self)
|
self.video_edit = QtWidgets.QLineEdit(self)
|
||||||
self.stream_media_layout.addWidget(self.stream_edit)
|
self.stream_media_layout.addRow(translate('MediaPlugin.MediaTab', 'Video:'), self.video_edit)
|
||||||
|
self.audio_edit = QtWidgets.QLineEdit(self)
|
||||||
|
self.stream_media_layout.addRow(translate('MediaPlugin.MediaTab', 'Audio'), self.audio_edit)
|
||||||
|
self.stream_cmd = QtWidgets.QLabel(self)
|
||||||
|
self.stream_media_layout.addWidget(self.stream_cmd)
|
||||||
self.left_layout.addWidget(self.stream_media_group_box)
|
self.left_layout.addWidget(self.stream_media_group_box)
|
||||||
self.vlc_arguments_group_box = QtWidgets.QGroupBox(self.left_column)
|
self.vlc_arguments_group_box = QtWidgets.QGroupBox(self.left_column)
|
||||||
self.vlc_arguments_group_box.setObjectName('vlc_arguments_group_box')
|
self.vlc_arguments_group_box.setObjectName('vlc_arguments_group_box')
|
||||||
@ -84,6 +88,8 @@ class MediaTab(SettingsTab):
|
|||||||
self.left_layout.addWidget(self.vlc_arguments_group_box)
|
self.left_layout.addWidget(self.vlc_arguments_group_box)
|
||||||
self.left_layout.addStretch()
|
self.left_layout.addStretch()
|
||||||
self.right_layout.addStretch()
|
self.right_layout.addStretch()
|
||||||
|
self.video_edit.editingFinished.connect(self.on_field_changed)
|
||||||
|
self.audio_edit.editingFinished.connect(self.on_field_changed)
|
||||||
# # Signals and slots
|
# # Signals and slots
|
||||||
|
|
||||||
def retranslate_ui(self):
|
def retranslate_ui(self):
|
||||||
@ -100,14 +106,9 @@ class MediaTab(SettingsTab):
|
|||||||
Load the settings
|
Load the settings
|
||||||
"""
|
"""
|
||||||
self.auto_start_check_box.setChecked(Settings().value(self.settings_section + '/media auto start'))
|
self.auto_start_check_box.setChecked(Settings().value(self.settings_section + '/media auto start'))
|
||||||
self.stream_edit.setText(Settings().value(self.settings_section + '/stream command'))
|
self.stream_cmd.setText(Settings().value(self.settings_section + '/stream command'))
|
||||||
if not self.stream_edit.text():
|
if not self.stream_cmd.text():
|
||||||
if is_linux:
|
self.set_base_stream()
|
||||||
self.stream_edit.setText(LINUX_STREAM)
|
|
||||||
elif is_win:
|
|
||||||
self.stream_edit.setText(WIN_STREAM)
|
|
||||||
else:
|
|
||||||
self.stream_edit.setText(OSX_STREAM)
|
|
||||||
self.vlc_arguments_edit.setPlainText(Settings().value(self.settings_section + '/vlc arguments'))
|
self.vlc_arguments_edit.setPlainText(Settings().value(self.settings_section + '/vlc arguments'))
|
||||||
if Settings().value('advanced/experimental'):
|
if Settings().value('advanced/experimental'):
|
||||||
for cam in QCameraInfo.availableCameras():
|
for cam in QCameraInfo.availableCameras():
|
||||||
@ -116,6 +117,14 @@ class MediaTab(SettingsTab):
|
|||||||
for au in QAudioDeviceInfo.availableDevices(QAudio.AudioInput):
|
for au in QAudioDeviceInfo.availableDevices(QAudio.AudioInput):
|
||||||
log.debug(au.deviceName())
|
log.debug(au.deviceName())
|
||||||
|
|
||||||
|
def set_base_stream(self):
|
||||||
|
if is_linux:
|
||||||
|
self.stream_cmd.setText(LINUX_STREAM)
|
||||||
|
elif is_win:
|
||||||
|
self.stream_cmd.setText(WIN_STREAM)
|
||||||
|
else:
|
||||||
|
self.stream_cmd.setText(OSX_STREAM)
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
"""
|
"""
|
||||||
Save the settings
|
Save the settings
|
||||||
@ -123,9 +132,14 @@ class MediaTab(SettingsTab):
|
|||||||
setting_key = self.settings_section + '/media auto start'
|
setting_key = self.settings_section + '/media auto start'
|
||||||
if Settings().value(setting_key) != self.auto_start_check_box.checkState():
|
if Settings().value(setting_key) != self.auto_start_check_box.checkState():
|
||||||
Settings().setValue(setting_key, self.auto_start_check_box.checkState())
|
Settings().setValue(setting_key, self.auto_start_check_box.checkState())
|
||||||
Settings().setValue(self.settings_section + '/stream command', self.stream_edit.text())
|
Settings().setValue(self.settings_section + '/stream command', self.stream_cmd.text())
|
||||||
Settings().setValue(self.settings_section + '/vlc arguments', self.vlc_arguments_edit.toPlainText())
|
Settings().setValue(self.settings_section + '/vlc arguments', self.vlc_arguments_edit.toPlainText())
|
||||||
|
|
||||||
|
def on_field_changed(self):
|
||||||
|
self.set_base_stream()
|
||||||
|
self.stream_cmd.setText(self.stream_cmd.text().format(video=self.video_edit.text(),
|
||||||
|
audio=self.audio_edit.text()))
|
||||||
|
|
||||||
def post_set_up(self, post_update=False):
|
def post_set_up(self, post_update=False):
|
||||||
"""
|
"""
|
||||||
Late setup for players as the MediaController has to be initialised first.
|
Late setup for players as the MediaController has to be initialised first.
|
||||||
|
@ -152,12 +152,10 @@ class VlcPlayer(MediaPlayer):
|
|||||||
"""
|
"""
|
||||||
vlc = get_vlc()
|
vlc = get_vlc()
|
||||||
log.debug('load vid in Vlc Controller')
|
log.debug('load vid in Vlc Controller')
|
||||||
controller = output_display
|
|
||||||
volume = controller.media_info.volume
|
|
||||||
if file:
|
if file:
|
||||||
path = os.path.normcase(file)
|
path = os.path.normcase(file)
|
||||||
# create the media
|
# create the media
|
||||||
if controller.media_info.media_type == MediaType.CD:
|
if output_display.media_info.media_type == MediaType.CD:
|
||||||
if is_win():
|
if is_win():
|
||||||
path = '/' + path
|
path = '/' + path
|
||||||
output_display.vlc_media = output_display.vlc_instance.media_new_location('cdda://' + path)
|
output_display.vlc_media = output_display.vlc_instance.media_new_location('cdda://' + path)
|
||||||
@ -169,8 +167,8 @@ class VlcPlayer(MediaPlayer):
|
|||||||
audio_cd_tracks = output_display.vlc_media.subitems()
|
audio_cd_tracks = output_display.vlc_media.subitems()
|
||||||
if not audio_cd_tracks or audio_cd_tracks.count() < 1:
|
if not audio_cd_tracks or audio_cd_tracks.count() < 1:
|
||||||
return False
|
return False
|
||||||
output_display.vlc_media = audio_cd_tracks.item_at_index(controller.media_info.title_track)
|
output_display.vlc_media = audio_cd_tracks.item_at_index(output_display.media_info.title_track)
|
||||||
elif controller.media_info.media_type == MediaType.Stream:
|
elif output_display.media_info.media_type == MediaType.Stream:
|
||||||
stream_cmd = Settings().value('media/stream command')
|
stream_cmd = Settings().value('media/stream command')
|
||||||
output_display.vlc_media = output_display.vlc_instance.media_new_location(stream_cmd)
|
output_display.vlc_media = output_display.vlc_instance.media_new_location(stream_cmd)
|
||||||
else:
|
else:
|
||||||
@ -179,7 +177,7 @@ class VlcPlayer(MediaPlayer):
|
|||||||
output_display.vlc_media_player.set_media(output_display.vlc_media)
|
output_display.vlc_media_player.set_media(output_display.vlc_media)
|
||||||
# parse the metadata of the file
|
# parse the metadata of the file
|
||||||
output_display.vlc_media.parse()
|
output_display.vlc_media.parse()
|
||||||
self.volume(output_display, volume)
|
self.volume(output_display, output_display.media_info.volume)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def media_state_wait(self, output_display, media_state):
|
def media_state_wait(self, output_display, media_state):
|
||||||
|
@ -103,8 +103,8 @@ class ProxyWidget(QtWidgets.QGroupBox):
|
|||||||
:param QtWidgets.QRadioButton button: The button that has toggled
|
:param QtWidgets.QRadioButton button: The button that has toggled
|
||||||
:param bool checked: The buttons new state
|
:param bool checked: The buttons new state
|
||||||
"""
|
"""
|
||||||
id = self.radio_group.id(button) # The work around (see above comment)
|
group_id = self.radio_group.id(button) # The work around (see above comment)
|
||||||
enable_manual_edits = id == ProxyMode.MANUAL_PROXY and checked
|
enable_manual_edits = group_id == ProxyMode.MANUAL_PROXY and checked
|
||||||
self.http_edit.setEnabled(enable_manual_edits)
|
self.http_edit.setEnabled(enable_manual_edits)
|
||||||
self.https_edit.setEnabled(enable_manual_edits)
|
self.https_edit.setEnabled(enable_manual_edits)
|
||||||
self.username_edit.setEnabled(enable_manual_edits)
|
self.username_edit.setEnabled(enable_manual_edits)
|
||||||
|
Loading…
Reference in New Issue
Block a user