python-codecs: fix stride handling

This commit is contained in:
Koushik Dutta
2023-06-07 15:10:40 -07:00
parent 1f209072ba
commit 7c41516cce
5 changed files with 12 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ except:
async def createPipelineIterator(pipeline: str, gst = None):
loop = asyncio.get_running_loop()
pipeline = '{pipeline} ! appsink name=appsink emit-signals=true sync=false max-buffers=-1 drop=true'.format(pipeline=pipeline)
pipeline = '{pipeline} ! appsink name=appsink emit-signals=true sync=false'.format(pipeline=pipeline)
print(pipeline)
finished = concurrent.futures.Future()

View File

@@ -105,10 +105,10 @@ class GstImage(scrypted_sdk.Image):
raise Exception("unable to map gst buffer")
try:
# pil = pilimage.new_from_memory(info.data, width, height, capsBands)
# pil.convert('RGB').save('/server/volume/test.jpg')
stridePadding = (width * capsBands) % 4
if stridePadding:
stridePadding = 4 - stridePadding
if stridePadding:
if capsBands != 1:
raise Exception(
@@ -131,6 +131,10 @@ class GstImage(scrypted_sdk.Image):
pil = pilimage.new_from_memory(info.data, width, height, capsBands)
image = pilimage.PILImage(pil)
# if bands == 1:
# pil = pilimage.new_from_memory(info.data, width, height, capsBands)
# pil.convert('RGB').save('/server/volume/test.jpg')
crop = None
if stridePadding:
crop = {