AlexEidt / Vidio

FFmpeg wrapper providing simple, cross-platform Video I/O, GIF Creation, and Webcam Streaming in Go.
https://pkg.go.dev/github.com/AlexEidt/Vidio
MIT License
349 stars 16 forks source link

Make camera fulfill the io.ReadCloser interface #15

Open marcoshuck opened 4 weeks ago

marcoshuck commented 4 weeks ago

I recently needed to write camera input to a stream in a QUIC server. To achieve this, I had to implement a custom adapter (reference). This experience highlights a real-world use case where the Camera struct naturally benefits from implementing io.ReadCloser. Having this functionality directly within the Vidio package would help people with similar use cases.

From the top of my head, it would require to:

  1. Rename Read to CanRead
  2. Implement Read from io.Reader in Camera.
  3. Make Close return an error.

By the way, thanks for putting this package together, it was literally plug and play.