Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting to new Settings class, instead of the old ENV VAR method. … #2520

Merged
merged 1 commit into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/classes/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from PyQt5.QtCore import QDir

VERSION = "2.4.3-dev2"
VERSION = "2.4.3-dev3"
MINIMUM_LIBOPENSHOT_VERSION = "0.2.2"
DATE = "20180922000000"
NAME = "openshot-qt"
Expand Down
12 changes: 10 additions & 2 deletions src/settings/_default.settings
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,26 @@
"setting": "send_metrics"
},
{
"value": true,
"value": false,
"title": "Enable Hardware Decode",
"type": "hidden",
"restart": true,
"category": "Performance",
"setting": "hardware_decode"
},
{
"value": false,
"title": "Enable Hardware Encode",
"type": "hidden",
"restart": true,
"category": "Performance",
"setting": "hardware_encode"
},
{
"value": true,
"title": "Process Video Frames in Parallel (Experimental)",
"type": "bool",
"restart": true,
"restart": false,
"category": "Performance",
"setting": "omp_threads_enabled"
},
Expand Down
17 changes: 12 additions & 5 deletions src/windows/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def __init__(self):
self.txtChannels.setVisible(False)

# Set OMP thread disabled flag (for stability)
os.environ['OS2_OMP_THREADS'] = "0"
openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = True
openshot.Settings.Instance().HIGH_QUALITY_SCALING = True

# Get the original timeline settings
width = get_app().window.timeline_sync.timeline.info.width
Expand Down Expand Up @@ -813,19 +814,25 @@ def accept(self):

# Re-set OMP thread enabled flag
if self.s.get("omp_threads_enabled"):
os.environ['OS2_OMP_THREADS'] = "1"
openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = False
else:
os.environ['OS2_OMP_THREADS'] = "0"
openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = True

# Return scale mode to lower quality scaling (for faster previews)
openshot.Settings.Instance().HIGH_QUALITY_SCALING = False

# Accept dialog
super(Export, self).accept()

def reject(self):
# Re-set OMP thread enabled flag
if self.s.get("omp_threads_enabled"):
os.environ['OS2_OMP_THREADS'] = "1"
openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = False
else:
os.environ['OS2_OMP_THREADS'] = "0"
openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = True

# Return scale mode to lower quality scaling (for faster previews)
openshot.Settings.Instance().HIGH_QUALITY_SCALING = False

# Cancel dialog
self.exporting = False
Expand Down
19 changes: 14 additions & 5 deletions src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2476,17 +2476,26 @@ def __init__(self, mode=None):
if s.get("enable-auto-save"):
self.auto_save_timer.start()

# Set hardware decode environment variable
# Set hardware decode
if s.get("hardware_decode"):
os.environ['OS2_DECODE_HW'] = "1"
openshot.Settings.Instance().HARDWARE_DECODE = True
else:
os.environ['OS2_DECODE_HW'] = "0"
openshot.Settings.Instance().HARDWARE_DECODE = False

# Set hardware encode
if s.get("hardware_encode"):
openshot.Settings.Instance().HARDWARE_ENCODE = True
else:
openshot.Settings.Instance().HARDWARE_ENCODE = False

# Set OMP thread enabled flag (for stability)
if s.get("omp_threads_enabled"):
os.environ['OS2_OMP_THREADS'] = "1"
openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = False
else:
os.environ['OS2_OMP_THREADS'] = "0"
openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = True

# Set scaling mode to lower quality scaling (for faster previews)
openshot.Settings.Instance().HIGH_QUALITY_SCALING = False

# Create lock file
self.create_lock_file()
Expand Down
20 changes: 14 additions & 6 deletions src/windows/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,27 @@ def bool_value_changed(self, widget, param, state):

elif param["setting"] == "hardware_decode":
if (state == Qt.Checked):
# Enable hardware decode environment variable
os.environ['OS2_DECODE_HW'] = "1"
# Enable hardware decode
openshot.Settings.Instance().HARDWARE_DECODE = True
else:
# Disable hardware decode environment variable
os.environ['OS2_DECODE_HW'] = "0"
# Disable hardware decode
openshot.Settings.Instance().HARDWARE_DECODE = False

elif param["setting"] == "hardware_encode":
if (state == Qt.Checked):
# Enable hardware encode
openshot.Settings.Instance().HARDWARE_ENCODE = True
else:
# Disable hardware encode
openshot.Settings.Instance().HARDWARE_ENCODE = False

elif param["setting"] == "omp_threads_enabled":
if (state == Qt.Checked):
# Enable OMP multi-threading
os.environ['OS2_OMP_THREADS'] = "1"
openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = False
else:
# Disable OMP multi-threading
os.environ['OS2_OMP_THREADS'] = "0"
openshot.Settings.Instance().WAIT_FOR_VIDEO_PROCESSING_TASK = True

# Check for restart
self.check_for_restart(param)
Expand Down