Update ha-ffmpeg 2.0 (#22427)

This commit is contained in:
Pascal Vizeli 2019-03-27 07:55:05 +01:00 committed by Sebastian Muszynski
parent 19d99ddf57
commit a55afa8119
14 changed files with 41 additions and 31 deletions

View file

@ -118,7 +118,7 @@ class YiCamera(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
url = await self._get_latest_video_url()
if url and url != self._last_url:
@ -135,7 +135,7 @@ class YiCamera(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
if not self._is_on:
return
@ -145,8 +145,9 @@ class YiCamera(Camera):
self._last_url, 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()