mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-05 16:00:06 +01:00
extended the time to prep a clip , reducing the issue with flickering change overs sometimes, focing audio out to local to avoid hdmi freezing issues (a known bug in omx player) added actions for hard-setting pal/ntsc composite options, added auto mode for screen size
This commit is contained in:
24
actions.py
24
actions.py
@@ -134,7 +134,7 @@ class Actions(object):
|
||||
|
||||
def set_playing_sample_start_to_current_duration(self):
|
||||
current_bank, current_slot = self.data.split_bankslot_number(self.video_driver.current_player.bankslot_number)
|
||||
current_position = self.video_driver.current_player.get_position()
|
||||
current_position = round(self.video_driver.current_player.get_position(),3)
|
||||
self.data.update_slot_start_to_this_time(current_bank, current_slot, current_position)
|
||||
self.load_this_slot_into_next_player(current_slot)
|
||||
|
||||
@@ -145,7 +145,7 @@ class Actions(object):
|
||||
|
||||
def set_playing_sample_end_to_current_duration(self):
|
||||
current_bank, current_slot = self.data.split_bankslot_number(self.video_driver.current_player.bankslot_number)
|
||||
current_position = self.video_driver.current_player.get_position()
|
||||
current_position = round(self.video_driver.current_player.get_position(),0)
|
||||
self.data.update_slot_end_to_this_time(current_bank, current_slot, current_position)
|
||||
self.load_this_slot_into_next_player(current_slot)
|
||||
|
||||
@@ -170,9 +170,21 @@ class Actions(object):
|
||||
else:
|
||||
self.message_handler.set_message('INFO', 'must be in dev_mode to change display')
|
||||
|
||||
def run_script(self, script_name):
|
||||
def set_composite_to_pal(self):
|
||||
self.run_script('set_composite_mode','2')
|
||||
self.message_handler.set_message('INFO', 'composite set to pal on next restart')
|
||||
|
||||
def set_composite_to_ntsc(self):
|
||||
self.run_script('set_composite_mode','0')
|
||||
self.message_handler.set_message('INFO', 'composite set to ntsc on next restart')
|
||||
|
||||
def run_script(self, script_name, script_argument=''):
|
||||
try:
|
||||
subprocess.call(['/home/pi/r_e_c_u_r/dotfiles/{}.sh'.format(script_name)])
|
||||
except exception as e:
|
||||
self.message_handler.set_message('ERROR',e.message)
|
||||
subprocess.call(['/home/pi/r_e_c_u_r/dotfiles/{}.sh'.format(script_name),script_argument])
|
||||
except Exception as e:
|
||||
if hasattr(e, 'message'):
|
||||
error_info = e.message
|
||||
else:
|
||||
error_info = e
|
||||
self.message_handler.set_message('ERROR',error_info)
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
[[{"rate": 3.5, "location": "/media/pi/TIM1/videos_to_play/colour_pixel_01.mp4", "length": 49.28, "end": -1, "start": -1, "name": "colour_pixel_01.mp4"}, {"rate": 1, "location": "/media/pi/TIM1/videos_to_play/long_spinning.mp4", "length": 804.245, "end": -1, "start": -1, "name": "long_spinning.mp4"}, {"rate": 0.5, "location": "/media/pi/TIM1/Test.mp4", "length": 599.585, "end": -1, "start": -1, "name": "Test.mp4"}, {"rate": 3.0, "location": "/media/pi/TIM1/teaser1.mp4", "length": 3.114, "end": -1, "start": -1, "name": "teaser1.mp4"}, {"rate": 0.5, "start": -1, "length": 3.114, "end": -1, "location": "/media/pi/TIM1/teaser1.mp4", "name": "teaser1.mp4"}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}], [{"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}, {"rate": 1, "location": "", "length": -1, "end": -1, "start": -1, "name": ""}]]
|
||||
[[{"rate": 1, "end": -1, "location": "/media/pi/5EB5-664C/recur test videos/colour_pixal_01.mp4", "start": -1, "length": 49.28, "name": "colour_pixal_01.mp4"}, {"rate": 1, "end": -1, "location": "/media/pi/5EB5-664C/recur test videos/test.mp4", "start": -1, "length": 599.608, "name": "test.mp4"}, {"rate": 1, "end": 52.0, "location": "/media/pi/5EB5-664C/recur test videos/colour_pixal_02.mp4", "length": 87.04, "start": 39.615, "name": "colour_pixal_02.mp4"}, {"rate": 1, "end": -1, "location": "/media/pi/5EB5-664C/recur test videos/samplerloop3s3.mp4", "length": 3.008, "start": -1, "name": "samplerloop3s3.mp4"}, {"rate": 1, "end": -1, "location": "/media/pi/5EB5-664C/recur test videos/samplerloop3s3.mp4", "start": -1, "length": 3.008, "name": "samplerloop3s3.mp4"}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}], [{"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}, {"rate": 1, "end": -1, "location": "", "start": -1, "length": -1, "name": ""}]]
|
||||
@@ -1,2 +1 @@
|
||||
"0-0"
|
||||
|
||||
"0-0"
|
||||
@@ -1 +1 @@
|
||||
[{"name": "SCREEN_SIZE", "options": ["dev_mode", "composite", "XGA"]}, {"name": "quit_the_program", "options": ["run_action"]}, {"name": "switch_display_to_hdmi", "options": ["run_action"]}, {"name": "switch_display_to_lcd", "options": ["run_action"]}]
|
||||
[{"name": "SCREEN_SIZE", "options": ["dev_mode", "composite_pal", "composite_ntsc", "XGA", "auto"]}, {"name": "quit_the_program", "options": ["run_action"]}, {"name": "switch_display_to_hdmi", "options": ["run_action"]}, {"name": "switch_display_to_lcd", "options": ["run_action"]}, {"name": "set_composite_to_pal", "options": ["run_action"]}, {"name": "set_composite_to_ntsc", "options": ["run_action"]}]
|
||||
@@ -49,7 +49,7 @@ class Display(object):
|
||||
self.display_text.pack()
|
||||
|
||||
def _load_title(self):
|
||||
self.display_text.insert(END, '================== r_e_c_u_r:beta ============= \n')
|
||||
self.display_text.insert(END, '================== r_e_c_u_r ================== \n')
|
||||
self.display_text.tag_add("TITLE", 1.19, 1.28)
|
||||
|
||||
def _load_player(self):
|
||||
@@ -75,13 +75,13 @@ class Display(object):
|
||||
bank_data = self.data.get_sampler_data()[self.bank_number]
|
||||
self.display_text.insert(END, '------------------ <SAMPLER> ------------------ \n')
|
||||
self.display_text.tag_add("DISPLAY_MODE", 4.19, 4.29)
|
||||
self.display_text.insert(END, '{:^6} {:<16} {:<4} {:<4} {:<4} {:<4} \n'.format(
|
||||
'{}-slot'.format(self.bank_number), 'name', 'length', 'start', 'end', 'rate'))
|
||||
self.display_text.insert(END, '{:^6} {:<16} {:<4} {:<4} {:<4} \n'.format(
|
||||
'{}-slot'.format(self.bank_number), 'name', 'length', 'start', 'end'))
|
||||
for index, slot in enumerate(bank_data):
|
||||
name_without_extension = slot['name'].rsplit('.',1)[0]
|
||||
self.display_text.insert(END, '{:^4} {:<18} {:<4} {:<4} {:<4} {:<4} \n'.format(
|
||||
self.display_text.insert(END, '{:^4} {:<18} {:<4} {:<4} {:<4} \n'.format(
|
||||
index, name_without_extension[0:22], self.format_time_value(slot['length']),
|
||||
self.format_time_value(slot['start']), self.format_time_value(slot['end']), slot['rate']))
|
||||
self.format_time_value(slot['start']), self.format_time_value(slot['end'])))
|
||||
current_bank , current_slot = self.data.split_bankslot_number(self.video_driver.current_player.bankslot_number)
|
||||
if current_bank is self.bank_number:
|
||||
self.selected_list_index = current_slot
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#config_hdmi_boost=4
|
||||
|
||||
# uncomment for composite PAL
|
||||
sdtv_mode=2
|
||||
sdtv_mode=0
|
||||
|
||||
#uncomment to overclock the arm. 700 MHz is the default.
|
||||
#arm_freq=800
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#framebuffer_height=720
|
||||
|
||||
# uncomment if hdmi display is not detected and composite is being output
|
||||
hdmi_force_hotplug=1
|
||||
#hdmi_force_hotplug=1
|
||||
|
||||
# uncomment to force a specific HDMI mode (this will force VGA)
|
||||
#hdmi_group=1
|
||||
@@ -37,7 +37,7 @@ hdmi_force_hotplug=1
|
||||
#config_hdmi_boost=4
|
||||
|
||||
# uncomment for composite PAL
|
||||
sdtv_mode=2
|
||||
sdtv_mode=0
|
||||
|
||||
#uncomment to overclock the arm. 700 MHz is the default.
|
||||
#arm_freq=800
|
||||
|
||||
@@ -1 +1 @@
|
||||
dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10 fbcon=font:ProFont6x11 quiet splash logo.nologo
|
||||
dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10 fbcon=font:ProFont6x11 quiet splash logo.nologo plymouth.ignore-serial-consoles
|
||||
|
||||
@@ -10,6 +10,12 @@ also some modifications might be needed to hide the boot text. i will document t
|
||||
|
||||
## changes to config-normal.txt
|
||||
|
||||
## changes to config-nomal.txt
|
||||
|
||||
- commenting out hdmi_force to allow composite output: `#hdmi_force_hotplug=1`
|
||||
|
||||
## changes to the cmdline.txt
|
||||
|
||||
`quiet splash logo.nologo plymouth.ignore-serial-consoles` for quiet boot with splash screen
|
||||
|
||||
[LCD-show-170703]: www.waveshare.com/w/uplosd/0/00/LCD-show-170703.tar.gz
|
||||
|
||||
3
dotfiles/set_composite_mode.sh
Executable file
3
dotfiles/set_composite_mode.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo sed -i "s/sdtv_mode=./sdtv_mode=$1/g" ~/r_e_c_u_r/dotfiles/lcd_display_drivers/LCD-show/boot/config-nomal.txt ~/r_e_c_u_r/dotfiles/lcd_display_drivers/LCD-show/boot/config-35.txt-180 /boot/config.txt
|
||||
@@ -56,10 +56,11 @@ class VideoDriver(object):
|
||||
self.last_player = self.current_player
|
||||
self.current_player = self.next_player
|
||||
self.next_player = temp_player
|
||||
self.last_player.exit()
|
||||
#self.last_player.exit()
|
||||
|
||||
def play_video(self):
|
||||
self.current_player.play()
|
||||
self.last_player.exit()
|
||||
self.next_player.try_load()
|
||||
self.in_current_playing_cycle = True
|
||||
self.wait_for_next_cycle()
|
||||
|
||||
@@ -39,7 +39,8 @@ class video_player:
|
||||
def load(self):
|
||||
try:
|
||||
self.get_context_for_player()
|
||||
self.arguments = ['--no-osd', '--win', self.set_screen_size(), '--alpha', '0']
|
||||
first_screen_arg, second_screen_arg = self.set_screen_size()
|
||||
self.arguments = ['--no-osd', '--adev', 'local', '--alpha', '0', first_screen_arg, second_screen_arg] # , ]
|
||||
self.status = 'LOADING'
|
||||
print('the location is {}'.format(self.location))
|
||||
self.omx_player = OMXPlayer(self.location, args=self.arguments, dbus_name=self.name)
|
||||
@@ -51,29 +52,31 @@ class video_player:
|
||||
self.start = 0
|
||||
self.crop_length = self.end - self.start
|
||||
print('{}: the duration is {}'.format(self.name, self.total_length))
|
||||
if self.start > 0.5:
|
||||
self.set_position(self.start - 0.5)
|
||||
if self.start > 0.9:
|
||||
self.set_position(self.start - 0.9)
|
||||
self.pause_at_start()
|
||||
print('set rate to {}'.format(self.rate))
|
||||
self.omx_player.set_rate(self.rate)
|
||||
self.load_attempts = 0
|
||||
#print('set rate to {}'.format(self.rate))
|
||||
#self.omx_player.set_rate(self.rate)
|
||||
#self.load_attempts = 0
|
||||
return True
|
||||
except ValueError:
|
||||
self.message_handler.set_message('ERROR', 'load attempt fail')
|
||||
except (ValueError, SystemError):
|
||||
#self.message_handler.set_message('ERROR', 'load attempt fail')
|
||||
return False
|
||||
|
||||
def pause_at_start(self):
|
||||
position = self.get_position()
|
||||
start_threshold = self.start - 0.05
|
||||
position = self.get_position()
|
||||
start_threshold = round(self.start - 0.05,2)
|
||||
#print('is playing: {} , position : {} , start_threshold : {}'.format(self.omx_player.is_playing(), position, start_threshold))
|
||||
if position > start_threshold:
|
||||
self.status = 'LOADED'
|
||||
self.omx_player.pause()
|
||||
self.omx_player.set_alpha(255)
|
||||
self.omx_player.pause()
|
||||
elif self.omx_running:
|
||||
self.root.after(5, self.pause_at_start)
|
||||
|
||||
def play(self):
|
||||
self.status = 'PLAYING'
|
||||
#self.omx_player.set_alpha(255)
|
||||
self.omx_player.play()
|
||||
self.pause_at_end()
|
||||
|
||||
@@ -90,7 +93,7 @@ class video_player:
|
||||
def reload(self):
|
||||
self.exit()
|
||||
self.omx_running = False
|
||||
self.load()
|
||||
self.try_load()
|
||||
|
||||
def is_loaded(self):
|
||||
return self.status is 'LOADED'
|
||||
@@ -151,11 +154,17 @@ class video_player:
|
||||
|
||||
def set_screen_size(self):
|
||||
if self.data.get_screen_size_setting() == 'dev_mode':
|
||||
return '50,350,550,750'
|
||||
elif self.data.get_screen_size_setting() == 'composite':
|
||||
return '45,15,970,760'
|
||||
return '--win', '50,350,550,750'
|
||||
elif self.data.get_screen_size_setting() == 'composite_pal':
|
||||
return '--win', '0,0,768,576'
|
||||
elif self.data.get_screen_size_setting() == 'composite_ntsc':
|
||||
return '--win', '0,0,640,480'
|
||||
elif self.data.get_screen_size_setting() == 'composite_converter':
|
||||
return '--win', '45,15,970,760'
|
||||
elif self.data.get_screen_size_setting() == 'XGA':
|
||||
return '0,0,1024,768'
|
||||
return '--win', '0,0,1024,768'
|
||||
else:
|
||||
return '--aspect-mode', 'stretch'
|
||||
|
||||
|
||||
class fake_video_player:
|
||||
|
||||
Reference in New Issue
Block a user