techyian / MMALSharp

C# wrapper to Broadcom's MMAL with an API to the Raspberry Pi camera.
MIT License
195 stars 33 forks source link

For NewFile(), Use Interface instead of Concrete Class #115

Closed kenssamson closed 4 years ago

kenssamson commented 4 years ago

https://github.com/techyian/MMALSharp/blob/1e245e0283146ae4219c7ec0286568cda11bc4ed/src/MMALSharp/Callbacks/FastImageOutputCallbackHandler.cs#L55-L58

NewFile() is defined in the interface IFileStreamCaptureHandler. This code should use that interface instead of using the derived concrete class ImageStreamCaptureHandler.

For example:

if (eos && this.CaptureHandler is IFileStreamCaptureHandler)
{
    ((IFileStreamCaptureHandler)this.CaptureHandler).NewFile();
}

This would allow users to create a custom IFileStreamCaptureHandler that uses a different naming scheme without having to overwrite the PostProcess code.

techyian commented 4 years ago

Thanks Ken. I've fixed this now.