mirror of
https://github.com/koush/scrypted.git
synced 2026-02-08 08:19:56 +00:00
python-codecs: add timestamps
This commit is contained in:
@@ -46,7 +46,6 @@ async def createPipelineIterator(pipeline: str):
|
||||
nonlocal hasFinished
|
||||
hasFinished = True
|
||||
yieldQueue.put(None)
|
||||
sampleQueue.put_nowait(None)
|
||||
asyncio.run_coroutine_threadsafe(sampleQueue.put(None), loop = loop)
|
||||
if not finished.done():
|
||||
finished.set_result(None)
|
||||
@@ -73,8 +72,8 @@ async def createPipelineIterator(pipeline: str):
|
||||
finally:
|
||||
yieldQueue.put(None)
|
||||
finally:
|
||||
finish()
|
||||
print('gstreamer finished')
|
||||
finish()
|
||||
|
||||
|
||||
def on_new_sample(sink, preroll):
|
||||
|
||||
@@ -2,6 +2,7 @@ import scrypted_sdk
|
||||
from typing import Any
|
||||
from thread import to_thread
|
||||
import io
|
||||
import time
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
@@ -81,6 +82,7 @@ def toPILImage(pilImageWrapper: PILImage, options: scrypted_sdk.ImageOptions = N
|
||||
|
||||
async def createPILMediaObject(image: PILImage):
|
||||
ret = await scrypted_sdk.mediaManager.createMediaObject(image, scrypted_sdk.ScryptedMimeTypes.Image.value, {
|
||||
'timestamp': time.time() * 1000,
|
||||
'format': None,
|
||||
'width': image.width,
|
||||
'height': image.height,
|
||||
|
||||
@@ -7,6 +7,7 @@ except:
|
||||
Image = None
|
||||
pyvips = None
|
||||
from thread import to_thread
|
||||
import time
|
||||
|
||||
class VipsImage(scrypted_sdk.VideoFrame):
|
||||
def __init__(self, vipsImage: Image) -> None:
|
||||
@@ -90,6 +91,7 @@ def toVipsImage(vipsImageWrapper: VipsImage, options: scrypted_sdk.ImageOptions
|
||||
|
||||
async def createVipsMediaObject(image: VipsImage):
|
||||
ret = await scrypted_sdk.mediaManager.createMediaObject(image, scrypted_sdk.ScryptedMimeTypes.Image.value, {
|
||||
'timestamp': time.time() * 1000,
|
||||
'format': None,
|
||||
'width': image.width,
|
||||
'height': image.height,
|
||||
|
||||
Reference in New Issue
Block a user