Update ha-ffmpeg 2.0 (#22427)
This commit is contained in:
parent
19d99ddf57
commit
a55afa8119
14 changed files with 41 additions and 31 deletions
|
@ -12,7 +12,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
REQUIREMENTS = ['ha-ffmpeg==1.11']
|
||||
REQUIREMENTS = ['ha-ffmpeg==2.0']
|
||||
|
||||
DOMAIN = 'ffmpeg'
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class FFmpegCamera(Camera):
|
|||
|
||||
async def async_camera_image(self):
|
||||
"""Return a still image response from the camera."""
|
||||
from haffmpeg import ImageFrame, IMAGE_JPEG
|
||||
from haffmpeg.tools import ImageFrame, IMAGE_JPEG
|
||||
ffmpeg = ImageFrame(self._manager.binary, loop=self.hass.loop)
|
||||
|
||||
image = await asyncio.shield(ffmpeg.get_image(
|
||||
|
@ -58,15 +58,16 @@ class FFmpegCamera(Camera):
|
|||
|
||||
async def handle_async_mjpeg_stream(self, request):
|
||||
"""Generate an HTTP MJPEG stream from the camera."""
|
||||
from haffmpeg import CameraMjpeg
|
||||
from haffmpeg.camera import CameraMjpeg
|
||||
|
||||
stream = CameraMjpeg(self._manager.binary, loop=self.hass.loop)
|
||||
await stream.open_camera(
|
||||
self._input, extra_cmd=self._extra_arguments)
|
||||
|
||||
try:
|
||||
stream_reader = await stream.get_reader()
|
||||
return await async_aiohttp_proxy_stream(
|
||||
self.hass, request, stream,
|
||||
self.hass, request, stream_reader,
|
||||
self._manager.ffmpeg_stream_content_type)
|
||||
finally:
|
||||
await stream.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue