Skip to content

Commit

Permalink
Renamed width to make it more clear what it does
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaserlang committed Dec 16, 2023
1 parent 1d630ae commit 3e77b4b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions seplis_play_server/transcoders/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Transcode_settings:
start_segment: Optional[int] | constr(max_length=0) = None
audio_lang: Optional[str] = None
max_audio_channels: Optional[int] | constr(max_length=0) = None
width: Optional[int] | constr(max_length=0) = None
max_width: Optional[int] | constr(max_length=0) = None
max_video_bitrate: Optional[int] | constr(max_length=0) = None
client_width: Optional[int] | constr(max_length=0) = None
supported_video_containers: Annotated[list[constr(min_length=1)], Query()] = Query(default=['mp4'])
Expand Down Expand Up @@ -257,7 +257,7 @@ def set_video(self):
if codec == 'copy':
return

width = self.settings.width or self.settings.client_width or self.video_stream['width']
width = self.settings.max_width or self.settings.client_width or self.video_stream['width']
if width > self.video_stream['width']:
width = self.video_stream['width']

Expand Down Expand Up @@ -287,8 +287,8 @@ def get_can_copy_video(self, check_key_frames=True):
logger.debug(f'[{self.settings.session}] HDR format not supported: {self.video_color.range_type}')
return False

if self.settings.width and self.settings.width < self.video_stream['width']:
logger.debug(f'[{self.settings.session}] Requested width is lower than input width ({self.settings.width} < {self.video_stream["width"]})')
if self.settings.max_width and self.settings.max_width < self.video_stream['width']:
logger.debug(f'[{self.settings.session}] Requested width is lower than input width ({self.settings.max_width} < {self.video_stream["width"]})')
return False

if self.settings.max_video_bitrate and self.settings.max_video_bitrate < int(self.metadata['format']['bit_rate'] or 0):
Expand Down Expand Up @@ -505,7 +505,7 @@ def get_video_transcode_bitrate(self):
bitrate = self.settings.max_video_bitrate or int(self.metadata['format']['bit_rate'] or 0)

if bitrate:
upscaling = self.settings.width and self.settings.width > self.video_stream['width']
upscaling = self.settings.max_width and self.settings.max_width > self.video_stream['width']
# only allow bitrate increase if upscaling
if not upscaling:
bitrate = self._min_video_bitrate(int(self.metadata['format']['bit_rate']), bitrate)
Expand Down

0 comments on commit 3e77b4b

Please sign in to comment.