Skip to content

Commit

Permalink
python-codecs: fix stride handling
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Jun 7, 2023
1 parent 1f20907 commit 7c41516
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plugins/python-codecs/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

{
// docker installation
"scrypted.debugHost": "koushik-windows",
"scrypted.debugHost": "koushik-ubuntu",
"scrypted.serverRoot": "/server",

// windows installation
Expand Down
4 changes: 2 additions & 2 deletions plugins/python-codecs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/python-codecs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/python-codecs",
"version": "0.1.69",
"version": "0.1.72",
"description": "Python Codecs for Scrypted",
"keywords": [
"scrypted",
Expand Down
2 changes: 1 addition & 1 deletion plugins/python-codecs/src/gst_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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()

Expand Down
10 changes: 7 additions & 3 deletions plugins/python-codecs/src/gstreamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ async def toBuffer(self, options: scrypted_sdk.ImageOptions = None):
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(
Expand All @@ -131,6 +131,10 @@ async def toBuffer(self, options: scrypted_sdk.ImageOptions = None):
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 = {
Expand Down

0 comments on commit 7c41516

Please sign in to comment.