Skip to content

Commit

Permalink
fix: values of dstRange/srcRange when calling sws_setColorspaceDetails()
Browse files Browse the repository at this point in the history
In sws_setColorspaceDetails(), dstRange/srcRange is 1 for JPEG range and 0 for
MPEG range.
  • Loading branch information
ernestcao committed Jul 17, 2024
1 parent 30759af commit 87a5007
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions av/video/reformatter.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ cdef class VideoReformatter:
if frame.ptr.format < 0:
raise ValueError("Frame does not have format set.")

# The definition of color range in pixfmt.h and swscale.h is different.
src_color_range = 1 if src_color_range == ColorRange.JPEG.value else 0
dst_color_range = 1 if dst_color_range == ColorRange.JPEG.value else 0

cdef lib.AVPixelFormat src_format = <lib.AVPixelFormat> frame.ptr.format

# Shortcut!
Expand Down

0 comments on commit 87a5007

Please sign in to comment.