membrane_core icon indicating copy to clipboard operation
membrane_core copied to clipboard

Move the list of behaviours used by elements to `Membrane.Element`

Open bblaszkow06 opened this issue 5 years ago • 3 comments

The callbacks for pipelines are in Membrane.Pipeline The callbacks for bins are in Membrane.Bin Why the callbacks for element are in Membrane.Element.Base? Membrane.Element is almost empty, contains only type definitions and one function cc @mat-hek

bblaszkow06 avatar Aug 06 '20 12:08 bblaszkow06

I believe it's to indicate that one should use Membrane.{Source, Filter, Sink}, not Membrane.Element as they do in case of pipelines and bins

mat-hek avatar Aug 06 '20 12:08 mat-hek

Wouldn't it be enough to mention that in moduledoc? At least this paragraph could be moved to Membrane.Element https://hexdocs.pm/membrane_core/Membrane.Element.Base.html#module-behaviours

bblaszkow06 avatar Aug 06 '20 13:08 bblaszkow06

I think it's a good approach not to have @behaviour or __using__ in Membrane.Element. I agree that most of Membrane.Element.Base moduledoc should be moved there though.

mat-hek avatar Aug 06 '20 14:08 mat-hek

Would the following be appropriate to move to the @moduledoc section of Membrane.Element?

https://github.com/membraneframework/membrane_core/blob/115eceb34d9b7165748156d511a3524c41b942d8/lib/membrane/element/base.ex#L8-L46

djanda97 avatar Apr 26 '23 02:04 djanda97

Yeah, it seems like a good idea, but in Membrane.Element.Base we'd still need to mention that it's a common behaviour that shouldn't be used directly and one should use Membrane.Source, Membrane.Filter, Membrane.Endpoint or Membrane.Sink instead

mat-hek avatar Apr 26 '23 08:04 mat-hek