Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it async? #1

Open
nyxnyx opened this issue Jun 17, 2019 · 4 comments
Open

Make it async? #1

nyxnyx opened this issue Jun 17, 2019 · 4 comments

Comments

@nyxnyx
Copy link

nyxnyx commented Jun 17, 2019

Hi Alex,
thank you for great job. Awsame!

I'm trying to integrate this library with Home-Assistant. My concern is to make it work async. Home Assistant is using asyncio and I'm trying to send stream from camera using monitor to pipe then read it with ffmped and then process.
Do you have time to make it async?

@alexshpilkin
Copy link
Owner

Generally speaking, yes, that’s the plan; but I’m afraid that’s going to be a bit of a project in itself. I’ve already put most of IO code into a separate module, and there’s some scaffolding for having several requests in flight (the filter thing), but I can’t say I’ve planned it out completely.

Also, when (and if) I start the async implementation, I think I’ll do Trio first, because, I have to admit, I haven’t figured out asyncio yet—there’s just so much stuff going on in there. Then there’s PyGObject, which has its own incompatible way of doing async ...

So I’m not opposed to the idea in principle, but don’t hold your breath. If you need it working now, I’d suggest just shoving the whole thing into a separate thread and exchanging messages with it; alternatively, I’d be happy to work with you on an implementation, even a proof-of-concept one.


A couple of caveats regarding the current state of the library:

  • Configuration messages are not yet supported. (The config tree is just so big that I’m not sure where to start; ask if you need something specific.)
  • Playback controls are not yet supported. (They don’t make much sense without async support.)
  • Alarm subscriptions are not yet supported. (This needs support for more than simple request/reply, search for “stray packet” in the source if you want to figure this out.)
  • Live video may stutter occasionally. (I still haven’t figured out where the correct framerate is recorded in the video stream.)
  • On a long-lived connection, you must call DVRIPClient.keepalive() from time to time. (Not doing this doesn’t always break stuff, but sometimes it does.)

@alexshpilkin
Copy link
Owner

By the way, I probably can’t help you with FFmpeg, but I do have a script that displays live video using GStreamer. (It does DVRIP processing in a separate daemon thread—GStreamer is thread-safe, thankfully.)

@alex-eri
Copy link

I working on async client. Now trying to start stream, but this code is too Typed. How you write it?)

@alex-eri
Copy link

Пишу асинхронную качалку записей.
OPPlayBack в ответе присылает номер пакета на 1 больше чем ожидаю. Это поведение нормально для всех камер? Есть ли список операций какие делают +1, а какие нет?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants