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

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

Closed
bblaszkow06 opened this issue Aug 6, 2020 · 5 comments · Fixed by #547
Closed

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

bblaszkow06 opened this issue Aug 6, 2020 · 5 comments · Fixed by #547

Comments

@bblaszkow06
Copy link
Member

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 bblaszkow06 added question wisdom-of-big-buck-bunny The issue is backed by a sophisticated theory with possibly subjective underlying assumptions labels Aug 6, 2020
@mat-hek
Copy link
Member

mat-hek commented Aug 6, 2020

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

@bblaszkow06
Copy link
Member Author

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

@mat-hek
Copy link
Member

mat-hek commented Aug 6, 2020

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.

@bblaszkow06 bblaszkow06 changed the title What is the point of Membrane.Element.Base? Move the list of behaviours used by elements to Membrane.Element Nov 19, 2021
@bblaszkow06 bblaszkow06 added docs enhancement minor and removed question wisdom-of-big-buck-bunny The issue is backed by a sophisticated theory with possibly subjective underlying assumptions enhancement labels Nov 19, 2021
@djanda97
Copy link
Contributor

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

# Elements
Elements are units that produce, process or consume data. They can be linked
with `Membrane.Pipeline`, and thus form a pipeline able to perform complex data
processing. Each element defines a set of pads, through which it can be linked
with other elements. During playback, pads can either send (output pads) or
receive (input pads) data. For more information on pads, see
`Membrane.Pad`.
To implement an element, one of base modules (`Membrane.Source`,
`Membrane.Filter`, `Membrane.Endpoint` or `Membrane.Sink`)
has to be `use`d, depending on the element type:
- source, producing buffers (contain only output pads),
- filter, processing buffers (contain both input and output pads),
- endpoint, producing and consuming buffers (contain both input and output pads),
- sink, consuming buffers (contain only input pads).
For more information on each element type, check documentation for appropriate
base module.
## Behaviours
Element-specific behaviours are specified in modules:
- `Membrane.Element.Base` - this module, behaviour common to all
elements,
- `Membrane.Element.WithOutputPads` - behaviour common to sources,
filters and endpoints
- `Membrane.Element.WithInputPads` - behaviour common to sinks,
filters and endpoints
- Base modules (`Membrane.Source`, `Membrane.Filter`, `Membrane.Endpoint`,
`Membrane.Sink`) - behaviours specific to each element type.
## Callbacks
Modules listed above provide specifications of callbacks that define elements
lifecycle. All of these callbacks have names with the `handle_` prefix.
They are used to define reaction to certain events that happen during runtime,
and indicate what actions framework should undertake as a result, besides
executing element-specific code.
For actions that can be returned by each callback, see `Membrane.Element.Action`
module.

@mat-hek
Copy link
Member

mat-hek commented Apr 26, 2023

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

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

Successfully merging a pull request may close this issue.

3 participants