Skip to content

Commit

Permalink
Add hardware accelerated profiles
Browse files Browse the repository at this point in the history
Fixes #27 and #45
  • Loading branch information
JuniorIsAJitterbug committed Mar 26, 2024
1 parent 6804312 commit afb5d27
Show file tree
Hide file tree
Showing 21 changed files with 761 additions and 29 deletions.
10 changes: 10 additions & 0 deletions src/tbc_video_export/common/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ class VideoBitDepthType(Enum):
BIT16 = "16bit"


class HardwareAccelType(Enum):
"""Hardware accel types for profiles."""

VAAPI = "vaapi"
NVENC = "nvenc"
QUICKSYNC = "quicksync"
AMF = "amf"
VIDEOTOOLBOX = "videotoolbox"


class ProfileVideoType(Enum):
"""Video types for profiles."""

Expand Down
2 changes: 1 addition & 1 deletion src/tbc_video_export/common/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _print_exception(e: BaseException) -> None:
if len(message := getattr(e, "message", str(e))) > 1:
logging.getLogger("console").exception(
ansi.error_color(f"{e.__class__.__name__}: {message}"),
exc_info=False,
exc_info=True,
)


Expand Down
13 changes: 12 additions & 1 deletion src/tbc_video_export/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
)

if TYPE_CHECKING:
from tbc_video_export.common.enums import ProfileVideoType, VideoSystem
from tbc_video_export.common.enums import (
HardwareAccelType,
ProfileVideoType,
VideoSystem,
)
from tbc_video_export.config.json import JsonConfig


Expand Down Expand Up @@ -319,6 +323,7 @@ class GetProfileFilter:

name: str
video_type: ProfileVideoType | None = None
hwaccel_type: HardwareAccelType | None = None
video_system: VideoSystem | None = None

def match(self, profile: Profile) -> bool:
Expand All @@ -334,6 +339,12 @@ def match(self, profile: Profile) -> bool:
):
return False

if (
self.hwaccel_type is not None
and video_profile.hardware_accel is not self.hwaccel_type
):
return False

if (
self.video_system is not None and video_profile.video_system is not None
) and video_profile.video_system is not self.video_system:
Expand Down
Loading

0 comments on commit afb5d27

Please sign in to comment.