mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Add support for streaming to ffmpeg (#22549)
This commit is contained in:
parent
fbb9097f6c
commit
c05bff7d17
@ -9,7 +9,8 @@ import logging
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
|
from homeassistant.components.camera import (
|
||||||
|
PLATFORM_SCHEMA, Camera, SUPPORT_STREAM)
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
from homeassistant.helpers.aiohttp_client import async_aiohttp_proxy_stream
|
from homeassistant.helpers.aiohttp_client import async_aiohttp_proxy_stream
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -46,6 +47,16 @@ class FFmpegCamera(Camera):
|
|||||||
self._input = config.get(CONF_INPUT)
|
self._input = config.get(CONF_INPUT)
|
||||||
self._extra_arguments = config.get(CONF_EXTRA_ARGUMENTS)
|
self._extra_arguments = config.get(CONF_EXTRA_ARGUMENTS)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supported_features(self):
|
||||||
|
"""Return supported features."""
|
||||||
|
return SUPPORT_STREAM
|
||||||
|
|
||||||
|
@property
|
||||||
|
def stream_source(self):
|
||||||
|
"""Return the stream source."""
|
||||||
|
return self._input.split(' ')[-1]
|
||||||
|
|
||||||
async def async_camera_image(self):
|
async def async_camera_image(self):
|
||||||
"""Return a still image response from the camera."""
|
"""Return a still image response from the camera."""
|
||||||
from haffmpeg.tools import ImageFrame, IMAGE_JPEG
|
from haffmpeg.tools import ImageFrame, IMAGE_JPEG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user