Commit graph

100 commits

Author SHA1 Message Date
Marc Mueller
41a81cbf15
Switch back to av 13.1.0 (#129699) 2024-11-04 14:48:28 +01:00
Marc Mueller
5cf13d9273
Additional stream typing improvements (#129695) 2024-11-02 22:22:31 +01:00
Marc Mueller
0eea3176d6
Minor stream typing improvements (#129691) 2024-11-02 19:29:09 +01:00
Marc Mueller
5bd63bb56b
Replace AVError with FFmpegError (#129689) 2024-11-02 19:14:59 +01:00
Marc Mueller
f7103da818
Refactor av.open calls to support type annotations (#129688) 2024-11-02 19:03:32 +01:00
Alberto Montes
b2401bf2e3
Update string formatting to use f-string on components (#125987)
* Update string formatting to use f-string on components

* Update code given review feedback

* Use f-string

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-09-19 11:38:25 +02:00
Allen Porter
700675042b
Improve redaction for stream error messages (#120867) 2024-07-05 09:42:29 +02:00
Marc Mueller
ca55986057
Import Generator from collections.abc (1) (#120914) 2024-07-01 11:51:51 +02:00
Marc Mueller
fe21e2b8ba
Import Generator from typing_extensions (1) (#118986) 2024-06-06 17:02:13 +02:00
Sid
ac54cdcdb4
Enable Ruff RUF010 (#115371)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-05-08 23:54:49 +02:00
Sid
e662e3b65c
Bump ruff to 0.4.2 (#116201)
* Bump ruff to 0.4.2

* review comments
2024-04-26 08:48:32 +02:00
Sid
f7b7f74d10
Enable Ruff TRY201 (#114269)
* Enable Ruff TRY201

* remove redundant rules
2024-03-28 10:18:07 +01:00
Joost Lekkerkerker
6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Sid
69564b1a17
Add ruff rule PIE800 (#113619)
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-16 16:31:30 -10:00
Marc Mueller
930a396712
Add empty line after module docstring [s] (#112704) 2024-03-08 14:33:51 +01:00
Marc Mueller
5f8ef37f2d
Update pylint to 3.0.4 (#111229)
* Update pylint to 3.0.4

* Use yield from

* Remove unnecessary pylint disable comments
2024-02-23 23:46:00 +01:00
uvjustin
d40a08958d
Use dataclasses instead of attrs in stream (#101148) 2023-09-30 09:46:30 +02:00
uvjustin
407aa31adc
Generate Stream snapshots using next keyframe (#96991)
* Add wait_for_next_keyframe option to stream images
Add STREAM_SNAPSHOT to CameraEntityFeature
Use wait_for_next_keyframe option for snapshots using stream

* Update stream test comments

* Add generic camera snapshot test

* Get stream still images directly in camera
Remove getting stream images from generic, nest, and ONVIF
Refactor camera preferences
Add use_stream_for_stills setting to camera
Update tests

* Only attempt to get stream image if integration supports stream

* Use property instead of entity registry setting

* Split out getting stream prerequisites from stream_source in nest

* Use cached_property for rtsp live stream trait

* Make rtsp live stream trait NestCamera attribute

* Update homeassistant/components/nest/camera.py

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* Change usage of async_timeout

* Change import formatting in generic/test_camera

* Simplify Nest camera property initialization

---------

Co-authored-by: Allen Porter <allen.porter@gmail.com>
2023-08-26 10:39:40 -07:00
Ville Skyttä
9da192c752
Avoid use of datetime.utc* methods deprecated in Python 3.12 (#93684)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2023-08-24 16:38:22 +02:00
Marc Mueller
77f38e33e5
Import names from typing instead of typing_extensions [3.11] (#97065) 2023-07-22 17:03:44 -05:00
Marc Mueller
ea4e2ab4aa
Add Self typing (4) [mypy 1.0] (#87601) 2023-02-06 22:30:22 -06:00
Franck Nijhof
fcb612cd6f
Collection of code styling tweaks (#87344) 2023-02-03 23:51:27 +01:00
uvjustin
c15f4ad648
Update stream timestamp discontinuity check with audio (#86446) 2023-01-23 16:27:09 +01:00
uvjustin
d0153f5031
Detect timestamp discontinuity in stream (#86430)
fixes undefined
2023-01-23 10:09:46 +01:00
uvjustin
8e117ee499
Pass frag_duration as integer (#86375)
fixes undefined
2023-01-22 17:28:17 +01:00
Franck Nijhof
f39f3b612a
String formatting and max line length - Part 5 (#84501)
Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2022-12-23 16:43:17 +01:00
uvjustin
75892385bb
Fix playback of hls cameras in stream (#75166) 2022-07-14 12:24:24 -07:00
uvjustin
f45afe7379
Use bitstream filter to allow ADTS AAC audio in stream (#74151) 2022-06-29 10:15:22 +02:00
uvjustin
fef21c02ee
Clean up disabling audio in stream (#74038) 2022-06-28 01:56:10 +02:00
uvjustin
01a4a83bab
Improve stream playback on high latency cameras (#72547)
* Disable LL-HLS for HLS sources
* Add extra wait for Nest cameras
2022-06-17 01:48:52 +10:00
uvjustin
617b0d04dc
Decouple stream options from PyAV options (#71247)
Co-authored-by: Allen Porter <allen.porter@gmail.com>
2022-05-14 23:31:18 -07:00
Allen Porter
41a032e3e3
Add diagnostics to stream's Stream objects (#68020)
* Add diagnostics to stream's Stream objects

Add diagnostics key/value pair to the Stream object. Diagnostics support
in camera integration will be added in a follow up and will access the
diagnostics on the Stream object, similar to the examples in the unit
test.

* Rename to audio/video codec

* Fix test codec names

* Update tests/components/stream/test_worker.py

Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: uvjustin <46082645+uvjustin@users.noreply.github.com>
2022-03-18 07:40:09 -07:00
Marc Mueller
04e1933728
Use correct relative imports [n-z] (#63471) 2022-01-05 17:23:49 +01:00
Allen Porter
23384ee1e8
Update stream errors with additional error information (#62900) 2021-12-29 18:57:14 +01:00
uvjustin
6e13605cad
Add get_image method to Stream (#61918)
* Add get_image method to Stream

* Add KeyFrameConverter class
2021-12-23 00:24:53 +08:00
Allen Porter
8ca89b10eb
Split StreamState class out of SegmentBuffer (#60423)
This refactoring was pulled out of https://github.com/home-assistant/core/pull/53676 as an
initial step towards reverting the addition of the SegmentBuffer class, which will be
unrolled back into a for loop.

The StreamState class holds the persistent state in stream that is used across stream worker
instantiations, e.g. state across a retry or url expiration, which primarily handles
discontinuities. By itself, this PR is not a large win until follow up PRs further simplify
the SegmentBuffer class.
2021-11-29 22:25:28 -08:00
Allen Porter
df90fdf641
Add an available property on Stream (#60429) 2021-11-29 21:23:58 -08:00
uvjustin
9ea338c121
Remove incomplete segment on stream restart (#59532) 2021-11-12 00:59:13 +08:00
uvjustin
3693b9bd04
Adjust frag_duration setting in stream (#59135) 2021-11-05 18:54:51 -07:00
uvjustin
9aaa92f366
Improve part metadata in stream (#58822) 2021-10-31 20:23:01 -07:00
uvjustin
35acca1063
Use PyAV fork and set hvc1 codec tag for H.265 (#58309) 2021-10-27 11:04:46 +02:00
uvjustin
06008bc343
Fix EXT-X-PROGRAM-DATE-TIME in stream (#58036)
* Fix EXT-X-PROGRAM-DATE-TIME in stream

* Update fragment duration comments in worker

* Update duration test in worker

* Augment test on low latency playlists

* Reset start_time on discontinuity
2021-10-25 11:33:41 +08:00
Marc Mueller
d51487f82a
Import Callable from collections.abc (3) (#56777) 2021-09-29 16:19:06 +02:00
uvjustin
923158cfba
Add ll hls to stream (#49608) 2021-08-29 09:53:41 +08:00
Allen Porter
094f7d38ad
Use buffer at stream start with unsupported audio (#54672)
Add a test that reproduces the issue where resetting the iterator
drops the already read packets. Fix a bug in replace_underlying_iterator
because checking the self._next function turns out not to work since
it points to a bound method so the "is not" check fails.
2021-08-15 21:02:37 -07:00
uvjustin
7a200a5d3b
Fix non monotonic dts error in stream (#53712)
* Use defaultdict for TimestampValidator._last_dts

* Combine filters

* Allow PeekIterator to be updated while preserving buffer

* Fix peek edge case

* Readd is_valid filter to video only iterator
2021-07-30 08:02:33 -07:00
Allen Porter
b3b5ee10b1
Fix mypy type for timestamp validator (#53598) 2021-07-27 22:04:59 -07:00
Allen Porter
022ba31999
Refactor the logic for peeking into the start of the stream (#52699)
* Reset dts validator when container is reset

* Reuse existing dts_validator when disabling audio stream

* Refactor peek logic at the start of a stream

Add a PeekingIterator to support rewinding an iterator so that the code
for adjusting audio streams and start pts can be inlined in the worker.

* Simplification and readability improvements

* Remove unnecessary verbiage from comments and pydoc

* Address pylint errors

* Remove rewind function and just mux the first packet separately

* More cleanup after removing rewind()

* Skip check to self._buffer on every iteration
2021-07-27 08:53:42 -07:00
Marc Mueller
b5cec353cc
Fix pylint issue with stream component c-extension (#52847)
* Rename 'extension-pkg-whitelist' setting to 'extension-pkg-allow-list'
* Add 'av.stream' and 'av.audio.stream'
* Replace 'Any' type hint
2021-07-10 22:58:37 +02:00
Allen Porter
e895b6cd42
Refactor decompression timestamp validation logic in stream component (#52462)
* Refactor dts validation logic into a separate function

Create a decompression timestamp validation function to move the logic out of
the worker into a separate class. This also uses the python itertools.chain
to chain together the initial packets with the remaining packets in the
container iterator, removing additional inline if statements.

* Reset dts validator when container is reset

* Fix typo in a comment

* Reuse existing dts_validator when disabling audio stream
2021-07-07 15:29:15 -07:00