# `BB.Camera.FFmpeg.Test.StubBackend`
[🔗](https://github.com/beam-bots/bb_camera_ffmpeg/blob/main/lib/bb/camera/ffmpeg/test/stub_backend.ex#L5)

A capture backend the test drives byte by byte.

Stands in for ffmpeg under MuonTrap so that every event capture has to cope
with — a frame split across reads, a truncated image, an unexpected exit
status, a consumer falling behind — is a function call in the test rather
than something to wait for and hope for.

Every operation is synchronous. `feed/2` returns once the data message is in
the capture's mailbox, so a test can feed bytes and then assert on what came
out without a sleep anywhere in between.

It reports what the capture does to it — opening, acknowledging, asking to
stop, closing — to `:report_to`, which is a pid or a registered name.

It ships in `lib`, not `test/support`, so that camera drivers built on this
package can declare it as their backend in a test robot. A dependency's
`test/support` is never compiled. It is for tests only.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `exited`

```elixir
@spec exited(pid(), integer()) :: :ok
```

Report that the captured process exited with `status`.

# `feed`

```elixir
@spec feed(pid(), binary()) :: :ok
```

Deliver `data` to the capture as one read.

# `feed_all`

```elixir
@spec feed_all(pid(), [binary()]) :: :ok
```

Deliver each binary in turn as a separate read.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
